From 63c93bfe53747ec15798a7591167d5954ec57ddb Mon Sep 17 00:00:00 2001 From: Marcel Zwiers Date: Fri, 27 Sep 2024 13:14:56 +0200 Subject: [PATCH] Add more dcm2niix "BidsGuess" entity checks --- bidscoin/plugins/dcm2niix2bids.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bidscoin/plugins/dcm2niix2bids.py b/bidscoin/plugins/dcm2niix2bids.py index 99482e16..4c1e1da4 100644 --- a/bidscoin/plugins/dcm2niix2bids.py +++ b/bidscoin/plugins/dcm2niix2bids.py @@ -511,10 +511,11 @@ def bidscoiner_plugin(session: Path, bidsmap: BidsMap, bidsses: Path) -> Union[N typeguess, targetguess = metadata.get('BidsGuess') or ['', ''] # BidsGuess: [datatype, filename] if typeguess and run.datatype != typeguess: LOGGER.warning(f"The datatype of {run} does not match with the datatype suggested by dcm2niix: {typeguess}") - elif targetguess and run.bids.get('suffix') != bids.get_bidsvalue(targetguess, 'suffix'): + elif targetguess and run.bids['suffix'] != bids.get_bidsvalue(targetguess, 'suffix'): LOGGER.warning(f"The suffix of {run} does not match with the suffix suggested by dcm2niix: {targetguess}") - if targetguess and run.bids.get('dir') and run.bids.get('dir') != bids.get_bidsvalue(targetguess, 'dir'): - LOGGER.warning(f"The (phase-encoding) 'dir' value in {run} does not match with the 'dir' value suggested by dcm2niix: {targetguess}") + for entity in ('part', 'inv', 'echo', 'dir'): + if targetguess and run.bids.get(entity) and run.bids[entity] != bids.get_bidsvalue(targetguess, entity): + LOGGER.warning(f"The '{entity}' value in {run} does not match with the '{entity}' value suggested by dcm2niix: {targetguess}") # Write the scans_table to disk LOGGER.verbose(f"Writing acquisition time data to: {scans_tsv}")