How to extract rib cage for finding region of interest ?

조회 수: 3 (최근 30일)
Berkem Teksüz
Berkem Teksüz 2021년 4월 27일
댓글: Berkem Teksüz 2021년 5월 4일
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(:,:,:))

채택된 답변

Matt J
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
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.
Berkem Teksüz
Berkem Teksüz 2021년 5월 4일
Okay I will open a new question, We do not need to count anything. its for just a sign for developer to stop, its done. I just need an airway segmentation as complex as that blue one.Thats all.Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by