[vtkusers] why the color of actor is white by seting the vtkLookupTable
朱文武
cool.wenwu at gmail.com
Thu Apr 15 21:00:48 EDT 2010
hi all,
I sent the message last night! However, no one responded ! So, i send
it again. Please forgive me, if it disrupts you!
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,0,1,1);
colorLookupTable->SetTableValue(122, 0,0,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 actors is the same- white.
Ccould anyone tell me why and give some suggestions?
Thanks
Wenwu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100416/e8466a0d/attachment.htm>
More information about the vtkusers
mailing list