HOW TO CALCULATED THE DICE SIMILARITY

조회 수: 28 (최근 30일)
mohd akmal masud
mohd akmal masud 2021년 10월 20일
답변: yanqi liu 2021년 10월 26일
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??

채택된 답변

yanqi liu
yanqi liu 2021년 10월 26일
similarity = dice(logical(I), logical(II));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by