SlicerSegmentEditorExtraEffects icon indicating copy to clipboard operation
SlicerSegmentEditorExtraEffects copied to clipboard

Fast Marching does not respect masking settings

Open mikebind opened this issue 9 months ago • 1 comments

Expected behavior: If "Editable area" or "Editable intensity range" masking settings are set, then, at least when the "Apply" button is pressed, only regions within the allowed editable area or ranges should be modified. It would be even better if these settings were also respected in the "Initialize" step, but I understand that may require access to the internals of the algorithm which are not feasible for a segment editor effect.

Actual behavior: Editable area and Editable intensity range settings are ignored. It appears that the "Modify other segments" masking setting is handled as expected.

To reproduce: Load SampleData CTACardio and create two non-overlapping segments via painting. Select one of them, and select the Fast Marching effect. Set Editable Area to "Outside all segments" and "Modify other segments" to "Overwrite all". Click "Initialize" button. Notice that the other segment is included in the preview region despite not being part of the editable area. Click the "Apply" button. Notice that any regions of the other segment which overlapped the preview region are now overwritten, despite not being included in the editable area.

The behavior that would make sense to me would be to allow Fast Marching to generate its preview volume without any masking settings, and then to apply the editable area and editable intensity range mask. If it is feasible to do this at every stage (e.g. including during initialization display and as the user adjusts the "Segment volume" slider) that would be great! If that is not feasible, then the masking settings should still definitely be applied when the Apply button is clicked, before modifying any other segments. The editable area mask is independent of any algorithm results, and should just be intersected with the changes coming out of the algorithm to limit them if needed.

I've reproduced this behavior on Slicer 5.6 and 5.8

mikebind avatar Mar 05 '25 17:03 mikebind

This would be really cool and now with wide availability of very smart AI chatbots, it may just take a few hours to implement instead of a few days. First of all, you can ask an AI chatbot to first cleanup the fast marching filter's C++ code (modernize it, improve variable names, code organization, etc.) to make it a bit easier to understand. Then it should be fairly straightforward to implement masking, so much so that it is very likely that an AI chatbot could flawlessly implement it.

lassoan avatar Sep 23 '25 00:09 lassoan