# Odd behavior after adding a moving mask in the ANTs extension

**URL:** <https://discourse.slicer.org/t/odd-behavior-after-adding-a-moving-mask-in-the-ants-extension/46117>\
**Category:** Support\
**Tags:** registration, masking, ants\
**Created:** [February 10, 2026, 8:05pm UTC](https://discourse.slicer.org/t/odd-behavior-after-adding-a-moving-mask-in-the-ants-extension/46117 "2026-02-10T20:05:44Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![sulli419](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sulli419/32/78859_2.png) [@sulli419](https://discourse.slicer.org/u/sulli419)\
**Post date:** [February 28, 2026, 2:06am UTC](https://discourse.slicer.org/t/odd-behavior-after-adding-a-moving-mask-in-the-ants-extension/46117/7 "2026-02-28T02:06:16Z")

</div>

A solution. Thanks to those who helped fix and update ATNs @mhalle @lassoan @pieper @simonoxen

Ok, I pitched this problem in a forum where people were discussing using large documentation and code data bases for priming AI for working in slicer, which includes debugging! Claude spotted the bug and fixed it. Interestingly, in my hands GPT 5.2 was suggesting a similar fix with zero documentation priming, but I didn’t completely trust it.

It appears that what was happening is that if the user selected only one mask (either fixed or moving) it didn’t load it and ran with no warning.

A new slicer ants released a couple of days ago with this fixed (see link). You can either replace the suspect .py file in your existing ANTs or install the absolute latest Slicer and then find the new extension from within the GUI

@mikebind is an expert user, so he might add some comments about how well it’s working. The masks seem to change the registration in fairly sensible ways, but I haven’t probed it rigorously.

Things I plan to check:  
1.) can different masks be mixed at matched at different stages (confirm at least in the CLI)?

2.) Why was I getting a funny result in the old version when adding a fixed AND moving mask (since this shouldn’t trigger this bug)? Test if this is still happening, i.e., not a separate bug to address.

> [@New slicer-skill ai tool](https://discourse.slicer.org/t/new-slicer-skill-ai-tool/46243/4):
>
> This sounds very useful. Could it be used to fixed bugs in extensions? As an example task, I am finding the ANTs extension can no longer apply fixed masks (for hiding parts of the volume). It would be interesting to see if Claude could nail the problem and provide a fix for the next version.

> <https://github.com/netstim/SlicerANTs/pull/15>
>
> \## Summary
> 
> \- \*\*Fixed\*\*: \`getMasksCommand()\` required both fixed AND moving mask…s to generate the \`--masks\` flag. Providing only a fixed mask (the common use case for hiding parts of the volume during registration) silently dropped the mask entirely — no \`--masks\` flag was emitted and no warning was shown.
> \- \*\*Fix\*\*: When only one mask is provided, \`NULL\` is passed as the ANTs placeholder for the missing mask, allowing either mask to be used independently.
> 
> \### Before (broken)
> \`\`\`
> \# User selects only a fixed mask → no --masks flag generated at all
> \`\`\`
> 
> \### After (fixed)
> \`\`\`
> \# Fixed only: --masks \[$fixedMask,NULL\]
> \# Moving only: --masks \[NULL,$movingMask\]
> \# Both: --masks \[$fixedMask,$movingMask\]
> \# Neither: no flag (unchanged)
> \`\`\`
> 
> \## Test plan
> 
> \- \[\] Load two volumes and a label map mask in Slicer
> \- \[\] In ANTs Registration, select only a fixed mask (leave moving mask as None)
> \- \[\] Run registration and verify the \`--masks\` flag appears in the generated command with \`NULL\` for the moving mask
> \- \[\] Repeat with only a moving mask selected
> \- \[\] Verify both masks together still works as before
> \- \[\] Verify no masks selected still omits the \`--masks\` flag
> 
> 🤖 Generated with \[Claude Code\](https://claude.com/claude-code)

---

_[View the full topic](https://discourse.slicer.org/t/odd-behavior-after-adding-a-moving-mask-in-the-ants-extension/46117)._
