tfmri.image.ssim3d_multiscale
tfmri.image.ssim3d_multiscale¶
- ssim3d_multiscale(img1, img2, max_val=None, power_factors=(0.0448, 0.2856, 0.3001, 0.2363, 0.1333), filter_size=11, filter_sigma=1.5, k1=0.01, k2=0.03, name='ssim3d_multiscale')[source]¶
Computes the multiscale SSIM (MS-SSIM) between two 3D images.
This function operates on batches of multi-channel inputs and returns an MS-SSIM value for each image in the batch.
- Parameters
img1 – A
Tensor
. First batch of images. Must have rank >= 4 with shapebatch_shape + [depth, height, width, channels]
.height
,width
anddepth
must be greater than or equal to(filter_size - 1) * 2 ** (len(power_factors) - 1) + 1
. Can have integer or floating point type, with values in the range[0, max_val]
.img2 – A
Tensor
. Second batch of images. Must have rank >= 4 with shapebatch_shape + [depth, height, width, channels]
.height
,width
anddepth
must be greater than or equal to(filter_size - 1) * 2 ** (len(power_factors) - 1) + 1
. Can have integer or floating point type, with values in the range[0, max_val]
.max_val – The dynamic range of the images (i.e., the difference between the maximum and the minimum allowed values). Defaults to 1 for floating point input images and
MAX
for integer input images, whereMAX
is the largest positive representable number for the data type.power_factors – A list of weights for each of the scales. The length of the list determines the number of scales. Index 0 is the unscaled resolution’s weight and each increasing scale corresponds to the image being downsampled by 2. Defaults to (0.0448, 0.2856, 0.3001, 0.2363, 0.1333), which are the values obtained in the original paper 1.
filter_size – The size of the Gaussian filter. Defaults to 11.
filter_sigma – The standard deviation of the Gaussian filter. Defaults to 1.5.
k1 – Factor used to calculate the regularization constant for the luminance term, as
C1 = (k1 * max_val) ** 2
. Defaults to 0.01.k2 – Factor used to calculate the regularization constant for the contrast term, as
C2 = (k2 * max_val) ** 2
. Defaults to 0.03.name – Namespace to embed the computation in.
- Returns
A
Tensor
of typefloat32
and shapebatch_shape
containing an MS-SSIM value for each image in the batch.
References
- 1
Z. Wang, E. P. Simoncelli and A. C. Bovik, “Multiscale structural similarity for image quality assessment,” The Thrity-Seventh Asilomar Conference on Signals, Systems & Computers, 2003, 2003, pp. 1398-1402 Vol.2, doi: 10.1109/ACSSC.2003.1292216.