[vtkusers] RE: Problem visualizing an image gradient vector field

Dean Inglis dean.inglis at sympatico.ca
Thu Oct 19 07:31:29 EDT 2006


Oscar,

don't worry about threads, I never seem to
get them to match up either.

in the pipeline I constructed, I pass my image
data (the gradient vectors) into a vtkProbeFilter
and probe the field with a polydata from an interactive
spline.  The output of the probe filter goes into
the vtkAssignAttributes (with the exact same settings
you have) and then to the 3D arrow/glyph pipepline.
Maybe the shrink filter is affecting it or maybe
assignattributes doesn't like image data?

Dean

-----Original Message-----
From:
Oscar Yañez Suarez
Sent: Wednesday, October 18, 2006 10:01 AM
Subject: Re: Problem visualizing an image gradient vector field


( sorry to send this to your mailbox, but I don't know how to make
this message thread with the previous messages at vtkusers ... )

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 these 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