Fixed an error when segmenting the lungs using an empty image or empty ROI.