[vtkusers] Question about color mapping due to scalar(s) in VTK

Alex Malyushytskyy alexmalvtk at gmail.com
Thu Jul 12 16:54:25 EDT 2012


Thanks David for comments,

I am aware of Field data. But this is a way of storing data.
To visualize it ( as a color for example ) , even if you have it
stored within data set as a field, you will need to assign color
directly to Actor (correct me if I am wrong).
The problem is that there is no way to enforce mapper to use this data
for color mapping.

You can't set it as an active scalar ( there are point related
scalars, there are cell related scalars, but there is no dataset
related scalar)
Data set does not implement anything like FIELD_ASSOCIATION_DATA_SET (
 existing choices are: FIELD_ASSOCIATION_POINTS,
FIELD_ASSOCIATION_CELLS, FIELD_ASSOCIATION_NONE,
FIELD_ASSOCIATION_POINTS_THEN_CELLS,
  NUMBER_OF_ASSOCIATIONS )
So standard way of coloring data set by assigning LookupTable to
mapper and let him to do the job will not work.

You will need to pre-build look-up table (probably using values stored
in the field data ), then assign color to each actor (using lookup
table ).
This applies you need a knowledge about actor associated with this
dataset to define the color.

When you you colorize dataset according to nodal or cell related
scalar you do not need to know anything about actor.
Mapper will do everything.

It might sound as not a big problem if your application needs to
colorize objects in only one way (either assign color directly to
actors or use mapper),
but I found it really complicates the code if you need to use both approaches.

It enforces you to maintain both actors and dataset pointers and two
way relations between them, when a single approach allows you to to
keep only one type of pointers.
and greatly increases complexity of the code.

All I wanted to point that coloring dataset according to a single
value (scalar which  may be only a single value)  may and should work
similar to the coloring it according to the nodal or cell related
scalar.

Alex



>
> I believe what you are looking for is "Field Data":
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/FieldData
>
> David



More information about the vtkusers mailing list