Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#192 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

@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ả

bug

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BrainLesion/preprocessing

Tất cả issue của BrainLesion/preprocessing

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.