<div dir="ltr"><div>Ken beat me to answering this one... I'll just add that if the data is floating point in the range [0, 1], you don't need to convert it to uint8 or multiply by 255. Just creating a floating point vector will give the same result. This is a more recent extension of the functionality: I know it works in 5.3 and master but I'm not sure how many versions back support it.<br><br><p class="MsoNormal" style="margin-right:0in;margin-left:0.5in;margin-bottom:0.0001pt">
<span style="font-size:10pt;font-family:"courier new"">A <span style="color:rgb(102,102,102)">
=</span> inputs[<span style="color:rgb(102,102,102)">0</span>]<span style="color:rgb(102,102,102)">.</span>CellData[<span style="color:rgb(186,33,33)">'A'</span>]</span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">B
<span style="color:rgb(102,102,102)">=</span> inputs[<span style="color:rgb(102,102,102)">0</span>]<span style="color:rgb(102,102,102)">.</span>CellData[<span style="color:rgb(186,33,33)">'B'</span>]</span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">C
<span style="color:rgb(102,102,102)">=</span> inputs[<span style="color:rgb(102,102,102)">0</span>]<span style="color:rgb(102,102,102)">.</span>CellData[<span style="color:rgb(186,33,33)">'C'</span>]</span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">colors
<span style="color:rgb(102,102,102)">=</span> numpy<span style="color:rgb(102,102,102)">.</span>empty((<span style="color:green">len</span>(A),<span style="color:rgb(102,102,102)">3</span>), dtype<span style="color:rgb(102,102,102)">=</span><span style="color:rgb(186,33,33)">'float'</span>)</span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">colors[:,<span style="color:rgb(102,102,102)">0</span>]
<span style="color:rgb(102,102,102)">=</span> A<span style="color:rgb(102,102,102)"></span></span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">colors[:,<span style="color:rgb(102,102,102)">1</span>]
<span style="color:rgb(102,102,102)">=</span> B<span style="color:rgb(102,102,102)"></span></span></p>
<p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">colors[:,<span style="color:rgb(102,102,102)">2</span>]
<span style="color:rgb(102,102,102)">=</span> C<span style="color:rgb(102,102,102)"></span></span><span style="font-size:10pt;font-family:"courier new""><br></span></p><p class="MsoNormal" style="margin-left:0.5in"><span style="font-size:10pt;font-family:"courier new"">output<span style="color:rgb(102,102,102)">.</span>CellData<span style="color:rgb(102,102,102)">.</span>append(colors,
<span style="color:rgb(186,33,33)">'colors'</span>)</span></p><br>HTH,<br></div>Shawn<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 8, 2017 at 1:56 PM, Moreland, Kenneth <span dir="ltr"><<a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div class="m_-207520897341471618WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">ParaView does not directly support ternary color maps, but if you create a field of colors (represented by three unsigned chars), then you can render those colors
directly by turning off the Map Scalars option. You can create these colors with a Programmable Filter with a script like the following:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">A <span style="color:#666666">
=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>CellData[<span style="color:#ba2121">'A'</span>]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">B
<span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>CellData[<span style="color:#ba2121">'B'</span>]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">C
<span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>CellData[<span style="color:#ba2121">'C'</span>]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">colors
<span style="color:#666666">=</span> numpy<span style="color:#666666">.</span>empty((<span style="color:green">len</span>(A),<span style="color:#666666">3</span>), dtype<span style="color:#666666">=</span><span style="color:#ba2121">'uint8'</span>)<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">colors[:,<span style="color:#666666">0</span>]
<span style="color:#666666">=</span> A<span style="color:#666666">*255</span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">colors[:,<span style="color:#666666">1</span>]
<span style="color:#666666">=</span> B<span style="color:#666666">*255</span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">colors[:,<span style="color:#666666">2</span>]
<span style="color:#666666">=</span> C<span style="color:#666666">*255</span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">output<span style="color:#666666">.</span>CellData<span style="color:#666666">.</span>append(colors,
<span style="color:#ba2121">'colors'</span>)</span><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Once you apply that script, color by the new “colors” array and uncheck the box marked “Map Scalars” (it is an advanced option in the properties panel).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-Ken<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> ParaView [mailto:<a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@<wbr>paraview.org</a>]
<b>On Behalf Of </b>Thomas Oliveira<br>
<b>Sent:</b> Saturday, May 6, 2017 7:24 AM<br>
<b>To:</b> ParaView <<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>><br>
<b>Subject:</b> [EXTERNAL] [Paraview] Visualization ternary saturation<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Dear all,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Given three cell arrays (A,B,C) representation saturations (A+B+C = 1 for every cell) is it possible to generate a ternary saturation image like the one attached (obtained in
<a href="http://www.esss.com.br/Kraken/wp-content/uploads/2014/07/Ternary-Saturation.png" target="_blank">
http://www.esss.com.br/Kraken/<wbr>wp-content/uploads/2014/07/<wbr>Ternary-Saturation.png</a>)?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">In the figure, A, B, C are saturations of water, oil and gas.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thomas Oliveira<u></u><u></u></p>
</div>
</div>
</span></div>
</div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>