From 7daf15717168cc4fc9ef9de2f5c4ac1f3d8d097a Mon Sep 17 00:00:00 2001 From: Steven Meisler Date: Mon, 7 Aug 2023 13:47:55 -0400 Subject: [PATCH 1/3] Update acquisition.py --- dcm2bids/acquisition.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dcm2bids/acquisition.py b/dcm2bids/acquisition.py index f7b7eccf..30d02fa9 100644 --- a/dcm2bids/acquisition.py +++ b/dcm2bids/acquisition.py @@ -211,8 +211,8 @@ def dstSidecarData(self, idList): if not isinstance(value, list): value = [value] - for val in value: - if isinstance(val, str) or isinstance(val, bool): + for val in value: + if isinstance(val, (bool, str, int, float)): if val not in idList and key in DEFAULT.keyWithPathsidecar_changes: logging.warning(f"No id found for '{key}' value '{val}'.") logging.warning(f"No sidecar changes for field '{key}' " @@ -221,7 +221,7 @@ def dstSidecarData(self, idList): "with this id.") else: values.append(idList.get(val, val)) - if values[-1] != val: + if values[-1] != val and isinstance(values[-1], str): if isinstance(values[-1], list): values[-1] = "bids::" + values[-1][0] else: From 1e09113dc6f7fec6eb433bb4643cc0b44091ff47 Mon Sep 17 00:00:00 2001 From: Steven Meisler Date: Mon, 7 Aug 2023 13:51:11 -0400 Subject: [PATCH 2/3] remove extra space --- dcm2bids/acquisition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/acquisition.py b/dcm2bids/acquisition.py index 30d02fa9..8dc02327 100644 --- a/dcm2bids/acquisition.py +++ b/dcm2bids/acquisition.py @@ -211,7 +211,7 @@ def dstSidecarData(self, idList): if not isinstance(value, list): value = [value] - for val in value: + for val in value: if isinstance(val, (bool, str, int, float)): if val not in idList and key in DEFAULT.keyWithPathsidecar_changes: logging.warning(f"No id found for '{key}' value '{val}'.") From c828f665e63002566d54d7892e0c0e861bca7f99 Mon Sep 17 00:00:00 2001 From: Steven Meisler Date: Mon, 7 Aug 2023 13:54:55 -0400 Subject: [PATCH 3/3] Update acquisition.py revert: remove conditional searching for strings --- dcm2bids/acquisition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/acquisition.py b/dcm2bids/acquisition.py index 8dc02327..b327b3b1 100644 --- a/dcm2bids/acquisition.py +++ b/dcm2bids/acquisition.py @@ -221,7 +221,7 @@ def dstSidecarData(self, idList): "with this id.") else: values.append(idList.get(val, val)) - if values[-1] != val and isinstance(values[-1], str): + if values[-1] != val: if isinstance(values[-1], list): values[-1] = "bids::" + values[-1][0] else: