[vtkusers] create vtkLookupTable by specifying RGB components?

Mark Wyszomierski markww at gmail.com
Wed May 4 11:49:02 EDT 2005


Hi, 

Working past the apparent mem leak with using color transfer function
with vtkImageViewer2, it does not seem to suffer the same problem
using vtkLookupTable. I just want to map greys from slots 0-255, blues
from 256-511, and so forth for greens, reds. My resulting LUT seems to
have the correct general colors, but looks somewhat hazy, not the true
colors. Is this how we can specifiy a direct mapping to the table
using RGB values: ?

vtkLookupTable *myLUT = vtkLookupTable::New();
myLUT->SetNumberOfTableValues(1024);
myLUT->SetScaleToLinear();
myLUT->SetRange(0,1023);
myLUT->Build();

for (int i = 0; i < 256; i++) TestLUT->SetTableValue(  0 + i, i, i,
i); // greyscales.
for (int i = 0; i < 256; i++) TestLUT->SetTableValue(256 + i, 0, 0,
i); // blues.
for (int i = 0; i < 256; i++) TestLUT->SetTableValue(512 + i, 0, i,
0); // greens.
for (int i = 0; i < 256; i++) TestLUT->SetTableValue(768 + i, i, 0, 0); // reds.

viewer->GetWindowLevel()->SetLookupTable(myLUT);



More information about the vtkusers mailing list