# Dynamic segmentation subtraction

**URL:** <https://discourse.slicer.org/t/dynamic-segmentation-subtraction/40296>\
**Category:** Support\
**Created:** [November 20, 2024, 9:00pm UTC](https://discourse.slicer.org/t/dynamic-segmentation-subtraction/40296 "2024-11-20T21:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ava23](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@ava23](https://discourse.slicer.org/u/ava23)\
**Post date:** [November 20, 2024, 9:00pm UTC](https://discourse.slicer.org/t/dynamic-segmentation-subtraction/40296/1 "2024-11-20T21:00:21Z")

</div>

I have a Volume A (a PET scan) with two segmentations: **Seg1** and **Seg2**.

A user is making adjustments to **Seg2** (adding and removing voxels).

I would like to dynamically display all voxels that are in **Seg1** but not in **Seg2** in a 3D volume (using a 3D Volume of the PET). This will help the user with their adjustments.

I understand that this can be achieved using **Segment Editor \> Logical Operators \> Subtract** , but this method is not dynamic.

Is there any way to achieve this dynamically?

I am also interested in an automated or Python-based solution

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 20, 2024, 9:01pm UTC](https://discourse.slicer.org/t/dynamic-segmentation-subtraction/40296/2 "2024-11-20T21:01:09Z")

</div>

You can make it dynamic using Python scripting. See many examples in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#segmentations).
