Skip to content

Commit 2d684be

Browse files
committed
tests/imtrimup: fix dynamic frames
1 parent 1f0da99 commit 2d684be

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/test_imtrimup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
@pytest.fixture
77
def dyndir(datain, mMRpars):
8-
# definition of dynamic frames for kinetic analysis
9-
frmdef = ["def", [4, 15], [8, 30], [9, 60], [2, 180], [8, 300]]
108
# output path
119
opth = str(Path(datain["corepath"]).parent / "amypad" / "dyndir")
1210

1311
res = Path(opth) / "PET" / "multiple-frames"
14-
if res.is_dir():
12+
if res.is_dir() and len(list(res.glob('*.nii*'))) > 1:
1513
return res
1614

1715
nipet = pytest.importorskip("niftypet.nipet")
1816
hst = nipet.mmrhist(datain, mMRpars)
1917
# offset for the time from which meaningful events are detected
2018
toff = nipet.lm.get_time_offset(hst)
2119
# dynamic frame timings
20+
# frmdef = ["def", [4, 15], [8, 30], [9, 60], [2, 180], [8, 300]]
21+
frmdef = ["def", [4, (hst['t1'] - hst['t0'] - toff) / 4]]
2222
frm_timings = nipet.lm.dynamic_timings(frmdef, offset=toff)
23-
nipet.lm.draw_frames(hst, frm_timings["timings"])
23+
# nipet.lm.draw_frames(hst, frm_timings["timings"]) # plot frames
2424
# hardware mu-map
2525
muhdct = nipet.hdw_mumap(datain, [1, 2, 4], mMRpars, outpath=opth, use_stored=True)
2626

@@ -30,6 +30,7 @@ def dyndir(datain, mMRpars):
3030
mMRpars,
3131
outpath=opth,
3232
store=True,
33+
use_stored=True,
3334
hst=hst,
3435
itr=2,
3536
petopt="ac",
@@ -44,7 +45,7 @@ def dyndir(datain, mMRpars):
4445
mMRpars,
4546
frames=frm_timings["timings"],
4647
mu_h=muhdct,
47-
mu_o=mupdct, # muodct,
48+
mu_o=mupdct,
4849
itr=5,
4950
fwhm=0.0,
5051
outpath=opth,
@@ -55,7 +56,7 @@ def dyndir(datain, mMRpars):
5556
return Path(opth) / "PET" / "multiple-frames"
5657

5758

58-
@pytest.mark.timeout(2 * 60 * 60) # 2h
59+
@pytest.mark.timeout(30 * 60) # 30m
5960
def test_imtrimup(dyndir):
6061
imtrimup = pytest.importorskip("amypet.imtrimup")
61-
imtrimup.run(dyndir)
62+
imtrimup.run(dyndir, glob='*_frm?_t*.nii*')

0 commit comments

Comments
 (0)