Dear List,
I did want to recreate an old MITK rendering behavior, where all black pixels
were rendered transparent.
After investing quite some time, I managed to achieve this goal by applying a
lookup table as follows
// generate vtk lookup table
vtkSmartPointer<vtkLookupTable> usLut = vtkSmartPointer<vtkLookupTable>::New();
usLut->SetNumberOfTableValues(256);
for(unsigned int i=1; i<256; i++)
usLut->SetTableValue(255-i, (double)i, (double)i, (double)i, 1.);
usLut->SetTableValue(0, 0.,0.,0.,0.);
usLut->Build();
// generate mitk lookup table
m_lutUS = mitk::LookupTable::New(); // mitk US lookup table for black
transparency
m_lutUS->SetVtkLookupTable(usLut);
// set lut node property
mitk::LookupTableProperty::Pointer mitkLutProp =
mitk::LookupTableProperty::New();
mitkLutProp->SetLookupTable(m_lutUS);
us_parent_node->SetProperty( "LookupTable", mitkLutProp );
us_parent_node->SetProperty( "Image Rendering.Mode",
mitk::RenderingModeProperty::New(mitk::RenderingModeProperty::LOOKUPTABLE_LEVELWINDOW_COLOR));
My question now: Is there a more convenient way to achieve this goal????
I think the code above has way too much overhead. Also having flipped indices
in ->SetTableValue(255-i, r,g,b,a);
does not make it easier to understand and apply the lut.
Additionally there should be a reference to the "Image Rendering.Mode" in
"mitk::LookupTable Class Reference", because without the correct render mode,
the lut will have no effect. It's kind of hard to figure that out when you did
everything else correctly!
Cheers,
Matthias
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users