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

Luis Ibanez luis.ibanez at kitware.com
Sat Aug 8 10:52:53 EDT 2009


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090808/b54ae327/attachment.htm>


More information about the Insight-users mailing list