I am using Python and SimpleITK, and I would like to access the raw distance values which are used in the calculation of the Hausdorff Distance in order to calculate the 95% Hausdorff Distance. When I use
sitk.HausdorffDistanceImageFilter I am able to retrieve the maximum distance or the average distance. After looking around at the itk documentation, what I need might be located in itk’s
DirectedHausdorffDistanceImageFilter. However, I don’t know how to access that output from within Python using SimpleITK.
I found this documentation here: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/34_Segmentation_Evaluation.html . However, it shows how to get the raw distance values for a surface-based Hausdorff distance, while the sitk filter uses point based segmentation results. It mentions how these two methods of calculation are not equivalent:
“the Hausdorff distance for the contour/surface representation and the discrete point set representing the segmented object differ, and that there is no correlation between the two.”
After looking more into the documentation, it seems like I could write something in Python using
sitk.SignedMaurerDistanceMap, and looping through the voxels to find the maximum, but it seems kind of inefficient if something optimized in the c++ libraries already exists.
Is there a way to access the “raw” distance values so that I can compute the 95% Hausdorff Distance (or any other percentile, for that matter) and leverage the speed of the itk libraries and use a discrete point set segmented object?
Thank you in advance for your help!