To save each of sub-indices (luminance, contrast and structure) in SSIM
5 views (last 30 days)
Show older comments
Hello,
I compare two dicom or nii data using sub-indices (luminance, contrast and structure) in SSIM.
I appreiciate if anyone let me get how to save each of sub-indices (luminance, contrast and structure) in SSIM seperatly.
0 Comments
Answers (1)
DGM
on 23 Oct 2021
Unless you need something special, you should be able to do this with standard syntax for ssim(). Mind you, the SSIM is the mean of the elementwise product of three arrays. If you extract only the index of each component, you're losing information by taking the array means before taking the product. Whether that matters depends what you expect to do with this information.
A = imread('cameraman.tif');
B = imgaussfilt(A,1.5);
% get SSIM index and map
[S Sm] = ssim(B,A);
% get component indices and maps
[Sc(1) Scm(:,:,1)] = ssim(B,A,'exponent',[1 0 0]);
[Sc(2) Scm(:,:,2)] = ssim(B,A,'exponent',[0 1 0]);
[Sc(3) Scm(:,:,3)] = ssim(B,A,'exponent',[0 0 1]);
% combine component indices (approximates SSIM)
[S prod(Sc)]
% combine component maps and take mean (matches SSIM)
[S mean2(prod(Scm,3))]
If you need something different, just open ssim(), look at it, and write a version that does what you want.
4 Comments
DGM
on 4 Nov 2021
If and when you find the answer has met your needs, you can accept it. That will move the thread to the "answered" queue, and hopefully make it more attractive to the next person with a similar question.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!