[vtkusers] i solved It..
Mathieu Malaterre
Mathieu.Malaterre at creatis.insa-lyon.fr
Tue Nov 4 08:19:38 EST 2003
yasser salman wrote:
> hi mathieu/all .., Finaly , i solved my problems ,, thanks for help.,
> i can read a single slice of Dicom files.., but the image displayed
> from bottom to top!! , second what a modification of this code can i
> do to read a seires of Dicom slices??
>
>
> vtkDICOMImageReader *Reader=vtkDICOMImageReader::New();
>
> vtkImageViewer2 *viewer = vtkImageViewer2::New();
> Reader->SetFilePrefix(VolData_FName);
> //Reader->SetFilePattern("%s%.1d.dcm"); -----> how can i use it in
> dicom Reader->SetDataByteOrderToLittleEndian();
> Reader->SetDataExtent(0,VolData_Width,0,VolData_Height,i,VolData_Images);
> Reader->SetDataScalarTypeToUnsignedShort();
> Reader->SetDataOrigin(0,0,0); Reader->SetDataSpacing(1,1,1);
> viewer->SetInput(Reader->GetOutput()); ......etc..,
>
Yasser,
[Please change you ML adress to vtkusers at vtk.org !]
Here is how I use it(*). Please note the use of vtkImageFlip.
However you are right vtkDICOMImageReader breaks the VTK design. You
should not have to call vtkImageFlip.
Furthermore I won't recommend you to use 'SetFilePrefix' for DICOM
images. In /theory/ the file name depends of the image serie/study
number. Thus you should use instead:
vtkDICOMImageReader::SetDirectoryName
http://www.vtk.org/doc/nightly/html/classvtkDICOMImageReader.html#a1
HTH
mathieu
(*)
#------------------------------------
import vtk
r = vtk.vtkDICOMImageReader ()
r.SetFileName( .... )
flipY = vtk.vtkImageFlip ()
flipY.SetInput (r.GetOutput())
flipY.SetFilteredAxis (1)
iren = vtk.vtkRenderWindowInteractor();
viewer = vtk.vtkImageViewer2();
viewer.SetInput ( flipY.GetOutput() );
viewer.SetupInteractor (iren);
iren.Initialize();
iren.Start();
#------------------------------------
More information about the vtkusers
mailing list