# Gradient artifact with Mask Volume effect from Editor Extra Effects?

**URL:** <https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916>\
**Category:** Support\
**Created:** [November 30, 2018, 12:26am UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916 "2018-11-30T00:26:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [November 30, 2018, 12:26am UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/1 "2018-11-30T00:26:12Z")

</div>

This is on MacOS, nightly build from October 22. A little old, but not ancient.

I’m seeing a strange “gradient” effect when using Mask Volume in Editor Extra Effects. Rather than a sharp cutoff from the inside to the outside of the masked volume, there’s this odd gradient from the normal values in the “kept” volume to the zero values outside. I’ve attached a screenshot - this gradient was NOT present in my original data. Any ideas what’s causing this? It’s kind of annoying because I use a threshold effect after masking and it causes an “envelope” to appear around my entire volume, caused by this gradient artifact.

Thanks in advance for any ideas! I’ll check to see if this also happens in 4.8…

![21%20PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/7/b731e595a17ca5b42acc792ec0b62b72530f2595.png)

---

<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 30, 2018, 1:46am UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/2 "2018-11-30T01:46:21Z")

</div>

By default, linear image interpolation is used in slice viewers: each displayed pixel is computed as a weighted average of voxels surrounding that 3D position. So, unless the slice is positioned exactly in the center of a voxel, you always see blending of two neighbor slices. Since masking creates huge intensity change at the boundary, the effect of this interpolation becomes more visible. So, what you see is normal and should not be a problem.

You can disable slice interpolation or position slice viewer in the center of the voxel (for example, by holding down shift button while moving the mouse in an orthogonal view).

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [November 30, 2018, 2:06am UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/3 "2018-11-30T02:06:23Z")

</div>

Hi Andras, thanks for the reply.

I’m not sure that slice interpolation is the issue - I turn it off and I still see this gradient. Let me outline what I did from the beginning and maybe that will help:

1. Load in a big microCT volume. Specimen is fossil insect in amber.
2. Outline specimen area in slices to prep for “Fill between slices”.
3. Use fill between slices to create segment containing only insect.
4. Use Mask Volume to mask off anything not containing insect.
5. Use threshold to “select” insect.

This is where I see these “gradient” areas at the border created by Fill Between Slices.

What do you think?

Thanks in advance for your time!!!

-Hollister

---

<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 30, 2018, 2:14am UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/4 "2018-11-30T02:14:07Z")

</div>

Can you share the scene (or reproduce it on a sample data set and share that scene)?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [December 5, 2018, 3:34pm UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/5 "2018-12-05T15:34:57Z")

</div>

Ugh. I had a test scene that I _thought_ reproduced what I was seeing, and I was writing up the procedure and now I can’t reproduce it.

I do have one question - does “Mask Volume” in Segment Editor Extra Effects operate differently depending on whether or not interpolation is enabled for the master volume in question? Or is interpolation just for _viewing_ in slice viewers?

Thank you, and sorry for the confusion!

-Hollister

---

<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:** [December 5, 2018, 4:35pm UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/6 "2018-12-05T16:35:03Z")

</div>

My understanding is that it is onle for viewing in slice viewers:

> [@What is the underlying function of 'interpolate' option of Volumes module](https://discourse.slicer.org/t/what-is-the-underlying-function-of-interpolate-option-of-volumes-module/1604/2):
>
> That option controls how the image is sampled when scaled for display: nearest neighbor / linear (see [https://en.wikipedia.org/wiki/Image\_scaling](https://en.wikipedia.org/wiki/Image_scaling) for details). There is nothing to save - what you see is still the original volume.

> [@Slice Interpolation](https://discourse.slicer.org/t/slice-interpolation/2808/5):
>
> You always see the real image. The coordinates (both the anatomical/patient coordinates and voxel coordinates) are also all real and correct. You may turn off interpolation (Volumes module / Display / Interpolate checkbox) if you want to make sure that at a certain position in the image you see the contribution of exactly one pixel of the image slices. If you could tell what your application (anatomy, procedure, imaging modality, etc) and your concerns are then we could give more specific answ…

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 18, 2019, 2:36pm UTC](https://discourse.slicer.org/t/gradient-artifact-with-mask-volume-effect-from-editor-extra-effects/4916/7 "2019-02-18T14:36:51Z")

</div>

OK, after many weeks, I finally got back to this and verified that it was indeed “problem between chair and keyboard”, as they say. I was switching between viewing several volumes and lost track of which ones had interpolation turned on.

Sorry for any confusion!

-Hollister
