moloney / dcmstack

DICOM to Nifti conversion with meta data preservation
Other
72 stars 52 forks source link

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

Open Spenhouet opened 4 years ago

Spenhouet commented 4 years ago

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 commented 4 years ago

@moloney Any feedback on this?

moloney commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 2 years ago

became also a problem for heudiconv: https://github.com/nipy/heudiconv/issues/582 with the link to sample dicoms at https://github.com/nipy/heudiconv/issues/582#issuecomment-1232589596 . 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 commented 1 year ago

We got another user reporting the same issue in heudiconv: https://github.com/nipy/heudiconv/issues/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 commented 1 year ago

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 commented 8 months ago

What else is needed to get that pull request finished?