Skip to content

Commit

Permalink
fix metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jul 10, 2024
1 parent 35e45aa commit e909f83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ def get_data(srcdir=".", outdir=OUTDIR, sirf_verbosity=0):

def get_image(fname):
if (source := srcdir / 'PETRIC' / fname).is_file():
return STIR.ImageData(str(source))
return STIR.ImageData(str(source)).as_array()
return None # explicit to suppress linter warnings

reference_image = get_image('reference_image.hv')
whole_object_mask = get_image('VOI_whole_object.hv')
background_mask = get_image('VOI_background.hv')
voi_masks = {
voi.stem: STIR.ImageData(str(voi))
voi.stem: STIR.ImageData(str(voi)).as_array()
for voi in (srcdir / 'PETRIC').glob("VOI_*.hv") if voi.stem[4:] not in ('background', 'whole_object')}

return Dataset(acquired_data, additive_term, mult_factors, OSEM_image, prior, kappa, reference_image,
Expand Down Expand Up @@ -238,7 +238,7 @@ def get_image(fname):
if data.reference_image is not None:
metrics_with_timeout.callbacks.append(
QualityMetrics(data.reference_image, data.whole_object_mask, data.background_mask,
tb_summary_writer=metrics_with_timeout.tb, roi_mask_dict=data.voi_masks))
tb_summary_writer=metrics_with_timeout.tb, voi_mask_dict=data.voi_masks))
metrics_with_timeout.reset() # timeout from now
algo = Submission(data)
try:
Expand Down

0 comments on commit e909f83

Please sign in to comment.