<div dir="ltr">Hi Jothy,<div><br></div><div>I see this mistake a lot... people try to blend images by setting the alpha of both images to 0.5. That's wrong. If you want to blend images, then the first image should be opaque, and the second image should have an alpha of 0.5.<br><div><br></div><div>C = C1*(1 - alpha2) + C2*alpha2</div><div><br></div><div>The second mistake is that, if you want to blend complimentary colors, then you don't want the Value of the second image to be the ramp. Instead, you want the Alpha of the second image to be the ramp.</div><div><br></div><div><div> // Create a GREEN lookup table</div><div> vtkSmartPointer<vtkLookupTable> table =</div><div> vtkSmartPointer<vtkLookupTable>::New();</div><div> table->SetHueRange(0.33333,0.33333);</div><div> table->SetSaturationRange(1.0,1.0);</div><div> table->SetValueRange(0.0,1.0);</div><div> table->SetAlphaRange(1.0,1.0); // make the bottom image opaque</div><div> table->SetRampToLinear();</div><div> table->Build();</div><div><br></div><div> // Create a MAGENTA lookup table</div><div> vtkSmartPointer<vtkLookupTable>table2 =</div><div> vtkSmartPointer<vtkLookupTable>::New();</div><div> table2 ->SetHueRange(0.8333,0.8333);</div><div> table2 ->SetSaturationRange(1.0,1.0);</div><div> table2 ->SetValueRange(1.0,1.0); // use pure magenta, don't mix with black</div><div> table2 ->SetAlphaRange(0.0,1.0); // use an alpha ramp to blend the images</div><div> table2 ->SetRampToLinear();</div><div> table2 ->Build();</div></div><div><br></div><div>- David<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 11:43 PM, Jothybasu Selvaraj <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</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 dir="ltr"><div style="font-family:verdana,sans-serif">Hi All</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">I am trying to overlay 2 registered images using complementary LUTs (magenta & green), so that the images will appear white where they match perfectly. However, I couldn't get the desired results. The image appears magenta where they match.</div><div style="font-family:verdana,sans-serif"><br>Can anyone find any mistakes in this?</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">Below are the LUTs I use:</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><font color="#008000">GREEN</font><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">lookup</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">table</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkLookupTable</span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkLookupTable</span><span style="color:rgb(0,0,0)">>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetHueRange</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0.33333</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">0.33333</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetSaturationRange</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">1.0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">1.0</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetValueRange</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0.0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">1.0</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetAlpha</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0.5</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetRampToLinear</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">table</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Build</span><span style="color:rgb(0,0,0)">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">MAGENTA</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">lookup</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">table</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkLookupTable</span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(0,0,0)">table2</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkLookupTable</span><span style="color:rgb(0,0,0)">>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;font-style:italic;color:rgb(0,0,0)">SetHueRange</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">0.8333</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">,</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">0.8333</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;font-style:italic;color:rgb(0,0,0)">SetSaturationRange</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">1.0</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">,</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">1.0</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;font-style:italic;color:rgb(0,0,0)">SetValueRange</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">0.0</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">,</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">1.0</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;font-style:italic;color:rgb(0,0,0)">SetAlpha</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,128)">0.5</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">SetRampToLinear</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">();</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">table2</span><span style="font-family:verdana,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:verdana,sans-serif;font-style:italic;color:rgb(0,0,0)">Build</span><span style="font-family:verdana,sans-serif;color:rgb(0,0,0)">();</span><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Any help is highly appreciated!</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Cheers</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Jothy</pre></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div></div></blockquote></div></div></div></div></div>