HOW TO CALCULATED THE DICE SIMILARITY

18 ビュー (過去 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 Center および File ExchangeImages についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by