Hi everyone,<br><br>I am trying to window the pixel intensities in my image using vtkLookupTable and vtkImageMapToColors objects.<br><br>Basically what I am trying to do is set the maximum and minimum values for the pixels. So, any value less than the minimum value should be replaced by the minimum value set and any pixel value more than the maximum value should be set by the maximum value.
<br><br>I thought I could do that with the combination of vtkLookupTable and the vtkImageMapToColors object.<br><br>So, here is what I try to do. I have a reslicer and I pipe the output of the reslicer to the input of the vtkImageMapToColors.
<br><br>For test purposes, I try to set the min and max value to the possible min and max value. However, all I get is a blank screen :(<br><br>Here is the code:<br><br>vtkLookupTable *bwLut = vtkLookupTable::New();<br>bwLut->SetTableRange (slicer->GetOutput()->GetScalarTypeMin(), slicer->GetOutput()->GetScalarTypeMax());
<br>bwLut->SetSaturationRange (0, 0);<br>bwLut->SetHueRange (0, 0);<br>bwLut->SetValueRange (0, 1);<br>bwLut->Build(); //effective built<br> <br>vtkImageMapToColors *mapColors = vtkImageMapToColors::New();<br>
mapColors->SetInputConnection(slicer->GetOutputPort());<br>mapColors->SetOutputFormatToRGB();<br>mapColors->SetLookupTable(bwLut);<br> <br>viewer1->SetInput(mapColors->GetOutput());<br><br>// blah blah.... viewer1->SetupInteractor(
widget.GetRenderWindow()->GetInteractor());<br>widget.SetRenderWindow(viewer1->GetRenderWindow());<br><br>Also, I noticed that there is a lot of casting going on... My input images are of type short but all the filters return the output as double....Is that normal?
<br><br>Also, what does vtkLookUpTable::SetValueRange actually do...<br><br>In my example, I expected to see the whole image as the min and max values (in the SetTableTange) function should be within the possible min and max values... but I see a black screen. Obviously, I have misunderstood what these classes actually do, so if anyone can help me understand it... I would be really grateful.
<br><br>Thanks :)<br><br>Anja<br>