1. Introduction
The human spine typically consists of 24 presacral vertebrae, of which seven are cervical, twelve are rib-bearing thoracic, and five are lumbar vertebrae [
1]. Nevertheless, the number of vertebrae may vary, leading to thoracolumbar transitional vertebrae (TLTV). TLTV is defined as a vertebra that has partial features of thoracic as well as lumbar vertebrae and has a dysplastic/hypoplastic rib [
2,
3]. These so-called stump ribs, by common definition, have a length of
mm and can only appear at the lowest thoracic level [
3]. Moreover, Tatara et al. [
2] found additional indicators for TLTV, such as anomalies in rib shape. This can occur, for example, due to a deformation of the rib head. The thoracolumbar junction is considered a weak connection, so injuries, such as fractures or thoracolumbar junction syndrome, often occur here [
4,
5]. These biomechanical changes might be crucial for surgical planning, as they can affect surgical outcomes and recovery [
6,
7]. Additionally, the occurrence of TLTV often indicates numerical anomalies, such as an additional or missing thoracic vertebra.
Overall, detecting such anomalies is vital for accurate assessment of vertebral heights and for localizing weak points. Automating this process would reduce radiologists’ work and increase the accuracy of surgical planning. Moreover, some CT reformations are not wide enough to capture the whole extent of the ribs. In these cases, a manual assessment of thoracolumbar stump ribs is so far infeasible. We aim to automatically localize and detect stump ribs and exploit rib-shape differences between stump ribs and regular ribs to detect stump ribs even with partially visible ribs.
For this to work, we need to automatically localize ribs in a CT image, measure their lengths, and extract morphological features. We opt to address this by creating dense, complete segmentation masks. Segmentation is the task of assigning a label to each pixel of an input image [
8]. In our case, the input images are CT images, and we want to assign each voxel to a rib structure. We then calculate the lengths of the ribs and other morphological features from these segmentations. After that, we can compare stump ribs and regular ribs based on these features and use them to differentiate the two groups without using length.
For developing solutions to automate the creation of segmentation annotations, deep learning has become a prominent field in science. Specifically, segmentation has been used in the past to localize and describe medical structures [
9], and it is considered state-of-the-art. Previously, most existing approaches to ribs used segmentation or center-extraction algorithms [
10,
11,
12,
13,
14,
15,
16,
17], which are not publicly available. The TotalSegmentator [
18] is publicly available and can segment ribs, yet it is unable to yield a quality sufficient for rib-length calculations. We expand the rib segmentation to capture the entire rib, develop a length-measurement algorithm, and make our model and segmentation masks available, thereby bridging a gap in the community. Finally, to the best of our knowledge, no work has attempted to automate stump rib detection or to conduct quantitative experiments contrasting regular ribs with stump ribs using automated morphological features.
The contributions of this study are:
We develop a whole rib segmentation tool for CT imaging and present a rib length measurement algorithm based on that segmentation.
We automatically detect and localize thoracolumbar stump ribs by calculating the rib length.
We describe stump rib morphological features in contrast to regular ribs and propose them as additional indicators of stump rib occurrence.
We show that these morphological features classify stump ribs even with a partial field of view.
2. Materials and Methods
2.1. Data
This study used three CT datasets (see
Figure 1). Two publicly available ones, VerSe [
19] and RibFrac [
20,
21], and a private in-house dataset. For demographics, see
Table 1. The VerSe data has expert-quality vertebra segmentation annotations. Thanks to Jin et al. [
22], the RibFrac data includes instance segmentations of the ribs (called RibSeg). The in-house dataset contains binary annotations of ribs created by one expert, A.D., separating rib tissue from background.
2.2. Segmentation Approach
To measure the length of the ribs, we require dense and complete segmentation annotations. We define a correct rib annotation as the filled bone outline (indicated by high-intensity values in CT) up to, but not including, the costal cartilage and the sternum.
We observed that the rib annotations in the RibFrac dataset exclude the rib heads. The TotalSegmentator [
18] exhibits the same issue (see
Figure 2). Thus, we developed our own rib segmentation model by utilizing nnUNet [
9], a widely used architecture for training semantic segmentation models. We started with a small set of annotations from the in-house data, ran inference on public datasets, manually corrected some to expand the training set, and then trained again.
In detail, we used 27 subjects from the in-house data with high segmentation quality (see
Figure 1). We trained a default nnUNet 3d fullres configuration with the suggested parameters, except for the patch size, which we set to a consistent cubic size of 192 × 192 × 192. We trained for 300 epochs with 3-fold cross-validation, resampling the training data to a consistent isotropic resolution of 0.8 mm. This value of 0.8 mm was chosen as a compromise between accuracy and computational feasibility, not a tuned hyperparameter. Additionally, we used elastic deformation (parameters chosen qualitatively) and random horizontal flipping to augment our data by a factor of ten.
We then applied this model to the public datasets. After careful review, we chose 17 subjects from VerSe and 11 from RibFrac. These annotations, along with another 45 randomly selected subjects from VerSe and RibFrac, were manually corrected by an expert (H.M.) with two years of experience. Two experts (H.S., J.S.K.), with three and 23 years of experience, respectively, supervised the corrections and reviewed them to ensure quality. We used ITKSnap 3.8.0 [
23] for annotation review and manual correction in all three dimensions. The 45 randomly selected subjects were used exclusively as the test set. The resulting training split, totaling 55 subjects, was used to retrain the rib segmentation model using the same training procedure.
Figure 2 compares our rib segmentation tool to existing approaches. These rib annotations are binary and thus only distinguish between foreground (ribs) and background (not ribs). The created manual and predicted segmentation masks from this study are published under
https://doi.org/10.5281/zenodo.14850928.
2.3. Instance Assignment
Our goal is to derive information for each rib individually. This requires instance segmentation masks of the ribs, not only semantic ones. To bridge this gap, we used vertebra instance segmentation masks. The VerSe data already contained expert-level annotations for individual vertebrae. We used the Bonescreen SpineR tool (Bonescreen GmbH, Munich, Germany) based on Sekuboyina et al. [
24] to generate vertebra segmentations for the RibFrac dataset. We then derived the connected components from the predicted binary rib segmentation mask of our model and assigned the rib components to the vertebrae based on spatial proximity. To ensure robust results, we employed the constraints that each vertebra can only have two ribs, and each rib can only be assigned to one vertebra (see
Figure 3). Moreover, we distinguished the side of the rib by comparing the rib localization to its corresponding vertebra. We encountered instances where a rib was segmented, but its corresponding vertebrae had not been segmented. In these cases, we consistently relabeled these rib instances to a set of unused labels. We manually reviewed the subjects using the generated 2D coronal and sagittal snapshots.
2.4. Rib Length Measurement
Now that we can localize and view each rib in our images individually, we need to measure the length of a single rib to assess whether it is a stump rib (SR). For that, we employed an iterative algorithm to calculate points along a path. We started by cropping a single rib combined with its corresponding vertebra. To ensure consistency, we rescaled the cropped segmentation mask to a fixed resolution of 0.5 mm for each dimension. The 0.5 was chosen based on initial observations. A higher resolution leads to computational infeasibility, while a lower resolution quickly exhibits larger interpolation errors due to the inherent discreteness of voxels. We filled 3D holes to ensure the segmentation remained dense while maintaining the overall shape and size.
The rib-length measuring algorithm (RLMA) starts by locating the rib’s start point. We select the closest point on the segmentation surface to the center of mass of the corresponding vertebra corpus. We refine the location by averaging all surrounding segmented voxels and projecting the result onto the segmentation surface (see
Figure 4). This ensures the start position is already at the middle of the rib, not at a corner. We set this start point as the first path point.
From the start point, we iteratively add path points along the center of the rib. For this, we find all candidate points within a circular distance of 14.5 to 15.5 mm from the previous path point. We remove all candidate points in that list that are closer to any prior path point than the latest, ensuring that we are iterating in the correct direction. We then take the average coordinate location of all these candidate points. We can compute a direction vector in relation to our previous path point. Moving from the latest point halfway along that direction vector gives us our next target. This new location gets projected onto the nearest segmentation voxel and is added as the next path point (see
Figure 4). This gets repeated until we reach the end of the rib, where no possible points lie on the circular slice. To find the final path point, we shoot a cone of ray-casts from the latest path point along the vector of the previous path point and find the point in those ray-casts that is furthest away from the latest path point. We take this as the endpoint. To calculate the length, we take the path points and sum the distances between them.
The circular distance range of 14.5 to 15.5 mm was chosen to accommodate the 0.5 mm resolution. It is a straight 30-voxel distance at that resolution, with some flexibility to allow for diagonal distances. This parameter was chosen based on initial observations: much lower and much higher values reduced the algorithm’s stability (very close path points produce jittery paths, while larger distances reduce accuracy).
By definition, thoracolumbar stump ribs (SR) are shorter than or equal to 38 mm [
3]. We compare this threshold to the length computed by our RLMA. This yields a binary label (SR or not-SR) for each rib.
2.5. Morphological Features
We calculate morphological features from our rib segmentations. We compute the spatial relation vector between the rib’s start point and the corresponding vertebra corpus center (DRC). Specifically, we examine the posterior distance between the rib and the corpus center, which we denote PDRC (see
Figure 5). Additionally, we use the path points and their spatial relationships via the direction vectors between neighboring path points. We denote
n-PPR as the spatial relation vector for the first
n path points. For example, 2-PPR means the direction vector from the rib’s start point to its next path point. From the RLMA, we have the rib’s length; using the segmentation mask, we can calculate the volume-to-length ratio.
To account for rotation, we use the orientation of each vertebra and multiply the inverted rotation matrix by the measured features to obtain rotations relative to each vertebra. Additionally, to be consistent, we mirror the left ribs onto the right side. This means that the right dimension always points away from the vertebra.
2.6. Experiments
We utilized the two public datasets (VerSe and RibFrac) for all downstream experiments. We ran our rib segmentation across all subjects and the rib-length measuring algorithm (RLMA) on the lowest two vertebrae with ribs present.
We compare the segmentation performance on our manually corrected test set. Our baselines are the RibSeg segmentation masks (both with and without fill holes applied) and the TotalSegmentator. We evaluate this on various metrics (see
Appendix A). This yields a comparative analysis regarding the segmentation performance.
For the rib length analysis, we used the analysis set (all subjects from VerSe and RibFrac that are not in the training set) and incorporated some exclusion criteria: We excluded 36 subjects in which the last rib is not visible in the image, 78 ribs for which the corresponding vertebra segmentation was missing, and two subjects with imaging artifacts (see
Figure 1 for detailed data flow).
Then, two experts (H.S., B.K.) reviewed the generated ribs segmentation for segmentation and measurement errors. As there is no standard in manually measuring the rib length, the experts categorized each rib into a five-point Likert scale: (1) the segmentation has major errors or segmented the wrong structure, (2) the segmentation is the correct structure but erroneous enough so that the resulting length is wrong, (3) the segmentation touches the border of the image and thus the length of the visible section is correct but incomplete, (4) the segmentation has minor mistakes which did not impact the length calculation, and (5) everything is fine. The relative frequency of this rating indicates how often our segmentation, combined with our RLMA, successfully measured rib length.
For the morphological analysis, we included ribs with certainty about their SR label. Hence, we only used ribs marked with (4) and (5) and those with (3) where the length of the visible part already exceeded the SR threshold.
We show how well we can separate stump ribs from regular ribs using morphological relations to the corresponding vertebra without using the full length of the ribs. Thus, we use the DRC features as input for a Support Vector Machine (SVM) [
25] to differentiate stump ribs and regular ribs. We also used
n-PPR as input features for the SVM. We test this with
n set to 2, 3, and 4 to see how much of a rib needs to be visible to predict stump ribs. Going beyond
would yield a measured length close to or beyond the SR threshold, thereby defeating the purpose. We also combine
n-PPR and DRC as input features to see whether this improves the performance.
For all SVM experiments, we repeat the setup with 10 different fixed seeds and a random 70/30 train/test subject-wise split to assess a robust separability performance. We report the F1, balanced accuracy, and AUC scores averaged over the 10 runs. Additionally, we compare this setup to logistic regression (LoRe) and multilayer perceptron (MLP). We did not address class imbalance for this, other than ensuring approximately equal numbers of SR cases across splits. Input features were always normalized based on the mean and standard deviation across the training samples of a split.
Finally, we perform a robustness analysis of the RLMA on the manually corrected test set. We compare the measured rib length in the reference annotations with that in the predicted annotations (see
Appendix C).
2.7. Statistical Analysis
To compare the statistical significance of our segmentation models, we use the Wilcoxon signed-rank test [
26] on Dice scores, with
indicating statistical significance. For the feature distributions grouped by stump ribs and regular ribs, we perform the Wilcoxon rank-sum test and use the same threshold for statistical significance.
2.8. Software
To conduct this study, we used Python v3.11, TPTBox v0.4.2, panoptica v1.1.4, and nnUNetv2 v2.6.2. All statistical significance tests were computed using SciPy v1.14.1.
2.9. Hardware
The nnUnet segmentation model was trained on an NVIDIA A40 GPU for approximately 30 h. The CPU used was an AMD EPYC 7413 with more than 100 GB of available RAM.
4. Discussion
Overall, our proposed method can robustly detect, localize, segment, and measure ribs in CT scans. This allows an automatic classification of stump ribs. Additionally, we propose simple morphological features beyond the length to correctly classify thoracolumbar stump ribs. These enable the detection of stump ribs in limited, arbitrary-field-of-view CT images and may help correctly label vertebrae and improve surgical planning.
Best stump-rib classification performance was achieved with both 4-PPR and DRC as feature inputs. Notably, to achieve this, we only require the beginning segment of the rib and the corresponding vertebra segmentation. This is fascinating, as the first four path points have an average total length of around 22 mm. By looking at the initial mm of a rib’s direction and orientation, we can deduce whether the rib is a stump rib or not. If only the initial mm (required for 3-PPR) of a rib is visible in the scan, we lose some performance but still get decent results. This is especially interesting in cases where the scan is not very wide, and thus, the ribs are not fully visible. Thus, our experiments imply that ribs can be categorized by morphological features, adding depth to the classification beyond a simple cutoff based on rib length.
However, limitations must be acknowledged. As there is no gold standard for manually measuring rib length, we cannot perform a quantitative comparative analysis of the exact measurements. Furthermore, the two public datasets VerSe and RibFrac used in this study have backgrounds in spinal anomalies such as fractures and rib cage fractures, respectively. Thus, they do not represent the general population, and we forfeit meaningful normative values or more generalized findings and relationships about ribs. Furthermore, our segmentation evaluation is restricted to only those datasets and does not contain an external test set. Correcting the predictions from the initial segmentation model might introduce a slight bias, which we do acknowledge. Compared to the literature, we observe more stump ribs in our data. We leave the correlation between rib lengths and the prevalence of stump ribs, along with other factors such as sex, height, and weight, for future work in a more representative cohort. Additionally, we did not compare nnUNet against other methods. Since we achieved excellent segmentation results, a comparison seemed unnecessary, and we provided the community with a simple, easy-to-use nnUNet.
Although this did not occur for the lowest two ribs in our analysis data, we acknowledge that the instance assignment algorithm will fail if ribs from adjacent vertebral levels are fused or connected in the segmentation.
The accuracy of the measured rib length depends on the quality of the segmentation masks produced. If the segmentation is erroneous, so is the measured rib length. However, in our experiments, we did not observe significant rib-length errors due to typical automatic segmentation inaccuracies. Only severe errors, such as merged ribs, large missing segments, split ribs, or structural anomalies (e.g., bone tumors or partially resected ribs), will result in measurable deviations due to algorithm design. Minor errors, i.e., those with a similar surface delineation, mostly result in length errors of less than 1 mm.
Finally, although we manually corrected all ribs and evaluated segmentation performance across all ribs in a scan, our downstream experiments focused on the lowest two ribs. Thus, we did not manually review measurements of the upper thoracic ribs and cannot guarantee the same level of measurement consistency there. However, as only the lowest ribs in a subject can be stump ribs, the measurement of the length is more important there.
We leave it to future research to include the morphology of the vertebra in a rib-focused analysis, accounting for abnormalities such as enlarged foveae. Additionally, a larger population study using our segmentation and rib-length measurement tools could further improve our understanding of stump ribs. Moreover, the occurrence of our stump rib features and their prevalence in relation to other aberrations, such as lumbosacral anomalies, should be investigated. Lastly, we leave open the question of whether the rib length measurement algorithm and morphological features can be used in an inverse manner to detect rib segmentation errors.