hi all,<br> <br> 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:<br>gray value - 111 to red,<br>
gray value-121 to blue.<br>Other gray value I don't care.<br><br>Also, the parameter I set in SetValue() of vtkDiscreteMarchingCubes is: <br>SetValue(0, 111);<br>SetValue(1, 121);<br><br>Then i set the lookup table as follows:<br>
vtkSmartPointer<vtkLookupTable> colorLookupTable= vtkSmartPointer<vtkLookupTable>::New();<br>colorLookupTable->SetTableRange(0, 122); // <br>colorLookupTable->SetNumberOfTableValues(123);<br>colorLookupTable->Build();<br>
<br>for (int i =0; i < 111; i++)<br>{<br> colorLookupTable->SetTableValue(i , i/255.0, i/255.0,i/255.0); // i don't care this loop<br>}<br>colorLookupTable->SetTableValue(111, 1,0,0,1); // this is essential for me<br>
for (int j = 112; j <120; j++)<br>{<br> colorLookupTable->SetTableValue(j , j/255.0, j/255.0, j/255.0); // i don't care this loop<br><br>}<br>colorLookupTable->SetTableValue(121, 0,1,1,1);<br>colorLookupTable->SetTableValue(122, 0,1,1,1);<br>
<br>vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>...<br>mapper->ScalarVisibilityOn() ;//#show colour <br>mapper->SetScalarRange(colorLookupTable->GetTableRange()); <br>
mapper->SetScalarModeToUseCellData() ;<br>mapper->SetLookupTable(colorLookupTable);<br> <br>The result of construction is that two structures whose gray value is 111 and 121 were reconstructed.<br>However, the color of these actor is the same, the white color.<br>
Can anyone tell me one and give some suggestions? <br><br>Thanks<br>Wenwu<br><br>