[Insight-users] Python Wrap_ITK and registration of Nifti files

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Tue Aug 11 12:43:29 EDT 2009


Hi,

Le 11 août 09 à 02:21, Malsoaz James a écrit :

> Thank you very much for the help. Indeed, it is working with the  
> name of modules that you gave.
>
> Is there a list somewhere of all these names? I still have some  
> problems to find the corresponding for some of them (e.g.  
> itkLinearInterpolateImageFunctionF2D, itkCenteredRigid2DTransform,  
> etc)

You can get the list of members in the itk module with

   dir(itk)

and a list of template parameters (and other members) in a template with

   dir(itk.CenteredRigid2DTransform)

or with the dict interface

   itk.CenteredRigid2DTransform.keys()

But the easiest way is certainly to hit tab after the name in ipython  
to get the possible member names :-)

Regards,

Gaëtan

>
>
> Anyway thank you again !
>
> --- En date de : Sam 8.8.09, Luis Ibanez <luis.ibanez at kitware.com> a  
> écrit :
>
> De: Luis Ibanez <luis.ibanez at kitware.com>
> Objet: Re: [Insight-users] Python Wrap_ITK and registration of Nifti  
> files
> À: "Malsoaz James" <jmalsoaz at yahoo.fr>
> Cc: insight-users at itk.org
> Date: Samedi 8 Août 2009, 14h52
>
>
> Hi James,
>
> Yes, the problem is that the examples in ITK are for the
> original CableSwig wrapping.
>
> You are using WrapITK, and it is not fully backward compatible
> with the original wrapping system.
>
>
> You will find more information about WrapITK in the
> following Insight Journal paper:
>
> http://www.insight-journal.org/browse/publication/85
> http://hdl.handle.net/1926/188
>
>
>
> The reader types that you may want to use are:
>
> 	• itk.ImageFileReader[itk.Image.F2] or
> 	• itk.ImageFileReader.IF2
>
>
> More specifically, your code should look like:
>
>
> imageType = itk.Image.F2
> imageReaderType = itk.ImageReader[imageType]
> registrationType = itk.ImageRegistrationMethod[imageType,imageType]
>
> reader1 = readerType.New()
> reader2 = readerType.New()
>
> registrator = registrationType.New()
>
> registrator.SetFixedImage( reader1.GetOutput() )
> registrator.SetMovingImage( reader2.GetOutput() )
>
>
> ....
>
> and so on.
>
>
> Please give it a try and let us know if you find any problems,
>
>
>      Thanks
>
>
>           Luis
>
>
> ------------------------------------------------------
> On Fri, Aug 7, 2009 at 2:29 PM, Malsoaz James <jmalsoaz at yahoo.fr>  
> wrote:
> Hello,
>
> I'm quite new in the use of ITK and I would like to create a  
> function to align two images in Python. My files are Nifti files  
> with this specific dim: [5, 256, 256, 124, 1, 1, 1, 1].
> I have a list of Nifti files and I would like to take the first one  
> as reference to align the other on it using a rigid transformation.
>
> I have been able to install ITK with the option wrap_ITK and the  
> 'import itk' in Python is working.
>
> Now, I would like to work on my registration problem. I have seen an  
> example called "ImageRegistration5.py" in the folder examples which  
> normally is used to align 2D images with a rigid transformation  
> (very close from what I desire, except for the dimension, I'm  
> working with 5). But the function used in there are not available in  
> my python environment (ie itkImageFileReaderF2_New(),  
> itkImageRegistrationMethodF2F2_New(), etc).
> Do I have made something wrong with the wrapping? Maybe the fact  
> that I use Wrap_ITK and not CSWIG is the problem.
>
>
> If someone has worked on similar thing, I would be happy to receive  
> help (ie examples, etc).
>
> By the way, is there any help/documentation about WrapITK except the  
> google page code?
>
> Thank you
> Best
> James
>
>
>
> _____________________________________
> 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
>
>
>
> _____________________________________
> 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

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090811/cffbc8e0/attachment.pgp>


More information about the Insight-users mailing list