HOW TO CALCULATE THE DICE SIMILARITY OF THE IMAGES SUBPLOT.

1 回表示 (過去 30 日間)
mohd akmal masud
mohd akmal masud 2021 年 10 月 20 日
コメント済み: yanqi liu 2021 年 10 月 27 日
Hi all, I have 2 data set logical images(binary images). EACH DATA SET HAVE 23 IMAGES. I want to check the dice similarity.
Below is the code for aorigional images.
%% first, read the image data and labelled images
clc
clear all
dataSetDir = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir = fullfile(dataSetDir,'labelledimages');
imds = imageDatastore(imageDir);
% view data set images origional
figure
for i = 1:23
subplot(5,5,i)
I = readimage(imds,i);
imshow(I)
title('training labels')
end
The the second one images code is below
%% second, read the binary images after segmentation
dataSetDir1 = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir1 = fullfile(dataSetDir1,'bnwaftersegmentation');
imds1 = imageDatastore(imageDir1);
% view data set images origional
figure
for ii = 1:23
subplot(5,5,ii)
II = readimage(imds1,ii);
imshow(II)
title('binary labels')
end
Then i used code below to know the dice similarity, but the answer is 0
similarity = dice(I, II)
similarity =
0
But I try test just one image (let say image number 11), its work.
s = imread('11.png');
d = imread('11.png');
similarity = dice(s,d)
similarity =
0.15119
ANYONE CAN HELP ME HOW TO CALCULATE THE TOTAL DICE SIMILSRITY FOR ALL 23 IMAGES

採用された回答

yanqi liu
yanqi liu 2021 年 10 月 26 日
%% first, read the image data and labelled images
clc
clear all
dataSetDir = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir = fullfile(dataSetDir,'labelledimages');
imds = imageDatastore(imageDir);
% view data set images origional
Is = [];
figure
for i = 1:23
subplot(5,5,i)
I = readimage(imds,i);
Is{end+1} = I;
imshow(I)
title('training labels')
end
%% second, read the binary images after segmentation
dataSetDir1 = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir1 = fullfile(dataSetDir1,'bnwaftersegmentation');
imds1 = imageDatastore(imageDir1);
% view data set images origional
Is2 = [];
figure
for ii = 1:23
subplot(5,5,ii)
II = readimage(imds1,ii);
Is2{end+1} = II;
imshow(II)
title('binary labels')
end
%% compare the dice similarity for every slice, like 1 with 1, 2 with 2, 3 with 3....and so on till 23 with 23..
similarity = [];
for i = 1 : 23
similarity(i) = dice(Is{i}, Is2{i});
fprintf('the dice similarity for %d with %d is %.3f\n', i, i, similarity(i));
end
  2 件のコメント
mohd akmal masud
mohd akmal masud 2021 年 10 月 26 日
tq sir, its work.
sir, how to buy your book?
yanqi liu
yanqi liu 2021 年 10 月 27 日
thank you,may be amazon
https://www.amazon.cn/dp/B086ZXVX2K/qid=1635297216

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by