[vtk-developers] Manual conversion of some Tcl to Python tests.

David Thompson david.thompson at kitware.com
Fri Aug 31 17:43:34 EDT 2012


>> ...
>> Eventually we would have a vtkColor4ub function overload for
>> vtkProperty::SetColor:
>> 
>> actor->GetProperty()->SetColor(vtkNamedColors::GetColor("antiquewhite"));
> 
> This gets me thinking... didn't someone just commit an addition to
> vtkLookupTable() so that it can look up colors by name, instead of by
> index?

That was probably my addition, but that's not what it does; it provides a way to store a textual annotation for a small set of discrete scalar values along with the colormap. The scalar bar actor will eventually draw leader lines out from the appropriate place on the scalar bar and render the text next to the value. The text is related to a scalar value, not a color.

It also provides an alternate color lookup technique, where only those scalar values with annotations are assigned colors (all others get the NaN color). When the lookup table is set to color this way, vtkScalarBarActor now draws discrete color swatches for each annotation and renders the labels next to them.

Since the annotated scalar values are stored as vtkVariants, it is feasible to add new MapScalars/MapValue methods to vtkScalarsToColors that take a vtkAbstractArray or vtkVariant instead of a vtkDataArray or double. These new methods are not currently planned, but is the reason I did things the way I did.

>  Maybe we could just use that.  A vtkLookupTable subclass that
> provides html colors, with all the standard names.

Hmm... I suppose you could treat the annotations as color names, but then you would lose the ability to have a note to go alongside the value.

	David


More information about the vtk-developers mailing list