HOW TO CALCULATE THE DICE SIMILARITY OF THE IMAGES SUBPLOT.

1 visualización (últimos 30 días)
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

Respuesta aceptada

yanqi liu
yanqi liu el 26 de Oct. de 2021
%% 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 comentarios
mohd akmal masud
mohd akmal masud el 26 de Oct. de 2021
tq sir, its work.
sir, how to buy your book?
yanqi liu
yanqi liu el 27 de Oct. de 2021
thank you,may be amazon
https://www.amazon.cn/dp/B086ZXVX2K/qid=1635297216

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by