[vtkusers] ImageBlending in Compound Mode

David Gobbi david.gobbi at gmail.com
Mon May 25 15:44:25 EDT 2015


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> 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
>
> Fax: +49-341-9738799
>
> Email: boettcher at kleintierklinik.uni-leipzig.de
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150525/d876c59c/attachment.html>


More information about the vtkusers mailing list