Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata "Space" Is Always "RAS" #8069

Closed
GaoxiangLuo opened this issue Sep 5, 2024 · 1 comment
Closed

Metadata "Space" Is Always "RAS" #8069

GaoxiangLuo opened this issue Sep 5, 2024 · 1 comment

Comments

@GaoxiangLuo
Copy link

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.
@KumoLiu
Copy link
Contributor

KumoLiu commented Sep 6, 2024

Hi @GaoxiangLuo, yes, the space are shown the coordinate system which is the convention of which reader you are using, not related to your image.

affine_lps_to_ras: whether to convert the affine matrix from "LPS" to "RAS". Defaults to ``True``.

@Project-MONAI Project-MONAI locked and limited conversation to collaborators Sep 6, 2024
@KumoLiu KumoLiu converted this issue into discussion #8070 Sep 6, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants