#### Previous topic

Metric measures (medpy.metric)

#### Next topic

medpy.metric.binary.jc

# medpy.metric.binary.dc¶

medpy.metric.binary.dc(result, reference)[source]

Dice coefficient

Computes the Dice coefficient (also known as Sorensen index) between the binary objects in two images.

The metric is defined as

$DC=\frac{2|A\cap B|}{|A|+|B|}$

, where $$A$$ is the first and $$B$$ the second set of samples (here: binary objects).

Parameters: result : array_like Input data containing objects. Can be any type but will be converted into binary: background where 0, object everywhere else. reference : array_like Input data containing objects. Can be any type but will be converted into binary: background where 0, object everywhere else. dc : float The Dice coefficient between the object(s) in result and the object(s) in reference. It ranges from 0 (no overlap) to 1 (perfect overlap).

Notes

This is a real metric. The binary images can therefore be supplied in any order.