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

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

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.

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?

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.

I’ve made the effect more robust, from tomorrow it should work now with any output volume.

Yep, now it works, thanks.

1 Like