# I want to count number of voxel/pixel

**URL:** <https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885>\
**Category:** Support\
**Created:** [May 3, 2024, 8:05am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885 "2024-05-03T08:05:53Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 3, 2024, 8:05am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/1 "2024-05-03T08:05:53Z")

</div>

![pixel](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/a/4a9e5ed76a03380caab27cbe2e1d94dd388e120e.png)  
hi after segment i need to count number of pixel of hole and lattice when i click on segment statics there no any obsent to calculate volume and pixel

---

<div class="post-metadata">

**Author:** ![rfenioux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rfenioux/32/70007_2.png) [@rfenioux](https://discourse.slicer.org/u/rfenioux)\
**Post date:** [May 3, 2024, 8:15am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/2 "2024-05-03T08:15:46Z")

</div>

It looks like there is an error with the segment statistics module. It should not be empty. Are there any error messages in the python console?

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 3, 2024, 8:40am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/3 "2024-05-03T08:40:20Z")

</div>

then what i can do any suggestion for me

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [May 3, 2024, 8:46am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/4 "2024-05-03T08:46:30Z")

</div>

> [@rfenioux](#):
>
> Are there any error messages in the python console?

This is the next step. Please look in the Python console for red text. If you find it, copy paste it here.

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 3, 2024, 8:51am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/5 "2024-05-03T08:51:03Z")

</div>

i am new user where i can find python console

---

<div class="post-metadata">

**Author:** ![rfenioux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rfenioux/32/70007_2.png) [@rfenioux](https://discourse.slicer.org/u/rfenioux)\
**Post date:** [May 3, 2024, 8:57am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/6 "2024-05-03T08:57:31Z")

</div>

You can use this button  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/9/5957ebfe83ad4d78b5030fd78b0ce512b9d7b1a5.png)

Or this menu that does the same thing  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/0/f06c284b34020348f138e97de33ca068655ee0d3.png)

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 3, 2024, 10:38am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/7 "2024-05-03T10:38:59Z")

</div>

![px](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/6/467dfc6caea1b528b5e53641548d628a8ebc7dfe.png)  
hello can any body help me to explain the parameter , which one is whole volume , i need volume of segmented structure and also overall volume, any body can help to explain these parameter

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 3, 2024, 3:38pm UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/8 "2024-05-03T15:38:33Z")

</div>

Please read the Segment Statistics module documentation: [Segment statistics — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentstatistics.html)

What is reported is the volume of the segmentation you generated. You need to define what “total volume” is (i.e., volume of the whole imaging grid, volume of the segmentation if the inside is filled etc)…

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 6, 2024, 1:56am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/9 "2024-05-06T01:56:09Z")

</div>

i read actually I want to calculate volume and number of pixel of both lattice ( wall) in segmented and also hole(air) in segmented image  
i applied segment statics but result only gave lattice volume not air

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 6, 2024, 3:09am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/10 "2024-05-06T03:09:08Z")

</div>

> [@Vikram](#):
>
> segment statics but result only gave lattice volume not air

Segment Statistics can only calculate statistics for the region you segmented. If you need the volume of air. You need to segment that as a separate structure.

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 6, 2024, 3:15am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/11 "2024-05-06T03:15:10Z")

</div>

Yeah I tried to segment but I did not can any one help me to segment air to volume of air

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 6, 2024, 4:17am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/12 "2024-05-06T04:17:44Z")

</div>

It is very simple, you just need to lower your threshold that will pick air, and make sure you that you donot overwrite the voxels already assigned to lattice.

The main issue, there is no enclosing area to limit the extend of air around lattice, it is continuous with outside. I would probably create ROI that spans the limits of lattice, and then use the local threshold to threshold only within that ROI.

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 6, 2024, 8:26am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/13 "2024-05-06T08:26:42Z")

</div>

i did get sir , what you mean

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 7, 2024, 4:43am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/14 "2024-05-07T04:43:23Z")

</div>

![air](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/9/79c163db1be304175dbfd045c3b190ea8fcb657c.png)  
when i segment air from cubic , and also adjust threshold , but the segmented image of cubic like that i also attached , why segmentation of air include some parts of lattice ?  
what is the reason behind this can anyone please told me

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 7, 2024, 4:47am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/15 "2024-05-07T04:47:27Z")

</div>

You need to create a new segment and set the editable area to outside of.segment\_1 (which should be the lattice)

---

<div class="post-metadata">

**Author:** ![Vikram](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@Vikram](https://discourse.slicer.org/u/Vikram)\
**Post date:** [May 7, 2024, 9:04am UTC](https://discourse.slicer.org/t/i-want-to-count-number-of-voxel-pixel/35885/16 "2024-05-07T09:04:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/5/453a39b48a42110ee119f5ecace458203a02408c.png)  
there is a lot of parameter . i need overall volume of air(segment2) and overall volume of lattice (segment1), which parameter i can take for volume in this data (volume LM) OR VOLUME CS.  
I read documentation but i did not get .  
can any one tell me please
