ultrasound_metrics.metrics.contrast#
Contrast metric.
References
Functions#
|
Calculate the contrast between two regions. |
Module Contents#
- ultrasound_metrics.metrics.contrast.contrast(values_inside: jaxtyping.Num[ultrasound_metrics._utils.array_api.ArrayAPIObj, *inside_dims], values_outside: jaxtyping.Num[ultrasound_metrics._utils.array_api.ArrayAPIObj, *outside_dims], *, db: bool = False) float[source]#
Calculate the contrast between two regions.
Equation and argument names follow the convention from [1]. Alternative formulations for frequency-independent analysis are discussed in [2].
inside: the region of interest (e.g. lesion)
outside: the background region
contrast: power-contrast ratio, not dB or amplitude-ratio
The contrast between two regions is defined as:
\[C = \frac{\mu_i}{\mu_o}\]where:
\[\mu_i = \mathbb{E}\left\{|s_i|^2\right\}\]\[\mu_o = \mathbb{E}\left\{|s_o|^2\right\}\]are, respectively, the mean signal power inside and outside the lesion, where \(s\) denotes the signal. Contrast can take any positive real value, and \(C \to \infty\) as \(\mu_o \to 0\).
Contrast is often expressed in decibels as:
\[C[\text{dB}] = 10\log_{10} C\]- Parameters:
values_inside – Pixel values from inside the lesion (I), i.e. the region of interest. For hypoechoic lesions like cysts, these are typically lower intensity values.
values_outside – Pixel values from outside the lesion (O), i.e. the background region.
db – Whether to return the contrast in dB.
- Returns:
The power-contrast between the inside and outside regions.
- Return type: