# Convert volume from voxels to mm^3 or cm^3

**URL:** https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280
**Category:** Beginner Questions
**Tags:** itkv5, image, itk-4122, simpleitk
**Created:** [July 13, 2020, 11:00am UTC](https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280 "2020-07-13T11:00:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![agatadefr](https://discourse.itk.org/user_avatar/discourse.itk.org/agatadefr/32/1629_2.png) [@agatadefr](https://discourse.itk.org/u/agatadefr)
#### Post date: [July 13, 2020, 11:00am UTC](https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280/1 "2020-07-13T11:00:07Z")

</div>

Hey Guys,

I am quite new in ITK. I implemented using LabelGeometryImageFilter.  
I extracted label volumes. Output results are in voxels.  
I would like to convert to cc`3 or mm^3.  
Could you help me how I can do that ?  
What is the best way ?

I would be appreciate for any help.

Best 🙂

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 13, 2020, 1:38pm UTC](https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280/2 "2020-07-13T13:38:30Z")

</div>

Multiply the number of voxels by the volume of a single voxel:

```auto
auto sp = image->GetSpacing();
double voxelVolume = sp[0]*sp[1]*sp[2];

```

---

<div class="post-metadata">

### Author: ![agatadefr](https://discourse.itk.org/user_avatar/discourse.itk.org/agatadefr/32/1629_2.png) [@agatadefr](https://discourse.itk.org/u/agatadefr)
#### Post date: [July 13, 2020, 1:46pm UTC](https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280/3 "2020-07-13T13:46:48Z")

</div>

Thanks for reply.  
I was thinking about something like this …

volume\_in\_voxels = labelGeometryImageFilter-\>GetVolume(labelValue);  
volume\_in\_cc = volume\_in\_voxels/(spacing[0]\*spacing[1]\*spacing[3]\*1000)

But I am not sure that I am right … ??

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 13, 2020, 1:47pm UTC](https://discourse.itk.org/t/convert-volume-from-voxels-to-mm-3-or-cm-3/3280/4 "2020-07-13T13:47:32Z")

</div>

That seems right.
