[Insight-users] Apply an ITK filter on a VTK object

Luis Ibanez luis.ibanez at kitware.com
Fri Mar 13 13:10:22 EDT 2009


Hi Nour,

In order to declare the itkImage you simply have to
answer two questions:


    A) What is the dimension of your image ? (2D, 3D, 4D ?)

    B) What is the pixel type of the image (char, int, float ?)


A typical declaration could be:


      typedef   itk::Image< unsigned char, 3 >    ImageType;

but, of course, this may be different in your case.


Openning the VTK file with a text editor can help you
answer both questions (A) and (B).

then you can declare the reader as:

    typedef itk::ImageFileReader<ImageType>    ReaderType;


You may also find useful to read the ITK Software Guide,


    http://www.itk.org/ItkSoftwareGuide.pdf

in particular the Chapter "Data Representation" and its
subsection "Images", where all these characteristics of
the ITK images are described in detail.




    Regards,


        Luis



-----------------
Nour Mestiri wrote:
> I'm sorry. I forgot to send to ITK
> 
> --- En date de : *Ven 13.3.09, Nour Mestiri /<nourmestiri at yahoo.fr>/* a 
> écrit :
> 
> 
>     De: Nour Mestiri <nourmestiri at yahoo.fr>
>     Objet: Re: [Insight-users] Apply an ITK filter on a VTK object
>     À: "Luis Ibanez" <luis.ibanez at kitware.com>
>     Date: Vendredi 13 Mars 2009, 9h33
> 
>     Hi Luis. Thank you for your answer.
>     I used the first way you suggest because i'm beginner.
>      
>     I wrote in my code those lines:
>     typedef itk::ImageFileReader<ImageType>    ReaderType;
>     ReaderType::Pointer reader = ReaderType::New();
>      
>     I don't know what to put as 'ImageType'.
>     In fact, i don't find the declaration of ITK objects so evident
>     (like VTK).
>     So can you please tell me what to do exactly to declare this object
>     'reader'?
>     Thank you so much
>      
> 
>     --- En date de : *Jeu 12.3.09, Luis Ibanez
>     /<luis.ibanez at kitware.com>/* a écrit :
> 
> 
>         De: Luis Ibanez <luis.ibanez at kitware.com>
>         Objet: Re: [Insight-users] Apply an ITK filter on a VTK object
>         À: nourmestiri at yahoo.fr
>         Cc: "ITK" <insight-users at itk.org>
>         Date: Jeudi 12 Mars 2009, 17h25
> 
> 
>         Hi Nourmestiri,
> 
> 
>                                Welcome to ITK !
> 
> 
>         There are to options that come to mind as possible solutions to
>         your problem:
> 
> 
>               A) The easy one:  ITK can read images from VTK files.
>                  Simply use the ImageFileReader to read the .vtk image
>                  and then apply ITK filters at will. At the end of your
>                  pipeline you could also write the image back into a VTK
>                  file if you wish to do so.
> 
>               B) The not-so-easy one: Use the ITK-VTK import/export filters
>                  in order to convert VTK images into ITK images and back
> 
>                  This is explained in the Tutorials:
>                  http://www..itk.org/ITK/help/tutorials.html
> 
>                  in particular in the Session:
>                  "Using ITK and VTK"
>              
>            http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf
> 
> 
>                  You will find the Import/Export classes in the directory
> 
>                         InsightApplications/Auxiliary/vtk
> 
>               C) The high-level on:
>                  You can use the classes provided in the Insight Journal
>         paper
>                  http://www.insight-journal.org/browse/publication/146
> 
>                  These classes can also be found in the directory:
> 
>                         InsightApplications/Auxiliary/vtk
> 
> 
> 
>         Please let us know if you find any problem,
> 
> 
>             Thanks
> 
> 
>                Luis
> 
> 
>         ----------------------------
>         nourmestiri at yahoo.fr
>         <http://fr.mc282.mail.yahoo.com/mc/compose?to=nourmestiri@yahoo.fr>
>         wrote:
>          > Hi all ITK users.
>          > I'm beginner in ITK developpment, so please try to help me
>         even if my question is very evident
>          > I have a 3D skull volume saved as a VTK file. I want to
>         extract the crest lines of this volume and i know that if i
>         segment it with , i cant have those lines.
>          > My question is: is it possible to apply an ITK filter on a
>         VTK object?
>          > If yes, what to do in my case? What can i do tp apply that
>         filter on my object?
>          > Thank you so much
>          >
>          >
>          >
>          >
>         ------------------------------------------------------------------------
>          >
>          > _____________________________________
>          > Powered by www.kitware.com
>          >
>          > Visit other Kitware open-source projects at
>          > http://www.kitware.com/opensource/opensource.html
>          >
>          > Please keep messages on-topic and check the ITK FAQ at:
>         http://www.itk.org/Wiki/ITK_FAQ
>          >
>          > Follow this link to subscribe/unsubscribe:
>          > http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 


More information about the Insight-users mailing list