[vtkusers] Assigning colors to scalars

Jens jens-devel at gmx.de
Sun Nov 6 17:33:23 EST 2005


Hi Lise
you need to call
u_field->GetPointData()->SetActiveScalars("attribute-name");
mapper->SetScalarRange(u_field->GetScalarRange());
,too.
This works for me as long as I call all functions before Render().
(and remove SetTableRange(...) )

	Greetings 
		Jens
P.S:
Please read my mail  "How to change the active cell attribute after "Render()" 
I wrote just before your mail and give me an answer for that ...

Am Sonntag, 6. November 2005 21:00 schrieb Lise Angell:
> 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
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list