# Volume masking "soft edge" option requires non-empty output volume

**URL:** <https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349>\
**Category:** Support\
**Created:** [March 12, 2023, 1:42pm UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349 "2023-03-12T13:42:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [March 12, 2023, 1:42pm UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349/1 "2023-03-12T13:42:15Z")

</div>

This backtrace is obtained with ‘Mask volume’ effect while setting ‘Soft edge’ :

```auto
Traceback (most recent call last):
  File "/home/user/programs/Slicer/lib/Slicer-5.3/qt-scripted-modules/SegmentEditorEffects/SegmentEditorMaskVolumeEffect.py", line 323, in onApply
    SegmentEditorMaskVolumeEffect.maskVolumeWithSegment(segmentationNode, segmentID, operationMode, fillValues, inputVolume, outputVolume,
  File "/home/user/programs/Slicer/lib/Slicer-5.3/qt-scripted-modules/SegmentEditorEffects/SegmentEditorMaskVolumeEffect.py", line 435, in maskVolumeWithSegment
    outputArray = slicer.util.arrayFromVolume(outputVolumeNode)
  File "/home/user/programs/Slicer/bin/Python/slicer/util.py", line 1662, in arrayFromVolume
    nshape = tuple(reversed(volumeNode.GetImageData().GetDimensions()))
AttributeError: 'NoneType' object has no attribute 'GetDimensions'

```

To reproduce :

Start Slicer  
Load CTA-cardio  
Go to ‘Segment editor’  
Create a segment  
Paint at random  
Switch to ‘Mask volume’ effect  
Set ‘Soft edge’ parameter at 0.50  
Select ‘Fill inside’  
Apply

The ‘Wait’ mouse cursor runs for ever, a ‘Temporary volume mask’ volume is present.

It ‘Mask volume’ is applied without setting ‘Soft edge’, it completes normally. Subsequently, if ‘Soft edge’ is set to \> 0.0, it completes as expected.

---

<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 12, 2023, 5:26pm UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349/2 "2023-03-12T17:26:25Z")

</div>

I cannot reproduce this issue.

Does it work well if you first run the effect without soft edge and then rerun with soft edge on the same output volume?

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [March 12, 2023, 5:53pm UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349/3 "2023-03-12T17:53:15Z")

</div>

> [@lassoan](#):
>
> Does it work well if you first run the effect without soft edge and then rerun with soft edge on the same output volume?

Yes, that’s the point.

A first run without ‘Soft edge’, and a next run with ‘Soft edge’ is OK.

A first run with ‘Soft edge’ hangs with the above description.

I’ll try again later on with my next build. It’s not a big issue, was just reporting.

P.S. : running on Linux, self built Slicer. Did not test yet with factory Slicer.

---

<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 12, 2023, 10:17pm UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349/4 "2023-03-12T22:17:41Z")

</div>

I’ve [made the effect more robust](https://github.com/Slicer/Slicer/commit/ac14df2b1010de94c1f45b8b0049f689b14afe9e), from tomorrow it should work now with any output volume.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [March 13, 2023, 8:54am UTC](https://discourse.slicer.org/t/volume-masking-soft-edge-option-requires-non-empty-output-volume/28349/5 "2023-03-13T08:54:49Z")

</div>

> [@lassoan](#):
>
> I’ve [made the effect more robust](https://github.com/Slicer/Slicer/commit/ac14df2b1010de94c1f45b8b0049f689b14afe9e)

Yep, now it works, thanks.
