[BUG] ANTsRegistrator resamples MRI modalities with nearest-neighbor interpolation by default
@LMZimmer がすでに取り組んでいます。
2026年9月18日 から。
評価
この issue はまだ評価されていません。
説明
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",
)
- 主要言語
- C
- スター
- 39
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BrainLesion/preprocessing のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
BrainLesion/preprocessing#169 · コメント 7 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
BrainLesion/preprocessing#190 ·
-
bug
BrainLesion/preprocessing#188 · リアクション 1 件 · 担当者 2 名 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
BrainLesion/preprocessing#185 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
BrainLesion/preprocessing#177 · コメント 3 件 ·
BrainLesion/preprocessing の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bradcypert/plum#53 ·
-
Component: GLib
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Status: Opened
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nextbsd/nextbsd-userland#285 ·