Skip to content

BUG: label_image_registration ignored labels with initial_transforms=None - #954

Merged
ntustison merged 1 commit into
ANTsX:mainfrom
jig-mistry:jm/label-registration-no-initial
Nov 9, 2026
Merged

ntustison merged 1 commit into
ANTsX:mainfrom
jig-mistry:jm/label-registration-no-initial

Conversation

@jig-mistry

Copy link
Copy Markdown
Contributor

label_image_registration(..., initial_transforms=None) drops the label images. The branch for 'identity' and transform files, which adds the per-label MSQ metrics, starts with

elif initial_transforms is not None or initial_transforms == 'identity':

That is False for None, so the deformable stage gets no label metrics:

  • With intensity images: it registers the intensity images only, without an error.
  • Without them: antsRegistration has no metric and fails with RuntimeError: Registration failed with error code 1.

The docstring says the initial transform is used "if specified", so None should mean no initial transform, as 'identity' does.

This makes that branch an else, and skips the transform-file handling for None. Changing is not None to is None instead would drop transform files from this branch.

test_label_image_registration_without_initial_transforms checks two things:

  • None and a list with a transform file pass the same label metrics to antsRegistration as 'identity';
  • a label-only call with None runs.

It fails on main and passes here.

…None

With initial_transforms=None neither branch added the label metrics, so the
deformable stage used only the intensity images, and a call without intensity
images failed in antsRegistration with error code 1. Treat None like
'identity': no initial transform, with the label metrics.
@cookpa
cookpa requested a review from ntustison November 8, 2026 16:03
@ntustison
ntustison merged commit d0b5588 into ANTsX:main Nov 9, 2026
2 checks passed
@ntustison

Copy link
Copy Markdown
Member

Thanks @jig-mistry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants