Previous topic

medpy.metric.histogram.relative_bin_deviation

Next topic

Image filter and manipulation (medpy.filter)

This Page

medpy.metric.histogram.relative_deviation

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

Calculate the deviation between two histograms.

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

\[d_{rd}(H, H') = \frac{ \sqrt{\sum_{m=1}^M(H_m - H'_m)^2} }{ \frac{1}{2} \left( \sqrt{\sum_{m=1}^M H_m^2} + \sqrt{\sum_{m=1}^M {H'}_m^2} \right) }\]

Attributes:

  • semimetric (triangle equation satisfied?)

Attributes for normalized histograms:

  • \(d(H, H')\in[0, \sqrt{2}]\)
  • \(d(H, H) = 0\)
  • \(d(H, H') = d(H', H)\)

Attributes for not-normalized histograms:

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

Attributes for not-equal histograms:

  • not applicable
Parameters:

h1 : sequence

The first histogram.

h2 : sequence

The second histogram, same bins as h1.

Returns:

relative_deviation : float

Relative deviation between the two histograms.