[vtkusers] Mapping normal components to r,g,b

Roy van Pelt r.f.p.v.pelt at tue.nl
Mon Sep 22 05:58:42 EDT 2008


Dear all,

For some time now I'm trying to set up a vector visualization, where the
coloring is just a mapping of the three components of the normal vector.

So I take a vtkImageReader to read a raw scalar volume. Next I use
vtkImageGradient and vtkImageNormals to compute the normals. Next I 
add the gradients and normals to the vtkImageData data set using:

dataset->GetPointData()->SetVectors(gradients->GetOutput()->GetPointData()->GetScalars());
dataset->GetPointData()->SetNormals(normals->GetOutput()->GetPointData()->GetScalars());

Ok, so that seems to be fine. But now I would like to see some color on
my 2D arrow glyph. I've been playing around with some lookup tables, but
it seems to read the scalar data. Also
glyph3D->SetColorModeToColorByVector() does not give me the right
results.

So, what I want is: for each normal vector, it's x y and z component
should represent and r,g and b value. This should give a smooth mapping
in color of the normal vector.

Can anyone give me some hints on how to do this?

Best regards,

Roy




More information about the vtkusers mailing list