# get Data arrays from all clips automatically

**URL:** https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304
**Category:** ParaView Support
**Created:** [May 11, 2020, 7:19pm UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304 "2020-05-11T19:19:48Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 11, 2020, 7:19pm UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/1 "2020-05-11T19:19:48Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 12, 2020, 1:24am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/2 "2020-05-12T01:24:18Z")

</div>

- Single file containing all clip : Select all -\> AppendDataset -\> SaveData
- One file for each clip : python script + for loop

---

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 12, 2020, 10:54am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/3 "2020-05-12T10:54:15Z")

</div>

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.)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 13, 2020, 2:18am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/5 "2020-05-13T02:18:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 13, 2020, 6:21am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/6 "2020-05-13T06:21:01Z")

</div>

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.

 ![Bildschirmfoto 2020-05-13 um 08.16.48](https://discourse.paraview.org/uploads/default/original/2X/3/38023a5502efbda0eea5e9e3bab6aff8f9a434f3.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 13, 2020, 6:28am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/7 "2020-05-13T06:28:21Z")

</div>

See here for more info about programmable filters :  
[https://www.paraview.org/Wiki/Python\_Programmable\_Filter](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.

---

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 13, 2020, 8:22am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/8 "2020-05-13T08:22:16Z")

</div>

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??

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 14, 2020, 4:31am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/9 "2020-05-14T04:31:46Z")

</div>

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)
```

---

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 14, 2020, 10:20pm UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/10 "2020-05-14T22:20:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 18, 2020, 1:30am UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/11 "2020-05-18T01:30:55Z")

</div>

> for some reason _rangeArrray = vtk.vtkDoubleArray()_ did not work, so I tried this:

what is the error ?

---

<div class="post-metadata">

### Author: ![Resa](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Resa](https://discourse.paraview.org/u/Resa)
#### Post date: [May 18, 2020, 12:22pm UTC](https://discourse.paraview.org/t/get-data-arrays-from-all-clips-automatically/4304/12 "2020-05-18T12:22:19Z")

</div>

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)
```
