# New feature: Soft edge option in volume masking

**URL:** <https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310>\
**Category:** Support\
**Tags:** feature\
**Created:** [March 11, 2023, 3:19pm UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310 "2023-03-11T15:19:42Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [March 11, 2023, 3:19pm UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/1 "2023-03-11T15:19:42Z")

</div>

“Mask Volume” is a Segment Editor effect that can paint a a segment’s shape inside an image volume. It can be used for removing anything from the image (e.g., remove the patient table from a CT by blanking out the area) or it can be used for painting in structures (e.g., to simulate presence of objects or to fix problems during imaging). A limitation of the tool was that the edited images often had noticeable artifacts at the boundary of the painted region.

A new **“Soft edge” option has been added to “Mask Volume” effect that removes the boundary artifacts of the in-painting** by gradually blending the solid painted region with the original image. The effect has a single parameter, which specifies the size of the transition zone for this blending.

### Example 1: Painting in a structure

Without soft edge (notice the blocky edges and color artifacts due to very high gradient):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/c/ec79d108db16fd61467612082f076f37fd7c0bb2.jpeg)

Using soft edge option with 0.5mm thickness:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/8/e83e5666488dbd27b828966330f8bf4a3cd34044.jpeg)

### Example 2: Remove a structure from the image

Without soft edge (notice the artifacts where the table touched the patient skin):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/8/786a0d693f56a0db70effcb2dcde4d47623679f7.jpeg)

Soft edge (less edge artifacts):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/c/fcdc29242a15a79121d00aab7d2dd4a8108c70d7.jpeg)

Soft edge (very wide edge, even less edge artifacts but the transition zone somewhat eats into the image):

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

The feature is available in recent Slicer Preview Releases (Slicer-5.3.0-2023-03-03 and later). Development was funded by SlicerHeart project.

---

<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:** [March 13, 2023, 2:12pm UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/2 "2023-03-13T14:12:15Z")

</div>

5 posts were split to a new topic: [Volume masking “soft edge” option requires non-empty output volume](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349)

---

<div class="post-metadata">

**Author:** ![Spiros\_Karkavitsas](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/spiros_karkavitsas/32/18224_2.png) [@Spiros\_Karkavitsas](https://discourse.slicer.org/u/Spiros_Karkavitsas)\
**Post date:** [March 14, 2023, 8:30am UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/3 "2023-03-14T08:30:11Z")

</div>

Hello Prof.Lasso

That is a great and very useful addition in Slicer. May I ask in how much time can this addition be added in a stable version instead of a preview?

Best  
Spiros

---

<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:** [March 14, 2023, 11:38am UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/4 "2023-03-14T11:38:32Z")

</div>

We have released a stable version very recently and the next one is scheduled in 3 months. Until then you can overwrite the `...\lib\Slicer-5.3\qt-scripted-modules\SegmentEditorEffects\SegmentEditorMaskVolumeEffect.py` file in the latest stable release by the one that comes from the latest preview release.

---

<div class="post-metadata">

**Author:** ![Spiros\_Karkavitsas](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/spiros_karkavitsas/32/18224_2.png) [@Spiros\_Karkavitsas](https://discourse.slicer.org/u/Spiros_Karkavitsas)\
**Post date:** [March 16, 2023, 8:51am UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/5 "2023-03-16T08:51:40Z")

</div>

Hello again and thank you a lot for your answer 🙂

It might sound obvious and maybe I understood something wrong here but:  
The last stable version of Slicer I can see in the website is 5.2.2 ando not 5.3 where this module is available.

Thank you again for your help,  
Spiros.

---

<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:** [March 16, 2023, 1:28pm UTC](https://discourse.slicer.org/t/new-feature-soft-edge-option-in-volume-masking/28310/6 "2023-03-16T13:28:14Z")

</div>

The new feature is available in Slicer-5.3. You can copy the feature from Slicer-5.3 to Slicer-5.2 by copying the file I mentioned above.
