HOW TO CALCULATED THE DICE SIMILARITY

16 Ansichten (letzte 30 Tage)
mohd akmal masud
mohd akmal masud am 20 Okt. 2021
Beantwortet: yanqi liu am 26 Okt. 2021
Hi all, I want to calculate the Dice Similarity Coefficient between the origional images and binary images.
this below is origional images.
%% first, read the origional 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,'Image');
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
this code below is binary images after segmentation
%% 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 run this code for calculate the dice similarity, but got error
similarity = dice(I, II);
Error using dice (line 117)
Expected input number 1, A, to be one of these types:
logical, double, categorical
Instead its type was uint8.
ANYONE CAN HELP ME??

Akzeptierte Antwort

yanqi liu
yanqi liu am 26 Okt. 2021
similarity = dice(logical(I), logical(II));

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by