Skip to content

Commit

Permalink
fix for pd+t2 naming scheme, and parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed Oct 15, 2020
1 parent a499563 commit 1d5f697
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions etc/pdt2_bids_corrector.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
#in the case of echo-1, the EchoNumber tag does not exist in the json file
if ("EchoNumber" not in data) and ("_echo_" in i):
js_addEchoNum = re.sub("_echo_", "_echo-1_", i)
js_changeEnding = re.sub("PDT2.*", "PDT2.json", js_addEchoNum)
js_changeEnding = re.sub("_PDT2[0-9]+.*", "_PDT2.json", js_addEchoNum)
print('renaming: '+i+' to '+js_changeEnding)
os.rename(i, js_changeEnding)

ni_addEchoNum = re.sub("_echo_", "_echo-1_", k)
ni_changeEnding = re.sub("PDT2.*", "PDT2.nii.gz", ni_addEchoNum)
ni_changeEnding = re.sub("_PDT2[0-9]+.*", "_PDT2.nii.gz", ni_addEchoNum)
print('renaming: '+k+' to '+ni_changeEnding)
os.rename(k, ni_changeEnding)

Expand All @@ -43,12 +43,12 @@
echonum = data["EchoNumber"]

js_addEchoNum = re.sub("_echo_", "_echo-" + str(echonum) + "_", i)
js_changeEnding = re.sub("PDT2.*", "PDT2.json", js_addEchoNum)
js_changeEnding = re.sub("_PDT2[0-9]+.*", "_PDT2.json", js_addEchoNum)
print('renaming: '+i+' to '+js_changeEnding)
os.rename(i, js_changeEnding)

ni_addEchoNum = re.sub("_echo_", "_echo-" + str(echonum) + "_", k)
ni_changeEnding = re.sub("PDT2.*", "PDT2.nii.gz", ni_addEchoNum)
ni_changeEnding = re.sub("_PDT2[0-9]+.*", "_PDT2.nii.gz", ni_addEchoNum)
print('renaming: '+k+' to '+ni_changeEnding)
os.rename(k, ni_changeEnding)

6 changes: 3 additions & 3 deletions heuristics/cfmm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def infotodict(seqinfo):
#tse tra T2w


if ('pd_t2_tse_tra' in s.series_description):
if ('pd_t2_tse_tra' in s.series_description or 'pd+t2_tse_tra' in s.series_description):
if ('ND' in (s.image_type[3].strip())):
info[pd_t2_tse_tra].append({'item': s.series_id})
if ('DIS3D' in (s.image_type[3].strip())):
Expand All @@ -391,15 +391,15 @@ def infotodict(seqinfo):


#tse cor T2w
elif ('pd_t2_tse_cor' in s.series_description):
elif ('pd_t2_tse_cor' in s.series_description or 'pd+t2_tse_cor' in s.series_description):
if ('ND' in (s.image_type[3].strip())):
info[pd_t2_tse_cor].append({'item': s.series_id})
if ('DIS3D' in (s.image_type[3].strip())):
info[DIS3D_pd_t2_tse_cor].append({'item': s.series_id})
if ('DIS2D' in (s.image_type[3].strip())):
info[DIS2D_pd_t2_tse_cor].append({'item': s.series_id})

elif ('pd_t2_tse' in s.series_description):
elif ('pd_t2_tse' in s.series_description or 'pd+t2_tse' in s.series_description):
if ('ND' in (s.image_type[3].strip())):
info[pd_t2_tse].append({'item': s.series_id})
if ('DIS3D' in (s.image_type[3].strip())):
Expand Down

0 comments on commit 1d5f697

Please sign in to comment.