bidskit icon indicating copy to clipboard operation
bidskit copied to clipboard

Cannot convert Tilted CT Scan

Open gauvinalexandre opened this issue 1 year ago • 0 comments

Describe the bug For CT Scan Dicoms that have tilt correction, *.json sidecar is not created. Hence, an error prevents dcm2niix and bidskit from continuing.

To Reproduce Unfortunately, I cannot share my Dicom data to help reproduce the bug. Steps to reproduce the behavior:

  1. Run bidskit with the command bidskit -d <sourcedata-path>
  2. Conversion to nifiti works well until:
  Adding protocol Vol_Bone_0.5__Vol. to dictionary
*** <file-path>/Vol_Bone_0.5_Vol.--s4--e0_Tilt_1.json
*** JSON sidecar not found - returning empty dictionary
Traceback (most recent call last):
  File "/home/algo/software/anaconda3/envs/neuro/bin/bidskit", line 33, in <module>
    sys.exit(load_entry_point('bidskit', 'console_scripts', 'bidskit')())
  File "/home/algo/libs/bidskit/bidskit/__main__.py", line 300, in main
    d2n.organize_series(
  File "/home/algo/libs/bidskit/bidskit/dcm2niix.py", line 142, in organize_series
    ser_desc = src_meta['SeriesDescription'].replace(' ', '_')
KeyError: 'SeriesDescription'
  1. If I copy the *.json sidecar file from he corresponding scan, and rename it with _Tilt_1 suffix, I still get the following error when running the command the second time:
Traceback (most recent call last):
  File "/home/algo/software/anaconda3/envs/neuro/bin/bidskit", line 33, in <module>
    sys.exit(load_entry_point('bidskit', 'console_scripts', 'bidskit')())
  File "/home/algo/libs/bidskit/bidskit/__main__.py", line 300, in main
    d2n.organize_series(
  File "/home/algo/libs/bidskit/bidskit/dcm2niix.py", line 209, in organize_series
    tr.purpose_handling(src_meta,
  File "/home/algo/libs/bidskit/bidskit/translate.py", line 107, in purpose_handling
    scan_seq = bids_meta['ScanningSequence']
KeyError: 'ScanningSequence'

Indeed, when I print the content of bids_meta, I get the following (no key "ScanningSequence"):

dict_keys(['Modality', 'ImagingFrequency', 'Manufacturer', 'ManufacturersModelName', 'InstitutionName', 'InstitutionalDepartmentName', 'InstitutionAddress', 'DeviceSerialNumber', 'StationName', 'BodyPartExamined', 'PatientPosition', 'SoftwareVersions', 'SeriesDescription', 'ProtocolName', 'ScanOptions', 'ImageType', 'SeriesNumber', 'AcquisitionTime', 'AcquisitionNumber', 'ConvolutionKernel', 'ExposureTime', 'XRayTubeCurrent', 'XRayExposure', 'ImageOrientationPatientDICOM', 'ConversionSoftware', 'ConversionSoftwareVersion'])

Expected behavior I'd hope to be able to use bidskit to convert and organize my ct scans, including the tilted version.

Desktop (please complete the following information):

  • OS: Ubuntu 23.04

gauvinalexandre avatar Aug 18 '23 00:08 gauvinalexandre