Hausdorff and Dice calculation principle

Dear Slicer Users,
sorry if this question is stupid but I realize I am not sure about the principle of DICE coef or Hausdorff distance calculation (even I know the equations).

The question: I am comparing 2 objects, 1 is 3D segmentation, the 2nd is also 3D object but generated from 2D structures (in CT slices). Is Dice coeff. and Hausdorff distance calculated in 2D (slice by slice) or 3D as a comparison of two 3D objects?
Thank you for any explanation how are these measures calculated in the background.



Both metrics are used to compare two labelmaps. Although Hausdorff can be interpreted for any set of points, in Slicer it uses the boundary voxels of labelmaps. Dice gives you an overall score, but it is very sensitive to the shape and relative size of the object in the image, while Hausdorff provides a more balanced and human-readable result (i.e. “95% of the boundary is within 2mm”).

If you’re interested how Segment Comparison in SlicerRT works exactly I suggest reading the class documentations in these two classes:

Thank you!

Have a ncie day