[vtkusers] Problem visualizing an image gradient vector field

Oscar Yañez Suarez yaso at xanum.uam.mx
Wed Oct 18 08:25:27 EDT 2006


Hi all,
I would appreciate your input regarding the following issue. I  am trying to
visualize the 2D vector field corresponding to an image gradient, using
vtkImageGradient, vtkAssignAttribute, and vtkGlyph3D. I've seen the scalar
components out of vtkImageGradient and the gradient looks fine, however, the
arrow glyphs are always parallel to the "x" axis (direction and scale seem
to be right at least), even though there are several nonzero components in
the "y" gradient direction. Unfortunately, the online documentation is not
helping that much. Thanks in advance! (what I think are the relevant
portions of tcl code follow)
...
# placing the image gradient components (a subsample of them) in the point
data VECTORS

vtkImageGradient hgrd
   hgrd SetInput [ himg GetOutput ]
   hgrd SetDimensionality 3
   hgrd HandleBoundariesOn
vtkImageShrink3D hgsub
   hgsub SetInput [ hgrd GetOutput ]
   hgsub SetShrinkFactors 5 5 1
vtkAssignAttribute hg
   hg SetInput [ hgsub GetOutput ]
   hg Assign SCALARS VECTORS POINT_DATA
...
# building the glyph

vtkGlyphSource2D arrow
   arrow SetGlyphTypeToArrow
   arrow SetScale 0.2
vtkGlyph3D field
   field SetInput [ hg GetOutput ]
   field SetSource [ arrow GetOutput ]
   field ScalingOn
   field OrientOn
   field SetScaleFactor 0.05
...



-- 
Oscar Yanez Suarez
Laboratorio de Neuroimagenologia
Departamento de Ingenieria Electrica
UAM - Iztapalapa
http://docencia.izt.uam.mx/oys
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061018/bd0e8d43/attachment.htm>


More information about the vtkusers mailing list