[vtkusers] Normalized POINT_DATA scalars of polydata to the domain of [-1.0, 1.0]

sergio campos camposs968 at gmail.com
Sun Nov 27 17:10:15 EST 2011


Hello I have the next file:
______________________________
____________________________________

# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 4 float
0 0 0
9 0 0
0 9 0
9 0 9
LINES 5 15
2 0 1
2 1 3
2 3 2
2 2 0
2 0 3
POINT_DATA 4
scalars pointvar float
LOOKUP_TABLE default
-1.2 -1.3 1.4 1.5
_______________________________________________________________________

How to normalized scalars pointvar to domain of  [-1.0, 1.0]  to display in
color values. The negative values blue, the positive values red and the
zeros values green.

I saw the next example
http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/DataManipulation/Python/FinancialField.py
but how can I apply this if I read the file?

  calc = vtk.vtkArrayCalculator()
  calc.SetInputConnection(rf.GetOutputPort())
  calc.SetAttributeModeToUsePointData()
  calc.AddScalarVariable("s", scalar, 0)
  calc.SetFunction("s / %f"%max)
 calc.SetResultArrayName("resArray")

Regards

sergio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111127/cabdc0fb/attachment.htm>


More information about the vtkusers mailing list