medpy
medpy copied to clipboard
reduce redundant computation when computing multiple surface distance-based metrics
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:
- make
__surface_distancesaccessible by removing the __ prefix - let all surface metrics take
surface_distances=Noneas 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
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
Sorry for the late reply. Sure I would accept a PR on that :)
Closed due to inactivity.