Open surajpaib opened 10 months ago
Describe the bug Setting reverse_indexing=True works well for NIFTI files but crashes for NRRD files when setting reader="ITKReader" in LoadImage
reverse_indexing=True
reader="ITKReader"
LoadImage
To Reproduce
_Case 1: Load NIFTI without setting reverse_indexing - Works!_
reverse_indexing
import monai import matplotlib.pyplot as plt nrrd_datalist = ["/mnt/data1/RadiomicsFoundationModel/LUNG1/NRRDs/LUNG1-001/CT.nrrd"] nifti_datalist = ["/mnt/data1/SOTASeg/Dataset600_TotalSegmentator_all_fullres/imagesTr/TotalSegmentator_1405_0000.nii.gz"] transform = monai.transforms.Compose([ monai.transforms.LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader"), monai.transforms.DataStats(), ]) out = transform(nifti_datalist)
Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 255, 255, 287]) Value range: (-1179.0, 3262.0)
_Case 2: Load NIFTI setting reverse_indexing=True - Works!_
import monai import matplotlib.pyplot as plt nrrd_datalist = ["/mnt/data1/RadiomicsFoundationModel/LUNG1/NRRDs/LUNG1-001/CT.nrrd"] nifti_datalist = ["/mnt/data1/SOTASeg/Dataset600_TotalSegmentator_all_fullres/imagesTr/TotalSegmentator_1405_0000.nii.gz"] transform = monai.transforms.Compose([ monai.transforms.LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader", reverse_indexing=True), monai.transforms.DataStats(), ]) out = transform(nifti_datalist)
Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 287, 255, 255]) Value range: (-1179.0, 3262.0)
_Case 3: Load NRRD without setting reverse_indexing - Works!_
import monai import matplotlib.pyplot as plt nrrd_datalist = ["/mnt/data1/RadiomicsFoundationModel/LUNG1/NRRDs/LUNG1-001/CT.nrrd"] nifti_datalist = ["/mnt/data1/SOTASeg/Dataset600_TotalSegmentator_all_fullres/imagesTr/TotalSegmentator_1405_0000.nii.gz"] transform = monai.transforms.Compose([ monai.transforms.LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader"), monai.transforms.DataStats(), ]) out = transform(nrrd_datalist)
Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 512, 512, 134]) Value range: (-1024.0, 3034.0)
_Case 4: Load NRRD setting reverse_indexing=True Breaks_
import monai import matplotlib.pyplot as plt nrrd_datalist = ["/mnt/data1/RadiomicsFoundationModel/LUNG1/NRRDs/LUNG1-001/CT.nrrd"] nifti_datalist = ["/mnt/data1/SOTASeg/Dataset600_TotalSegmentator_all_fullres/imagesTr/TotalSegmentator_1405_0000.nii.gz"] transform = monai.transforms.Compose([ monai.transforms.LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader", reverse_indexing=True), monai.transforms.DataStats(), ]) out = transform(nrrd_datalist)
Error message: Segmentation fault (core dumped)
Segmentation fault (core dumped)
Environment monai_env_config.txt
Also mentioned in #7365
Hi @surajpaib, can not reproduce the issue, could you please share a case then I can take a look at it? Thanks!
Describe the bug Setting
reverse_indexing=True
works well for NIFTI files but crashes for NRRD files when settingreader="ITKReader"
inLoadImage
To Reproduce
_Case 1: Load NIFTI without setting
reverse_indexing
- Works!_Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 255, 255, 287]) Value range: (-1179.0, 3262.0)
_Case 2: Load NIFTI setting
reverse_indexing=True
- Works!_Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 287, 255, 255]) Value range: (-1179.0, 3262.0)
_Case 3: Load NRRD without setting
reverse_indexing
- Works!_Data statistics: Type: <class 'monai.data.meta_tensor.MetaTensor'> torch.float32 Shape: torch.Size([1, 512, 512, 134]) Value range: (-1024.0, 3034.0)
_Case 4: Load NRRD setting
reverse_indexing=True
Breaks_Error message:
Segmentation fault (core dumped)
Environment monai_env_config.txt