Segmenting lung nodules from Chest X-ray images

14 views (last 30 days)
This is my code. It is almost accurately segmenting out the lung regions from chest x-ray images. But i need to write a logic that also segments out those blobs only that are candidate nodules. I also have ground truth for the nodule's size and location in the image.
clear; clc; close all;
%% Loading images
Threshold = 36;
raw_x_ray='JPCLN014.png';
I=imread(raw_x_ray);
figure(101);
imshow(I);
colormap(gray);
title('Grayscale X-Ray');
I=wiener2(I, [5 5]);
figure(102);
subplot(2,1,1);
imshow(I);
subplot(2,1,2);
imhist(I, 256);
a_thresh = I >= Threshold; % set this threshold
[labelImage, numberOfBlobs] = bwlabel(a_thresh);
props = regionprops(a_thresh,'all');
sortedSolidity = sort([props.Solidity], 'descend');
SB = sortedSolidity(1);
if SB == 1
binaryImage = a_thresh; figure(103);
imshow(binaryImage); colormap(gray);
The image needs to be flipped first. Nodule's size is 20mm for this image, (569,717) are the coordinates, the nodule is in the right upper lobe (S3) and is malignant (lung cancer diagnosed).

Answers (1)

Image Analyst
Image Analyst on 4 Jan 2022

Community Treasure Hunt

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

Start Hunting!