# Calculating Volume for .vtk File

**URL:** https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255
**Category:** ParaView Support
**Created:** [January 19, 2021, 11:07pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255 "2021-01-19T23:07:09Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Jessblair11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@Jessblair11](https://discourse.paraview.org/u/Jessblair11)
#### Post date: [January 19, 2021, 11:07pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/1 "2021-01-19T23:07:09Z")

</div>

Hello,  
I am looking into finding the volume of a .vtk mesh from ITK-SNAP after applying a transformation filter. I have tried small snippets of code from the “Programmable Code” filter but the code did not work for me. Are there other steps to try?

Thank you 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: [January 20, 2021, 9:00am UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/2 "2021-01-20T09:00:05Z")

</div>

What about the “Mesh Quality” filter ? you can compute volume of cells and then integrate it.

---

<div class="post-metadata">

### Author: ![Jessblair11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@Jessblair11](https://discourse.paraview.org/u/Jessblair11)
#### Post date: [January 20, 2021, 8:03pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/3 "2021-01-20T20:03:55Z")

</div>

Hello,  
Thank you for the response. I looked into this filter and tried ways to use it, but had troubling figuring out my desired volume results. Is there a way you could go through the steps with me? Thank you!

---

<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: [January 21, 2021, 9:41am UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/4 "2021-01-21T09:41:24Z")

</div>

Please share your file.

---

<div class="post-metadata">

### Author: ![Jessblair11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@Jessblair11](https://discourse.paraview.org/u/Jessblair11)
#### Post date: [January 21, 2021, 5:32pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/5 "2021-01-21T17:32:53Z")

</div>

[TAV70\_WholePatient.pvsm](https://discourse.paraview.org/uploads/short-url/cJE4wZLyAU1UwcFyVmtQBMbaaW.pvsm) (1.6 MB)

Here is the file. The chambers are color coded and named. For LA, RV, LV, and RV, that is what I am looking to find the volume of. The models in red are the aorta, valves, and coronary arteries and I don’t need the volumes for those. Would you be able to show me how to use the filter so I can calculate this for the 9 other trials I have? Thank you.

---

<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: [January 22, 2021, 9:09am UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/6 "2021-01-22T09:09:37Z")

</div>

pvsm is not enough, please share your data as well.

---

<div class="post-metadata">

### Author: ![Jessblair11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@Jessblair11](https://discourse.paraview.org/u/Jessblair11)
#### Post date: [January 22, 2021, 4:41pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/7 "2021-01-22T16:41:01Z")

</div>

Here is a link for the chambers I created in ITK-SNAP and then exported to ParaView. I had to apply a transform filter to get into the correct units, so I also included the .nii.gz file from ITK-SNAP. Do you need any additional files?  
Here is the link: [https://csulb-my.sharepoint.com/:f:/g/personal/jessica\_blair\_student\_csulb\_edu/EjIEbsjc6dZAoqN8hnqW7kgB8jh1\_MbB\_PUlia-M0j0tAw?e=2a7LQt](https://csulb-my.sharepoint.com/:f:/g/personal/jessica_blair_student_csulb_edu/EjIEbsjc6dZAoqN8hnqW7kgB8jh1_MbB_PUlia-M0j0tAw?e=2a7LQt)  
Please let me know if you cannot access this. Thank you for your help!

---

<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: [January 25, 2021, 9:31am UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/8 "2021-01-25T09:31:15Z")

</div>

Your dataset is not volumic but surfacic. You want to compute the volme inside your surface ?

Maybe TTK has something for this @Charles_Gueunet

---

<div class="post-metadata">

### Author: ![Charles\_Gueunet](https://discourse.paraview.org/user_avatar/discourse.paraview.org/charles_gueunet/32/40_2.png) [@Charles\_Gueunet](https://discourse.paraview.org/u/Charles_Gueunet)
#### Post date: [January 25, 2021, 9:55am UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/9 "2021-01-25T09:55:42Z")

</div>

There is no filters in TTK that could compute the volume of a mesh (or enclosed in a surface) as of today.

I think [Tetgen](https://wias-berlin.de/software/tetgen/features.html) may be the right tool for this, but I am not sure how to get the total volume with it.

---

<div class="post-metadata">

### Author: ![Jessblair11](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@Jessblair11](https://discourse.paraview.org/u/Jessblair11)
#### Post date: [January 25, 2021, 11:48pm UTC](https://discourse.paraview.org/t/calculating-volume-for-vtk-file/6255/10 "2021-01-25T23:48:05Z")

</div>

Hello, I am trying to compute the volume inside the surface. There is an option to view volume in ITK-SNAP, so I will refer to that for the time being and review their manual. Per Tetgen tutorial, it seems as if the mesh can be viewed in .vtk per a switch to be seen in ParaView. At the moment, I don’t believe the volume option will work for the file from SNAP, but I appreciate both of your help in this matter. If anything is figured out, I will respond to this post with an answer. Stay healthy!
