[vtkusers] problems in using vtkInteractorStyleImage

luxiaohua at outlook.com luxiaohua at outlook.com
Wed Apr 8 04:09:41 EDT 2015


Dear VTKrs:

I am trying to use mouse to change Slice Orientation of the dicom image sequences. So I use
the vtkInteractorStyleImage.

But when I press X or Y ,the Slice Orientation not set to yz or xz. This confuses me.

The vtkInteractorStyleImage functions like below, but I cant change the slices through the image;

// If SetInteractionModeToImageSlicing() is called, then some of the mouse
// events are changed as follows:
// - CTRL Left Mouse slices through the image
// - SHIFT Middle Mouse slices through the image
// - CTRL Right Mouse spins the camera
//
// If SetInteractionModeToImage3D() is called, then some of the mouse
// events are changed as follows:
// - SHIFT Left Mouse rotates the camera for oblique slicing
// - SHIFT Middle Mouse slices through the image
// - CTRL Right Mouse also slices through the image
//
// In all modes, the following key bindings are in effect:
// - R Reset the Window/Level
// - X Reset to a sagittal view
// - Y Reset to a coronal view
// - Z Reset to an axial view

      Someone can help me for my confusion !

Many thanks,
Lu


int main(int argc, char* argv[])
{
vtkSmartPointer<vtkResliceImageViewer > imageViewer =
vtkSmartPointer<vtkResliceImageViewer >::New();

//Read the image
vtkSmartPointer<vtkDICOMImageReader> reader =
vtkSmartPointer<vtkDICOMImageReader>::New();


reader->SetDirectoryName("c:\\s20");
reader->Update();


imageViewer->SetInput( reader->GetOutput() );


vtkSmartPointer<vtkInteractorStyleImage> imageStyle =
vtkSmartPointer<vtkInteractorStyleImage>::New(); 

imageStyle->SetInteractionModeToImage3D();

vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
imageViewer->GetRenderWindow()->SetInteractor( renderWindowInteractor );
renderWindowInteractor->SetInteractorStyle( imageStyle );
imageViewer->Render();


renderWindowInteractor->Initialize();
renderWindowInteractor->Start();

return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150408/34221a9b/attachment.html>


More information about the vtkusers mailing list