[Paraview] Lookup Table Range

David Pont David.Pont at scionresearch.com
Tue Apr 13 01:00:48 EDT 2010


I am developing a python script to visualise point data (unstructured grid) with a large number of scalar values for each point.
My problem is some of the scalar data is a bit noisy, i.e. a histogram of the values has a long tail at one or both ends, which effectively reduces the useful range of color in the visualisation. I would like to determine the 5 and 95 percentiles for each data array and use these as the range for the LUT. And I would like to do this from my python script. I can't figure out how to get at the underlying point data, as it would then be very easily to calculate a restricted range.
See my current script below.

Thanks in advance for any help, Dave


####################################################
from paraview.simple import *

sm = servermanager
sm.Connect()

INPUTFILES = ("Esk all trees v2.txt_1.vtk", "Esk all trees v2.txt_2.vtk", "Esk all trees v2.txt_3.vtk")

# create reader for legacy VTK files
reader = LegacyVTKReader(FileNames=INPUTFILES[2])

#create and configure view window
Show()
view = GetActiveView()
#set the background color
#view.Background = [1,1,1]  #white
#set window size
view.ViewSize = [800, 600]
view.UseOffscreenRenderingForScreenshots = True

# set basic display properties
dp = GetDisplayProperties()
#set representation
dp.Representation = "Points"
#dp.Representation = "Surface"
#set point size
dp.PointSize = 2
dp.MapScalars = True
dp.InterpolateScalarsBeforeMapping = True

# create a legend
bar = servermanager.rendering.ScalarBarWidgetRepresentation(registrationGroup='scalar_bars', registrationName="ScalarBarWidgetRepresentation1")
#bar.LabelColor = [1.0, 1.0, 1.0]
#bar.TitleColor = [1.0, 1.0, 1.0]
bar.TitleFontSize = 10
bar.LabelFontSize = 10
view.Representations.append(bar)

# render and save image for each scalar array in the point data
for a in reader.PointData :
                print a.GetName()
                r = a.GetRange()
                dp.LookupTable = MakeBlueToRedLT(r[0], r[1])
                dp.ColorAttributeType = 'POINT_DATA'
                dp.ColorArrayName = a.GetName()
                bar.Title = a.GetName()
                bar.LookupTable = dp.LookupTable
                Render()
                #save screenshot
                WriteImage( "v%s.jpg" % (a.GetName()) )

________________________________
Disclaimer: This e-mail and any attachments may contain information which is confidential or subject to copyright. If you receive this e-mail in error, please delete it.
Scion does not accept responsibility for anything in this e-mail which is not provided in the course of Scion's usual business or for any computer virus, data corruption, interference or delay arising from this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100413/dafda3af/attachment.htm>


More information about the ParaView mailing list