<div dir="ltr"><div><div>I'm not very familiar with the Compounding mode, but is there any reason</div><div>why you cannot use the default mode, i.e. alpha-blending?</div><div><br></div><div> m_blend_A->SetInput(0, GreyImage);</div><div> m_blend_A->SetInput(1, GreenImage);</div><div> m_blend_A->SetOpacity(1, 0.7);</div><div> m_blend_A->Update();</div></div><div><br></div><div>By setting the opacity of the green image to 0.7, the opacity of the "base"</div><div>image is automatically (1.0 - 0.7). Black pixels in the green image (any pixel</div><div>with alpha==0) will be completely transparent.</div><div><br></div><div> - David</div><div><br></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 25, 2015 at 12:50 PM, Böttcher, Prof. Dr. Peter <span dir="ltr"><<a href="mailto:Boettcher@kleintierklinik.uni-leipzig.de" target="_blank">Boettcher@kleintierklinik.uni-leipzig.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US">Dear All<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have two vtkImageData which I map to grey and green color using vtkImageMapToWindowLevelColors-></span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">SetOutputFormatToRGBA</span><span lang="EN-US">.
The two LookUps are manually defined like this:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGreen->SetTableRange(0,256-1);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGreen->Build();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> for(float i=1; i<256; i++)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGreen->SetTableValue(i,0,i/(256-1),0.0,1.0); // Green<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGreen->SetTableValue(0,0.0,0.0,0.0,0.0); // Background<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGrey->SetTableRange(0,256-1);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGrey->Build();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> for(float i=0; i<256; i++)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> tableGrey->SetTableValue(i,i/(256-1),i/(256-1), i/(256-1),1.0); // Grey<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">
<span style="color:green"><u></u><u></u></span></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt">
<span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green">m_blend_A->SetInput(0, GreyImage);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->SetOpacity(0, 0.3);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->SetInput(1, GreenImage);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->SetOpacity(1, 0.7);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->SetBlendModeToCompound();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->SetCompoundThreshold(0);<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New';color:green"> m_blend_A->Update();<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">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).<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">Any help would be much appreciated.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">Thanks - Peter
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">---------------------------------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">Prof. Dr. Peter Böttcher, DipECVS<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">European Veterinary Specialist in Surgery
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt">Fachtierarzt für Kleintierchirurgie
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt">Klinik für Kleintiere
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt">Universität Leipzig
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt">An den Tierkliniken 23<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">D-04103 Leipzig (Germany)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">Tel: <a href="tel:%2B49-341-9738700" value="+493419738700" target="_blank">+49-341-9738700</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">Fax: <a href="tel:%2B49-341-9738799" value="+493419738799" target="_blank">+49-341-9738799</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt">Email:
</span><span style="font-size:9pt"><span lang="EN-US" style="color:blue"><a href="mailto:boettcher@kleintierklinik.uni-leipzig.de" target="_blank">boettcher@kleintierklinik.uni-leipzig.de</a></span></span></p></div></div></blockquote></div></div></div></div>