<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks for your reply.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">But I tried to change the alpha value in the Lookup Table of the first input to 0 and tried to set the opacity value of the 2<sup>nd</sup> input as 1. Then
also the result is coming incorrect(white screen is shown,no output is displayed). The expected result should be that the 1<sup>st</sup> input is perfectly transparent so only 2<sup>nd</sup> input should be shown in the output.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">First Input LUT(changed the alpha value to 0)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.0in;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">for</span><span style="font-size:9.5pt;font-family:Consolas"> (<span style="color:blue">int</span> i = 0; i < 4096; i++)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">string</span> str = read.ReadLine();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">string</span>[] value = str.Split(<span style="color:#A31515">','</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">double</span>[] colorValue = <span style="color:blue">new</span>
<span style="color:blue">double</span>[5];<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">for</span> (<span style="color:blue">int</span> j = 0; j < 5; j++)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> colorValue[j] =
<span style="color:#2B91AF">Convert</span>.ToDouble(value[j]);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> table.SetTableValue((<span style="color:blue">long</span>)colorValue[0], colorValue[1], colorValue[2], colorValue[3], 0);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Setting the opacity of second Input<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">blend.SetOpacity(1, 1);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Can you please explain this behavior?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Anupriya<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Jagjeet Nain [mailto:jagjeet.nain@gmail.com]
<br>
<b>Sent:</b> Monday, October 01, 2012 7:35 PM<br>
<b>To:</b> Sharma, Anupriya<br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Not able to blend properly<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">it works following way:<o:p></o:p></p>
</div>
<p class="MsoNormal">Normal (default) : This is the standard blending mode used by OpenGL and other graphics packages. The output always has the same number of components and the same extent as the first input.
<b>The alpha value of the first input is not used in the blending computation, instead it is copied directly to the output.</b><br>
<br>
output <- input[0]<br>
foreach input i {<br>
foreach pixel px {<br>
r <- input[i](px)(alpha) * opacity[i]<br>
f <- (255 - r)<br>
output(px) <- output(px) * f + input(px) * r<br>
}<br>
}<br>
<br>
Cheers<br>
On Mon, Oct 1, 2012 at 7:40 AM, <<a href="mailto:anupriya.sharma@accenture.com">anupriya.sharma@accenture.com</a>> wrote:<br>
> Hi<br>
><br>
> <br>
><br>
> I am trying to blend two different raw files. I have used vtkImageReader to<br>
> read both the files. I have applied two different lookup tables on both the<br>
> file<br>
><br>
> I have also used vtkImageMapToColors ColorMapper = new<br>
> vtkImageMapToColors();<br>
><br>
> <br>
><br>
> vtkImageMapToColors ColorMapper = new vtkImageMapToColors();<br>
><br>
> ColorMapper.SetInput(reader1.GetOutput());<br>
><br>
> ColorMapper.SetLookupTable(table);<br>
><br>
> <br>
><br>
> vtkImageMapToColors ColorMapper1 = new<br>
> vtkImageMapToColors();<br>
><br>
> ColorMapper1.SetInput(reader2.GetOutput());<br>
><br>
> ColorMapper1.SetLookupTable(table1);<br>
><br>
> <br>
><br>
> “table is the Lookuptable applied on first file and table1 is the lookup<br>
> table applied on second file”.<br>
><br>
> <br>
><br>
> After setting the lookuptable I have created instance of vtkImage blend.<br>
><br>
> <br>
><br>
> vtkImageBlend blend = new vtkImageBlend();<br>
><br>
> blend.setOpacity(0,0);<br>
><br>
> blend.setOpacity(1,0);<br>
><br>
> blend.AddInputConnection(ColorMapper.GetOutputPort);<br>
><br>
> blend.AddInputConnection(ColorMapper1.GetOutputPort);<br>
><br>
> <br>
><br>
> I have later given the output of blend to the Input Connection of Viewer.<br>
><br>
> Viewer.SetInputConnection(blend.GetOutputPort());<br>
><br>
> <br>
><br>
> But the problem is the opacity results are coming incorrect.<br>
><br>
> <br>
><br>
> If the opacity of first file is 0 and the opacity of second file is also 0<br>
> then no output should be displayed but the output is getting displayed with<br>
> color of first LUT i.e Green.<br>
><br>
> If the opacities are 0.5 and 0.5(0.5 opacity for both the files) then the<br>
> fused color (dark green ) is getting displayed. The same color is getting<br>
> displayed at opacities 0 and 0.5(0 for first file and 0.5 for second).The<br>
> same thing is happening with opacities 1 and 0.5(1 for first file and 0.5<br>
> for second).<br>
><br>
> <br>
><br>
> Could anyone please explain how this Opacity function is working and how to<br>
> blend two different files with different color tables.<br>
><br>
> <br>
><br>
> <br>
><br>
> <br>
><br>
> Regards<br>
><br>
> Anupriya Sharma<br>
><br>
> <br>
><br>
><br>
> ________________________________<br>
> Subject to local law, communications with Accenture and its affiliates<br>
> including telephone calls and emails (including content), may be monitored<br>
> by our systems for the purposes of security and the assessment of internal<br>
> compliance with Accenture policy.<br>
> ______________________________________________________________________________________<br>
><br>
> <a href="http://www.accenture.com">www.accenture.com</a><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><o:p></o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal
compliance with Accenture policy.<br>
______________________________________________________________________________________<br>
<br>
www.accenture.com<br>
</font>
</body>
</html>