Skip to content

Unable to get attribute from Philips DICOM: Calculated shape does not match number of frames. #1211

Closed
@yarikoptic

Description

@yarikoptic

Originally brought to try on these DICOMs in the context of nipy/heudiconv#575 (comment) and trying on Philips DICOMs within http://github.com/neurolabusc/dcm_qa_enh by @neurolabusc for enhanced Philips dicoms for sw 5.3.0:

where attempt to run heudiconv crashed
❯ heudiconv -f convertall -c dcm2niix --bids -o out-heudiconv -s unknown --files Philips
INFO: Running heudiconv version 0.11.6 latest 0.12.0
INFO: Analyzing 3 dicoms
Traceback (most recent call last):
  File "/usr/bin/heudiconv", line 33, in <module>
    sys.exit(load_entry_point('heudiconv==0.11.6', 'console_scripts', 'heudiconv')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/heudiconv/cli/run.py", line 24, in main
    workflow(**kwargs)
  File "/usr/lib/python3/dist-packages/heudiconv/main.py", line 327, in workflow
    study_sessions = get_study_sessions(dicom_dir_template, files,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/heudiconv/parser.py", line 178, in get_study_sessions
    seqinfo_dict = group_dicoms_into_seqinfos(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/heudiconv/dicoms.py", line 202, in group_dicoms_into_seqinfos
    mwinfo = validate_dicom(filename, dcmfilter)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/heudiconv/dicoms.py", line 106, in validate_dicom
    del mw.series_signature[sig]
        ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/nibabel/onetime.py", line 142, in __get__
    val = self.getter(obj)
          ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/nibabel/nicom/dicomwrappers.py", line 625, in series_signature
    signature['image_shape'] = (self.image_shape, eq)
                                ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/nibabel/onetime.py", line 142, in __get__
    val = self.getter(obj)
          ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/nibabel/nicom/dicomwrappers.py", line 566, in image_shape
    raise WrapperError('Calculated shape does not match number of frames.')
nibabel.nicom.dicomwrappers.WrapperError: Calculated shape does not match number of frames.

I found an oldish fixed issue #693 relating to the same "Effect", and then reproduced with similar minimalish reproducer on a sample file from that repo with master version of nibabel:

❯ python -c 'import nibabel, pydicom, sys; from nibabel.nicom.dicomwrappers import wrapper_from_file; print(nibabel.__version__); mw = wrapper_from_file(sys.argv[1], force=True); print(mw.series_signature)' Philips/IM_0027_fMAP.dcm
<string>:1: UserWarning: The DICOM readers are highly experimental, unstable, and only work for Siemens time-series at the moment
Please use with caution.  We would be grateful for your help in improving them
5.1.0.dev90+g3a4cc5e3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/yoh/proj/nipy/nipy-suite/nibabel-upstream/nibabel/onetime.py", line 156, in __get__
    val = self.getter(obj)
          ^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/nipy/nipy-suite/nibabel-upstream/nibabel/nicom/dicomwrappers.py", line 625, in series_signature
    signature['image_shape'] = (self.image_shape, eq)
                                ^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/nipy/nipy-suite/nibabel-upstream/nibabel/onetime.py", line 156, in __get__
    val = self.getter(obj)
          ^^^^^^^^^^^^^^^^
  File "/home/yoh/proj/nipy/nipy-suite/nibabel-upstream/nibabel/nicom/dicomwrappers.py", line 566, in image_shape
    raise WrapperError('Calculated shape does not match number of frames.')
nibabel.nicom.dicomwrappers.WrapperError: Calculated shape does not match number of frames.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions