Hi,
I don't know about a more convenient way to change the opacity for black
pixels. We are always happy to read about suggestions though!
Thanks for pointing out the documentation issue about the rendering mode
property. I filed bug 16591 for that.
Best,
Sascha
On 11/12/2013 02:58 PM, Noll, Matthias wrote:
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
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users