Typically, inspiration is preferred when xraying the lungs. The x-ray technologist will ask a patient to be still and to take a deep breath and to hold it. This not only reduces the possibility of a blurred image but also enhances the quality of the image since air-filled lungs are easier to see on x-ray film. However, inspiration causes low density in the inner part of lung field. That means that ribs in the inner part of lung field have lower density than the other parts nearer to the border of the lung field. That is why edge detection algorithms often fail to detect ribs. Therefore to make rib edges clear we try to produce an expiration lung field using a 'hemi-elliptical cavity.' Based on the expiration lung field, we extract the rib edges using <i>canny edge detector</i> and a new connectivity method, called '4 way with 10-neighbors connectivity' to detect clavicle and rib edge candidates. Once the edge candidates are formed, our system selects the best candidates using knowledge-based constraints such as a gradient, length and location. The edges can be paired and labeled as superior rib edge and inferior rib edge. Then the system uses the clavicle, which is obtained in a same method for the rib edge detection, as a landmark to label all detected ribs.