[vtkusers] ImageBlending in Compound Mode

Böttcher, Prof. Dr. Peter Boettcher at kleintierklinik.uni-leipzig.de
Tue May 26 17:15:13 EDT 2015


You are correct, this should work but  it doesn't. It seems that vtkImageMapToWindowLevelColors sets the alpha value to 255, regardless of the alpha value in the lookup. So, my problem is not related to the blender but to the vtkImageMapToWindowLevelColors.
Any ide to solve this?

Peter

Von: David Gobbi [mailto:david.gobbi at gmail.com]
Gesendet: Montag, 25. Mai 2015 21:44
An: Böttcher, Prof. Dr. Peter
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] ImageBlending in Compound Mode

I'm not very familiar with the Compounding mode, but is there any reason
why you cannot use the default mode, i.e. alpha-blending?

            m_blend_A->SetInput(0, GreyImage);
            m_blend_A->SetInput(1, GreenImage);
            m_blend_A->SetOpacity(1, 0.7);
            m_blend_A->Update();

By setting the opacity of the green image to 0.7, the opacity of the "base"
image is automatically (1.0 - 0.7).  Black pixels in the green image (any pixel
with alpha==0) will be completely transparent.

 - David



On Mon, May 25, 2015 at 12:50 PM, Böttcher, Prof. Dr. Peter <Boettcher at kleintierklinik.uni-leipzig.de<mailto:Boettcher at kleintierklinik.uni-leipzig.de>> wrote:
Dear All

I have two vtkImageData which I map to grey and green color using vtkImageMapToWindowLevelColors->SetOutputFormatToRGBA. The two LookUps are manually defined like this:

                  tableGreen->SetTableRange(0,256-1);
                  tableGreen->Build();
                  for(float i=1; i<256; i++)
                  tableGreen->SetTableValue(i,0,i/(256-1),0.0,1.0); // Green
                  tableGreen->SetTableValue(0,0.0,0.0,0.0,0.0); // Background

                  tableGrey->SetTableRange(0,256-1);
                  tableGrey->Build();
                  for(float i=0; i<256; i++)
                  tableGrey->SetTableValue(i,i/(256-1),i/(256-1), i/(256-1),1.0); // Grey


Using vtkImageBlend I would like to blend both images using different opcity values (0 - 1), but ignoring any black pixel in the green image, by using SetCompoundMode and CompoundThreshold = 0.

m_blend_A->SetInput(0, GreyImage);
            m_blend_A->SetOpacity(0, 0.3);
            m_blend_A->SetInput(1, GreenImage);
            m_blend_A->SetOpacity(1, 0.7);
            m_blend_A->SetBlendModeToCompound();
            m_blend_A->SetCompoundThreshold(0);
            m_blend_A->Update();

Whatever I do, the "black" pixels (background) in the green image are still overlayed on the grey image pixels. However, when I turn the threshold to anything other than 0 no pixel at all are pushed trough the blender (neither the green nor the grey image).

Any help would be much appreciated.

Thanks - Peter



---------------------------------------------------------
Prof. Dr. Peter Böttcher, DipECVS
European Veterinary Specialist in Surgery
Fachtierarzt für Kleintierchirurgie
Klinik für Kleintiere
Universität Leipzig
An den Tierkliniken 23
D-04103 Leipzig (Germany)
Tel: +49-341-9738700<tel:%2B49-341-9738700>
Fax: +49-341-9738799<tel:%2B49-341-9738799>
Email: boettcher at kleintierklinik.uni-leipzig.de<mailto:boettcher at kleintierklinik.uni-leipzig.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150526/6c467553/attachment.html>


More information about the vtkusers mailing list