[vtkusers] Coloring different contours

Felix Mayr felix.mayr at tum.de
Tue Jan 15 11:52:52 EST 2019


Dear vtkusers,

I'm trying to set different colors for different contour values. To this 
end I'm creating a vtkColorTransferFunction():
	lut = vtkColorTransferFunction()
	# repeated for all the isovalues
	lut.AddRGBPoint(isovalue, r, g, b)
	lut.build()
Yielding something like:
vtkColorTransferFunction (0x41a0d10)
   Debug: Off
   Modified Time: 282517
   Reference Count: 1
   Registered Events: (none)
   Alpha: 1
   VectorMode: Component
   VectorComponent: 0
   VectorSize: -1
   IndexedLookup: OFF
   AnnotatedValues: 0 entries.
   Size: 1
   Clamping: On
   Color Space: RGB
   Scale: Linear
   Range: 0.0001 to 0.0001
   AllowDuplicateScalars: 0
   NanColor: 0.5, 0, 0
   BelowRangeColor: (0, 0, 0)
   UseBelowRangeColor: OFF
   ABoveRangeColor: (1, 1, 1)
   UseAboveRangeColor: OFF
     0 X: 0.0001 R: 1 G: 1 B: 1 Sharpness: 0 Midpoint: 0.5

I then use SetLookupTable on a preexisting vtkActor, where the 
vtkPolyDataMapper of the pipeline is configured with 
SetScalarVisibilityOn. For one color this works great. Unfortunately 
once I add a second one, everything gets still colored the same. Does 
anyone spot any error?


Felix Mayr
<felix.mayr at tum.de>
Technical University of Munich, Simulation of Nanosystems for Energy 
Conversion [www.sne.ei.tum.de]



More information about the vtkusers mailing list