From 4885bec0a6930edd00759e055bd3e427a360a28d Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 14 Apr 2022 19:37:26 -0400 Subject: [PATCH 01/14] add entity table order --- dcm2bids/structure.py | 22 ++++++++++++++++++++-- dcm2bids/utils.py | 6 ++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 94ea9d19..f7ce3e13 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -207,7 +207,7 @@ def dstRoot(self): return opj( self.participant.directory, self.dataType, - self.participant.prefix + self.suffix, + self.set_order_entity_table(), ) @property @@ -219,9 +219,27 @@ def dstIntendedFor(self): return opj( self.participant.session, self.dataType, - self.participant.prefix + self.suffix, + self.set_order_entity_table(), ) + def set_order_entity_table(self): + curr_name = self.participant.prefix + self.suffix + new_name = '' + curr_dict = dict(x.split("-") for x in curr_name.split("_") if len(x.split('-'))==2) + ext = [x for x in curr_name.split("_") if len(x.split('-'))==1] + + for curr_key in DEFAULT.entityTableKeys: + if curr_key in curr_dict.keys(): + new_name = '_'.join([new_name, curr_key + '-' + + curr_dict[curr_key]]) + curr_dict.pop(curr_key, None) + for curr_key in curr_dict.keys(): + new_name = '_'.join([new_name, curr_key + '-' + + curr_dict[curr_key]]) + new_name = new_name[1:] + new_name = '_'.join([new_name,ext[0]]) + return new_name + @property def intendedFor(self): return self._intendedFor diff --git a/dcm2bids/utils.py b/dcm2bids/utils.py index 4fae5c2f..20101a8a 100644 --- a/dcm2bids/utils.py +++ b/dcm2bids/utils.py @@ -37,6 +37,12 @@ class DEFAULT(object): runTpl = "_run-{:02d}" caseSensitive = True + # Entity table: + # https://bids-specification.readthedocs.io/en/latest/99-appendices/04-entity-table.html#appendix-iv-entity-table + entityTableKeys = ["sub","ses","task","acq","ce","rec","dir", + "run","mod","echo","flip","inv","mt","part", + "recording"] + # misc tmpDirName = "tmp_dcm2bids" helperDir = "helper" From 5d73836d75c18171a9b7d94130a993b9b765cc34 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 14 Apr 2022 19:51:28 -0400 Subject: [PATCH 02/14] add docstring --- dcm2bids/structure.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index f7ce3e13..a7ce0f80 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -223,6 +223,11 @@ def dstIntendedFor(self): ) def set_order_entity_table(self): + """ + Return: + The destination filename formated following BIDS entity key table + https://bids-specification.readthedocs.io/en/latest/99-appendices/04-entity-table.html#appendix-iv-entity-table + """ curr_name = self.participant.prefix + self.suffix new_name = '' curr_dict = dict(x.split("-") for x in curr_name.split("_") if len(x.split('-'))==2) @@ -233,6 +238,7 @@ def set_order_entity_table(self): new_name = '_'.join([new_name, curr_key + '-' + curr_dict[curr_key]]) curr_dict.pop(curr_key, None) + for curr_key in curr_dict.keys(): new_name = '_'.join([new_name, curr_key + '-' + curr_dict[curr_key]]) From fc38fdadc8b6c6071d949a973efa28678d46f4c1 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 14 Apr 2022 20:12:31 -0400 Subject: [PATCH 03/14] add warning message --- dcm2bids/structure.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index a7ce0f80..cc9fae5a 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -2,7 +2,7 @@ """k""" - +import logging from os.path import join as opj from future.utils import iteritems from .utils import DEFAULT @@ -132,6 +132,8 @@ def __init__( self.customLabels = customLabels self.srcSidecar = srcSidecar + self.logger = logging.getLogger(__name__) + if sidecarChanges is None: self.sidecarChanges = {} else: @@ -240,6 +242,9 @@ def set_order_entity_table(self): curr_dict.pop(curr_key, None) for curr_key in curr_dict.keys(): + self.logger.warning( + "Entity \"%s\" is not a valid BIDS entity.", curr_key + ) new_name = '_'.join([new_name, curr_key + '-' + curr_dict[curr_key]]) new_name = new_name[1:] From 307797879ea79b1f14b3222397f641f487ac2f07 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 14 Apr 2022 20:16:19 -0400 Subject: [PATCH 04/14] fix pep8 --- dcm2bids/structure.py | 8 +++----- dcm2bids/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index cc9fae5a..094d20ed 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -232,8 +232,8 @@ def set_order_entity_table(self): """ curr_name = self.participant.prefix + self.suffix new_name = '' - curr_dict = dict(x.split("-") for x in curr_name.split("_") if len(x.split('-'))==2) - ext = [x for x in curr_name.split("_") if len(x.split('-'))==1] + curr_dict = dict(x.split("-") for x in curr_name.split("_") if len(x.split('-')) == 2) + ext = [x for x in curr_name.split("_") if len(x.split('-')) == 1] for curr_key in DEFAULT.entityTableKeys: if curr_key in curr_dict.keys(): @@ -248,7 +248,7 @@ def set_order_entity_table(self): new_name = '_'.join([new_name, curr_key + '-' + curr_dict[curr_key]]) new_name = new_name[1:] - new_name = '_'.join([new_name,ext[0]]) + new_name = '_'.join([new_name, ext[0]]) return new_name @property @@ -278,14 +278,12 @@ def indexSidecar(self, value): """ self._indexSidecar = value - def dstSidecarData(self, descriptions, intendedForList): """ """ data = self.srcSidecar.origData data["Dcm2bidsVersion"] = __version__ - # intendedFor key if self.intendedFor != [None]: intendedValue = [] diff --git a/dcm2bids/utils.py b/dcm2bids/utils.py index 20101a8a..19481317 100644 --- a/dcm2bids/utils.py +++ b/dcm2bids/utils.py @@ -39,8 +39,8 @@ class DEFAULT(object): # Entity table: # https://bids-specification.readthedocs.io/en/latest/99-appendices/04-entity-table.html#appendix-iv-entity-table - entityTableKeys = ["sub","ses","task","acq","ce","rec","dir", - "run","mod","echo","flip","inv","mt","part", + entityTableKeys = ["sub", "ses", "task", "acq", "ce", "rec", "dir", + "run", "mod", "echo", "flip", "inv", "mt", "part", "recording"] # misc From 8a16cbabb8e5a27152b6ba7b87ae6d0970fd1949 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 11:19:14 -0400 Subject: [PATCH 05/14] Update dcm2bids/structure.py Co-authored-by: Samuel Guay --- dcm2bids/structure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 094d20ed..ed2b0bd4 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -227,8 +227,8 @@ def dstIntendedFor(self): def set_order_entity_table(self): """ Return: - The destination filename formated following BIDS entity key table - https://bids-specification.readthedocs.io/en/latest/99-appendices/04-entity-table.html#appendix-iv-entity-table + The destination filename formatted following the v1.7.0 BIDS entity key table + https://bids-specification.readthedocs.io/en/v1.7.0/99-appendices/04-entity-table.html """ curr_name = self.participant.prefix + self.suffix new_name = '' From 4917144ba182b1d2ae3b1ce858e03b29cf05e816 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 11:19:26 -0400 Subject: [PATCH 06/14] Update dcm2bids/utils.py Co-authored-by: Samuel Guay --- dcm2bids/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/utils.py b/dcm2bids/utils.py index 19481317..fbffa859 100644 --- a/dcm2bids/utils.py +++ b/dcm2bids/utils.py @@ -38,7 +38,7 @@ class DEFAULT(object): caseSensitive = True # Entity table: - # https://bids-specification.readthedocs.io/en/latest/99-appendices/04-entity-table.html#appendix-iv-entity-table + # https://bids-specification.readthedocs.io/en/v1.7.0/99-appendices/04-entity-table.html entityTableKeys = ["sub", "ses", "task", "acq", "ce", "rec", "dir", "run", "mod", "echo", "flip", "inv", "mt", "part", "recording"] From db9486a0e3d523d93b3ed11fac46aaff3b7d8b23 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 11:44:05 -0400 Subject: [PATCH 07/14] Update dcm2bids/structure.py Co-authored-by: Samuel Guay --- dcm2bids/structure.py | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index ed2b0bd4..ba653e1f 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -230,25 +230,38 @@ def set_order_entity_table(self): The destination filename formatted following the v1.7.0 BIDS entity key table https://bids-specification.readthedocs.io/en/v1.7.0/99-appendices/04-entity-table.html """ - curr_name = self.participant.prefix + self.suffix + current_name = self.participant.prefix + self.suffix new_name = '' - curr_dict = dict(x.split("-") for x in curr_name.split("_") if len(x.split('-')) == 2) - ext = [x for x in curr_name.split("_") if len(x.split('-')) == 1] + current_dict = dict(x.split("-") for x in current_name.split("_") if len(x.split('-')) == 2) + suffix_list = [x for x in current_name.split("_") if len(x.split('-')) == 1] - for curr_key in DEFAULT.entityTableKeys: - if curr_key in curr_dict.keys(): - new_name = '_'.join([new_name, curr_key + '-' + - curr_dict[curr_key]]) - curr_dict.pop(curr_key, None) + for current_key in DEFAULT.entityTableKeys: + if current_key in current_dict and new_name != '': + new_name += f"_{current_key}-{current_dict[current_key]}" + elif current_key in current_dict: + new_name = f"{current_key}-{current_dict[current_key]}" + current_dict.pop(current_key, None) - for curr_key in curr_dict.keys(): + for current_key in current_dict: self.logger.warning( - "Entity \"%s\" is not a valid BIDS entity.", curr_key - ) - new_name = '_'.join([new_name, curr_key + '-' + - curr_dict[curr_key]]) - new_name = new_name[1:] - new_name = '_'.join([new_name, ext[0]]) + f"Entity '{current_key}' is not a valid BIDS entity." + ) + new_name = f"{new_name}_{current_key}-{current_dict[current_key]}" + + new_name = f"{new_name}_{'_'.join(suffix_list)}" # Allow multiple single key (without value) + + if len(suffix_list) != 1: + self.logger.warning( + f"There was more than one suffix found ({suffix_list}), this is not BIDS compliant. Make sure you know what you are doing." + ) + + if current_name != new_name: + self.logger.warning( + f"""✅ Filename was reordered according to BIDS entity table order: + from: {current_name} + to: {new_name}""" + ) + return new_name @property From a8648be7e35c4e850cdd46475450465ee852555b Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 18:13:41 -0400 Subject: [PATCH 08/14] Fix multiple print when reordering entities --- dcm2bids/dcm2bids.py | 12 ++++++------ dcm2bids/sidecar.py | 10 +++++----- dcm2bids/structure.py | 42 ++++++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/dcm2bids/dcm2bids.py b/dcm2bids/dcm2bids.py index a96a1b45..6b842e07 100644 --- a/dcm2bids/dcm2bids.py +++ b/dcm2bids/dcm2bids.py @@ -141,11 +141,9 @@ def run(self): intendedForList = [[] for i in range(len(parser.descriptions))] for acq in parser.acquisitions: + acq.setDstFile() intendedForList = self.move(acq, intendedForList) - check_latest() - check_latest("dcm2niix") - def move(self, acquisition, intendedForList): """Move an acquisition to BIDS format""" for srcFile in glob(acquisition.srcRoot + ".*"): @@ -153,8 +151,6 @@ def move(self, acquisition, intendedForList): _, ext = splitext_(srcFile) dstFile = os.path.join(self.bidsDir, acquisition.dstRoot + ext) - # os.makedirs(os.path.dirname(dstFile), exist_ok=True) - # python2 compatibility if not os.path.exists(os.path.dirname(dstFile)): os.makedirs(os.path.dirname(dstFile)) @@ -196,11 +192,12 @@ def move(self, acquisition, intendedForList): os.rename(srcFile, dstFile) intendedFile = acquisition.dstIntendedFor + ".nii.gz" - if not intendedFile in intendedForList[acquisition.indexSidecar]: + if intendedFile not in intendedForList[acquisition.indexSidecar]: intendedForList[acquisition.indexSidecar].append(intendedFile) return intendedForList + def get_arguments(): """Load arguments for main""" parser = argparse.ArgumentParser( @@ -298,6 +295,9 @@ def main(): ) return 1 + check_latest() + check_latest("dcm2niix") + app = Dcm2bids(**vars(args)) return app.run() diff --git a/dcm2bids/sidecar.py b/dcm2bids/sidecar.py index 2ffbd820..7085b6b2 100644 --- a/dcm2bids/sidecar.py +++ b/dcm2bids/sidecar.py @@ -158,7 +158,7 @@ def build_graph(self): for sidecar, description in possibleLinks: criteria = description.get("criteria", None) if criteria and self.isLink(sidecar.data, criteria): - graph[sidecar].append(description) + graph[sidecar].append(description) self.graph = graph @@ -189,7 +189,7 @@ def compare(name, pattern): result = [] for tag, pattern in iteritems(criteria): - name = data.get(tag, '')# or '' + name = data.get(tag, '') if isinstance(name, list): try: @@ -217,7 +217,6 @@ def build_acquisitions(self, participant): self.logger.info("Sidecars pairing:") for sidecar, valid_descriptions in iteritems(self.graph): - #for sidecar, descriptions in iteritems(self.graph): sidecarName = os.path.basename(sidecar.root) # only one description for the sidecar @@ -242,13 +241,14 @@ def build_acquisitions(self, participant): else: self.logger.warning("Several Pairing <- %s", sidecarName) for desc in valid_descriptions: - acq = Acquisition(participant, indexSidecar=self.descriptions.index(desc), + acq = Acquisition(participant, + indexSidecar=self.descriptions.index(desc), **desc) self.logger.warning(" -> %s", acq.suffix) self.acquisitions = acquisitions + acquisitions_intendedFor - return acquisitions + acquisitions_intendedFor + return self.acquisitions def find_runs(self): """ diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index ba653e1f..2b9fe5e9 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -"""k""" +"""Participant class""" import logging from os.path import join as opj @@ -121,6 +121,8 @@ def __init__( IntendedFor=None, **kwargs ): + self.logger = logging.getLogger(__name__) + self._modalityLabel = "" self._customLabels = "" self._intendedFor = None @@ -132,8 +134,6 @@ def __init__( self.customLabels = customLabels self.srcSidecar = srcSidecar - self.logger = logging.getLogger(__name__) - if sidecarChanges is None: self.sidecarChanges = {} else: @@ -144,6 +144,9 @@ def __init__( else: self.intendedFor = intendedFor + self.bidsCompliant = {} + self.dstFile = '' + def __eq__(self, other): return ( self.dataType == other.dataType @@ -209,7 +212,7 @@ def dstRoot(self): return opj( self.participant.directory, self.dataType, - self.set_order_entity_table(), + self.dstFile, ) @property @@ -221,15 +224,16 @@ def dstIntendedFor(self): return opj( self.participant.session, self.dataType, - self.set_order_entity_table(), + self.dstFile, ) - def set_order_entity_table(self): + def setDstFile(self): """ Return: The destination filename formatted following the v1.7.0 BIDS entity key table https://bids-specification.readthedocs.io/en/v1.7.0/99-appendices/04-entity-table.html """ + bidsCompliant = [] current_name = self.participant.prefix + self.suffix new_name = '' current_dict = dict(x.split("-") for x in current_name.split("_") if len(x.split('-')) == 2) @@ -243,26 +247,32 @@ def set_order_entity_table(self): current_dict.pop(current_key, None) for current_key in current_dict: - self.logger.warning( - f"Entity '{current_key}' is not a valid BIDS entity." - ) new_name = f"{new_name}_{current_key}-{current_dict[current_key]}" - new_name = f"{new_name}_{'_'.join(suffix_list)}" # Allow multiple single key (without value) + if current_dict: + self.logger.warning("Entity \"{}\"".format(list(current_dict.keys())) + + " is not a valid BIDS entity.") + + new_name = f"{new_name}_{'_'.join(suffix_list)}" # Allow multiple single key (without value) if len(suffix_list) != 1: - self.logger.warning( - f"There was more than one suffix found ({suffix_list}), this is not BIDS compliant. Make sure you know what you are doing." - ) + self.logger.warning("There was more than one suffix found " + "({}), this is not ".format(suffix_list) + + "BIDS compliant. Make sure you know what " + "you are doing.") if current_name != new_name: + bidsCompliant.append({'name': new_name, + 'old_name': current_name}) self.logger.warning( f"""✅ Filename was reordered according to BIDS entity table order: from: {current_name} - to: {new_name}""" - ) + to: {new_name}""") + + for d in bidsCompliant: + self.bidsCompliant.update(d) - return new_name + self.dstFile = new_name @property def intendedFor(self): From 55dde246d26f71d82fd822d80ff10384b3d79514 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 20:24:16 -0400 Subject: [PATCH 09/14] fix tests --- dcm2bids/sidecar.py | 1 + dcm2bids/structure.py | 4 ---- tests/test_dcm2bids.py | 3 +-- tests/test_structure.py | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dcm2bids/sidecar.py b/dcm2bids/sidecar.py index 7085b6b2..f3ad1ae5 100644 --- a/dcm2bids/sidecar.py +++ b/dcm2bids/sidecar.py @@ -225,6 +225,7 @@ def build_acquisitions(self, participant): acq = Acquisition(participant, srcSidecar=sidecar, **desc) acq.indexSidecar = self.descriptions.index(desc) + acq.setDstFile() if acq.intendedFor != [None]: acquisitions_intendedFor.append(acq) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 2b9fe5e9..9af2075b 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -144,7 +144,6 @@ def __init__( else: self.intendedFor = intendedFor - self.bidsCompliant = {} self.dstFile = '' def __eq__(self, other): @@ -269,9 +268,6 @@ def setDstFile(self): from: {current_name} to: {new_name}""") - for d in bidsCompliant: - self.bidsCompliant.update(d) - self.dstFile = new_name @property diff --git a/tests/test_dcm2bids.py b/tests/test_dcm2bids.py index 7330a684..d20d3b34 100644 --- a/tests/test_dcm2bids.py +++ b/tests/test_dcm2bids.py @@ -96,8 +96,7 @@ def test_caseSensitive_false(): app.run() layout = BIDSLayout(bidsDir.name, - validate=False, - ignore='tmp_dcm2bids') + validate=False) path_dwi = os.path.join(bidsDir.name, "sub-01", diff --git a/tests/test_structure.py b/tests/test_structure.py index 396c3086..6f374871 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -30,4 +30,5 @@ def test_acquisition_get_dst_path(name, session, modality, custom, expected): participant = Participant(name, session) acquisition = Acquisition(participant, "anat", modality, customLabels=custom) + acquisition.setDstFile() assert acquisition.dstRoot == expected From fb77dd5fac8465d520b914acbebe5fc75185baa4 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 21:16:29 -0400 Subject: [PATCH 10/14] remove relicat --- dcm2bids/structure.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 9af2075b..dcb9a81d 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -232,7 +232,6 @@ def setDstFile(self): The destination filename formatted following the v1.7.0 BIDS entity key table https://bids-specification.readthedocs.io/en/v1.7.0/99-appendices/04-entity-table.html """ - bidsCompliant = [] current_name = self.participant.prefix + self.suffix new_name = '' current_dict = dict(x.split("-") for x in current_name.split("_") if len(x.split('-')) == 2) @@ -261,8 +260,6 @@ def setDstFile(self): "you are doing.") if current_name != new_name: - bidsCompliant.append({'name': new_name, - 'old_name': current_name}) self.logger.warning( f"""✅ Filename was reordered according to BIDS entity table order: from: {current_name} From c5814a917c788a3f1723789f29ee69c8ec61be50 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 21:51:28 -0400 Subject: [PATCH 11/14] Update dcm2bids/structure.py Co-authored-by: Samuel Guay --- dcm2bids/structure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index dcb9a81d..5763cec3 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -255,8 +255,8 @@ def setDstFile(self): if len(suffix_list) != 1: self.logger.warning("There was more than one suffix found " - "({}), this is not ".format(suffix_list) + - "BIDS compliant. Make sure you know what " + f"({suffix_list}). this is not BIDS " + "compliant. Make sure you know what" "you are doing.") if current_name != new_name: From 943a8046c39b0e6ea867360dde58391e1822b5c2 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 21:51:45 -0400 Subject: [PATCH 12/14] Update dcm2bids/structure.py Co-authored-by: Samuel Guay --- dcm2bids/structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 5763cec3..b808699f 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -251,7 +251,7 @@ def setDstFile(self): self.logger.warning("Entity \"{}\"".format(list(current_dict.keys())) + " is not a valid BIDS entity.") - new_name = f"{new_name}_{'_'.join(suffix_list)}" # Allow multiple single key (without value) + new_name += f"_{'_'.join(suffix_list)}" # Allow multiple single key (without value) if len(suffix_list) != 1: self.logger.warning("There was more than one suffix found " From 312e1084b5782ad9e7ba3c0404e2928b796a9b48 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 21:51:54 -0400 Subject: [PATCH 13/14] Update dcm2bids/structure.py Co-authored-by: Samuel Guay --- dcm2bids/structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index b808699f..860245e5 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -245,7 +245,7 @@ def setDstFile(self): current_dict.pop(current_key, None) for current_key in current_dict: - new_name = f"{new_name}_{current_key}-{current_dict[current_key]}" + new_name += f"_current_key}-{current_dict[current_key]}" if current_dict: self.logger.warning("Entity \"{}\"".format(list(current_dict.keys())) + From 545b267dee937bcc6d01098f478da4e5424d151a Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Apr 2022 21:56:54 -0400 Subject: [PATCH 14/14] fix typo --- dcm2bids/structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/structure.py b/dcm2bids/structure.py index 860245e5..72156820 100644 --- a/dcm2bids/structure.py +++ b/dcm2bids/structure.py @@ -245,7 +245,7 @@ def setDstFile(self): current_dict.pop(current_key, None) for current_key in current_dict: - new_name += f"_current_key}-{current_dict[current_key]}" + new_name += f"_{current_key}-{current_dict[current_key]}" if current_dict: self.logger.warning("Entity \"{}\"".format(list(current_dict.keys())) +