[vtkusers] vtkDataSetMapper Coloring Question

Jeremy Stout stout.jeremy at gmail.com
Thu Jul 7 08:43:43 EDT 2005


I am using vtkDataSetMapper to help visualize a data set after putting
it through a series of filters. As part of the visualization process,
I am trying to color the dataset by a specific scalar array. That part
is working pretty good for me. The only problem I am running into is
that I want to flip the color spectrum on the lookup table the mapper
is using so that blue represents the lower boundary of my scalar range
and red is the upper range. At the moment, blue is representing the
upper range and red the lower range. I've looked through the
vtkLookupTable and vtkDataSetMapper APIs, but I haven't seen anything
that will let me do what I am wanting. For what it is worth, here is
the code I am using to setup the mapper (this is Java):

vtkDataSet filteredDataSet;

filteredDataSet = finalFilter.GetOutput();
filteredDataSet.SetActiveScalars("void_fraction");

dataSetMapper = new vtkDataSetMapper();
dataSetMapper.SetInput(filteredDataSet);
dataSetMapper.SetScalarModeToUsePointFieldData();
dataSetMapper.SetScalarRange(0.0, 4800.0);
dataSetMapper.SelectColorArray("void_fraction");

I figure it is rather easy to swap the colors, but I am not seeing how
to do it. Any help in this matter would be appreciated.

Jeremy Stout



More information about the vtkusers mailing list