[vtkusers] Problem visualizing an image gradient vector field

Oscar Yañez Suarez yaso at xanum.uam.mx
Wed Oct 18 09:51:42 EDT 2006


Hi Dean, thanks for your prompt response. Unfortunately it is not
working yet. Let me add some info to your suggestions and some extras
I've found recently:

> if your original image is a 2D image, then you
> have to set the gradient filter correctly (I think
>it will do this for you automatically)

> hgrd SetDimensionality 2

> then try padding the gradient image with zeros:
> ...

This is true, the original image is 2D, so doing what you suggest
works fine. vtkImageGradient also handles the "SetDimensionality 3"
for a 2D image, yielding a third scalar component of constant zeros
(just like your suggested padding). So either method produces a 3D
vector field, but whose components are stored in the Scalars.
Therefore the need for the vtkAssignAttribute.

> this will give you a 3D vector field,
> so use a vtkArrowSource instead of a vtkGlyphSource2D:
> ...

OK, no problem with this

> field SetScaleModeToDataScalingOff
> field SetScaleFactor 0.05

I think this settings you suggest will cancel each other's efects, won't they?

And finally, as I am suspicious of the Scalars -> Vectors array
copying, I looked carefully into the output of vtkAssignAttribute, and
it has 3 Scalar components and NO Vector components. I guess this is
the main reason for the failure, but I have no clue of what is going
on there.

Thanks for your help, it is really appreciated.
 Oscar



-- 
Oscar Yanez Suarez
Laboratorio de Neuroimagenologia
Departamento de Ingenieria Electrica
UAM - Iztapalapa
http://docencia.izt.uam.mx/oys



More information about the vtkusers mailing list