From e909f8320dbd1d7396046c3ea751a2c8bacc4fe8 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 10 Jul 2024 17:56:05 +0100 Subject: [PATCH] fix metrics --- petric.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/petric.py b/petric.py index ec62dc7..d68cd2d 100755 --- a/petric.py +++ b/petric.py @@ -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, @@ -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: