[Insight-users] How to get 2D image slices from 3D vtk image data

Luis Ibanez luis.ibanez at kitware.com
Sat Oct 23 18:30:41 EDT 2004


Hi Amitesh

You can do this in two steps. First convert the
VTK image into an ITK image. Second extract a 2D
slice from the ITK image.


1) For converting vtkImageData into itk::Image 3D,
    you can use the classes itkVTKImageTOImageFilter.
    Simply copy into your project the files from

      InsightApplications/Auxiliary/vtk
                      itkVTKImageToImageFilter.h
                      itkVTKImageToImageFilter.txx


2) Once you have a 3D ITK image, then you can extract
    2D Slices from it by using the ExtractImageFilter

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ExtractImageFilter.html

    for an example on the use of this filter, please look
    at the file

            /Insight/Examples/IO/
                ImageReadExtractWrite.cxx



*NOTE* that if you have the VTK image in a vtk file, and you don't
really need to do any other VTK processing on the image, then you
can skip step (1) because ITK has readers for VTK images.  In that
case you can simply use the example program described in item (2)
above.



    Regards,



       Luis



----------------------
Amitesh Agarwal wrote:

> Hi,
> 
> I am a new ITK user. I have a 3D image data in .vtk format. I need to
> generate 2D image slices at specific levels or planes in 3D space from
> the given 3D image data.  Is there any example, implemention or a
> method by which it can be done while programing with ITK libraries.
> 
> Can anybody help me in this matter? 
> 
> Thanks 
> Amitesh
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 






More information about the Insight-users mailing list