# Volume extraction

**URL:** https://discourse.paraview.org/t/volume-extraction/9862
**Category:** ParaView Support
**Created:** [June 21, 2022, 7:31am UTC](https://discourse.paraview.org/t/volume-extraction/9862 "2022-06-21T07:31:17Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 7:31am UTC](https://discourse.paraview.org/t/volume-extraction/9862/1 "2022-06-21T07:31:17Z")

</div>

Hello, everyone,

I need to extract a volume of spherical shape in a file.pvd at my disposal, how can I do this? I need to be able to choose both the centre of the sphere and the radius.  
I also have associated with my file an.xml file which contains the info of the values of the individual voxels. Is there any way I can extract those as well?  
Thanks in advance.

---

<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: [June 21, 2022, 7:35am UTC](https://discourse.paraview.org/t/volume-extraction/9862/2 "2022-06-21T07:35:58Z")

</div>

Hi Lorenzo,

Please share your data.

Best,

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 7:52am UTC](https://discourse.paraview.org/t/volume-extraction/9862/3 "2022-06-21T07:52:09Z")

</div>

This is the beginning of the xml file associated with the pvd file:

```auto
<?xml version="1.0"?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
  <mesh_function>
    <mesh_value_collection name="f" type="double" dim="3" size="316803">
      <value cell_index="0" local_entity="0" value="0.340542" />
      <value cell_index="1" local_entity="0" value="0.479969" />
      <value cell_index="2" local_entity="0" value="0.985618" />
      <value cell_index="3" local_entity="0" value="0.000000" />
      <value cell_index="4" local_entity="0" value="0.392166" />
      <value cell_index="5" local_entity="0" value="0.000000" />
      <value cell_index="6" local_entity="0" value="0.000000" />
      <value cell_index="7" local_entity="0" value="0.402671" />
      <value cell_index="8" local_entity="0" value="0.841263" />
      <value cell_index="9" local_entity="0" value="0.642589" />
      <value cell_index="10" local_entity="0" value="0.465866" />
      <value cell_index="11" local_entity="0" value="0.552327" />
...

```

And this is a image of the file .pvd

 ![Brain](https://discourse.paraview.org/uploads/default/original/2X/d/d5e85d94f9d1b828245a57ef2409adad2673106a.jpeg)

---

<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: [June 21, 2022, 7:55am UTC](https://discourse.paraview.org/t/volume-extraction/9862/4 "2022-06-21T07:55:19Z")

</div>

Do you want to extract cells by value of by index ?

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 7:58am UTC](https://discourse.paraview.org/t/volume-extraction/9862/5 "2022-06-21T07:58:09Z")

</div>

I would need to extract a region to know the values of individual cells and keep the original index that these cells have in the complete mesh

---

<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: [June 21, 2022, 7:58am UTC](https://discourse.paraview.org/t/volume-extraction/9862/6 "2022-06-21T07:58:57Z")

</div>

Sorry @Lorenzo11 , I dont understand what you want to do. Please clarify your request.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 8:06am UTC](https://discourse.paraview.org/t/volume-extraction/9862/7 "2022-06-21T08:06:19Z")

</div>

I have 3 meshes of the same type (brain with the same grid) to which 3 different types of values are associated: value a, value b and value c.  
I should compare the individual cell values of a specific region (within a sphere centred at a specific point), so I was thinking of extracting that region from the total mesh. is that possible? Only I would have to keep the original indices identifying the cells because otherwise they might not match those of mesh b or mesh c. Then get an xml file (or something similar) with the list of cell indices together with the value.

---

<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: [June 21, 2022, 8:08am UTC](https://discourse.paraview.org/t/volume-extraction/9862/8 "2022-06-21T08:08:40Z")

</div>

- If the meshes have the same exact geometry: AppendAttributes
- If the meshes are different: ResampleWithDataset
- If you want to extract the cells: Selection + ExtractSelection

I think that should cover your needs ?

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 8:11am UTC](https://discourse.paraview.org/t/volume-extraction/9862/9 "2022-06-21T08:11:19Z")

</div>

OK I will try as indicated, thank you!!! I should also be able to extract a list with values, shouldn’t I?

---

<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: [June 21, 2022, 8:13am UTC](https://discourse.paraview.org/t/volume-extraction/9862/10 "2022-06-21T08:13:42Z")

</div>

Yes, values will be extracted.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 9:21am UTC](https://discourse.paraview.org/t/volume-extraction/9862/11 "2022-06-21T09:21:12Z")

</div>

With AppendAttribute I can currently only extract the cell to which the point appears which I would like to use as the centre of my sphere. How do I indicate the radius of the region to be extracted?

---

<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: [June 21, 2022, 9:51am UTC](https://discourse.paraview.org/t/volume-extraction/9862/12 "2022-06-21T09:51:46Z")

</div>

Clip with sphere ?

That would be much easier if you provided an example of what you are trying to achieve.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 10:22am UTC](https://discourse.paraview.org/t/volume-extraction/9862/13 "2022-06-21T10:22:18Z")

</div>

BRAIN A

 ![Brain](https://discourse.paraview.org/uploads/default/original/2X/d/d5e85d94f9d1b828245a57ef2409adad2673106a.jpeg)  
 ![Region_of_brain](https://discourse.paraview.org/uploads/default/original/2X/1/12399857627aa84f493319bdfd03edc1a1b58c4c.png)  
BRAIN B  
 ![Brain2](https://discourse.paraview.org/uploads/default/original/2X/f/fc0b77da7577ec0a38a558985d7e8fb263938032.jpeg)

From my whole brain I need to extract the list of values associated with the cells in the extracted region (the one in the image was extracted with Extract cell by region → clip sphere and then choosing centre and radius).  
From this region I need to extract a list of paired values (cell id + Value (f)) with information about all the tetrahedra in the mesh. (The cell ids must clearly be the original ones for the whole brain as I then have to compare the values obtained from mesh a with mesh b).

Unfortunately I don’t have any examples already done.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 10:38am UTC](https://discourse.paraview.org/t/volume-extraction/9862/14 "2022-06-21T10:38:15Z")

</div>

From the section obtained I could simply, using find data, select the boxes that have value f within a range and put maximum and minimum values as limits (in the case of Brain A [0,1]) to see what they are worth.  
However, the list that will be formed will have a different indexing of the cells than the one I started with, so it may be different when I do the same procedure on Brain B. This would not allow me to compare the A and B values in the specific N cell.

I hope my objective is clearer

---

<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: [June 21, 2022, 11:03am UTC](https://discourse.paraview.org/t/volume-extraction/9862/15 "2022-06-21T11:03:29Z")

</div>

The field “OriginalCellIds” should contain the original indexes. Maybe you can use that.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 11:05am UTC](https://discourse.paraview.org/t/volume-extraction/9862/16 "2022-06-21T11:05:50Z")

</div>

Ok, where can I find it?

---

<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: [June 21, 2022, 11:14am UTC](https://discourse.paraview.org/t/volume-extraction/9862/17 "2022-06-21T11:14:13Z")

</div>

Please share actual data.

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 11:17am UTC](https://discourse.paraview.org/t/volume-extraction/9862/18 "2022-06-21T11:17:15Z")

</div>

![Schermata 2022-06-21 alle 13.15.29](https://discourse.paraview.org/uploads/default/original/2X/5/5a492cfa1339d32c072616682e950155224e2869.png)  
 ![Schermata 2022-06-21 alle 13.15.38](https://discourse.paraview.org/uploads/default/original/2X/d/d8b4674d903a72e0aae8ff3fba3b2175cec7bb9d.png)

I got a list like this

---

<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: [June 21, 2022, 11:30am UTC](https://discourse.paraview.org/t/volume-extraction/9862/21 "2022-06-21T11:30:31Z")

</div>

I’m afraid I need the data to be able to open it in ParaView to help you

---

<div class="post-metadata">

### Author: ![Lorenzo11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e56c9b/32.png) [@Lorenzo11](https://discourse.paraview.org/u/Lorenzo11)
#### Post date: [June 21, 2022, 12:24pm UTC](https://discourse.paraview.org/t/volume-extraction/9862/22 "2022-06-21T12:24:26Z")

</div>

[FA.pvd](https://discourse.paraview.org/uploads/short-url/aKtMQyGzyfeYL51qoKmtnizpCgJ.pvd) (164 Bytes)

[Next page](https://discourse.paraview.org/t/volume-extraction/9862.md?page=2)
