medpy icon indicating copy to clipboard operation
medpy copied to clipboard

reduce redundant computation when computing multiple surface distance-based metrics

Open FabianIsensee opened this issue 4 years ago • 2 comments

Hi there,

is there a specific reason for __surface_distances being hidden with the __ prefix? Imagine someone (hint: me :-) ) would like to compute multiple surface-based metrics for the same predicted segmentation (ASD, ASSD, HD, HD95 etc). Right now the surface distances (which are expensive to be computed) will need to be recomputed for each metric: that can be a lot of redundant computation.

Suggestion:

  1. make __surface_distances accessible by removing the __ prefix
  2. let all surface metrics take surface_distances=None as additional argument. If it is None, the distances are computed (like they are right now). But users could also choose to precompute the distances and pass them to multiple surface-based metrics and thus save a lot of computation.

Would you be willing to accept a PR on this?

(we would somehow need to handle gt->pred and pred-> gt distances which are sometimes needed, sometimes not. Maybe using two input arguments, one for each)

Best,

Fabian

FabianIsensee avatar May 05 '21 06:05 FabianIsensee

correction: I can import __surface_distances with from medpy.metric.binary import __surface_distances but that is not good practice because __ is telling users not to import it

FabianIsensee avatar May 05 '21 06:05 FabianIsensee

Sorry for the late reply. Sure I would accept a PR on that :)

loli avatar Jun 30 '21 10:06 loli

Closed due to inactivity.

loli avatar Dec 15 '23 17:12 loli