<div>Thanks Eric - unfortunately your calculation won&#39;t take into account the area (my data is coming from an unstructured grid).  I&#39;ve put in my solution with integrate attributes.  It&#39;s a bit slow calculating the contour each time though....</div>
<div><br></div><div>8&lt;--------------------------------------------------</div><div>from vtkPVFiltersPython import vtkIntegrateAttributes</div><div><br></div><div>scalar_name = &quot;span&quot;</div><div>scalar_min = 0.01</div>
<div>scalar_max = 0.99</div><div>scalar_steps = 10</div><div><br></div><div>input = self.GetInput()</div><div>output = self.GetOutput()</div><div><br></div><div>aa = vtk.vtkAssignAttribute()</div><div>aa.SetInputConnection(input.GetProducerPort())</div>
<div>aa.Assign(scalar_name, &quot;SCALARS&quot;, &quot;POINT_DATA&quot;)</div><div>aa.Update()</div><div><br></div><div>appender = vtk.vtkAppendFilter()</div><div><br></div><div>scalar_curr = scalar_min</div><div>scalar_step = (scalar_max - scalar_min) / (scalar_steps - 1.0)</div>
<div>for i in range(0, scalar_steps):</div><div><br></div><div>    contour = vtk.vtkContourFilter()</div><div>    contour.SetInput(aa.GetOutput())</div><div>    contour.SetValue(0, scalar_curr)</div><div>    contour.Update()</div>
<div><br></div><div>    iv = vtkIntegrateAttributes()</div><div>    iv.SetInput(contour.GetOutput())</div><div>    iv.Update()</div><div><br></div><div>    appender.AddInput(iv.GetOutput())</div><div>    scalar_curr += scalar_step</div>
<div><br></div><div>appender.Update()</div><div>output.ShallowCopy(appender.GetOutput())</div><div><div>--------------------------------------------------&gt;8</div></div><div><br></div><br><div class="gmail_quote">On 30 September 2010 17:48, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">Was having trouble doing the sum using numpy instead of the python built-in sum(), but I figured it out. It&#39;s just slightly cleaner this way, but I don&#39;t know which is faster.<div>
<br></div><div>Of course, I still don&#39;t know if this does what you are looking for, but I thought I&#39;d pass it along anyway... :)  (I had also been using &quot;nice&quot; values for my contours, so this version changes the original test for rt==val to be more robust to roundoff errors.)<br>
<div><br></div><div><div class="im"><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">rt = inputs[0].PointData[&#39;RTData&#39;]</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
rtg = inputs[0].PointData[&#39;RTGradMag&#39;]</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">rt_set = sorted(set(rt.reshape((-1,)).tolist()))</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">sums = vtk.vtkDoubleArray()</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">sums.SetName(&#39;SummedValues&#39;)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
sums.SetNumberOfComponents(1)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">conts = vtk.vtkDoubleArray()</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
conts.SetName(&#39;ContourValues&#39;)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">conts.SetNumberOfComponents(1)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">for val in rt_set:</div>
</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>summed_val = numpy.sum(rtg[numpy.abs(rt-val)&lt;0.0001], axis=1)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<span style="white-space:pre-wrap">        </span>conts.InsertNextValue(val)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>sums.InsertNextValue(summed_val[0])</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>print val, summed_val[0]</div><div class="im"><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo = self.GetTableOutput()</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.AddColumn(conts)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.AddColumn(sums)</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></div></div></div><div><div></div><div class="h5"><div><br><div><div>On Sep 30, 2010, at 12:11 PM, Eric E. Monson wrote:</div>
<br><blockquote type="cite"><div style="word-wrap:break-word">That&#39;s great.<div><br></div><div>This is very rough, but I was thinking of something like this after setting the programmable filter Output Data Set Type to vtkTable (to test I&#39;ve created a Wavelet Source and run it through a Gradient filter, and then a Calculator which creates a new value called RTGradMag, which is the magnitude of the gradient vector, then the data is Contoured by RTData value with Compute Scalars checked ON):</div>
<div><br></div><div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">rt = inputs[0].PointData[&#39;RTData&#39;]</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
rtg = inputs[0].PointData[&#39;RTGradMag&#39;]</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">rt_set = sorted(set(rt.reshape((-1,)).tolist()))</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">sums = vtk.vtkDoubleArray()</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">sums.SetName(&#39;SummedValues&#39;)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
sums.SetNumberOfComponents(1)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">conts = vtk.vtkDoubleArray()</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
conts.SetName(&#39;ContourValues&#39;)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">conts.SetNumberOfComponents(1)</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
</p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><br></div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">for val in rt_set:</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>summed_val = sum(rtg[rt==val].reshape((-1,)).tolist())</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<span style="white-space:pre-wrap">        </span>conts.InsertNextValue(val)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>sums.InsertNextValue(summed_val)</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="white-space:pre-wrap">        </span>print val, summed_val</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo = self.GetTableOutput()</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.AddColumn(conts)</div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.AddColumn(sums)</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><br></div><div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></div><div><div>On Sep 30, 2010, at 11:45 AM, Paul Edwards wrote:</div>
<br><blockquote type="cite">I&#39;ve found out how to access the &quot;Integrate Attributes&quot;  - I can import it from vtkPVFiltersPython :)<div><br><div class="gmail_quote">On 30 September 2010 16:17, Paul Edwards <span dir="ltr">&lt;<a href="mailto:paul.m.edwards@gmail.com" target="_blank">paul.m.edwards@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eric,<div><br></div><div>You are right - I would like one row of integrated values per contour.  I don&#39;t understand how I can do this without &quot;Integrate Attributes&quot; though.</div>

<div><br></div><div>Regards,<br><font color="#888888">
Paul</font><div><div></div><div><br><br><div class="gmail_quote">On 30 September 2010 15:30, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Could you be a bit more clear about what you&#39;re trying to do? It sounds like you&#39;re trying to take your contours and integrate some attributes over each of the contours separately so you get a table which contains as many rows as the number of contours (and maybe separate columns for each attribute)?<div>


<br></div><div>As I was playing around I had trouble creating a programmable filter which has a polygonal mesh as input, but a vtkTable as output... Does anyone know if this is possible? Or, does vtkDataObjectToTable filter exist for ParaView so the data could be run through that before the programmable filter?</div>


<div><br></div><div>If I&#39;m understanding what you&#39;re trying to do, it seems like it should be possible to implement with a programmable filter if this piece can be accomplished, even without the Integrate Attributes filter.</div>


<div><br></div><font color="#888888"><div>-Eric</div></font><div><div></div><div><div><br><div><div>On Sep 30, 2010, at 10:20 AM, Paul Edwards wrote:</div><br><blockquote type="cite">Ah - thanks for the tip!<div>
<br></div><div>Does anyone know the way to call this in a programmable filter?  Or, is it even wrapped for python?</div><div><br></div><div>Thanks,<br>Paul<br><br><div class="gmail_quote">On 30 September 2010 14:51, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hey Paul,<div><br></div><div>I don&#39;t have an answer to your problem, but just wanted to point out that vtkIntegrateAttributes is not part of VTK proper, but is listed on the ParaView docs pages:</div>



<div><br></div><div><a href="http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkIntegrateAttributes.html" target="_blank">http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkIntegrateAttributes.html</a></div>



<div><br></div><div>-Eric</div><div><br><div>
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>



------------------------------------------------------</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><br></div></span></div><br><div><div><div></div><div><div>On Sep 30, 2010, at 6:00 AM, Paul Edwards wrote:</div>



<br></div></div><blockquote type="cite"><div><div></div><div>Hi,<div><br></div><div>I&#39;m trying to create a table containing several rows of integrated values for different contours with a programmable filter but I can&#39;t see how to use the &quot;Integrate Variables&quot; filter.  In filters.xml it show as being called vtkIntegrateAttributes but I cannot create this in python.  Also, there is no webpage for this class on the nightly documentation site.</div>




<div><br></div><div>Any help is appreciated,</div><div>Paul<br><br><div class="gmail_quote">On 30 September 2010 08:57, Biddiscombe, John A. <span dir="ltr">&lt;<a href="mailto:biddisco@cscs.ch" target="_blank">biddisco@cscs.ch</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">








<div lang="EN-GB" link="blue" vlink="purple">

<div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Sorry Paul. I must have clicked reply instead of replay-all. I
intended to post to the list</span></p><div><span style="font-size:11.0pt;color:#1F497D"> </span><br></div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">JB</span></p><div><span style="font-size:11.0pt;color:#1F497D"> </span><br>



</div><div><span style="font-size:11.0pt;color:#1F497D"> </span><br></div>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> Paul Edwards
[mailto:<a href="mailto:paul.m.edwards@gmail.com" target="_blank">paul.m.edwards@gmail.com</a>] <br>
<b>Sent:</b> 30 September 2010 09:48<br>
<b>To:</b> Biddiscombe, John A.<br>
<b>Subject:</b> Re: [Paraview] plotting integrated values of cutting plane at
various offsets</span></p>

</div><div><div></div><div><div> <br></div><p class="MsoNormal">Thanks John - I&#39;ll have a go with a python programmable
filter today.</p>

<div><div> <br></div>

</div>

<div><p class="MsoNormal">Regards,</p>

</div>

<div><p class="MsoNormal">Paul</p>

</div>

<div><div> <br></div>

<div><p class="MsoNormal">On 30 September 2010 07:19, Biddiscombe, John A. &lt;<a href="mailto:biddisco@cscs.ch" target="_blank">biddisco@cscs.ch</a>&gt; wrote:</p>

<div>

<div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Paul</span></p><div><span style="font-size:11.0pt;color:#1F497D"> </span><br></div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I’d knock up a filter which stores the
desired value each time it executes, and increments the list by one on each
execution. This would build up a list (in a polydata or vtkTable for example)
which could then be plotted on a graph. A reset button on a custom panel can be
used to clear the values. I’ve done this a couple of times for time related
filters when I wanted to plot something unusual over T.</span></p><div><span style="font-size:11.0pt;color:#1F497D"> </span><br></div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">JB</span></p><div><span style="font-size:11.0pt;color:#1F497D"> </span><br>



</div>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@paraview.org</a> [mailto:<a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@paraview.org</a>]
<b>On Behalf Of </b>Paul Edwards<br>
<b>Sent:</b> 29 September 2010 15:53<br>
<b>To:</b> paraview<br>
<b>Subject:</b> [Paraview] plotting integrated values of cutting plane at
various offsets</span></p>

</div>

<div>

<div><div> <br></div><p class="MsoNormal">Hi,</p>

<div><div> <br></div>

</div>

<div><p class="MsoNormal">I
have created a contour and integrated the output to produce a single value.
 Is there a way to plot this value as the contour changes?  I have
created an animation for the isosurface but cannot see a filter that I could
use to plot these values across the range.</p>

</div>

<div><div> <br></div>

</div>

<div><p class="MsoNormal">Thanks
in advance,</p>

</div>

<div><p class="MsoNormal">Paul</p>

</div>

</div>

</div>

</div>

</div>

</div><div> <br></div>

</div>

</div></div></div>

</div>


</blockquote></div><br></div></div></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>



<br>Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>



</blockquote></div><br></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br></div></div>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br></div></div></div></div></div></blockquote></div><br>