[vtkusers] Reading nrrd files

Sam Raby rabysam28 at gmail.com
Tue Jan 14 13:51:54 EST 2014


Hello

I would like to read a nrrd file and be able to scroll through slices. Is
there an example online that can help on how to use vtknrrdreader in order
to do that?

The following is what I have written so far.

Thanks
Sam


vtkSmartPointer<vtkNrrdReader> reader =
vtkSmartPointer<vtkNrrdReader>::New();
reader->SetFileName(argv[1]);

vtkSmartPointer<vtkImageViewer2> imageViewer =
vtkSmartPointer<vtkImageViewer2>::New();
imageViewer->SetInputConnection(reader->GetOutputPort());

vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();

imageViewer->SetupInteractor(renderWindowInteractor);
imageViewer->Render();
imageViewer->GetRenderer()->ResetCamera();
imageViewer->Render();

renderWindowInteractor->Start();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140114/f65d8b18/attachment.html>


More information about the vtkusers mailing list