[vtkusers] Arithmetic on point data arrays

Gerrick Bivins gbivins at objectreservoir.com
Wed Jun 17 09:13:04 EDT 2009


Hi Adam,
The way you are trying to use the arraycalculator is incorrect. One example
of how to use it would be to create a new array in a single dataset from
adding to existing arrays from the same  data set.
Take a look at the example here:
http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/DataManipu
lation/Python/FinancialField.py?root=VTK&content-type=text/plain

If I understand what you are trying to do you could create one structured
grid and then just add the arrays from each of the files as a different
scalar/point data array(pt_view_01,pt_view_02...etc).
Then you could contour based on the selected array.
If you did want to use the array calculator you could then take this single
dataset and sum the arrays as you described.


 HTH
Gerrick


On 6/17/09 7:51 AM, "Adam Davis" <addavis at FosterandPartners.com> wrote:

> 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 
> 
> 
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

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


More information about the vtkusers mailing list