[vtkusers] vtkLookupTable and vtkImageMapToColors question
Anja Ende
anja.ende at googlemail.com
Mon Aug 21 05:52:32 EDT 2006
Hi everyone,
I am trying to window the pixel intensities in my image using vtkLookupTable
and vtkImageMapToColors objects.
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.
I thought I could do that with the combination of vtkLookupTable and the
vtkImageMapToColors object.
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.
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 :(
Here is the code:
vtkLookupTable *bwLut = vtkLookupTable::New();
bwLut->SetTableRange (slicer->GetOutput()->GetScalarTypeMin(),
slicer->GetOutput()->GetScalarTypeMax());
bwLut->SetSaturationRange (0, 0);
bwLut->SetHueRange (0, 0);
bwLut->SetValueRange (0, 1);
bwLut->Build(); //effective built
vtkImageMapToColors *mapColors = vtkImageMapToColors::New();
mapColors->SetInputConnection(slicer->GetOutputPort());
mapColors->SetOutputFormatToRGB();
mapColors->SetLookupTable(bwLut);
viewer1->SetInput(mapColors->GetOutput());
// blah blah.... viewer1->SetupInteractor(widget.GetRenderWindow
()->GetInteractor());
widget.SetRenderWindow(viewer1->GetRenderWindow());
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?
Also, what does vtkLookUpTable::SetValueRange actually do...
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.
Thanks :)
Anja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060821/83612278/attachment.htm>
More information about the vtkusers
mailing list