[Paraview] Visualization ternary saturation

Dan Lipsa dan.lipsa at kitware.com
Tue May 9 09:59:23 EDT 2017


Hi all,

Indeed, rather than supporting only 'unsigned char' for direct color
mapping - using color mode VTK_COLOR_MODE_DEFAULT, all integer and floating
point types can be used for direct color mapping using the color mode
VTK_COLOR_MODE_DIRECT_SCALARS.
Integer type colors should be between 0-255 and floating point colors
should be between 0-1.

Dan


On Mon, May 8, 2017 at 10:16 PM, Cory Quammen <cory.quammen at kitware.com>
wrote:

> > I tried it your way in ParaView 5.3.0, and it did not work correctly. Are
> > you sure this is implemented in 5.3 and not a new feature in the upcoming
> > 5.4?
>
> Ken,
>
> This was implemented some time ago. In 5.3.0, I could do the following:
>
> * Add Sphere Source
> * Add Programmable Filter with the Script set to
>
> A = inputs[0].PointData['Normals'][:,0]
> B = inputs[0].PointData['Normals'][:,1]
> C = inputs[0].PointData['Normals'][:,2]
> colors = numpy.empty((len(A),3), dtype='float')
> colors[:,0] = A
> colors[:,1] = B
> colors[:,2] = C
> output.PointData.append(colors, 'colors')
>
> * Turn off Map Scalars
>
> You could also skip this silly use of the Programmable Filter
> altogether and color the Sphere source by 'Normals', then turn Map
> Scalars off.
>
> I believe the capability to treat floating-point arrays of 3-tuples
> was added to VTK in commit
>
> commit 00de9a942ff74e797fbe4cd8c67307c8065cdade
> Author: Dan Lipsa <dan.lipsa at kitware.com>
> Date:   Thu Nov 20 13:35:35 2014 -0500
>
>     Add VTK_COLOR_MODE_DIRECT_SCALARS. See vtkScalarsToColors::MapScalars.
>
> - Cory
>
> > From: Shawn Waldon [mailto:shawn.waldon at kitware.com]
> > Sent: Monday, May 8, 2017 12:11 PM
> > To: Moreland, Kenneth <kmorel at sandia.gov>
> > Cc: Thomas Oliveira <thomas.oliveira at gmail.com>; ParaView
> > <paraview at paraview.org>
> > Subject: [EXTERNAL] Re: [Paraview] Visualization ternary saturation
> >
> >
> >
> > 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 <kmorel at sandia.gov>
> 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:paraview-bounces at paraview.org] On Behalf Of
> Thomas
> > Oliveira
> > Sent: Saturday, May 6, 2017 7:24 AM
> > To: ParaView <paraview at paraview.org>
> > 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
> >
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170509/7f048034/attachment.html>


More information about the ParaView mailing list