Rotation of vtkonnotatedcubeactor does not work.Is there a mistake in my usage?I put it in vtkorientationmarkerwidget and call its rotation method.
Hello,
Did you setup your vtkOrientationMarkerWidget
correctly?
//----------------------adding the orientation axes-------------------------
vtkSmartPointer<vtkAnnotatedCubeActor> axes = vtkSmartPointer<vtkAnnotatedCubeActor>::New();
_vtkAxesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
_vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
_vtkAxesWidget->SetOrientationMarker(axes);
_vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); //both widgets must share the same interactor.
_vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2);
_vtkAxesWidget->SetEnabled(1);
_vtkAxesWidget->InteractiveOn();
//--------------------------------------------------------------------------
In the code above, _vtkwidget
is the VTK widget for your application’s GUI framework (e.g. QVTKOpenGLNativeWidget
in applications uding Qt).
take care,
Paulo
Please look at: vtkOrientationMarkerWidget, in patricular the comment: To use this object, there are two key steps: 1) …
Also you can directly access several examples showing usage from there. I would recommend starting with OrientationMarkerWidget
Hello,The code is the same as yours, but axes. RotateY () does not work
In fact, I want to perform matrix transformation on it to ensure that the orientation of volume data in different directions is the same.
Hello,
“Does not work” is like saying your entire body hurts to the doctor . Can you, please, be more specific? Nothing happens? The volume disappears? The volume is distorted? The volume gets cut? The volume goes the wrong way? Please, describe more clearly what you get when you call RotateY()
in your code. Preferably with the code snippet directly involved.
regards,
Paulo
Hello,The code is the same as what you posted. I solved my problem with another solution. Thank you very much for your reply!
//----------------------adding the orientation axes-------------------------
vtkSmartPointer axes = vtkSmartPointer::New();
_vtkAxesWidget = vtkSmartPointer::New();
_vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
_vtkAxesWidget->SetOrientationMarker(axes);
_vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); //both widgets must share the same interactor.
_vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2);
_vtkAxesWidget->SetEnabled(1);
_vtkAxesWidget->InteractiveOn();
axes->RotateY(90);
//--------------------------------------------------------------------------
So, what was your other solution? Others with the same problem as yours may benefit from it.
I use ImageData.SetDirectionMatrix() to rotate the object itself to ensure that the orientation of different objects is the same