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

What is the current state with respect to enhanced MRI (3D DICOMs)? #71

Closed
Spenhouet opened this issue Apr 23, 2020 · 13 comments
Closed

Comments

@Spenhouet
Copy link

Spenhouet commented Apr 23, 2020

I just tested an enhanced MR image from a Siemens device and got an exception telling me that time is missing:

The extension is not valid: Missing required base classification time

dcm2niix had no issue converting the enhanced MR image.

Should this generally work? Or is this not yet implemented?

I did successfully load the enhanced MR image via pydicom, but it fails on adding it to the stack:

my_stack = dcmstack.DicomStack()
src_dcm = pydicom.read_file(str(dicom_file_path))
my_stack.add_dcm(src_dcm)  #<- fails here

What is still missing for this to work? Could you need support implementing this? Do you need an example file that I can send you?

@Spenhouet
Copy link
Author

Spenhouet commented Jul 2, 2020

@moloney Any feedback on this?

@moloney
Copy link
Owner

moloney commented Aug 5, 2020

Sorry to be so slow to reply. My colleague and some other folks have done some work to improve "enhanced" (multiframe) handling in nibabel, but it isn't leveraged in dcmstack. At this point I prefer to put any time I have towards getting dcmstack functionality into nibabel, rather than implementing new functionality here.

@Spenhouet
Copy link
Author

@moloney Thank you for your reply and the clarification on the maintenance / state of this project.
I was not aware of the efforts put into nibabel and that the goal is to provide the current dcmstack functionality in nibabel. That is great news. How can we follow the state of these efforts? Are there open issues on the nibabel project with respect to this which you can link to? Or is there another way to follow the progress?

We will probably need to switch to the new nibabel implementation as soon as it is available. As of the coming October all Siemens devices here will be switched/updated to "enhanced" (multiframe).

@Spenhouet
Copy link
Author

I found this repository: https://github.com/matthew-brett/czi-nibabel (not sure if that is supposed to be public).
This looks like a really cool project!

Going by this:

The grant starts at January 1, 2021 and the milestone is to have the DICOM to NIfTI integration into Nibabel ready 3 months after that. So basically this functionality is supposed to be available in April 2021. Correct me if that is a wrong assumption.

Not sure if that includes the multiframe handling.

Sadly we will have to somehow cope with this differently. As mentioned, as of October we (and probably many more) will have be able to handle multiframe DICOMs. We really like dcmstack and did hope that we could stick to it (or the Nibable replacement), but if the above mentioned timeframe is accurate, then we will need to switch to something like dcmtk.

@yarikoptic
Copy link
Contributor

yarikoptic commented Aug 31, 2022

became also a problem for heudiconv: nipy/heudiconv#582 with the link to sample dicoms at nipy/heudiconv#582 (comment) . Detailed traceback from local execution

Traceback (most recent call last):
  File "/home/yoh/proj/heudiconv/heudiconv-master/venvs/dev3/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run
    runtime = self._run_interface(runtime)
  File "/home/yoh/proj/heudiconv/heudiconv-master/venvs/dev3/lib/python3.10/site-packages/nipype/interfaces/utility/wrappers.py", line 142, in _run_interface
    out = function_handle(**args)
  File "<string>", line 28, in embed_dicom_and_nifti_metadata
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmstack.py", line 1226, in parse_and_stack
    results[key] = stack_group(group, warn_on_except, **stack_args)
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmstack.py", line 1180, in stack_group
    result.add_dcm(dcm, meta)
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmstack.py", line 605, in add_dcm
    nii_wrp = NiftiWrapper.from_dicom_wrapper(dw, meta)
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmmeta.py", line 1561, in from_dicom_wrapper
    result = klass(nii_img, make_empty=True)
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmmeta.py", line 1280, in __init__
    self.meta_ext.check_valid()
  File "/home/yoh/deb/gits/pkg-exppsy/dcmstack/src/dcmstack/dcmmeta.py", line 306, in check_valid
    raise InvalidExtensionError('Missing required base '
dcmstack.dcmmeta.InvalidExtensionError: The extension is not valid: Missing required base classification time

@yarikoptic
Copy link
Contributor

We got another user reporting the same issue in heudiconv: nipy/heudiconv#613 . I wonder on either @matthew-brett et al in czi-nibabel achieved the desired functionality which could be used in dcmstack to handle such DICOMs?

@moloney
Copy link
Owner

moloney commented Feb 10, 2023

I just opened a PR with something that seems to be working for 3D enhanced DICOM files. Feel free to test it out and give feedback, I just want to add tests before merging. Adding support for 4D enhanced DICOM files would probably also be doable, but so far isn't a priority for me.

@psadil
Copy link

psadil commented Jan 18, 2024

What else is needed to get that pull request finished?

@moloney
Copy link
Owner

moloney commented Nov 20, 2024

The branch for PR #84 is in a good enough state for people to start testing. Still some clean up and improvements I want to make before merging, but the bulk of the work is done. Supports multi-frame files with up to four dimensions thanks in part to the work I recently pushed to nibabel.nicom.

Also, I should mention that the meta data structure in the Nifti extension is much nicer to work with than the original multi-frame DICOM as I get rid of all the extra nesting they added. I also do a first-pass attempt at producing some slightly normalized meta data that goes further towards normalizing across vendors and legacy vs multi-frame DICOM.

@Spenhouet
Copy link
Author

Thank you for working on this! We really would like to test it out (and see this released in a new version) but atm. do not have the time to do so.

@moloney
Copy link
Owner

moloney commented Dec 5, 2024

I went ahead and merged PR #84 into master. I'm sure there is still room for improvement both here and in Nibabel's dicomwrappers, but at this point it would be better to open more specific issues for anything that comes up.

@moloney moloney closed this as completed Dec 5, 2024
@Spenhouet
Copy link
Author

@moloney can you publish a new release? We need a release version to test.

@moloney
Copy link
Owner

moloney commented Dec 5, 2024

I created issue #97 to track what needs to be done for a release. Unless there is an institutional block then installing directly from github is generally quite easy, and any additional testing on real world data sets prior to release would be very helpful.

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

4 participants