[vtkusers] FW: colour mapping stress ellipsoids

Mecit Yaman yaman at myhorizon.org
Sun Jul 30 12:18:54 EDT 2006


hi, thanks for the replies.


i need to clarify one thing straight. the coloring i am trying is not
restricted to three orthogonal dimension as ugur assumed. for each tensor, i
need a set of colors calculated for each theta and phi direction (in the
spherical coordinates.) assuming a thetaResolution of 20 and phiresolution
of 20, color scalar array will be 400 scalars. i tried to explain how i get
the colors in the first message. basically a colour is calculated from the
surface normal and vector at that location (the vector is calculated from
the tensor by a scalar product of the tensor and the surface normal) (see my
first message below.) although the visualization idea is complicated, i know
that vtk script should not necessarily be as complex.


a visualization task with vtk follows 


source > filters> mapper > actor >rendering


i understand i need to scale and aling a vtkTensorGlyph using my tensor.
then i need to create a vtkDoubleArray with 400 components using the same
tensor and vtkTensorGlpyh surface normals.  what is not clear to me is: how
to calculate the color array and store them in a vtkDoubleArray from the
tensor and surface normals. i suppose i need to getSurfaceNormals and
multiply them component by component with my tensor to obtain another set of
vectors. and with this new set i need to do scalar multiplication with the
surface normals to get the scalar color array.


once i have a scalar array i assign them to the vtkTensorGlyph, as luca
wrote, with vtkPolyData::GetPointData::SetScalars(array).

i am familiar with vtk theoretically and used it for straightforward tasks.
i will appreciate any help regarding how to practically create the color
array. btw  i’m using java to write the scripts.




mecit yaman

university of cape town




From: Luca Pallozzi Lavorante [mailto:lplavorante at gmail.com] 
Sent: 25 July 2006 01:55 PM
To: yaman at myhorizon.org
Subject: Re: [vtkusers] colour mapping stress ellipsoids


Yaman, I do agree with Ugur.
I have used the vtkTensorGlyph class in order to get strain ellipsoids. I
also have tried to color the deformed object and, as far as I know, the only
way is to associate scalar values to the object´s points through the
vtkFloatArray or vtkDoubleArray. Once you created the array, the association
is made via a call like vtkPolyData::GetPointData::SetScalars(array).
I hope this helps


On 7/24/06, Ugur BOZKAYA <u.bozkaya at fmcon.com> wrote:

Selam Mecit,

As far as I know, there is no class for this purpose in VTK currently.
vtkTensorGlyph and vtkGlyph3D can be used for typical tensor
visualization. But the tensors are shown only in one color(RGB is also 
possible I guess, but it will not solve your problem). If you are
familiar enough with VTK, you can change these classes for your purpose.
Those glyph shapes such as ellipsoids (deformed spheres) are already
defined as vtkPolyData, so you can use other shapes.

I assume you are planning to use 3 orthogonal directions for coloring.
You only need a vtkDataArray (e.g. vtkDoubleArray) with 3 components. So
for each tensor location you will have 3 values. 

I guess it will be easier to write your own class which looks simpler.
You will have your output as vtkPolyData, which is actually composed of
your tensors. May be you can have a function which calculates a
tensorshape(multicolored vtkPolyData) for a given location then you can
add the output of this function to your volume output for each location.

Good Luck,

Mecit Yaman wrote:
> hi,
> i am trying to visualize second order tensors using stress ellipsoids with
> different color mapping. the usual colouring is to map a scalar value,
> components, effective stress, trace or other scalars on the surface. i
> to do a colouring where each point/polygon on the ellipsoid will be
> differently. the color scheme is defined as follows:
> the color along direction n(i) of the ellipsoid is obtained from the angle

> between the n(i), direction vector, and the stress vector along n(i). (the
> stress vector along a direction can be obtained by multiplying the stress
> tensor, T(ij) with the direction vector, n(i)).  Thus: 
> T(ij)         tensor
> n(i)  direction vector
> stress vector(i) = T(ij) . n(i)
> angle between stress vector and direction vector
> cos(angle) = stress vector (i) . n(i) / ( |stress vector(i)| | n(i)|) 
> how does one colour map these angles, which are different for every
> direction on an ellipsoid? do I need to change stress ellipsoid into a
> polygonal data type? how do I calculate and store the angles in VTK? 
> i am able to render the icons in Mathematica, and will be happy to share
> information with anyone interested.
> thanks,
> M Yaman
> University of Cape Town
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
Follow this link to subscribe/unsubscribe:


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

More information about the vtkusers mailing list