[vtkusers] vtkWindowLevelLookupTable is not working

maymansy mayoy_m86 at yahoo.de
Mon Mar 12 04:48:12 EDT 2012


Hello,

I have been struggling for days now and just can't get the
vtkWindowLevelLookupTable to work correctly. I use Kitware's ActiViz wrapper
classes and my task is to implement MPR. so after i get the slice (using the
vtkImageReslice class) i start the graylevel conversion process. The images
are monochrome2, 12 bit, unsigned dicom images with window width of 1249 and
level of 712. All i want to do is to convert them into an 8bit gray scale
(256 gray values) using the vtkWindowLevelLookupTable.
These were my (unsuccessful) trials:
1)  vtkWindowLevelLookupTable wlLUT = vtkWindowLevelLookupTable.New();
     wlLUT.SetWindow(1249);
     wlLUT.SetLevel(712);
     wlLUT.Build();
2)  vtkWindowLevelLookupTable wlLUT = vtkWindowLevelLookupTable.New();
     wlLUT.SetMaximumTableValue(255.0, 255.0, 255.0, 0);
     wlLUT.SetMinimumTableValue(0.0, 0.0, 0.0, 0.0);
     wlLUT.SetNumberOfTableValues(256);
     wlLUT.SetWindow(1249);
     wlLUT.SetTableRange(712.0 - 624.5, 712.0 + 624.5);
     wlLUT.SetLevel(712);
     wlLUT.Build();
3) vtkWindowLevelLookupTable wlLUT = vtkWindowLevelLookupTable.New();
    wlLUT.SetTableRange(0.0, 1249.0); 
    wlLUT.SetSaturationRange(0.0, 0.0);
    wlLUT.SetHueRange(0.0, 0.0);
    wlLUT.SetValueRange(0.0, 1.0);
    wlLUT.Build();

Then i tried setting the table values one by one (which gave a quite
acceptable result): 
4) vtkWindowLevelLookupTable wlLUT = vtkWindowLevelLookupTable.New();
    int numberOfEntries = 4096;
    wlLUT.SetNumberOfTableValues(4096);//2144
    for (int i = 0; i < numberOfEntries; i++)
       {
           double value = (double)i / 256.0;
           wlLUT.SetTableValue(i, value, value, value, 1.0);
        }
   wlLUT.SetTableRange(0.0, 4096); 
   wlLUT.Build();

can anybody please help me out of this hassle? i don't know what i am doing
wrong?

Thanks in advance,
-may mansy

--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkWindowLevelLookupTable-is-not-working-tp5556968p5556968.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list