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

1 vue (au cours des 30 derniers jours)
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

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by