How to combine all the segmented binary images in one figure

8 views (last 30 days)
Hi all, I have code below.
Anyone know how to combine all the segmented images in one figure?
clc
clear all
[spect map]=dicomread('i-131-phantom validation 04112019 256x256');
info = dicominfo('i-131-phantom validation 04112019 256x256');
%gp=info.SliceThickness;
spect=(squeeze(spect));%smooth3
aa=size(spect);aa=aa(3);
% NI KALAU VOLUME1 en amin prepapre 10:1
% BCKG 468 MAX 381
seedR1 = 111; seedC1 = 150; seedP1 = 88;
W1 = graydiffweight(spect, seedC1, seedR1, seedP1 , 'GrayDifferenceCutoff', 1000000);
thresh1 = 0.004349;
[BW1, D1] = imsegfmm(W1, seedC1, seedR1, seedP1, thresh1);
% figure, imshow3D(BW1)
T1 = regionprops('table', BW1,'Area','Centroid')
% NI KALAU VOLUME2 en amin prepapre 10:1
% BCKG 468 MAX 221
seedR2 = 135; seedC2 = 149; seedP2 = 88;
W2 = graydiffweight(spect, seedC2, seedR2, seedP2 , 'GrayDifferenceCutoff', 1000000);
thresh2 = 0.001399;
[BW2, D2] = imsegfmm(W2, seedC2, seedR2, seedP2, thresh2);
% figure, imshow3D(BW2)
T2 = regionprops('table', BW2,'Area','Centroid')
% NI KALAU VOLUME3 en amin prepapre 10:1
% BCKG 468 MAX 143
seedR3 = 147; seedC3 = 129; seedP3 = 88;
W3 = graydiffweight(spect, seedC3, seedR3, seedP3 , 'GrayDifferenceCutoff', 1000000);
thresh3 = 0.000319;
[BW3, D3] = imsegfmm(W3, seedC3, seedR3, seedP3, thresh3);
% figure, imshow3D(BW3)
T3 = regionprops('table', BW3,'Area','Centroid')
% NI KALAU VOLUME4 en amin prepapre 10:1
% BCKG 468 MAX 109
seedR4 = 135; seedC4 = 108; seedP4 = 88;
W4 = graydiffweight(spect, seedC4, seedR4, seedP4 , 'GrayDifferenceCutoff', 1000000);
thresh4 = 0.000091;
[BW4, D4] = imsegfmm(W4, seedC4, seedR4, seedP4, thresh4);
% figure, imshow3D(BW4)
T4 = regionprops('table', BW4,'Area','Centroid')
imshow3D(BW1, BW2, BW3,BW4)
But got error
Error using imshow3D
Too many input arguments.
If I did seperately, can. But I do not seperately.
This one is BW1
This one is BW2
This one is BW3
This one is BW4
Should be all the sphere in one figure as example below

Accepted Answer

Image Analyst
Image Analyst on 24 Oct 2021
You can OR them together
allBW = BW1 | BW2 | BW3 | BW4;
imshow(allBW);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!