<div dir="ltr">Can you use vtkImageMapToColors instead? You can use the vtkLookupTable's SetRange() method to control the window/level.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 3:15 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Any ide to solve this?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Peter<u></u><u></u></span></p>
<p class="MsoNormal"><a name="14d921452909ab48__MailEndCompose"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Gobbi [mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>]
<br>
<b>Gesendet:</b> Montag, 25. Mai 2015 21:44<br>
<b>An:</b> Böttcher, Prof. Dr. Peter<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Betreff:</b> Re: [vtkusers] ImageBlending in Compound Mode<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">I'm not very familiar with the Compounding mode, but is there any reason<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">why you cannot use the default mode, i.e. alpha-blending?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> m_blend_A->SetInput(0, GreyImage);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> m_blend_A->SetInput(1, GreenImage);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> m_blend_A->SetOpacity(1, 0.7);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> m_blend_A->Update();<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">By setting the opacity of the green image to 0.7, the opacity of the "base"<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">image is automatically (1.0 - 0.7). Black pixels in the green image (any pixel<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">with alpha==0) will be completely transparent.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> - David<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, May 25, 2015 at 12:50 PM, Böttcher, Prof. Dr. Peter <<a href="mailto:Boettcher@kleintierklinik.uni-leipzig.de" target="_blank">Boettcher@kleintierklinik.uni-leipzig.de</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Dear All</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></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:10.0pt;font-family:"Courier New"">SetOutputFormatToRGBA</span><span lang="EN-US">.
The two LookUps are manually defined like this:</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGreen->SetTableRange(0,256-1);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGreen->Build();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> for(float i=1; i<256; i++)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGreen->SetTableValue(i,0,i/(256-1),0.0,1.0); // Green</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGreen->SetTableValue(0,0.0,0.0,0.0,0.0); // Background</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGrey->SetTableRange(0,256-1);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGrey->Build();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> for(float i=0; i<256; i++)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> tableGrey->SetTableValue(i,i/(256-1),i/(256-1), i/(256-1),1.0); // Grey</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">
</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> </span><u></u><u></u></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.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green">m_blend_A->SetInput(0, GreyImage);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->SetOpacity(0, 0.3);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->SetInput(1, GreenImage);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->SetOpacity(1, 0.7);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->SetBlendModeToCompound();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->SetCompoundThreshold(0);</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:green"> m_blend_A->Update();</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;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).</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Any help would be much appreciated.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Thanks - Peter
</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">---------------------------------------------------------</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">Prof. Dr. Peter Böttcher, DipECVS</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">European Veterinary Specialist in Surgery
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Fachtierarzt für Kleintierchirurgie
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Klinik für Kleintiere
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Universität Leipzig
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9.0pt">An den Tierkliniken 23</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">D-04103 Leipzig (Germany)</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">Tel:
<a href="tel:%2B49-341-9738700" target="_blank">+49-341-9738700</a></span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">Fax:
<a href="tel:%2B49-341-9738799" target="_blank">+49-341-9738799</a></span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">Email:
<span style="color:blue"><a href="mailto:boettcher@kleintierklinik.uni-leipzig.de" target="_blank">boettcher@kleintierklinik.uni-leipzig.de</a></span></span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>