Skip to content

Commit

Permalink
added storing dictionary in break dyanamic alignment with CT
Browse files Browse the repository at this point in the history
  • Loading branch information
pjmark committed Jan 9, 2024
1 parent 2483517 commit e46b35b
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions amypet/align_brkdyn_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@



def align_break_petct(niidat, cts, Cnt, qcpth=None, refpetidx=None):
def align_break_petct(niidat, cts, Cnt, qcpth=None, refpetidx=None, use_stored=False):

Check failure on line 22 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L22

E303 too many blank lines (3)
Raw output
amypet/align_brkdyn_ct.py:22:1: E303 too many blank lines (3)
'''
Align PET images in break dynamic acquisition
using the CT for aligning all frames within each acquisition
Expand All @@ -39,6 +39,23 @@ def align_break_petct(niidat, cts, Cnt, qcpth=None, refpetidx=None):
used as reference instead.
'''

# > output path from the input dictionary
opth = niidat['outpath'].parent

# > output path for alignment of CTs
algnFpth = opth/(f'aligned_full')

Check failure on line 46 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L46

F541 f-string is missing placeholders
Raw output
amypet/align_brkdyn_ct.py:46:22: F541 f-string is missing placeholders
affsF = algnFpth/'combined_affines'

Check failure on line 48 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L48

W293 blank line contains whitespace
Raw output
amypet/align_brkdyn_ct.py:48:1: W293 blank line contains whitespace
nimpa.create_dir(algnFpth)
nimpa.create_dir(affsF)

# > output dictionary file
fout = algnFpth/'aligned_full_output.npy'
if use_stored and fout.is_file():
outdct = np.load(fout, allow_pickle=True)
outdct = outdct.item()
return outdct

# > number of frames for break dynamic acquisitions A and B
nfrmA = len(niidat['series'][0])
nfrmB = len(niidat['series'][1])
Expand All @@ -65,14 +82,7 @@ def align_break_petct(niidat, cts, Cnt, qcpth=None, refpetidx=None):
# > alignment results
algn_frm = [None, None]

opth = niidat['outpath'].parent

# > output path for alignment of CTs
algnFpth = opth/(f'aligned_full')
affsF = algnFpth/'combined_affines'

Check failure on line 85 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L85

W293 blank line contains whitespace
Raw output
amypet/align_brkdyn_ct.py:85:1: W293 blank line contains whitespace
nimpa.create_dir(algnFpth)
nimpa.create_dir(affsF)

if qcpth is None:

Check failure on line 87 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L87

E303 too many blank lines (3)
Raw output
amypet/align_brkdyn_ct.py:87:5: E303 too many blank lines (3)
qcpth = opth/'QC-output'
Expand Down Expand Up @@ -343,5 +353,7 @@ def align_break_petct(niidat, cts, Cnt, qcpth=None, refpetidx=None):
outdct['faffines'] = faffines
outdct['fnii_com'] = algn_frm[0]['fnii_com'] + algn_frm[1]['fnii_com']

np.save(fout, outdct)

return outdct

Check failure on line 359 in amypet/align_brkdyn_ct.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] amypet/align_brkdyn_ct.py#L359

W391 blank line at end of file
Raw output
amypet/align_brkdyn_ct.py:359:1: W391 blank line at end of file

0 comments on commit e46b35b

Please sign in to comment.