GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [BUG] ANTsRegistrator resamples MRI modalities with nearest-neighbor interpolation by default · Issue #192 · BrainLesion/preprocessing

[BUG] ANTsRegistrator resamples MRI modalities with nearest-neighbor interpolation by default #192

New issue
Copy link
New issue
Copy link
Open
Open
[BUG] ANTsRegistrator resamples MRI modalities with nearest-neighbor interpolation by default#192
Copy link
Assignees
LMZimmer
Labels
bugSomething isn't working

Description

@LMZimmer
LMZimmer
opened on Sep 17, 2026
Issue body actions

Version: brainles_preprocessing 0.6.13 (same in 0.6.10)

ANTsRegistrator.transform defaults to interpolator="nearestNeighbor", and ANTsRegistrator.register calls self.transform(...) without passing an interpolator. Modality.register / Modality.transform also never pass one (brainles_preprocessing/modality.py:265, :398, :411).

As a result, every resampling step in AtlasCentricPreprocessor.run (coregistration to the center modality, atlas registration incl. the combined coregistration+atlas transform, atlas correction) resamples the MRI modalities with nearest neighbor.

There currently seems to be no supported way to change this from the user side: passing ANTsRegistrator(transformation_params={"interpolator":"linear"}) fails with "TypeError: apply_transforms() got multiple values for keyword argument 'interpolator'" because transform forwards interpolator=interpolator, **transform_kwargs to ants.apply_transforms (ANTs.py:217). The only workaround is subclassing ANTsRegistrator and overriding the default of transform.

Suggested fix: default interpolator to "linear" in ANTsRegistrator.transform (and inverse_transform), and let Modality.register / Modality.transform pass an interpolator.

Reproducibility
import tempfile
from pathlib import Path

import ants
import numpy as np
from brainles_preprocessing.registration import ANTsRegistrator

tmp = Path(tempfile.mkdtemp())
img = tmp / "img.nii.gz"
ants.image_write(ants.from_numpy(np.random.rand(16, 16, 16).astype(np.float32)), str(img))
tx = tmp / "identity.mat"
ants.write_transform(ants.new_ants_transform(dimension=3, transform_type="AffineTransform"), str(tx))

registrator = ANTsRegistrator(transformation_params={"interpolator": "linear"})
registrator.transform(
fixed_image_path=img,
moving_image_path=img,
transformed_image_path=tmp / "out.nii.gz",
matrix_path=tx,
log_file_path=tmp / "log.txt",
)

Activity

  1. LMZimmer
    added
    bugSomething isn't working
    on Sep 17, 2026
  2. neuronflow commented on Sep 17, 2026

    @neuronflow
    neuronflow
    on Sep 17, 2026
    Collaborator
    More actions

    ohhh sweet! this might be the reason why ANTs produces such weird results for our low resolution input scans @ErikGro ! nice catch @LMZimmer

  3. neuronflow commented on Sep 17, 2026

    @neuronflow
    neuronflow
    on Sep 17, 2026
    Collaborator
    More actions

    @MarcelRosier can you have a look please?

  4. neuronflow commented on Sep 17, 2026

    @neuronflow
    neuronflow
    on Sep 17, 2026
    Collaborator
    More actions

    Suggested fix: default interpolator to "linear" in ANTsRegistrator.transform (and inverse_transform), and let Modality.register / Modality.transform pass an interpolator.

    sounds good to me, can you please submit a PR @LMZimmer

  5. LMZimmer commented on Sep 17, 2026

    @LMZimmer
    LMZimmer
    on Sep 17, 2026
    Author
    More actions

    Ill submit one tomorrow 👍

    Reacted by neuronflow
  6. neuronflow
    assigned
    LMZimmer
    on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @LMZimmer
    LMZimmer

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.