[Paraview] plotting integrated values of cutting plane at various offsets

Biddiscombe, John A. biddisco at cscs.ch
Fri Oct 1 05:06:03 EDT 2010


The way I did this a year or two ago, was using a multiblock reader which had locations of probes (surfaces etc from a cad program) -  (this would correspond top one dataset per contour in your example). Then I made a wrapper around vtkIntegrateAttributes which ran the filter once per block and collected the results into a vtkTable for plotting in the standard chartwindow (though the charts have changed a bit since I did this)
(NB. Paul, I'm sure you've downloaded these classes before because you asked me about them in the past).
All you'd need to do is use the connectivity filter to extract each contour, and place them into a multiblock filter, then use the vtkProbeIntegrationFilter which I don't maintain at the moment, but I'm sure google will find the source.

JB


From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org] On Behalf Of Eric E. Monson
Sent: 30 September 2010 20:04
To: Paul Edwards
Cc: paraview list
Subject: Re: [Paraview] plotting integrated values of cutting plane at various offsets

Yeah, I wondered if you were needing the area.

If you want to compare the speed you could also try using a Python script (assigned to a macro button) which sets up this pipeline in the GUI for you automatically based on your desired contour values, branching out your pipeline into a bunch of Contour plus Integrate Variables filters, and then all of the outputs appended in the end...

There should also be a way to do the Contouring before the programmable filter, and then set up, pretty much like you did, a series of Threshold plus IntegrateAttributes filters and then pull all the results into a table at the end.

Anyway, glad you figured it out.
-Eric

On Sep 30, 2010, at 1:09 PM, Paul Edwards wrote:


Thanks Eric - unfortunately your calculation won't take into account the area (my data is coming from an unstructured grid).  I've put in my solution with integrate attributes.  It's a bit slow calculating the contour each time though....

8<--------------------------------------------------
from vtkPVFiltersPython import vtkIntegrateAttributes

scalar_name = "span"
scalar_min = 0.01
scalar_max = 0.99
scalar_steps = 10

input = self.GetInput()
output = self.GetOutput()

aa = vtk.vtkAssignAttribute()
aa.SetInputConnection(input.GetProducerPort())
aa.Assign(scalar_name, "SCALARS", "POINT_DATA")
aa.Update()

appender = vtk.vtkAppendFilter()

scalar_curr = scalar_min
scalar_step = (scalar_max - scalar_min) / (scalar_steps - 1.0)
for i in range(0, scalar_steps):

    contour = vtk.vtkContourFilter()
    contour.SetInput(aa.GetOutput())
    contour.SetValue(0, scalar_curr)
    contour.Update()

    iv = vtkIntegrateAttributes()
    iv.SetInput(contour.GetOutput())
    iv.Update()

    appender.AddInput(iv.GetOutput())
    scalar_curr += scalar_step

appender.Update()
output.ShallowCopy(appender.GetOutput())
-------------------------------------------------->8


On 30 September 2010 17:48, Eric E. Monson <emonson at cs.duke.edu<mailto:emonson at cs.duke.edu>> wrote:
Was having trouble doing the sum using numpy instead of the python built-in sum(), but I figured it out. It's just slightly cleaner this way, but I don't know which is faster.

Of course, I still don't know if this does what you are looking for, but I thought I'd pass it along anyway... :)  (I had also been using "nice" values for my contours, so this version changes the original test for rt==val to be more robust to roundoff errors.)

rt = inputs[0].PointData['RTData']
rtg = inputs[0].PointData['RTGradMag']
rt_set = sorted(set(rt.reshape((-1,)).tolist()))

sums = vtk.vtkDoubleArray()
sums.SetName('SummedValues')
sums.SetNumberOfComponents(1)
conts = vtk.vtkDoubleArray()
conts.SetName('ContourValues')
conts.SetNumberOfComponents(1)

for val in rt_set:
summed_val = numpy.sum(rtg[numpy.abs(rt-val)<0.0001], axis=1)
conts.InsertNextValue(val)
sums.InsertNextValue(summed_val[0])
print val, summed_val[0]

pdo = self.GetTableOutput()
pdo.AddColumn(conts)
pdo.AddColumn(sums)

On Sep 30, 2010, at 12:11 PM, Eric E. Monson wrote:


That's great.

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'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):

rt = inputs[0].PointData['RTData']
rtg = inputs[0].PointData['RTGradMag']
rt_set = sorted(set(rt.reshape((-1,)).tolist()))

sums = vtk.vtkDoubleArray()
sums.SetName('SummedValues')
sums.SetNumberOfComponents(1)
conts = vtk.vtkDoubleArray()
conts.SetName('ContourValues')
conts.SetNumberOfComponents(1)

for val in rt_set:
summed_val = sum(rtg[rt==val].reshape((-1,)).tolist())
conts.InsertNextValue(val)
sums.InsertNextValue(summed_val)
print val, summed_val

pdo = self.GetTableOutput()
pdo.AddColumn(conts)
pdo.AddColumn(sums)

On Sep 30, 2010, at 11:45 AM, Paul Edwards wrote:


I've found out how to access the "Integrate Attributes"  - I can import it from vtkPVFiltersPython :)

On 30 September 2010 16:17, Paul Edwards <paul.m.edwards at gmail.com<mailto:paul.m.edwards at gmail.com>> wrote:
Hi Eric,

You are right - I would like one row of integrated values per contour.  I don't understand how I can do this without "Integrate Attributes" though.

Regards,
Paul

On 30 September 2010 15:30, Eric E. Monson <emonson at cs.duke.edu<mailto:emonson at cs.duke.edu>> wrote:
Could you be a bit more clear about what you're trying to do? It sounds like you'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)?

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?

If I'm understanding what you'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.

-Eric

On Sep 30, 2010, at 10:20 AM, Paul Edwards wrote:


Ah - thanks for the tip!

Does anyone know the way to call this in a programmable filter?  Or, is it even wrapped for python?

Thanks,
Paul
On 30 September 2010 14:51, Eric E. Monson <emonson at cs.duke.edu<mailto:emonson at cs.duke.edu>> wrote:
Hey Paul,

I don'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:

http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkIntegrateAttributes.html

-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Sep 30, 2010, at 6:00 AM, Paul Edwards wrote:

Hi,

I'm trying to create a table containing several rows of integrated values for different contours with a programmable filter but I can't see how to use the "Integrate Variables" 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.

Any help is appreciated,
Paul
On 30 September 2010 08:57, Biddiscombe, John A. <biddisco at cscs.ch<mailto:biddisco at cscs.ch>> wrote:
Sorry Paul. I must have clicked reply instead of replay-all. I intended to post to the list

JB


From: Paul Edwards [mailto:paul.m.edwards at gmail.com<mailto:paul.m.edwards at gmail.com>]
Sent: 30 September 2010 09:48
To: Biddiscombe, John A.
Subject: Re: [Paraview] plotting integrated values of cutting plane at various offsets

Thanks John - I'll have a go with a python programmable filter today.

Regards,
Paul

On 30 September 2010 07:19, Biddiscombe, John A. <biddisco at cscs.ch<mailto:biddisco at cscs.ch>> wrote:
Paul

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.

JB

From: paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org> [mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>] On Behalf Of Paul Edwards
Sent: 29 September 2010 15:53
To: paraview
Subject: [Paraview] plotting integrated values of cutting plane at various offsets

Hi,

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.

Thanks in advance,
Paul


_______________________________________________
Powered by www.kitware.com<http://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 ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview






_______________________________________________
Powered by www.kitware.com<http://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 ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101001/3e9eb1b2/attachment-0001.htm>


More information about the ParaView mailing list