# Histogram using Phyton 

**URL:** <https://discourse.slicer.org/t/histogram-using-phyton/24577>\
**Category:** Support\
**Created:** [July 30, 2022, 2:26pm UTC](https://discourse.slicer.org/t/histogram-using-phyton/24577 "2022-07-30T14:26:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessica](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jessica](https://discourse.slicer.org/u/Jessica)\
**Post date:** [July 30, 2022, 2:26pm UTC](https://discourse.slicer.org/t/histogram-using-phyton/24577/1 "2022-07-30T14:26:13Z")

</div>

Hello, I have zero experience in 3D slicer or coding  
I am actually MD  
I am working on project and was able to segment the pituitary from Segment editor then calculate the volume using Statistics  
Need to get a grayscale histogram for the segment portion aka the pituitary  
Can someone please help to guide me from scratch ?

Thank you

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 30, 2022, 7:12pm UTC](https://discourse.slicer.org/t/histogram-using-phyton/24577/2 "2022-07-30T19:12:06Z")

</div>

Fortunately there is a an example for what you need. Paste it in slicer and you should get the image below. You can customize to work with your data and for that you will need to learn some python.

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#get-histogram-of-a-segmented-region](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-histogram-of-a-segmented-region)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/5/a547e311cc510604c63dadc12608ae860be0708c.jpeg)
