bidskit icon indicating copy to clipboard operation
bidskit copied to clipboard

'SerDesc' key error

Open ChristineFarrugia opened this issue 2 years ago • 2 comments

Hi,

I am trying to run the latest version of bidskit (2022.10.4) but am getting a key error for SerDesc during the second pass (output below).

------------------------------------------------------------
Pass 2 : Populating BIDS directory
------------------------------------------------------------
  Creating subject list from sourcedata contents
  Found 1 subjects in sourcedata folder

------------------------------------------------------------
Processing subject 01
------------------------------------------------------------
  Working subject directory : /mnt/BSC-Data-01/BIDS_Processing/work/bidskit/sub-01
  BIDS subject directory  : /mnt/BSC-Data-01/BIDS_Processing/sub-01
* Excluding protocol localizer
  Organizing t1_mprage_tra_p2_iso
Traceback (most recent call last):
  File "/home/cfarr05/anaconda3/envs/bidskit/bin/bidskit", line 33, in <module>
    sys.exit(load_entry_point('bidskit==2022.10.4', 'console_scripts', 'bidskit')())
  File "/home/cfarr05/anaconda3/envs/bidskit/lib/python3.9/site-packages/bidskit-2022.10.4-py3.9.egg/bidskit/__main__.py", line 289, in main
    d2n.organize_series(
  File "/home/cfarr05/anaconda3/envs/bidskit/lib/python3.9/site-packages/bidskit-2022.10.4-py3.9.egg/bidskit/dcm2niix.py", line 166, in organize_series
    prot_dict = fmaps.add_intended_run(prot_dict, src_meta, run_no[fc])
  File "/home/cfarr05/anaconda3/envs/bidskit/lib/python3.9/site-packages/bidskit-2022.10.4-py3.9.egg/bidskit/fmaps.py", line 413, in add_intended_run
    if prot_dict[info['SerDesc']] in suffixes:
KeyError: 'SerDesc'

Could something be wrong with my protocol translator file? This is what it looks like:

{
    "localizer":[
        "EXCLUDE_BIDS_Directory",
        "EXCLUDE_BIDS_Name",
        "UNASSIGNED"
    ],
    "t1_mprage_tra_p2_iso":[
        "anat",
        "T1w",
        "UNASSIGNED"
    ],
    "t2_space_tra_p2_iso":[
        "anat",
        "T2w",
        "UNASSIGNED"
    ],
    "gre_field_mapping":[
        "fmap",
        "acq-rest",
        ["task-rest_bold"]
    ],
    "EvaSeries_GLM":[
        "EXCLUDE_BIDS_Directory",
        "EXCLUDE_BIDS_Name",
        "UNASSIGNED"
    ],
    "Mean_&_t-Maps":[
        "EXCLUDE_BIDS_Directory",
        "EXCLUDE_BIDS_Name",
        "UNASSIGNED"
    ],
    "acq-p1-s3-3mm_fmri_Motor_left_toe_function":[
        "func",
        "task-rest_bold",
        "UNASSIGNED"
    ],
    "ExternalDesign":[
        "EXCLUDE_BIDS_Directory",
        "EXCLUDE_BIDS_Name",
        "UNASSIGNED"
    ]
}

I'm processing this as rest data because I'm just interested in setting up the pipeline at the moment.

ChristineFarrugia avatar Oct 12 '22 13:10 ChristineFarrugia

Hi @ChristineFarrugia. At first glance, your protocol translator looks fine. Would you be able to share a deidentified minimal version of your DICOM sourcedata? Only include 5 or so images from each series, just to keep bidskit and dcm2niix happy? I can burrow down into why bidskit is missing the SerDesc key at this stage. Send a link via Slack or I can create a secure upload link.

jmtyszka avatar Oct 12 '22 20:10 jmtyszka

Should be fixed now and I've added some handling for deidentified DICOM data without the AcquisitionTime tag. v2022.10.13 has been pushed to PyPi and can be installed using pip install bidskit. Let me know if this new version works at your end.

jmtyszka avatar Oct 13 '22 22:10 jmtyszka

I had the same error, new version gets past the error for me. Thanks!

claytonjschneider avatar Oct 26 '22 15:10 claytonjschneider

Apologies for the late reply. I can confirm that v2022.10.13 solves the problem. Thanks a lot @jmtyszka.

ChristineFarrugia avatar Nov 18 '22 14:11 ChristineFarrugia