Segmenting Lungs and nodules in CT images

image-processing, matlab

Solution

Try this:

% dp6BK.png is your original image, I downloaded directly
I = im2double(imread('dp6BK.png'));  
I=I(:,:,1);
imshow(I)


cropped = I(50:430,8:500); %% Crop region of interest   
thresholded = cropped < 0.35; %% Threshold to isolate lungs
clearThresh = imclearborder(thresholded); %% Remove border artifacts in image   
Liver = bwareaopen(clearThresh,100); %% Remove objects less than 100 pixels
Liver1 = imfill(Liver,'hole'); % fill in the vessels inside the lungs
figure,imshow(Liver1.*cropped)

What you will get:

Problem

I am new with Image processing in Matlab, I am trying to segment LUNG and nodules from CT image. I have done initial image enhancement. I searched lot on the same but I haven't found any relevant materials. Trying to segment lung part from the given image; and then detecting nodules on Lung part. Code I tried in Matlab: ``` d1 = dicomread('000000.dcm'); d1ca = imadjust(d1); d1nF = wiener2(d1ca); d1Level = graythresh(d1nF); d1sBW = im2bw(d1nF,d1Level); sed = strel('diamon',1); BWfinal = imerode(d1sBW,sed); BWfinal = imerode(BWfinal,sed); BWoutline = bwperim(BWfinal); Segout = d1nF; Segout(BWoutline) = 0; edgePrewitt = edge(d1nF,'prewitt'); ``` Result of above code: Want results like this: http://oi41.tinypic.com/35me7pj.jpg http://oi42.tinypic.com/2jbtk6p.jpg http://oi44.tinypic.com/w0kthe.jpg http://oi40.tinypic.com/nmfaio.jpg http://oi41.tinypic.com/2nvdrie.jpg http://oi43.tinypic.com/2nvdnhk.jpg I know its may be easy for experts. Please help me out. Thank you!

Original source