[BUG] ANTsRegistrator resamples MRI modalities with nearest-neighbor interpolation by default
@LMZimmer đang làm issue này rồi.
Từ ngày 18/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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",
)
- Ngôn ngữ chính
- C
- Star
- 39
- Fork
- 11
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của BrainLesion/preprocessing
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
BrainLesion/preprocessing#169 · 7 bình luận ·
-
[BUG] HTTP error responses from Zenodo bypass the "use local copy" fallbackCó thể đã có người làm @ErikGro đã nhận 20 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
BrainLesion/preprocessing#190 ·
-
[BUG] cannot import ANTSRegistratorCó thể làm lại được @neuronflow đã nhận 45 ngày trước và không có pull request nào đang mở. Đang mởbug
BrainLesion/preprocessing#188 · 1 reaction · 2 người được giao ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
BrainLesion/preprocessing#185 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
BrainLesion/preprocessing#177 · 3 bình luận ·
Tất cả issue của BrainLesion/preprocessing
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/pg_clickhouse#383 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
johnsonjh/emu2-cpm86#68 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Zenmap CrashĐang mởZenmap
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
BasedHardware/omi#19306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
fastfetch-cli/fastfetch#2619 ·
Maintainer thường phản hồi trong vòng 1 ngày