[vtkusers] FieldData to PointData

Philipp.Batchelor philipp.batchelor at kcl.ac.uk
Tue Jul 2 14:02:41 EDT 2002


Hello,

maybe somebody can enlighten me, I don't seem to understand 
how to the  FieldData is converted to PointData under vtk4.0.

I just want to render the field, here curvature. I used to store
it as a 'vtkScalars', and that was it, but now, as I have to use
FieldData->DataArray, I can't manage to get a PointData that can
be rendered, or as in the code below, written to a file. The output
file contains only the geometry.

Ph.

----------------------------------------------------
set scalar "GaussCurvature"

vtkDataSetReader reader
reader SetFileName "icosaK.vtk"
reader SetFieldDataName "Curvatures" 
#necessary?
reader Update

vtkRearrangeFields rf
rf SetInput [do2ds GetOutput]
rf AddOperation COPY $scalar DATA_OBJECT POINT_DATA
rf Update

vtkAssignAttribute aa
aa SetInput [rf GetOutput]
aa Assign $scalar SCALARS POINT_DATA
aa Update

vtkPolyDataWriter wr
wr SetInput [aa GetOutput]
wr SetFileName "tmp.pd.vtk"
wr Update 
----------------------------------------------------

My example input data file is:

----------------------------------------------------
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
FIELD Curvatures 1
GaussCurvature 1 12 float
0.328119 0.328119 0.328119 0.328119 0.328119 0.328119 0.328119 0.328119 0.328119
 
0.328119 0.328119 0.328119 
POINTS 12 float
-0.552786 -1.7013 -0.894427 -1.44721 -1.05146 0.894427 -1.78885 0 -0.894427 
0.552786 -1.7013 0.894427 1.78885 0 0.894427 1.44721 -1.05146 -0.894427 
0 0 -2 -0.552786 1.7013 -0.894427 1.44721 1.05146 -0.894427 
0.552786 1.7013 0.894427 0 0 2 -1.44721 1.05146 0.894427 

POLYGONS 20 80
3 0 1 2 
3 3 1 0 
3 5 3 0 
3 8 4 5 
3 4 3 5 
3 8 6 7 
3 7 6 2 
3 2 6 0 
3 0 6 5 
3 5 6 8 
3 9 10 4 
3 11 10 9 
3 1 10 11 
3 3 10 1 
3 4 10 3 
3 9 4 8 
3 7 9 8 
3 11 9 7 
3 2 11 7 
3 1 11 2 

CELL_DATA 20
POINT_DATA 12



More information about the vtkusers mailing list