<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Arithmetic on point data arrays</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">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.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Am I correct that I should be using vtkArrayCalculator to do the summing?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">If this is correct, would I call SetInput and AddScalarArrayName iteratively for each of my source data sets?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">To be more specific about what I am currently trying to do:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Here's a sample header from one of my stuctured points files:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"># vtk DataFile Version 2.0</FONT>
<BR><FONT SIZE=2 FACE="Arial">Point Data for Analysis</FONT>
<BR><FONT SIZE=2 FACE="Arial">ASCII</FONT>
<BR><FONT SIZE=2 FACE="Arial">DATASET STRUCTURED_POINTS</FONT>
<BR><FONT SIZE=2 FACE="Arial">DIMENSIONS 31 35 65</FONT>
<BR><FONT SIZE=2 FACE="Arial">ORIGIN 0 0 0</FONT>
<BR><FONT SIZE=2 FACE="Arial">SPACING 6 6 4</FONT>
<BR><FONT SIZE=2 FACE="Arial">POINT_DATA 70525</FONT>
<BR><FONT SIZE=2 FACE="Arial">SCALARS pt_view short 1</FONT>
<BR><FONT SIZE=2 FACE="Arial">LOOKUP_TABLE Default</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">In a tcl file, I am trying to get the data into the array calculator as follows:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">-----</FONT>
<BR><FONT SIZE=2 FACE="Courier">vtkStructuredPointsReader reader1</FONT>
<BR><FONT SIZE=2 FACE="Courier">reader1 SetFileName "c:\\sp.vtk"</FONT>
<BR><FONT SIZE=2 FACE="Courier">reader1 Update</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier">set pt [[[reader1 GetOutput] GetPointData] GetArray "pt_view"]</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier">vtkArrayCalculator calc</FONT>
<BR> <FONT SIZE=2 FACE="Courier">calc SetAttributeModeToUsePointData</FONT>
<BR> <FONT SIZE=2 FACE="Courier">calc SetInput [reader1 GetOutput]</FONT>
<BR> <FONT SIZE=2 FACE="Courier">calc AddScalarArrayName $pt 0</FONT>
<BR><FONT SIZE=2 FACE="Arial">-----</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkArrayCalculator throws an error:</FONT>
<BR><FONT SIZE=2 FACE="Arial">Invalid array name: vtkTemp2</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Can someone please advise:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">1. Whether vtkArrayCalculator is the proper way to do the summing?</FONT>
<BR><FONT SIZE=2 FACE="Arial">2. If so, why the above isn't working?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thank you.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">-Adam Davis</FONT>
</P>
</BODY>
</HTML>