[prev in list] [next in list] [prev in thread] [next in thread]
List: vtkusers
Subject: Re: [vtkusers] ImageBlending in Compound Mode
From: David Gobbi <david.gobbi () gmail ! com>
Date: 2015-05-26 21:28:17
Message-ID: CANwS1=GiydcH2hC30TMMamPfG0KGqOqUQyRDPSOvvZ6CGFp+EA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Can you use vtkImageMapToColors instead? You can use the vtkLookupTable's
SetRange() method to control the window/level.
On Tue, May 26, 2015 at 3:15 PM, Böttcher, Prof. Dr. Peter <
Boettcher@kleintierklinik.uni-leipzig.de> wrote:
> 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@gmail.com]
> *Gesendet:* Montag, 25. Mai 2015 21:44
> *An:* Böttcher, Prof. Dr. Peter
> *Cc:* vtkusers@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@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@kleintierklinik.uni-leipzig.de
>
[Attachment #5 (text/html)]
<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>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic