[vtkusers] Arithmetic on point data arrays

Adam Davis addavis at FosterandPartners.com
Wed Jun 17 08:51:36 EDT 2009


I have a number of data sets obtained from structured points files, all
of which are equal in dimension. I would like to create a single data
set for isosurface visualization that represents the sum of these
individual sets, with the ability to weight each individual set by a
certain factor in the resultant output. I wish to do this within vtk
because I would like to interactively change the weighting (using
sliders) and see the results.

Am I correct that I should be using vtkArrayCalculator to do the
summing?

If this is correct, would I call SetInput and AddScalarArrayName
iteratively for each of my source data sets?

To be more specific about what I am currently trying to do:

Here's a sample header from one of my stuctured points files:

# vtk DataFile Version 2.0
Point Data for Analysis
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 31 35 65
ORIGIN 0 0 0
SPACING 6 6 4
POINT_DATA 70525
SCALARS pt_view short 1
LOOKUP_TABLE Default

In a tcl file, I am trying to get the data into the array calculator as
follows:

-----
vtkStructuredPointsReader reader1
reader1 SetFileName "c:\\sp.vtk"
reader1 Update

set pt [[[reader1 GetOutput] GetPointData] GetArray "pt_view"]

vtkArrayCalculator calc
	calc SetAttributeModeToUsePointData
	calc SetInput [reader1 GetOutput]
	calc AddScalarArrayName $pt 0
-----

vtkArrayCalculator throws an error:
Invalid array name: vtkTemp2

Can someone please advise:

1. Whether vtkArrayCalculator is the proper way to do the summing?
2. If so, why the above isn't working?

Thank you.

-Adam Davis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090617/3ec4c98e/attachment.htm>


More information about the vtkusers mailing list