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

nicom MultiframeWrapper fails to return image_shape attribute with multi-volume mri data #1388

Open
AlanKuurstra opened this issue Nov 21, 2024 · 2 comments

Comments

@AlanKuurstra
Copy link

AlanKuurstra commented Nov 21, 2024

Does the nibabel.nicom dicom wrapper support multi-frame dicoms with multiple volumes?

I have a dicom with frame index ordering: "Temporal Position Index", "Stack ID", "In Stack Position Number". Loading the dicom and attempting to access the image_shape attribute

mw = dw.wrapper_from_file(filepath, force=True, stop_before_pixels=True)
mw.image_shape

fails with error:

Traceback (most recent call last):
  File "/home/akuurstr/.config/JetBrains/PyCharm2024.2/scratches/heudiconv_bruker_dicom_conversion.py", line 65, in <module>
    mw.image_shape
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/virtualization/python_virtualenvs/heudiconv/lib/python3.10/site-packages/nibabel/nicom/dicomwrappers.py", line 770, in image_shape
    raise WrapperError('Non-singular index precedes the slice index')
nibabel.nicom.dicomwrappers.WrapperError: Non-singular index precedes the slice index

It seems MultiframeWrapper wants the stack position number to be the slowest changing index.

@AlanKuurstra AlanKuurstra changed the title nicom MultiframeWrapper fails to return image_shape attribute with multi-volume data nicom MultiframeWrapper fails to return image_shape attribute with multi-volume mri data Nov 21, 2024
@moloney
Copy link
Contributor

moloney commented Nov 21, 2024

The code currently assumes we don't need to reorder the DimensionIndexValues, mostly out of expediency and lack of a clear need. Your dataset appears to show that we do need to check for and allow this. Can you share the dataset?

@AlanKuurstra
Copy link
Author

AlanKuurstra commented Nov 25, 2024

Here is a link to one of bruker's enhanced dicoms:

https://uwoca-my.sharepoint.com/:u:/g/personal/akuurstr_uwo_ca/ERV-zm-DPOhHqv1pSUWVj1oBQMV8FbAb7CT-9SjNC019Mg?e=nk4Lyo

@isolovey, do you have a dataset to add from your converter?

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