Project-MONAI / Project-MONAI/MONAI

NRRD Reader for 4D images

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

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
8.7k
Fork
1.6k
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
20

Mô tả

Describe the bug
I have created some 4D NRRD files, in which the first dimension represents channels (different MRI scans). In my current use case, the 4D volumes are slices, meaning that the final dimension is 1, but the same issues would happen for larger volumes.

I created the NRRD files myself using pynrrd, and try to load them into tensors with the NRRDReader. pynrrd automatically sets the 'sizes' key in the header, to the total array size. As such, the check to find channels in NRRDReader.get_data does not actually work on these files. In addition, it is not possible to save the 'space_directions' key in the header without a direction for the channel dimension too, otherwise 3DSlicer cannot load the file. Note that in my example, the kinds key is the following: ['list', 'domain', 'domain', 'domain']

A file can be found here. (The link expires after 10 days, please let me know if I need to make a new one)

I have implemented some fixes, mainly by using the 'kinds' key, I'll make a PR soon.

To Reproduce
Steps to reproduce the behavior:

  1. Use the LoadImage transform to load the image linked above.
  2. An error will happen in the _get_affine method, when transposing the affine matrix, because it's not symmetric.

Expected behavior
The NRRD file should be loaded correctly with the correct spacing information.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

Ensuring you use the relevant python executable, please paste the output of:

Workspace environment set for:
   /storage/workspaces/artorg_aimi/ws_00000
Activate existing virtual environment at /storage/homefs/dn25y590/projects/visual-models/ignition/.venv
To deactivate, hit Ctrl + D
SLURM_JOB_ID: 38784913
UV_ENV_FILE: 
================================
Printing MONAI config...
================================
MONAI version: 0+untagged.3276.g06c74ab.dirty
Numpy version: 2.3.2
Pytorch version: 2.6.0+cu124
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 06c74ab9080ec3bddbf9099d667e57ab726b5cce
MONAI __file__: /storage/homefs/<username>/projects/visual-models/monai/monai/__init__.py

Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: 5.4.4
Nibabel version: 5.3.2
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
scipy version: 1.16.1
Pillow version: 11.3.0
Tensorboard version: 2.20.0
gdown version: 5.2.0
TorchVision version: 0.21.0+cu124
tqdm version: 4.67.1
lmdb version: 1.7.3
psutil version: 7.0.0
pandas version: 2.3.1
einops version: 0.8.1
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: 3.2.0
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
clearml version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Linux
Linux version: Rocky Linux 9.6 (Blue Onyx)
Platform: Linux-5.14.0-570.58.1.el9_6.x86_64-x86_64-with-glibc2.34
Processor: x86_64
Machine: x86_64
Python version: 3.12.11
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='/storage/homefs/dn25y590/projects/visual-models/ignition/slurm_output/slurm-38784913.out', fd=1, position=1503, mode='a', flags=33793), popenfile(path='/storage/homefs/dn25y590/projects/visual-models/ignition/slurm_output/slurm-38784913.out', fd=2, position=75, mode='a', flags=33793)]
Num physical CPUs: 128
Num logical CPUs: 128
Num usable CPUs: 20
CPU usage (%): [8.8, 0.1, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1, 0.1, 0.0, 0.1, 0.0, 0.0, 0.1, 0.1, 0.1, 53.3, 78.3, 47.1, 67.8, 57.5, 76.5, 53.3, 71.7, 44.1, 63.9, 75.1, 65.3, 78.5, 85.6, 65.5, 35.5, 0.2, 0.9, 0.0, 0.0, 0.3, 1.7, 0.0, 0.1, 0.5, 0.3, 1.6, 7.3, 0.7, 53.7, 47.2, 0.5, 0.5, 0.1, 0.3, 0.1, 0.1, 0.3, 0.3, 0.0, 1.5, 2.6, 0.5, 0.1, 1.6, 0.0, 0.5, 0.5, 0.1, 0.2, 0.0, 0.1, 0.1, 0.2, 0.1, 0.0, 0.1, 0.9, 0.0, 0.1, 0.1, 0.1, 1.0, 1.1, 0.1, 0.0, 0.2, 0.1, 0.0, 0.1, 0.0, 0.1, 0.3, 0.9, 0.1, 0.6, 0.4, 0.5, 0.2, 0.0, 0.2, 0.1, 0.3, 0.1, 0.5, 0.1, 0.1, 0.0, 0.1, 0.1, 0.0, 0.1, 0.2, 0.2, 0.1, 2.0, 100.0, 1.8, 0.9, 0.3, 0.6, 2.2, 0.0, 0.1, 32.6, 1.7, 0.1, 1.2, 0.1, 0.1, 0.1, 0.0]
CPU freq. (MHz): 2503
Load avg. in last 1, 5, 15 mins (%): [10.8, 11.6, 11.6]
Disk usage (%): 78.7
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 503.2
Available memory (GB): 398.9
Used memory (GB): 61.7

================================
Printing GPU config...
================================
Num GPUs: 1
Has CUDA: True
CUDA version: 12.4
cuDNN enabled: True
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None
cuDNN version: 90100
Current device: 0
Library compiled for CUDA architectures: ['sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90']
GPU 0 Name: NVIDIA A100 80GB PCIe
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 108
GPU 0 Total memory (GB): 79.1
GPU 0 CUDA capability (maj.min): 8.0

Additional context
Add any other context about the problem here.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu với các entry point NRRDReader.get_data và _get_affine được transformation LoadImage sử dụng, sau đó tái hiện lỗi với tệp NRRD 4D được liên kết. Hoàn thành khi reader tải được các tệp 4D có chiều kênh được mô tả bởi kinds header và giữ nguyên thông tin spacing chính xác mà không gặp lỗi transpose affine.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
data
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
58/100

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.