The task of segmenting the posterior ribs within the lung fields is of great practical importance. For example, delineation of the ribs may lead to a decreased number of false positives in computerized detection of abnormalities, and hence analysis of radiographs for computer-aided diagnosis purposes will benefit from this. We use an iterative, pixel-based, statistical classification method - iterated contextual pixel classification (ICPC). It is suited for a complex segmentation task in which a global shape description is hard to provide. The method combines local gray level and contextual information to come to an overall image segmentation. Because of it generality, it is also useful for other segmentation tasks. In our case, the variable number of visible ribs in the lung fields complicates the use of a global model. Additional difficulties arise from the poor visibility of the lower and medial ribs. Using cross validation, the method is evaluated on 35 radiographs in which all posterior ribs were traced manually. ICPC obtains an accuracy of 83%, a sensitivity of 79%, and a specificity of 86% for segmenting the costal space. Further evaluation is done using five manual segmentations from a second observer, whose performance is compared with the five corresponding images from the first manual segmentation, yielding 83% accuracy, 84% sensitivity, and 83% specificity. On these five images, ICPC attains 82%, 78%, and 86% respectively.