Previous topic

medpy.metric.histogram.fidelity_based

Next topic

medpy.metric.histogram.histogram_intersection_1

This Page

medpy.metric.histogram.histogram_intersection

medpy.metric.histogram.histogram_intersection(h1, h2)[source]

Calculate the common part of two histograms.

The histogram intersection between two histograms \(H\) and \(H'\) of size \(m\) is defined as:

\[d_{\cap}(H, H') = \sum_{m=1}^M\min(H_m, H'_m)\]

Attributes:

  • a real metric

Attributes for normalized histograms:

  • \(d(H, H')\in[0, 1]\)
  • \(d(H, H) = 1\)
  • \(d(H, H') = d(H', H)\)

Attributes for not-normalized histograms:

  • not applicable

Attributes for not-equal histograms:

  • not applicable
Parameters:

h1 : sequence

The first histogram, normalized.

h2 : sequence

The second histogram, normalized, same bins as h1.

Returns:

histogram_intersection : float

Intersection between the two histograms.