[vtkusers] why the color of actor is white by seting the vtkLookupTable
Bill Lorensen
bill.lorensen at gmail.com
Fri Apr 16 00:01:09 EDT 2010
The lookup table and mapper look OK to me. Can you attach the entire
program if it is not too large?
Bill
On Thu, Apr 15, 2010 at 9:00 PM, 朱文武 <cool.wenwu at gmail.com> wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK 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