[vtkusers] 3D Tiff rendering!

Jeremy Winston winston at cat.rpi.edu
Mon Apr 14 19:22:21 EDT 2003


yasser salman wrote:
> Hi..,
> i worte the this code to read a series of tiff file ., it works but the first image only appeared in the windowview.. i wanna to handle these images to create a 3D rendering (as in example Medical2.cxx..can u help me for this..also how i can process it separetly after reding it..
> thanx..  
> vtkTIFFReader *Reader = vtkTIFFReader::New();
>     Reader->SetFilePrefix ("D:/tiff/TIFF/MRI");
>     Reader->SetFilePattern("%s%.4d.tif");// my First file MRI0001.tiff
>     Reader->SetDataExtent (0,255,0,255,1,15); // 15 slice only..
> 	Reader->SetDataSpacing(1,1,1);
> 	Reader->Update();

    vtkExtractVOI *VOI = vtkExtractVOI::New();
       VOI->SetInput(Reader->GetOutput());
       VOI->SetVOI(0,255,0,255,1,1);


> 	vtkImageViewer* viewer = vtkImageViewer::New();
>      viewer->SetColorWindow(255);
> 	 viewer->SetColorLevel(128);


          viewer->SetInput(VOI->GetOutput());


>      viewer->SetSize(256,256);
>      viewer->Render();

To change the slice you're viewing, just make another call
to VOI's SetVOI() method, with the slice number you want as
the last two parameters (e.g., VOI->SetVOI(0,255,0,255,2,2)),
and Render() again.  (You might have to call VOI's Update()
method, I'm not sure.)

As for viewing the whole volume, Medical2.cxx is only showing
two isocontours, not the voxel data.  Read the source, run the
compiled code, then read it again.  That's the best way to learn
it.  That's what I do.

HTH,
-Jeremy





More information about the vtkusers mailing list