Automatic Lung Segmentation in CT Images with Accurate Handling of the Hilar Region