# Segment the Active Volume

**URL:** <https://discourse.slicer.org/t/segment-the-active-volume/24728>\
**Category:** Development\
**Tags:** segmentation, python, 3d-model\
**Created:** [August 12, 2022, 4:35pm UTC](https://discourse.slicer.org/t/segment-the-active-volume/24728 "2022-08-12T16:35:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michabermoy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/michabermoy/32/16003_2.png) [@michabermoy](https://discourse.slicer.org/u/michabermoy)\
**Post date:** [August 12, 2022, 4:35pm UTC](https://discourse.slicer.org/t/segment-the-active-volume/24728/1 "2022-08-12T16:35:52Z")

</div>

Is it possible to segment the active volume so that all other components of the volume are completely removed? For example:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b4e371a0c5c0426c7c94f7adc55be0473cd4a23b.jpeg)

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [August 12, 2022, 4:55pm UTC](https://discourse.slicer.org/t/segment-the-active-volume/24728/2 "2022-08-12T16:55:22Z")

</div>

You can use the “Mask volume” editor effect to erase areas in the volume outside of the segment.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/0/60bd3e7c586a6ba5a68b1c6334507727b3166146.png)

---

<div class="post-metadata">

**Author:** ![michabermoy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/michabermoy/32/16003_2.png) [@michabermoy](https://discourse.slicer.org/u/michabermoy)\
**Post date:** [August 29, 2022, 7:59pm UTC](https://discourse.slicer.org/t/segment-the-active-volume/24728/3 "2022-08-29T19:59:19Z")

</div>

Do you happen to know how to accomplish this with Python code?

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [August 31, 2022, 2:12am UTC](https://discourse.slicer.org/t/segment-the-active-volume/24728/4 "2022-08-31T02:12:47Z")

</div>

try the python code below

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/1/3112bf8d9bdfec679b966aa9231ddef3797f3df9.png)
