How to extract rib cage for finding region of interest ?
5 次查看(过去 30 天)
显示 更早的评论
Hello, Im trying to find lung roi from raw CT image. I cannot detect rib cage with bwarefilt() to extract because it checks just 2d, so cannot combine that info with connectivity. So I felt regionprops3 will help me but im not sure how to use regionprops3 to extract it, Im open to any alternative ways to extract that rib cage.
-no lung tissue should be lost
error in line 36:
Subscripting into a table using one subscript (as in t(i)) or three or more subscripts (as in t(i,j,k)) is not supported. Always specify a row subscript and a variable subscript, as in t(rows,vars).
my code is
source_path_raw = 'C:\Users\rawimage';
V_raw = niftiread(source_path_raw);
%to initialize
x=size(V_raw,1);
y=size(V_raw,2);
z = size(V_raw,3);
BW = zeros(x,y,z);
slice_num = size(V_raw,3);
V_raw = imbinarize(V_raw);
for i=1:slice_num
one_slice = V_raw(:,:,i);
radius =4; % radius 4,decomposition 0 veri kaybetmemek için en optimali
decomposition = 0;
se = strel('disk',radius,decomposition);
BW(:,:,i) = imerode(one_slice, se);
end
BW = imfill(BW, 'holes');
V_BW = bwareaopen(BW,100);
volumeViewer(V_BW(:,:,:));
% Attached creenshot from here
conn=18;
n=3;
cc = bwconncomp(V_BW,conn);
if (cc.NumObjects == 0), error('%s: error - input array is empty', mfilename); end
% Getting more information about the connected-components
rp = regionprops3(cc, "Volume");
Cent = rp(1).Volume;
crow = round(Cent(2));
ccol = round(Cent(1));
cplane = round(Cent(3));
% Sorting by size, largest first
[~, ind] = sort([rp.Volume], 'descend');
% Keeping only the n largest connected-components
rp = rp(ind(crow, ccol, cplane));
% Setting relevant indices in the output array
Xout = false(size(V_BW));
n = min(n,length(rp));
for i=1:n,
Xout(rp(i).PixelIdxList) = true;
end
% Keeping only the statistics of the n largest connected-components
rp = rp(1:n);
volumeViewer(Xout(:,:,:))
0 个评论
采纳的回答
Matt J
2021-4-27
编辑:Matt J
2021-4-27
I cannot detect rib cage with bwarefilt() to extract because it checks just 2d
A 3D (and higher) version of bwareafilt is available here
23 个评论
Matt J
2021-5-4
编辑:Matt J
2021-5-4
I'm afraid I don't understand the task. You mean you are trying to count the number of branches in different airway paths?
In any case, it doesn't sound like a simple application of erosion. think it would be a good idea to start a new thread where you can more fully explain the new task and where the answers offered by people can focus on that.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!