segmetrics.contour
- class segmetrics.contour.ContourMeasure(*args, correspondance_function: Literal['min', 'max'] = 'min', **kwargs)
Bases:
ImageMeasureMixin
,Measure
Defines a performance measure which is based on the spatial distances of binary volumes (images).
- class segmetrics.contour.Hausdorff(quantile: float = 1, **kwargs)
Bases:
ContourMeasure
Defines the Hausdorff distsance between two binary images.
The Hausdorff distsance is the maximum Euclidean distance of the ground truth contour to the segmented contour. The Hausdorff distsance is not upper-bounded. Lower values correspond to better segmentation performance.
- Parameters:
quantile – Specifies the quantile of the Hausdorff distsance. The default
quantile=1
corresponds to the Hausdorff distance described by Bamford (2003). Any other positive value forquantile
corresponds to the quantile method introduced by Rucklidge (1997).
References:
P. Bamford, “Empirical comparison of cell segmentation algorithms using an annotated dataset,” in Proc. Int. Conf. Image Proc., 1612 vol. 2, 2003, pp. II-1073–1076.
W. J. Rucklidge, “Efficiently locating objects using the Hausdorff distance.” International Journal of computer vision 24.3 (1997): 251-270.
- class segmetrics.contour.NSD(*args, correspondance_function: Literal['min', 'max'] = 'min', **kwargs)
Bases:
ContourMeasure
Defines the normalized sum of distsances between two binary images.
Let \(R\) be the set of all image pixels corresponding to the ground truth segmentation, and \(S\) the set of those corresponding to the segmentation result. Moreover, let \(\operatorname{dist}_{\partial R} \left(x\right) = \min_{x' \in \partial R}\left\|x - x'\right\|\) be the Euclidean distance of an image point \(x\) to the contour \(\partial R\) of the ground truth segmentation \(R\). Then, the normalized sum of distances is defined as
\[\mathrm{NSD} = \sum_{x \in R \triangle S} \operatorname{dist}_{\partial R}\left(x\right) / \sum_{x \in R \cup S} \operatorname{dist}_{\partial R}\left(x\right),\]where \(R \triangle S = \left(R \setminus S\right) \cup \left(S \setminus R\right)\) is the symmetric difference of \(R\) and \(S\). \(\mathrm{NSD}\) attains values between \(0\) and \(1\). Lower values correspond to better segmentation performance.