Chest X-ray Screening System: Segmentation Module – v3.

Candemir S


Atlas-based lung boundary detection module (MATLAB Code)

We present to you software developed as part of the following article:

Candemir S, Jaeger S, Palaniappan K, Musco JP, Singh RK, Xue Z, Karargyris A, Antani S, Thoma G, McDonald CJ. Lung segmentation in chest radiographs using anatomical atlases with nonrigid registration. IEEE Trans Med Imaging. 2014 Feb; 33(2):577-90. doi: 10.1109/TMI.2013.2290491. PMID: 24239990

We request that you cite the paper if this code is used for publications or product.

The software contains the following assets:

- LungSegment_module.m: performs the lung segmentation on CXRs.

- Patient_Xrays: folder contain patient X-ray to be segmented. Please locate your test X-rays in this folder. The X-ray image can be in DICOM, TIFF, PNG, BMP, or JPEG file formats.

- Model_Xrays: folder contain example X-rays, their corresponding lung masks, vertical, and horizontal profiles. These X-rays and lung masks are used during registration process.

- Model_h.mat and Model_v.mat: precomputed profiles for model x-rays.

- TEST.m: to test the system, please run this function. 

- subfunctions: CEB_polygionCurveEvolution.m, cebShape2Spline.m, f_removeBlackBorderds.m, f_RemoveSmallSegments.m, FindSimilarCXR.m, fitSpline.m, read_Xray.m, read_Xray.m, read_X_Mask.m, RegisterModel.m, SmoothBoundary.m (please refer code comments for these functions. )

The system is developed using MATLAB version 8.4 on 64-bit Intel architecture running Windows 7 operating system.

- Employed functions: mexDenseSIFT(m, mex), mesDiscreteFlow(m,mex), SIFTflowc2f.m functions are employed from the “SIFT Flow: Dense Correspondence across Scenes and Its applications”. Please use the website to download the latest version of these functions. Do not forget citing the SIFTFlow paper.

How to run:

  1. Download and unpack the zip file containing the code here.
  2. Locate your CXRs in the Patient X-ray folder.
  3. Run the TEST.m function. The binary lung masks will be computed for each patient X-ray. The masks will be the same size as patient X-ray.
  4. Adjust parameters to obtain better results for your CXRs.

Contact: Stefan Jaeger


Candemir S Chest X-ray Screening System: Segmentation Module – v3.