Skip to content

Change interpolation defaults to "linear" - #193

Open
LMZimmer wants to merge 3 commits into
BrainLesion:mainfrom
LMZimmer:main
Open

LMZimmer wants to merge 3 commits into
BrainLesion:mainfrom
LMZimmer:main

Conversation

@LMZimmer

Copy link
Copy Markdown

Changed defaults for niftireg and ANTS backends to linear which was NN interpolation before.

An "interpolator" argument is now available upon Registrator construction and .register / .transform calls.

Changed defaults for niftireg and ANTS backends to linear which was NN
interpolation before.

Added an argument to the registrator construction to set the
interpolator
@LMZimmer

Copy link
Copy Markdown
Author

Adresses Issue #192.

@neuronflow
neuronflow requested review from MarcelRosier and neuronflow and a balanced review from Copilot and removed request for Copilot October 5, 2026 11:51
@neuronflow
neuronflow requested a balanced review from Copilot October 6, 2026 12:41

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.

Copilot review overview

🟡 Changes recommended

Defacing masks need label-preserving interpolation, and registration overrides fail with unsupported backends.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Updates image resampling to use linear interpolation by default and exposes interpolation overrides through registration and modality APIs.

Changes:

  • Switches ANTs and NiftyReg transformation defaults to linear.
  • Adds ANTs interpolation selection from configured defaults or call arguments.
  • Forwards modality-level interpolation options and updates documentation.
File Description
brainles_preprocessing/​transform.py Documents linear interpolation defaults.
brainles_preprocessing/​registration/​niftyreg/​niftyreg.py Changes forward and inverse transformation defaults.
brainles_preprocessing/​registration/​ANTs/​ANTs.py Resolves interpolation settings and forwards registration overrides.
brainles_preprocessing/​modality.py Adds interpolation arguments to registration and transformation wrappers.

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

Comment thread brainles_preprocessing/registration/ANTs/ANTs.py
Comment thread brainles_preprocessing/modality.py
@neuronflow

Copy link
Copy Markdown
Collaborator

@LMZimmer please have a look at copilot comments. The masking needs to haben with nearest neighbor interpolation

@neuronflow neuronflow 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.

@LMZimmer please see comment above

LMZimmer and others added 2 commits October 6, 2026 16:39
…r to ANTs

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ng ANTs

CenterModality.deface now explicitly passes the correct keyword for interpolator based on the registrator backend

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.

🔵 Needs a closer look

The new modality-level interpolation option can silently produce output using an unintended interpolation method.

0 open findings

2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Elastix ignores the requested interpolation option

brainles_preprocessing/​modality.py:404

The new Modality.transform(interpolator=...) option is silently ignored for ElastixRegistrator. Its transform() accepts the keyword but never uses it when constructing the parameter object or calling register() (registration/elastix/elastix.py:83-111), so the output uses the backend default instead of the requested interpolation. Reject explicit interpolation options for Elastix here, as Modality.register() does for unsupported backends, or implement support in the backend.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

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.

3 participants