[vtkusers] Coloring vector components as RGB
Pelt, R.F.P. van
R.F.P.v.Pelt at tue.nl
Sun Oct 19 13:11:22 EDT 2008
Hi all,
I'm currently working with a vtkImageData, containing single component
scalar values
and a vector field. I've been playing around with vtkGlyph3D to get some
arrows plotted.
I would like to have the arrows colored where the x, y and z components
are mapped to R,G,B colors.
This seems a trivial thing to do, but unfortunately I cannot find how to
do this using VTK.
(By default VTK tends to be using LUTs and scalar mappings as far as I
can tell)
Can anyone please help me to get this fixed?
Furthermore I would like to have a vtkImagePlane slicing through the
volume, where the texture on
the plane should also map the vector components to RGB. I have similar
problem with this.
Any help is really appreciated.
Regards,
Roy
//----------------------------------------------------------------------
---------------------------
arrow2D = vtkGlyphSource2D::New();
arrow2D->SetGlyphTypeToArrow();
arrow2D->FilledOff();
glyph = arrow2D->GetOutput();
// Create the glyphFilter with a certain threshold set
vtkThresholdPoints *thresholdPoints = vtkThresholdPoints::New();
thresholdPoints->SetInput(data);
thresholdPoints->ThresholdByUpper(threshold);
vtkMaskPoints *maskPoints = vtkMaskPoints::New();
maskPoints->SetInput(thresholdPoints->GetOutput());
maskPoints->SetOnRatio(10);
vtkGlyph3D *glyphFilter = vtkGlyph3D::New();
glyphFilter->SetInput(maskPoints->GetOutput());
glyphFilter->SetSource(glyph);
glyphFilter->SetVectorModeToUseVector();
glyphFilter->SetScaleFactor(0.005);
glyphFilter->OrientOn();
// Create the glyphMapper
vtkPolyDataMapper *glyphMapper = vtkPolyDataMapper::New();
glyphMapper->SetInput(glyphFilter->GetOutput());
// Configure the glyphActor
if(glyphActor == NULL) glyphActor = vtkActor::New();
glyphActor->SetMapper(glyphMapper);
//----------------------------------------------------------------------
---------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081019/ac71c108/attachment.htm>
More information about the vtkusers
mailing list