How to calculate sphere area in subplot.
1 view (last 30 days)
Show older comments
mohd akmal masud
on 28 Sep 2021
Commented: mohd akmal masud
on 29 Sep 2021
Hi all,
I have 41 images. when I binarize it, then I plot 41 images in one figure as shown below. My coding as below. But only the last images its calculate the area of circle, that have one circle. Anyone can help me how to calculate the area for all the circle for all images in subplot.
%testimages
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,'Test');
IMDS = imageDatastore(IMAGEDir);
% IMDS = imageDatastore(IMAGEDir , ...
% 'FileExtensions', '.dcm','ReadFcn',@(x) dicomread(x));
% % volReader = @(x) dicomRead(x);
% voldsTest = imageDatastore(IMAGEDir , ...
% 'FileExtensions','.dcm','ReadFcn',volReader);
alldice=[]
acc=[]
for ii=1:41
subplot(6,7,ii)
I = readimage(IMDS,ii);
[C,scores] = semanticseg(I,net1);
B = labeloverlay(I,C);
outt2=C=="foreground";
st2=strel('disk',5);
outt22=imopen(outt2,st2);
title('input')
imshow(outt22)
end
T = regionprops('table', outt22,'Area','Centroid')
T =
1×2 table
Area Centroid
____ ________________
162 147.78 116.65
0 Comments
Accepted Answer
yanqi liu
on 28 Sep 2021
sir,please check the follow code to get some information
%testimages
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,'Test');
IMDS = imageDatastore(IMAGEDir);
% IMDS = imageDatastore(IMAGEDir , ...
% 'FileExtensions', '.dcm','ReadFcn',@(x) dicomread(x));
% % volReader = @(x) dicomRead(x);
% voldsTest = imageDatastore(IMAGEDir , ...
% 'FileExtensions','.dcm','ReadFcn',volReader);
alldice=[]
acc=[]
for ii=1:41
subplot(6,7,ii)
I = readimage(IMDS,ii);
[C,scores] = semanticseg(I,net1);
B = labeloverlay(I,C);
outt2=C=="foreground";
st2=strel('disk',5);
outt22=imopen(outt2,st2);
title('input')
imshow(outt22)
fprintf('\nprocess %d image\n', ii);
T = regionprops('table', outt22,'Area','Centroid')
end
1 Comment
More Answers (1)
yanqi liu
on 28 Sep 2021
may be the filename should save?
clc; clear all; close all;
%testimages
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,'Test');
IMDS = imageDatastore(IMAGEDir);
% IMDS = imageDatastore(IMAGEDir , ...
% 'FileExtensions', '.dcm','ReadFcn',@(x) dicomread(x));
% % volReader = @(x) dicomRead(x);
% voldsTest = imageDatastore(IMAGEDir , ...
% 'FileExtensions','.dcm','ReadFcn',volReader);
alldice=[]
acc=[]
Ts = [];
Ts2 = [];
for ii=1:41
subplot(6,7,ii)
I = readimage(IMDS,ii);
[C,scores] = semanticseg(I,net1);
B = labeloverlay(I,C);
outt2=C=="foreground";
st2=strel('disk',5);
outt22=imopen(outt2,st2);
title('input')
imshow(outt22)
fprintf('\nprocess %d image\n', ii);
T = regionprops('table', outt22,'Area','Centroid');
Ts{ii} = T;
Ts2 = [Ts2; T];
end
disp(Ts2);
disp(Ts);
3 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!