Skip to content

fix: add ANTSRegistrator alias to fix import error - #189

Closed
neuronflow with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-import-error-antsregistrator
Closed

fix: add ANTSRegistrator alias to fix import error#189
neuronflow with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-import-error-antsregistrator

Conversation

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

from brainles_preprocessing.registration import ANTSRegistrator raised an ImportError because the class was only exported as ANTsRegistrator (lowercase s).

Changes

  • brainles_preprocessing/registration/__init__.py: adds ANTSRegistrator = ANTsRegistrator alias inside the try block so both casings resolve correctly; if antspyx is not installed, neither name is available (existing behavior preserved)
from brainles_preprocessing.registration import ANTSRegistrator  # now works
from brainles_preprocessing.registration import ANTsRegistrator  # still works

Copilot AI linked an issue Aug 13, 2026 that may be closed by this pull request
…init__

Co-authored-by: neuronflow <7048826+neuronflow@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix import error for ANTSRegistrator fix: add ANTSRegistrator alias to fix import error Aug 13, 2026
Copilot AI requested a review from neuronflow August 13, 2026 11:14
@neuronflow

Copy link
Copy Markdown
Collaborator

Ah interesting the small S was created by autocomplete and led to the error message.

@neuronflow
neuronflow marked this pull request as ready for review August 14, 2026 08:52
Copilot AI lite review requested due to automatic review settings August 14, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an import-casing mismatch in the registration package by adding an ANTSRegistrator alias for the existing ANTsRegistrator, eliminating an ImportError for users importing the all-caps variant.

Changes:

  • Add ANTSRegistrator = ANTsRegistrator alias inside the existing try import block for the ANTs registrator.
  • Preserve the existing optional-dependency behavior (when antspyx is missing, neither symbol is available).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@MarcelRosier MarcelRosier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we need this instead of just importing ANTsRegistrator? in case the name is wrong, just correct it rather than adding an alias

@neuronflow

Copy link
Copy Markdown
Collaborator

For some reason I don't fully understand yet, VSCode autocomplete leads to importing the wrong Caps version, which then leads to code crashes, but I agree, this is not really needed.

@neuronflow

Copy link
Copy Markdown
Collaborator

let's not merge, this but I am wondering what triggers this wrong code suggestion 🙃

@neuronflow neuronflow closed this Aug 16, 2026
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.

[BUG] cannot import ANTSRegistrator

4 participants