tools.ssim

Contents

tools.ssim#

bartorch.tools.ssim()#

Mean structural similarity of the magnitudes.

Magnitudes are the root sum of squares over the coil axis, and each image is divided by the maximum magnitude of its reference. SSIM with k1 = 0.01, k2 = 0.03, dynamic range one and population statistics over a uniform 7x7 window in (y, x), at every position the window fits whole (no padding), averaged over those positions, over z and over every other axis.

Parameters:
  • reference (torch.Tensor) – (..., coils, z, y, x), or a (y, x) image; y and x at least seven.

  • input (torch.Tensor) – (..., coils, z, y, x), or a (y, x) image; y and x at least seven.

Returns:

Mean SSIM, at most one.

Return type:

float

Raises:

ValueError – If y or x is below seven.