How to calculate sphere area in subplot.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
yanqi liu
2021-9-28
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 个)
yanqi liu
2021-9-28
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!