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 908c39a
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 @@ -92,8 +92,8 @@ class QualityMetrics(ImageQualityCallback):
"""From https://github.com/SyneRBI/PETRIC/wiki#metrics-and-thresholds"""
def __init__(self, reference_image, whole_object_mask, background_mask, **kwargs):
super().__init__(reference_image, **kwargs)
self.whole_object_indices = np.where(whole_object_mask == 1)
self.background_indices = np.where(background_mask == 1)
self.whole_object_indices = np.where(whole_object_mask.as_array())
self.background_indices = np.where(background_mask.as_array())
self.ref_im_arr = reference_image.as_array()
self.norm = self.ref_im_arr[self.background_indices].mean()

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 908c39a

Please sign in to comment.