[vtkusers] vtkImageViewer Help

Amy Squillacote amy.squillacote at kitware.com
Thu Jun 2 14:39:10 EDT 2005


Hi Abhi,

Try creating a vtkRenderWindowInteractor and passing it to vtkImageViewer 
using its SetupInteractor method.  Then you should still be able to use the 
vtkRenderWindowInteractor to keep the window open.

- Amy

At 02:28 PM 6/2/2005, Abhi Rampal wrote:
>Good Day,
>
>I wrote a program in C++ to view DICOM images using vtKImageViewer. When I 
>run the program the window into which the image is loaded closes 
>automatically. With Polydata I woudl use vtkRenderWindowInteractor to keep 
>the window open but this solution does not work with vtkImageViewer. Does 
>anyone have a solution?
>
>the code being used is:
>
>  vtkImageReader *reader = vtkImageReader::New();
>  reader->SetDataByteOrderToLittleEndian();
>  reader->SetDataExtent(0,63,0,63,40,40);
>  reader->SetFilePrefix("C:\\vtk\\VTKData\\Data\\headsq\\quarter");
>  reader->SetDataMask(0x7fff);
>
>  vtkImageGradient *gradient = vtkImageGradient::New();
>  gradient->SetInput(reader->GetOutput());
>  gradient->SetDimensionality(3);
>
>  vtkImageViewer *viewer = vtkImageViewer::New();
>  viewer->SetInput(gradient->GetOutput());
>  viewer->SetZSlice(22);
>  viewer->SetColorWindow(2000);
>  viewer->SetColorLevel(0);
>  viewer->Render();
>
>  reader->Delete();
>  gradient->Delete();
>  viewer->Delete();
>
>Thank you and with kind regards,
>
>Abhi
>
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic. 
>Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list