[vtkusers] why the color of actor is white by set the vtkLookupTable

朱文武 cool.wenwu at gmail.com
Thu Apr 15 10:35:43 EDT 2010


hi all,

       I need your help ! I use vtkDiscreteMarchingCubes to reconstruct
anatomy structure, and use the vtkLookupTable to map the color. Now, i
design the color map as follows:
gray value - 111 to red,
gray value-121 to blue.
Other gray value I don't care.

Also, the parameter I set in SetValue() of  vtkDiscreteMarchingCubes is:
SetValue(0, 111);
SetValue(1, 121);

Then i set the lookup table as follows:
vtkSmartPointer<vtkLookupTable> colorLookupTable=
vtkSmartPointer<vtkLookupTable>::New();
colorLookupTable->SetTableRange(0, 122); //
colorLookupTable->SetNumberOfTableValues(123);
colorLookupTable->Build();

for (int i =0; i < 111; i++)
{
    colorLookupTable->SetTableValue(i , i/255.0, i/255.0,i/255.0); // i
don't care this loop
}
colorLookupTable->SetTableValue(111, 1,0,0,1); // this is essential for me
for (int j = 112; j <120; j++)
{
    colorLookupTable->SetTableValue(j , j/255.0, j/255.0, j/255.0); // i
don't care this loop

}
colorLookupTable->SetTableValue(121, 0,1,1,1);
colorLookupTable->SetTableValue(122, 0,1,1,1);

vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
...
mapper->ScalarVisibilityOn() ;//#show colour
mapper->SetScalarRange(colorLookupTable->GetTableRange());
mapper->SetScalarModeToUseCellData() ;
mapper->SetLookupTable(colorLookupTable);

The result of construction is that two structures whose gray value is 111
and 121 were reconstructed.
However, the color of these actor is the same, the white color.
Can anyone tell me one and give some suggestions?

Thanks
Wenwu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100415/366a5d80/attachment.htm>


More information about the vtkusers mailing list