[vtkusers] The use of vtkDicomImageReader.

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Wed Nov 19 04:02:12 EST 2003


yasser salman wrote:
> hi mathieu..
> yeah thanx it made sense,, but when i use the series directory (which contain same study) and try to view slices speratly, only the first slice appeard on all views, (when i'm using vtkImageReader, the All slices in the series directory Displayed Good)  so how can i append the next slice to be showed.., here is my code ..(plz note , there is no errors and it works good in vtkImageReader but only when use vtkDICOMImageReader the *only first* slice displayed in the all views..)
> thanx again for this  geart help mathieu..,
> 
<SNIP>

Yasser,

	Your code is a *very* complicated for such task, instead try something 
like this(*). Why do you create a DICOMReader within the for loop ? 
vtkDICOMImageReader convert a stack of 2D images to a volume for you.

mathieu

(*)
/****************************************************************/
#include <vtkDICOMImageReader.h>
#include <vtkImageViewer2.h>
#include <vtkRenderer.h>

int main()
{
   vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
   vtkImageViewer2     *viewer = vtkImageViewer2::New();

   viewer->SetInput(reader->GetOutput());
   reader->SetDirectoryName(VolData_FName);
   reader->Update();

   int VolData_Images = viewer->GetWholeZMax ();

   for (int i=0;i<=VolData_Images;i++)
   {
     viewer->SetZSlice(i);
     //for vtkImageViewer2 before r1.19
     viewer->GetRenderer()->ResetCameraClippingRange();
     viewer->Render();
   }
   reader->Delete();
   viewer->Delete();

   return 0;
}
/****************************************************************/




More information about the vtkusers mailing list