[vtkusers] Visualizing a vector field from a vtkImageData

David Doria daviddoria at gmail.com
Sun Sep 11 14:03:30 EDT 2011


I have a 2D vtkImageData with pixels that represent 2D vectors. That is:

vtkImageData* image = vtkImageData::New();
image->SetDimensions(50,50,1);
image->SetNumberOfScalarComponents(2);
image->SetScalarTypeToFloat();

I now want to display these vectors. I tried to use a vtkGlyphXD
filter (I tried both N=2 and N=3), and it seems to produce an arrow at
each of the non-zero vectors that I hard coded, but the vectors are
not oriented correctly. That is, they both seem to be aligned with the
X axis, and neither of the vectors I specified are parallel to the X
axis.

Here is what I tried:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/WishList/Visualization/VectorField

Any suggestions on how to get these glyphs to point in the direction
specified by the pixels?

Thanks,

David



More information about the vtkusers mailing list