Hi everybody,
I’ve placed 200 sphere clips on a polygonal mesh and put the filter “integrate variables” on each of them.
Now I’d like to export all Data Arrays from every Clip automatically. How could I do that?
- Single file containing all clip : Select all -> AppendDataset -> SaveData
- One file for each clip : python script + for loop
Thank you Mathieu
The AppendDataset -> SaveData strategy works for the integrateVariables Filter. It creates a list containing the Areas of all Clips.
In case of the clips itself the output of AppendDataset -> SaveData is a list of all the points included in the clips, instead of a list of the data ranges.
How could i get a list containing only the data ranges?
Additionally I’d like to extract the bounds of the clips as well.
(And if possible the names I gave them in Paraview.)
Then you need to extract the data ranges. I suppose you are looking for a table containing all these data ranges ?
I’m afraid there is no such filter in ParaView, you will need to extract them using a ProgrammableFilter.
Exactly,
I need to get the values of this table for every clip!
I’ll try to figure out how to create such a filter.
See here for more info about programmable filters :
https://www.paraview.org/Wiki/Python_Programmable_Filter
Sadly your usecase is not covered by the examples, this filter should not be too hard to implement, considering that you know a little bit about programming in VTKPython.
To be honest I have no idea about VTKPython.
I tried to set the Output Data Set Type to vtkTable, but only got ERROR messages.
Could you please give me some hints?
I start and end the script with:
input0 = inputs [0]
…
output.CellData.append()
Is that correct??
You programmable filter could look like this (untested), with a vtkTable output (set it before applying the first time) :
ugi = self.GetUnstructuredGridInput()
to = self.GetTableOutput()
rangeArrray = vtk.vtkDoubleArray()
rangeArray.SetNumberOfComponents(2)
rangeArray.SetName("range")
activationArray = ugi.GetPointData()->GetArray("activation bipolar")
range = activationArray.GetRange(0)
rangeArray.InsertNextTuple(range)
to.AddColumn(rangeArray)
Using this code I get the ranges:
data = self.GetUnstructuredGridInput().GetPointData()
cutoutMask = data.GetArray(0).GetRange(0)
activationBipolar = data.GetArray(1).GetRange(0)
activationUnipolar = data.GetArray(2).GetRange(0)
voltageBipolar = data.GetArray(3).GetRange(0)
voltageUnipolar = data.GetArray(4).GetRange(0)
for some reason rangeArrray = vtk.vtkDoubleArray() did not work, so I tried this:
mydict = {}
ra = []
mydict["activation bipolar (ms)"] = ra
ra.append(activationBipolar)
which creates an array containing the range. But it is still not possible to display it in the information panel.
for some reason rangeArrray = vtk.vtkDoubleArray() did not work, so I tried this:
what is the error ?
Actually it DID work Thank you! This is what my programmable Filter looks like at the moment:
Table = self.GetTableOutput()
data = self.GetUnstructuredGridInput().GetPointData()
cutoutMask = data.GetArray(0).GetRange(0)
activationBipolar = data.GetArray(1).GetRange(0)
activationUnipolar = data.GetArray(2).GetRange(0)
voltageBipolar = data.GetArray(3).GetRange(0)
voltageUnipolar = data.GetArray(4).GetRange(0)
ABArray = vtk.vtkDoubleArray()
ABArray.SetNumberOfComponents(2)
ABArray.SetName("activation bipolar (ms)")
ABArray.InsertNextTuple(activationBipolar)
Table.AddColumn(ABArray)
AUArray = vtk.vtkDoubleArray()
AUArray.SetNumberOfComponents(2)
AUArray.SetName("activation unipolar (ms)")
AUArray.InsertNextTuple(activationUnipolar)
Table.AddColumn(AUArray)
VBArray = vtk.vtkDoubleArray()
VBArray.SetNumberOfComponents(2)
VBArray.SetName("voltage bipolar (mV)")
VBArray.InsertNextTuple(voltageBipolar)
Table.AddColumn(VBArray)
VUArray = vtk.vtkDoubleArray()
VUArray.SetNumberOfComponents(2)
VUArray.SetName("voltage unipolar (mV)")
VUArray.InsertNextTuple(voltageUnipolar)
Table.AddColumn(VUArray)
cutoutMaskArray = vtk.vtkDoubleArray()
cutoutMaskArray.SetNumberOfComponents(2)
cutoutMaskArray.SetName("cutout mask")
cutoutMaskArray.InsertNextTuple(cutoutMask)
Table.AddColumn(cutoutMaskArray)