[Insight-users] ITK to VTK for 4D images
Mathieu Stumpf
mathieu.stumpf at etu.unistra.fr
Wed Apr 25 05:00:44 EDT 2012
Hello, I'm still trying to make this conversion work. If anybody is
aware of a python example of the wiki page[1], it would help me much.
Also, the example use ItkVtkGlue, but I can't find a way to build a
python wrapper. Building from sources[2], it will only generate
libItkVtkGlue.a and the makefile doesn't provide an install target.
As said I tried to use an other method to get a vtk image, but it
doesn't work (the application crash without error messages) and with itk
vector image, you even can't use this method as the accurate template
isn't implemented.
So the following code :
file_path = str("/home/miv/stumpf/images/DTI.nhdr")
VImageType = itk.VectorImage.SS3
reader = itk.ImageFileReader[VImageType].New()
reader.SetFileName(file_path)
iv_image = reader.GetOutput() # itk::VectorImage<short, 3u>
log(iv_image) # Ok
connector = itk.ImageToVTKImageFilter[VImageType].New()
connector.SetInput(reader.GetOutput())
connector.Update()
vtk_image = connector.GetOutput()
log(vtk_image)
End with this error :
Traceback (most recent call last):
File "/home/miv/stumpf/src/lampyre/Tests/OpeningImage.py", line 31, in <module>
connector = itk.ImageToVTKImageFilter[VImageType].New()
File "/usr/local/lib/ITK-4.1/Python/itkTemplate.py", line 233, in __getitem__
raise KeyError, 'itkTemplate : No template %s for the %s class' % (str(parameters), self.__name__)
KeyError: "itkTemplate : No template [<class 'itkVectorImagePython.itkVectorImageSS3'>] for the itk::ImageToVTKImageFilter class"
Anyway, even with an implemented template like itk.Image.SS3 it crashes
the application. I wonder if it could be because it doesn't correspond
to the actual image type I open. I don't know how to check that, I tried
with ITK-SNAP, it gives "t" as ITK_OnDiskStorageTypeName.
[1] http://www.itk.org/Wiki/ITK/Examples/IO/ImageToVTKImageFilter
[2]
http://gitorious.org/itkwikiexamples/itkwikiexamples/blobs/raw/143b4a80c6f5bbe44edbcbeccaa9c05b83042d65/ItkVtkGlue.tar.gz
kind regards,
mathieu
Le mardi 24 avril 2012 à 13:02 +0200, Mathieu Stumpf a écrit :
> Le lundi 23 avril 2012 à 11:00 -0400, Bradley Lowekamp a écrit :
> > Hello,
> >
> >
> > What is the current issue you are having with your SimpleITK
> > implementation?
>
> My project require explicitly to compare performances between 4D
> ITK::Image and ITK::VectorImage.
>
> On the other hand, SimpleITK seems to be the way to go to use ITK with
> python. So probably I should at least compare it with the two previous
> solutions.
>
> >
> > Currently, I am aware what we don't have support to convert
> > VectorImage to numpy arrays. But that is near the top of my todo list
> > this week.
> >
> >
> > Also, I am interested in your input data? What do you mean by 4D? 3D +
> > time? 3D+ multichannel? What is your input file format and what is the
> > meta data that is report? If there is an issue with SimpleITK reading
> > it, I'd like to see a sample file to see if support could easily be
> > added.
>
> I must develop an application able to display anatomic images, tensors,
> ODF, tractography, choosing miscellaneous colors for fiber tracts, and
> so on.
>
> I also have to define appropriate data structures to store ODF, how to
> add this information in a nifti image. If you have hint on the subject,
> I'll be very interested.
>
> kind regards,
> mathieu
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> 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