How to segment lung from 2D images

5 ビュー (過去 30 日間)
AUWAL ABUBAKAR
AUWAL ABUBAKAR 2021 年 2 月 20 日
回答済み: Keerthana Chiruvolu 2021 年 2 月 23 日
Good day,
I have multiple 2D images from which I would like to segment the lung field from each. I successfully developed a code to do that, but it does not work for all the images as the contrast slightly vary from one image to the other (Image1 and 2 attached). I try using ‘imhistmatch’ to match the contrast between the images but without success. Please see my code below and the results obtained in fig.1. Could someone please help me modify the code to suit this purpose or suggest a better method to achieve this?
clear;clc;close all
% Ia=imread('image1.jpg');
load image1
II = adapthisteq(Ia,'clipLimit',0.02,'Distribution','rayleigh');
subplot(2,4,2);imshow(II);title('Adjusted contrast')
II(II>35000)=0;
II = bwareaopen(II,50); %remove connected components
mask = bwareafilt(II, 2); %There are small noise blobs. Extract the two largest objects.
z=ImageAnalyst(mask,-1); %Extract the 2nd largest objects.
subplot(2,4,1);imshow(Ia);title('Original image1')
subplot(2,4,3);imshow(z);title('segmented lung')
subplot(2,4,4);imshowpair(z,Ia);title('Image1/lung pair')
%%
% image2
% Ib=imread('image2.jpg');
load image2
I=imhistmatch(Ib, Ia);% adjust the histogram of 2D image to macth histogram of image1 image
I = adapthisteq(Ib,'clipLimit',0.02,'Distribution','rayleigh');
subplot(2,4,6);imshow(I);title('Adjusted contrast')
I(I>35000)=0;
I = bwareaopen(I,50); %remove connected components
mask = bwareafilt(I, 2); %There are small noise blobs. Extract the two largest objects.
z=ImageAnalyst(mask,-1); %Extract the 2nd largest objects ising ImageAnalyst funtion
subplot(2,4,5);imshow(Ib);title('Original image2')
subplot(2,4,7);imshow(z);title('segmented lung')
subplot(2,4,8);imshowpair(z,Ib);title('Image2/lung pair')
  3 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 20 日
More @AUWAL ABUBAKAR Are the images properly attached?
AUWAL ABUBAKAR
AUWAL ABUBAKAR 2021 年 2 月 20 日
Thanks for your response @KALYAN ACHARJYA and @darova. There was an error attaching the images. I have attached the variables now. Thanks

サインインしてコメントする。

回答 (1 件)

Keerthana Chiruvolu
Keerthana Chiruvolu 2021 年 2 月 23 日
Hi,
Use the Image Segmenter App to segment the lungs from the images and generate binary mask easily. You can import the original image and export the mask directly to MATLAB Workspace.

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by