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 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Biomedical Imaging 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!