How to segment image with location wanted.
Show older comments
Hi Everyone. I Have Code below. But the image look like unwanted segmentation. Because I just want the volume that in red circle only. I just write the location that I want, but result stil same.
clc
clear all
[spect map]=dicomread('ArifSyazwan.dcm');
info = dicominfo('ArifSyazwan.dcm');
%gp=info.SliceThickness;
spect=(squeeze(spect));%smooth3
aa=size(spect);aa=aa(3);
imshow3D(spect);
T = adaptthresh(spect, 0.000000001);
%change grey to binary
BW = imbinarize(spect,T);
%open image
figure
imshow3D(BW(56:65, 72: 62)); % which is the location that we want
% CC = bwconncomp(BW);
% [r, c] = cellfun(@(x) ind2sub(size(BW), x), CC.PixelIdxList, 'UniformOutput', 0);
data = regionprops('table', BW,'Area','Centroid')

Should be the image appear like below that I want

Anyone can help me?
Accepted Answer
More Answers (1)
mohd akmal masud
on 9 Dec 2021
1 Comment
yanqi liu
on 9 Dec 2021
yes,use select can get the target area,in 3D use bwselect3,it is great!
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!