Skip to content

Commit

Permalink
fixed potential problem with radioactivity injection time in dcmsort()
Browse files Browse the repository at this point in the history
  • Loading branch information
pjmark authored and casperdcl committed Jun 29, 2023
1 parent d0dc4f8 commit 46de10e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions niftypet/nimpa/prc/imio.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,19 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
trcr = None
if [0x054, 0x016] in dhdr:
trinf = dhdr[0x054, 0x016][0]

if [0x018, 0x1078] in trinf:
val = trinf[0x018, 0x1078].value
if '.' in val:
tinjct = datetime.datetime.strptime(val, '%Y%m%d%H%M%S.%f')
else:
tinjct = datetime.datetime.strptime(val, '%Y%m%d%H%M%S')
elif [0x018, 0x1072] in trinf:
val = trinf[0x018, 0x1072].value
if '.' in val:
tinjct = datetime.datetime.strptime(std_date+val, '%Y%m%d%H%M%S.%f')
else:
tinjct = datetime.datetime.strptime(std_date+val, '%Y%m%d%H%M%S')

if [0x018, 0x031] in trinf:
trcr = trinf[0x018, 0x031].value
Expand Down

0 comments on commit 46de10e

Please sign in to comment.