[vtkusers] Assigning colors to scalars
Lise Angell
lise.angell at gmail.com
Sun Nov 6 15:00:19 EST 2005
Dear vtk-users,
I'm working with a 3D dataset containing a heart model. This model is
read into vtk as an UnstructuredGrid with a scalar value in each
point.
I would like to color the model according to these scalars. I've tried
vtkLookupTable, setting the table range to the min and max value of
the scalar values, but the model still turns out all red...
This is (parts of) my code, I would be grateful for any advise:
# scalar_range contains min and max value in the unstructured grid u_field
lut = vtk.vtkLookupTable()
lut.SetNumberOfColors(10)
lut.SetTableRange(scalar_range[0], scalar_range[1])
lut.SetHueRange(0.0, 0.3)
lut.Build()
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(u_field)
mapper.SetLookupTable(lut)
Best regards,
Lise
--
"Je forme une entreprise qui n'eut jamais d'exemple,
et dont l'exécution n'aura point d'imitateur." J-J Rousseau
More information about the vtkusers
mailing list