Hi, I want to separate the lung tissue from the CT images taken from the chest, but the code I use removes the lung tumors or other parts of the lung itself, and I want the co
2 次查看(过去 30 天)
显示 更早的评论
Hi, I want to separate the lung tissue from the CT images taken from the chest, but the code I use removes the lung tumors or other parts of the lung itself, and I want the complete lung tissue. can you help me
z='D:\payanname\codes\lowerleg_imgs\';
d=dir(fullfile(z,'\*.bmp'));
nfiles = length(d);
for ii=1:nfiles
I = imread(strcat(z,d(ii).name));
BW = I > 40;
BW = imcomplement(BW);
BW = imclearborder(BW);
BW = imfill(BW, 'holes');
radius = 3;
decomposition = 0;
se = strel('disk',radius,decomposition);
BW = imerode(BW, se);
maskedImageXY = I;
maskedImageXY(~BW) = 0;
% figure
% imshow(maskedImageXY)
output_folder='D:\payanname\New folder';
myImage = imresize(maskedImageXY,[500 500]);
outputFileName = fullfile(output_folder,[sprintf('%d.png',ii)]);
imwrite(myImage, outputFileName);
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biomedical Imaging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!