HOW TO CALCULATED THE DICE SIMILARITY

27 visualizaciones (últimos 30 días)
mohd akmal masud
mohd akmal masud el 20 de Oct. de 2021
Respondida: yanqi liu el 26 de Oct. de 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??

Respuesta aceptada

yanqi liu
yanqi liu el 26 de Oct. de 2021
similarity = dice(logical(I), logical(II));

Más respuestas (0)

Categorías

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

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by