Hi Nil,

try this:
vtkRenderWindow *renderWindow = mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4");
  axes = vtkSmartPointer<vtkAxesActor>::New();
  widget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
  widget->SetOrientationMarker(axes);
  widget->SetOutlineColor(0.9300, 0.5700, 0.1300);
  widget->SetInteractor(renderWindow->GetInteractor());
  widget->SetEnabled(1);
  widget->InteractiveOn();

It looks good to me, but we have never really tested if there are side effects when using interactive vtkWidgets in the QmitkRenderWindow If you don't want to move or resize the widget in the running application, I recommend to call:
widget->InteractiveOff();

Regards,
Christoph

On 07/25/2014 07:37 PM, Nil Goyette wrote:
Hi all, is there a way to add a vtkOrientationMarkerWidget to the 3D view? I successfully added a vtkAxesActor with this code

vtkRenderWindow *renderWindow =
mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4");
mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(renderWindow);

vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();
renderer->GetVtkRenderer()->AddActor(axes);

But it's useless without a vtkOrientationMarkerWidget.
So I try to add the following code (mostly from http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes)
vtkSmartPointer<vtkOrientationMarkerWidget> widget =
vtkSmartPointer<vtkOrientationMarkerWidget>::New();
widget->SetOrientationMarker(axes);
widget->SetOutlineColor(0.9300, 0.5700, 0.1300);
widget->SetInteractor(renderWindow->GetInteractor());
widget->SetEnabled(1);
widget->InteractiveOn();
The application always crashes in vtkOrientationMarkerWidget .cxx, ExecuteCameraUpdateEvent() near line
vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
I think it's because this->CurrentRenderer is a bad pointer, something lke 0xdfdfdfdf

Oh, if there's an MITK way of displaying the axis in the 3D view, it's even better! Thanks for your time.

--
Logo Imeka <http://imeka.ca/>     Nil Goyette, M.Sc.
www.imeka.ca <http://imeka.ca/>


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to