[vtkusers] lut->SetAlphaRange and lut->SetRange do not work on RGBA images?
Thomas Kilgus
t.kilgus at dkfz-heidelberg.de
Wed Aug 10 04:32:48 EDT 2011
Hi everyone,
My problem is that the methods SetAlphaRange and SetRange do not have
any effect on RGBA images. SetRange works well on gray scale images.
I use the following pipeline to render arbitrary images:
Load the image -> Reslice it via vtkImageReslice -> Apply some
properties with a lookuptable like Window/Level, opacity, etc. -> render
the texture with a vtkPolyDataMapper.
Here comes the code (which I think is important for my question):
vtkSmartPointer<vtkLookupTable> lut =
vtkSmartPointer<vtkLookupTable>::New();
//built a default lookuptable
lut->SetSaturationRange( 0.0, 0.0 );
lut->SetHueRange( 0.0, 0.0 );
lut->SetValueRange( 0.0, 1.0 );
lut->Build();
//map all black values to transparent
lut->SetTableValue(0, 0.0, 0.0, 0.0, 0.0);
lut->SetRange(someValue, someValue); //someValue between 0 and 255
lut->SetAlphaRange(someOtherValue, someOtherValue); //someOtherValue
between 0 and 1
[...] //load the image
vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New();
texture->SetLookupTable(lut);
texture->SetInput(image);
vtkSmartPointer<vtkPlaneSource> plane =
vtkSmartPointer<vtkPlaneSource>::New();
[...] //generate a plane to render the texture on
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConection(plane->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->SetTexture(texture);
[...] //pass the actor to the renderer
Does anyone have an idea what could be wrong? Again: the lut is working
fine for grayscale images, but not for RGBA images...
best regards
Thomas
More information about the vtkusers
mailing list