How to restrict vtk widgets movement within DICOM displaying area

classic Classic list List threaded Threaded
1 message Options
ran
Reply | Threaded
Open this post in threaded view
|

How to restrict vtk widgets movement within DICOM displaying area

ran
This post was updated on .
As part of an application for displaying DICOM images in Qt widget
in windows 10, I'm using vtkResliceImageViewer (or vtkImageViewer2), custom
vtkInteractorStyleImage, vtkGenericOpenGLRenderWindow, QVTKOpenGLWidget for
displaying and fitting the images in Qt window.
I also use vtkPlaneWidget, mriVtkLineWidget2 widgets inside the DICOM
viewer.
It is working properly, but the problem is while initially set the
coordinates for mriVtkLineWidget2 and vtkPlaneWidget objects it's correctly
displaying inside the DICOM image displayed area. But when moving the
widgets with mouse interactions, its rendering outside the
DICOM image rendered area.
My requirement is needed to restrict the widgets movement within the DICOM image displayed
area.
 How can I restrict widgets movement inside DICOM displaying area?

My rendering code is something like this,

    vtkNew <vtkGenericOpenGLRenderWindow> m_openGlRenWin;
    vtkNew <MyVtkInteractionStyleImage> m_InteractorStyleWin;
    vtkNew <vtkResliceImageViewer> m_vtkImViewerWin;
    QScopedPointer <QVTKOpenGLWidget> m_vtkWgtWin;
    vtkNew<vtkPlaneWidget> m_vtkPlaneWid;
    vtkNew <mriVtkLineWidget2> m_Line;

   m_vtkWgtWin->SetRenderWindow(m_openGlRenWin);
   m_vtkImViewerWin->SetRenderWindow(m_openGlRenWin);
   m_vtkImViewerWin->SetupInteractor(m_openGlRenWin->GetInteractor());
   
m_openGlRenWin->GetInteractor()->SetInteractorStyle(m_InteractorStyleWin);
   m_vtkPlaneWid->SetInteractor(m_vtkImViewerWin->GetInteractor());
  m_Line->SetInteractor(m_vtkImViewerWin->GetInteractor());

The code is not full, the only relevant part is included.
Actually I need to restrict the widget interaction movements within vtkImageActor(of vtkResliceImageViewer) bounds. Have any default way for this. Or have to do it manually by tracking the widgets coordinates on movement with vtkImageActor bounds?
Please help to restrict the widget movements.
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers