Describe the bug
When use LoadImage, the metadata "space" is always RAS, not reflecting the real orientation.
To Reproduce
Here is a minimal code snippet to reproduce the behavior:
# download a example 3D brain MRI file from the internet
import requests
url = "http://www.neuromorphometrics.com/1103_3.tgz"
r = requests.get(url)
with open("1103_3.tgz", "wb") as f:
f.write(r.content)
# unzip the file and prepare the data
import tarfile
tar = tarfile.open("1103_3.tgz")
tar.extractall(path="1103_3")
tar.close()
# load the image with monai and ants
import nibabel as nib
nib.Nifti1Header.quaternion_threshold = -1e-06
from ants import image_read
from monai.transforms import LoadImage
loader = LoadImage(image_only=False)
img_monai = loader("1103_3/Data/1103/3/NIFTI/1103_3.nii")
print(f"MONAI Reading: {img_monai[1]['space']}")
img_ants = image_read("1103_3/Data/1103/3/NIFTI/1103_3.nii")
print(f"ANTS Reading: {img_ants.orientation}")
Expected behavior
It's expected to print out RSP, but it printed out RAS as always.
MONAI Reading: RAS
ANTS Reading: RSP
Environment
Ensuring you use the relevant python executable, please paste the output of:
================================
Printing MONAI config...
================================
MONAI version: 1.3.0
Numpy version: 1.24.4
Pytorch version: 2.0.0+cu117
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 865972f7a791bf7b42efbcd87c8402bd865b329e
Optional dependencies:
Pytorch Ignite version: 0.4.13
ITK version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 5.2.0
scikit-image version: 0.21.0
scipy version: 1.10.1
Pillow version: 10.2.0
Tensorboard version: 2.14.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.15.1+cu117
tqdm version: 4.66.1
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.9.0
pandas version: 2.0.3
einops version: 0.7.0
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
clearml version: NOT INSTALLED or UNKNOWN VERSION.
Describe the bug
When use
LoadImage, the metadata "space" is always RAS, not reflecting the real orientation.To Reproduce
Here is a minimal code snippet to reproduce the behavior:
Expected behavior
It's expected to print out RSP, but it printed out RAS as always.
Environment
Ensuring you use the relevant python executable, please paste the output of: