[Insight-users] ITK to VTK

Luis Ibanez luis.ibanez at kitware.com
Fri, 26 Dec 2003 16:50:09 -0500


Hi Mohamed,

Thanks for the details on the segmentation
process that you are implementing.


1) The binary mask that is the output of the
    SimpleFuzzyConnectedness filter could be saved
    as an image using the .vtk file format.

2) The ITK mesh that results from the deformable
    model, should be converted first to a vtkPolyData,
    following the example of the file:

    InsightApplications/Auxiliary/vtk/vtk2itk.cxx

    Once it is converted to a vtkPolyData, you can
    use VTK writers in order to save it in a file.


Note that the ImageFileWriter will help you in
the task (1) (above), but not in task (2). If
you create a vtkPolyData (as in (2)), you must
use a native vtkWriter.


Regards,


    Luis



-----------------------------
Alam, Mohammed wrote:

> Luis,
> 
> Yeah I would like to save (write) my 3D segmented object to a file. Then
> read it through a VTK format and display it as a VTK object. 
> 
> 1. I am using the 3D SimpleFuzzyConnectedness filter to get my 3D binary
> mask. 
> 2. Then use deformable model to generate a 3D segmented object, using the
> binary mask.
> 3a. I can then write the co-ordinates and elements of this object to a file.
> 3b. Save my file in such a way that it may be read by a VTK filter as a VTK
> object??????
> 
> Hope this will help you to understand my problem in a better way. Meanwhile
> I will try to use itk::ImageFileWriter< ImageType > and save the file with
> extension ".vtk".
> 
> Highly appreciate your concern.
> 
> Thanks
> Mohammed
> 
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis . ibanez at kitware . com] 
> Sent: Monday, December 22, 2003 7:20 PM
> To: Alam, Mohammed
> Cc: Insight-users at itk . org
> Subject: Re: [Insight-users] ITK to VTK
> 
> 
> 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
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
> 
> 
>