A general approach for automatic segmentation of pneumonia, pulmonary nodule, and tuberculosis in CT images