[Insight-users] ITK to VTK

Luis Ibanez luis . ibanez at kitware . com
Mon, 22 Dec 2003 19:19:51 -0500


Hi Mohammed,

I assume that what you call the
"3D segmented object" is an object
of type:

      itk::Image< char, 3 >

and what you call VTK format is
a vtkImageData class.

Is that right ?

The first thing that you have to
decide is if you want to do this
connection directly in an executable
or through saving the data in a file.

In the first option you have to take
the output of the ITK filter that is
producing your "3D segmented object"
and connect it to the

   itkImageToVTKImageFilter

then take the output of this last filter
and connect is as input to the VTK filters
you want to use, presumably for visualizing
the segmented structure.


If, on the other hand, you want to simply
save the segmented data in the form of a
file that can be read by VTK, the simplest
way to go is to instantiate an

    itk::ImageFileWriter< ImageType >

and save the file with extension ".vtk".

This format can be read directly with
VTK scripts.


If you state your problem more specifically
we could be able to give you more specific
help,



Regards,



    Luis



--------------------------
Alam, Mohammed wrote:
> Thanks for your prompt reply. Can you help me in converting the 3D segmented
> object to VTK format....i am not really sure where to start from? Although,
> I was able to successfully run the examples in the PDF presentations.
> 
> Mohammed
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis . ibanez at kitware . com] 
> Sent: Monday, December 22, 2003 1:17 PM
> To: Alam, Mohammed
> Cc: 'insight-users at itk . org'
> Subject: Re: [Insight-users] ITK to VTK
> 
> Hi Alam,
> 
> Instructions of how to connect ITK to VTK
> are available in the Tutorial sessions.
> 
> http://www . itk . org/HTML/Tutorials . htm
> 
> In particular in the PDF presentation:
> 
> http://www . itk . org/CourseWare/Training/GettingStarted-II . pdf
> 
> You can convert ITK images to VTK format
> by using the filters in:
> 
>    InsightApplications/Auxiliary/vtk
> 
> Their files are
> 
>     itkImageToVTKImageFilter.h
>     itkImageToVTKImageFilter.txx
>     itkVTKImageToImageFilter.h
>     itkVTKImageToImageFilter.txx
> 
> You can also convert itk::Mesh to vtkPolyData
> by following the example in
> 
>      vtk2itk.cxx
> 
> in the same directory.
> 
> If you want to convert an ITK image already
>  stored in a file, into a VTK image file,
> you can simply use the example in
> 
>   Insight/Examples/ImageReadWrite.cxx
> 
> and provide as input a ITK image file format
> and as output a .vtk fileformat.
> 
> 
> If you are using the CVS version of VTK,
> you will also find that a new reader for
> MetaImages is available now.
> 
> 
> Please let us know if you have further questions,
> 
> 
>    Thanks
> 
>       Luis
> 
> 
> --------------------------------
> Alam, Mohammed wrote:
> 
> 
>>Hi
>>
>>I generated a 3D segmented object using ITK. Is there a tool in ITK to
>>convert this 3D object to VTK object? 
>>
>>Your reply will be highly appreciated.
>>
>>Thanks
>>Alam
>>
>>
>> 
>>
> 
> 
> 
> 
>