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.

A = inputs[0].CellData['A']

B = inputs[0].CellData['B']

C = inputs[0].CellData['C']

colors = numpy.empty((len(A),3), dtype='float')

colors[:,0] = A

colors[:,1] = B

colors[:,2] = C

output.CellData.append(colors, 'colors')

HTH,
Shawn

On Mon, May 8, 2017 at 1:56 PM, Moreland, Kenneth <[email protected]> wrote:

> 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:
>
>
>
> A = inputs[0].CellData['A']
>
> B = inputs[0].CellData['B']
>
> C = inputs[0].CellData['C']
>
> colors = numpy.empty((len(A),3), dtype='uint8')
>
> colors[:,0] = A*255
>
> colors[:,1] = B*255
>
> colors[:,2] = C*255
>
> output.CellData.append(colors, 'colors')
>
>
>
> 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).
>
>
>
> -Ken
>
>
>
> *From:* ParaView [mailto:[email protected]] *On Behalf Of *Thomas
> Oliveira
> *Sent:* Saturday, May 6, 2017 7:24 AM
> *To:* ParaView <[email protected]>
> *Subject:* [EXTERNAL] [Paraview] Visualization ternary saturation
>
>
>
> Dear all,
>
> 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 http://www.esss.com.br/Kraken/
> wp-content/uploads/2014/07/Ternary-Saturation.png)?
>
> In the figure, A, B, C are saturations of water, oil and gas.
>
> Best regards,
>
> Thomas Oliveira
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to