[vtkusers] some questions about example Imagereslicing.cxx
David Gobbi
david.gobbi at gmail.com
Wed Oct 27 12:41:16 EDT 2010
2010/10/26 晓彦 隽晓彦 <juanxiaoyan at hotmail.com>:
> i find the value of SetDataSpacing is not used when read the 2D CT images
> using vtkImageReader2, but i want to read 2D CT images as 3D according to
> value of SetDataSpacing in order to extract a interpolated slice in desired
> orientation. i wonder it can be implemented? i will appreciate any answer
> from you. thank you.
>
> some program of the example is as follows:
> vtkImageReader2 *reader = vtkImageReader2::New();
> reader->SetFilePrefix(argv[1]);
> reader->SetDataExtent(0, 63, 0, 63, 1, 93);
> reader->SetDataSpacing(3.2, 3.2, 1.5);
> reader->SetDataOrigin(0.0, 0.0, 0.0);
> reader->SetDataScalarTypeToUnsignedShort();
> reader->UpdateWholeExtent();
The image reader cannot do any reslicing. The SetDataSpacing() method
tells VTK that the pixels in the file are 3.2mm by 3.2mm and that the
slices are 1.5mm apart, because VTK needs this information in order to
correctly render the data. To reslice the data, you must add a
vtkImageReslice filter or a vtkImageResample filter after the reader.
I might have misunderstood your question, but I hope that my answer is helpful.
David
More information about the vtkusers
mailing list