[vtkusers] vtkImageData of arrays to vtkImageData of vectors

Eric E. Monson emonson at cs.duke.edu
Tue Sep 20 13:44:21 EDT 2011


Hello Alba,

I have never used ITK with VTK, so I don't know if there is a different way to convert your ImageData so the three components will end up as a vector automatically, but you should be able to use the vtkArrayCalculator to create a new vector out of the three components. There is one wiki example here:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/ArrayCalculator

And the documentation page

http://www.vtk.org/doc/nightly/html/classvtkArrayCalculator.html

has more info about the functions and links to more examples and tests. You'll need to do something like red*iHat + green*jHat + blue*kHat as your equation. Personally, I would first try loading my data into ParaView to play with equations and visualization methods. (You may have to write out your vtkImageData to a vtk or vti file first to load it into ParaView...)

Sorry I don't have time to give you a more clear example right now, but hopefully this can get you started on a useful path.

-Eric

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
Eric E Monson
Duke Visualization Technology Group


On Sep 20, 2011, at 10:12 AM, Garin, Alba wrote:

> Good morning,
>  
> i am trying to visualize glyphs with vtk and itk that represent the main diffusion direction of my dicom images. I read the dicoms and i get an oriented image with Vectors of unsigned short as pixel type. I can visualize properly this information in color maps representing the orientation of each voxel with RGB.
>  
> The problem starts when i want to represent the directionality with lines, glyphs or others. I figured out why i have this problem and i know i need a vector per voxel in the vtkImageData that i use as input in the (for example) vtkStreamLine class. The thing is that i convert itk::OrientedImage to vtkImageData with the itkImageToVTKImageFilter, and i get an vtkImageData as output with scalars in each voxel, 3 scalars per voxel (an array) instead of a vector of 3 component in each voxel.
>  
> Is there any way to set the filter to convert into an image of vector instead of image of arrays?
> Can i convert my vtkImageData of arrays to an vtkImageData of vectors?
>  
> Thanks in advance,
> Alba
>  
>  
> Alba Garin Muga
> Computer Science PhD Student
> Applied Mechanics Department
> Paseo Manuel Lardizabal, 15
> 20018 Donostia-San Sebastian.Spain
> Tel.  +34 943 212 800  (Ext. 2111)
> Fax: +34 943 213 076
> Web:www.ceit.es
> <image001.gif>
> <image002.jpg>
> Antes de imprimir este e-mail piense bien si es necesario hacerlo. El medioambiente es cosa de todos.
> Before printing this e-mail ask yourself if you really need a hard copy. We are all responsible for the environment.
>  
>  
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110920/7ab7b706/attachment.htm>


More information about the vtkusers mailing list