Structural Similarity (SSIM)¶
Key: ssim · Family: signal fidelity · Better: higher ↑ · Per-lead: yes
SSIM asks: do two signals have the same level, the same variation and the same shape? Instead of summing raw differences it compares three statistics, which makes it closer to how a person judges similarity. ECGEN-Eval uses a global (whole-signal) 1-D version.
Try it¶
The two extra cards split SSIM into a luminance term (are the means equal?) and a contrast × structure term (are the variations equal and correlated?).
Interactive demo loading… (needs JavaScript)
What to notice:
- Amplitude changes lower only the contrast part, and only a little: a beat at 80 % amplitude still has SSIM near 1, while PRD calls it a 20 % error.
- Baseline drift affects the luminance term.
- Inverted T wave and 20 ms late reduce the correlation (structure), which is the part that matters most.
How it works¶
- For each real recording, find the nearest synthetic recording.
- Per lead, compute the means, variances and covariance over the whole signal, and the stabilising constants from the real signal's dynamic range \(L\).
- Combine them into SSIM and average; the score is the mean over leads.
The math¶
\[
\mathrm{SSIM}(x,y) =
\underbrace{\frac{2\mu_x\mu_y + C_1}{\mu_x^2 + \mu_y^2 + C_1}}_{\text{luminance}}\cdot
\underbrace{\frac{2\sigma_{xy} + C_2}{\sigma_x^2 + \sigma_y^2 + C_2}}_{\text{contrast}\times\text{structure}}
\]
with \(C_1 = (0.01L)^2\), \(C_2 = (0.03L)^2\) and \(L\) the range of the real signal. The second factor equals \(c\cdot s\) when \(C_3 = C_2/2\), with \(c\) the contrast and \(s\) the Pearson correlation.
Reading the score¶
- Range [−1, 1]; 1 means identical. Negative values mean anti-correlated signals.
- This is the global form: one value per signal, not a sliding-window average as in image SSIM, so local errors are averaged out.
- SSIM is insensitive to modest amplitude scaling, which is useful when gain differs but can hide clinically relevant voltage changes (for example low-voltage ECGs).
Use it with ECGEN-Eval¶
Parameters are in the Metric Reference.
Learn more¶
- Wang et al., Image Quality Assessment: From Error Visibility to Structural Similarity, IEEE TIP 2004.
- Shahriari et al., applied to ECG signal quality in IEEE TBME 2018.