Skip to content
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

Dicom to Nifti affine matrix issue. #96

Open
ericabg1 opened this issue Jul 5, 2021 · 1 comment
Open

Dicom to Nifti affine matrix issue. #96

ericabg1 opened this issue Jul 5, 2021 · 1 comment

Comments

@ericabg1
Copy link

ericabg1 commented Jul 5, 2021

Hi,

I was hoping to get some help with an issue I am experiencing when changing format from Dicom to Nifti. I am trying to export the masks in Mimics (Materialise) to nifti format, via the scripting module.

I tried using dicom2nifti function to get the affine transformation. First, I converted the whole Dicom image to Nifti using dicom2nifti. Then, I "get" the affine matrix using these commands:
image = nib.load (path to image)
affine_nifti = image.affine

Then, I get the masks of interest into an array format (via the Mimics scripting module) and use the following line to export the mask into nifti format:
mask_img = nib.nifti1.Nifti1Image(mask_array, affine_nifti)

However, when I view the resulting image in ITK-snap, the orientations are wrong (see image below). For reference, it is a mask of the vertebral column.

image

I am not sure what I am getting wrong here, but since the orientations are wrong, something is not working in my procedure. I was hoping to get some help to get the correct orientation for the mask in Nifti format. The image exported by dicom2nifti is correctly oriented when viewed in ITK-snap, so I am a bit confused.

Please let me know if anything is not clear.

Thank you for your help,

Erica

@yaaski
Copy link

yaaski commented Jun 12, 2024

Same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants