[Insight-users] How to connect itk::VTKImageImport with vtkImageExport

Luis Ibanez luis.ibanez at kitware.com
Sat, 17 Apr 2004 12:47:57 -0400


Hi Thomas,

Classes for converting ITK images into VTK ones
(and back) are available in the InsightApplications
checkout.

Please look at:

    InsightApplications/
                   Auxiliary/
                           vtk

         itkImageToVTKImageFilter.h
         itkImageToVTKImageFilter.txx
         itkVTKImageToImageFilter.h
         itkVTKImageToImageFilter.txx

http://www.itk.org/cgi-bin/cvsweb.cgi/InsightApplications/Auxiliary/vtk/?cvsroot=Insight

These filters *already* integrate VTK/ITK image
Export/Import internally and connect all the
callbacks required to make the ITK and VTK
pipelines to work together.

Examples on how to use these classes are
presented in the Tutorials:

      http://www.itk.org/HTML/Tutorials.htm

in particular in:

http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf



   Regards,


      Luis



--------------------------
Thomas - Kuiran Chen wrote:

> Hi Luis,
> 
> I need to use some preprocessed image data in ITK from my VTK component, and looks like itk::VTKImageImport can do that by connecting the output of VTK::vtkImageExport.
> 
> But the man page really doesn't help much to explain how to connect these two together.
> 
> Could you please give me some more details or simply, a piece of example/test code (C++)?
> 
> Thanks,
> Thomas Kuiran Chen
> 
> 
> 
> ---------------------- Original Message ------------------------
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: Wagner Sales <wsalles2003 at yahoo.com.br>
> Sent: 2004-04-16 15:29:03
> Subject: Re: [Insight-users] Creating 3D images based on slices
> 
> 
> Hi Wagner,
> 
> If you already have the data in memory, then
> the only issue is to perform interpolation.
> 
> (Assuming that the slices are actually not
>   spaced uniformly)... or are they uniformly
> spaced along Z ?
> 
> If the space if uniform you don't need any
> interpolation...
> 
> Otherwise, You may want to look at the BSpline
> interpolators in ITK as well as the KernelBase
> splines.
> 
> 
>     Regards,
> 
> 
>        Luis
> 
> 
> -------------------
> Wagner Sales wrote:
> 
> 
>>Hi Luis,
>>
>>Luis Ibanez wrote:
>>
>>
>>>Hi Wagner,
>>>
>>>Are your slices being stored in independent files ? 
>>
>>
>>Here is the problem... Are not! But I have the data in memory, but I can 
>>convert to every format. In last case, pixel by pixel... ;)
>>I have the position z-axis position too... Well, if have like do this 
>>withou using the serie readers, like in VTK ( vtk have one too ), better 
>>to me. But if not have, or are must difficult, 'll change my program... 
>>no problem.
>>Thks.
>>
>>
>>>
>>>If so, you can simply use the ImageSeriesImageReader.
>>>You will find examples in the directory:
>>>
>>>       Insight/Examples/IO
>>>
>>>they are:
>>>
>>>       DicomSeriesReadImageWrite.cxx
>>>       ImageReadImageSeriesWrite.cxx
>>>       ImageSeriesReadWrite.cxx
>>>       RGBImageSeriesReadWrite.cxx
>>>
>>>
>>>
>>>This will create a 3D image with the collection of
>>>2D image from your files.
>>>
>>>It is still *your* responsibility to setup the Z
>>>pixel spacing, since the reader has no other way to
>>>figure out this value. (DICOM probably can...).
>>>
>>>You can use the itkChangeInformationImageFilter for
>>>the purpose of setting such pixel spacing.
>>>
>>>There is no interpolation involved in this process.
>>>The 3D image will be just a concatenation of slices.
>>>
>>>
>>>If your slices do not correspond to a uniform
>>>sampling along Z.... then.... you are in trouble...  :-/
>>>
>>>Are they at least parallel  ? ...
>>>
>>>The brute force approach will be to use KernelSplines
>>>in order to interpolate intensity values... that will
>>>work... but is not going to be fast.
>>>
>>>
>>>   Regards,
>>>
>>>
>>>      Luis
>>>
>>>
>>>
>>>------------------------
>>>Wagner Sales wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>First, thank's by the last help. like you all probabily know, I need 
>>>>to use a volume in ITK. You told me to use a itkImage with dimension 
>>>>= 3. I looked in the examples, and i'm convinced that that's the 
>>>>right way to do it. But, now I have a different problem... like I 
>>>>said before, I need to fill this 3-dimensional itkImage with n 
>>>>2-dimensional images. So, my current problem is how o put n 
>>>>differents images into the 3D image, and, furthermore, how to specify 
>>>>the coordinates of the images in the 3D one (the z-axis). After that, 
>>>>I need to interpolate the images, because my slices aren't 
>>>>contiguous, I was looked how to set the space between the images. Are 
>>>>just that? I don't need to specify the interpolation?
>>>>
>>>>Thanks,
>>>>
>>>>Wagner
>>>>
>>>>
>>>>_______________________________________________
>>>>Insight-users mailing list
>>>>Insight-users at itk.org
>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>
>>>
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> --------------------------------------------------------------------
> 			
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>