1. A method of performing ribcage segmentation in a chest image, the method comprising: classifying the top of the chest image as having lungs adjacent to the top or not adjacent to the top; segmenting the top of the ribcage, based on the result of said classifying, to obtain a top mask; and segmenting at least one side of the ribcage, using an endpoint of the top mask as a starting point.