Distance between two segments

Yes this is why I wrote that you’ll need the minimum Hausdorff, which will be the distance between the two closest points. As @lassoan says it’s usually 0 because usually we compare two segments representing the same objects (so they overlap). So this is why it’s not shown in Segment Statistics UI (I thought for some reason that it was). I’m not aware of any method for getting this number on the UI, but this is some python code that will get it for you:

import vtkSlicerSegmentComparisonModuleLogicPython
s=getNode('vtkMRMLSegmentationNode1') # Whatever your input is
p1=s.GetClosedSurfaceRepresentation('Segment_1') # Again, depends on your input. If it's not a segmentation then you'll need to access the model nodes
p2=s.GetClosedSurfaceRepresentation('Segment_2')
pdf=vtkSlicerSegmentComparisonModuleLogicPython.vtkPolyDataDistanceHistogramFilter()
pdf.SetInputReferencePolyData(p1)
pdf.SetInputComparePolyData(p2)
pdf.Update()
pdf.GetNthPercentileHausdorffDistance(0)
1 Like