Hi Markus, 

If I understand correctly, the goal is to associate a value (corresponding) to 
a color to each face of the object, then define a LookUpTable difining the 
value association with a rgba color. 

So the 4 first points are ok for me but the 5th " Setup node-properties" is not 
clear to me: I do not see where/how the CellScalars are associated with the 
LookUpTable. 

I tried to set the CellScalar value: 
output->GetCellData()->SetScalars(scalars); 
output ->Update(); 
but nothing is visible. 

How can I "associate" my color face array with the LookUpTable? 

Thank you. 

Best regards, 

Tangi 

------------------------------------- 
Tangi MEYER 
Virtual and Augmented Reality 
System and Software Engineer 
Leuvensesteenweg 325 
B-1932 Zaventem - Belgium 
Telephone: +32 (0) 2 721 54 84 
Fax: +32 (0) 2 721 54 44 
------------------------------------- 


From: "Engel Markus" <[email protected]> 
To: "[email protected]" <[email protected]>, 
"[email protected]" <[email protected]> 
Sent: Monday, 31 May, 2010 10:32:48 AM 
Subject: AW: mitk-users Digest, Vol 48, Issue 13 


Hi Tangi, 


If you want to color different parts of your surface with different colors, you 
can use CellScalars and a LookupTable. 

1. Create your surface-composition as proposed by Jochen. 
2. create a vtkUnsignedCharArray that has as many elements as the surface has 
triangles. 

vtkUnsignedCharArray* scalars = vtkUnsignedCharArray::New(); 
scalars->SetNumberOfValues( surfaceComp->GetNUmberOfCells() ); 

3. For each triangle that belongs to one arrow set one scalar 

- For int i=0; i<size of red arrow; i++ 
Scalars->SetValue( id, 0 ); 

Same for other two arrows as well. Consider that the Cell-Ids change due to the 
surface-composition! 

4. Create LookupTable 

vtkLookupTable *vtkLUT = lookupTable->GetVtkLookupTable(); 
vtkLUT->SetNumberOfTableValues( 2 ); 
vtkLUT->SetRange(0.0, 3.0); 
vtkLUT->SetTableValue( 0, rgb-red ); 
vtkLUT->SetTableValue( 1, rgb-blue ); 
vtkLUT->SetTableValue( 2, rgb-green ); 
vtkLUT->Build(); 

mitk::LookupTable::Pointer lookupTable = mitk::LookupTable::New(); 
lookupTable->SetVtkLookupTable(vtkLUT); 

mitk::LookupTableProperty* lookupTableProperty = 
mitk::LookupTableProperty::New(lookupTable); 


5. Setup node-properties 


node->SetProperty( "LookupTable", lookupTableProperty ); 
node->SetBoolProperty("scalar visibility", true); 
node->SetFloatProperty("ScalarsRangeMaximum", 3); 
node->SetBoolProperty("color mode", true); 
node->Update(); 

That should do the trick. You can also set the ScalarType-Property to cellData 
but cellData should be used automatically if nothing else is defined. 
I hope this could help you in your attempt. 

Bests, 

Markus 



------------------------------------------------------------------------------

_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to