Rib segmentation + low-RAM nnU-Net inference - #135
Conversation
…or the 0.8 full ct model we need 250 GB of RAM for a full body image.)
Benchmark comparisonSpeed (wall time per call)baseline Showing the 5 most-changed measurements per case; the rest are collapsed. Rows with a baseline below 3 ms are tagged
|
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_seg |
3.00 ±0.08 | 2.71 ±0.05 | -9.7% | 0.000 |
poi_calc_centroids_nocrop |
4.69 ±0.09 | 4.28 ±0.09 | -8.6% | 0.000 |
nii_filter_connected_components |
4.64 ±0.07 | 4.30 ±0.07 | -7.3% | 0.000 |
nii_rescale_seg |
3.34 ±0.13 | 3.23 ±0.10 | -3.2% | 0.059 |
nii_load_img |
11.12 ±0.08 | 10.77 ±0.04 | -3.1% | 0.000 |
… 31 more measurements
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
poi_calc_poi_from_subreg_vert |
13.33 ±0.25 | 12.91 ±0.33 | -3.1% | 0.019 |
nii_save |
12.24 ±0.20 | 11.89 ±0.13 | -2.9% | 0.003 |
nii_erode_msk |
6.08 ±0.09 | 6.20 ±0.06 | +1.9% | 0.047 |
nii_fill_holes |
4.34 ±0.05 | 4.41 ±0.09 | +1.8% | 0.065 |
nii_rescale |
40.16 ±0.22 | 39.52 ±0.22 | -1.6% | 0.001 |
nii_resample_from_to |
42.18 ±0.27 | 41.65 ±0.21 | -1.3% | 0.007 |
nii_dilate_msk |
123.52 ±0.68 | 124.32 ±0.39 | +0.7% | 0.020 |
metric_voxels |
250463.00 ±0.00 | 250463.00 ±0.00 | +0.0% | — |
metric_labels |
3.00 ±0.00 | 3.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
14.51 ±0.00 | 14.51 ±0.00 | +0.0% | — |
poi_map_labels |
0.22 ±0.01 | 0.15 ±0.01 | -30.4% (noise) | 0.000 |
nii_set_dtype |
0.57 ±0.02 | 0.41 ±0.03 | -28.9% (noise) | 0.000 |
poi_reorient |
0.46 ±0.02 | 0.37 ±0.03 | -20.6% (noise) | 0.001 |
nii_reorient |
0.94 ±0.08 | 0.76 ±0.04 | -19.5% (noise) | 0.003 |
nii_apply_crop |
0.73 ±0.05 | 0.59 ±0.03 | -18.8% (noise) | 0.001 |
poi_resample_from_to |
0.81 ±0.02 | 0.66 ±0.06 | -18.4% (noise) | 0.001 |
nii_pad_to |
0.75 ±0.09 | 0.63 ±0.04 | -16.7% (noise) | 0.020 |
poi_load |
1.12 ±0.02 | 0.94 ±0.04 | -15.9% (noise) | 0.000 |
poi_to_global |
0.24 ±0.01 | 0.21 ±0.01 | -14.1% (noise) | 0.001 |
nii_extract_label |
0.48 ±0.03 | 0.41 ±0.04 | -13.6% (noise) | 0.037 |
nii_map_labels |
1.10 ±0.04 | 0.96 ±0.05 | -12.9% (noise) | 0.001 |
poi_local_to_global_arr |
0.33 ±0.01 | 0.29 ±0.02 | -11.8% (noise) | 0.003 |
poi_save |
0.52 ±0.01 | 0.46 ±0.05 | -11.5% (noise) | 0.016 |
nii_compute_crop |
0.34 ±0.02 | 0.31 ±0.02 | -10.1% (noise) | 0.009 |
nii_get_array |
0.05 ±0.00 | 0.05 ±0.00 | -9.8% (noise) | 0.012 |
poi_rescale |
0.25 ±0.02 | 0.23 ±0.02 | -8.3% (noise) | 0.018 |
nii_get_connected_components |
2.09 ±0.03 | 2.26 ±0.03 | +8.1% (noise) | 0.000 |
poi_calc_centroids |
2.64 ±0.05 | 2.50 ±0.05 | -5.2% (noise) | 0.001 |
nii_center_of_masses |
1.82 ±0.04 | 1.77 ±0.02 | -2.9% (noise) | 0.057 |
nii_unique |
0.65 ±0.03 | 0.66 ±0.02 | +2.2% (noise) | 0.815 |
nii_volumes |
1.88 ±0.04 | 1.87 ±0.02 | -0.8% (noise) | 0.153 |
ct_2d — shape (73, 47, 1)
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_resample_from_to |
7.89 ±0.09 | 7.31 ±0.19 | -7.4% | 0.004 |
nii_rescale |
5.52 ±0.22 | 5.40 ±0.16 | -2.0% | 0.148 |
nii_dilate_msk |
14.76 ±0.69 | 14.65 ±0.12 | -0.7% | 0.319 |
metric_voxels |
3431.00 ±0.00 | 3431.00 ±0.00 | +0.0% | — |
metric_labels |
3.00 ±0.00 | 3.00 ±0.00 | +0.0% | — |
… 30 more measurements
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
metric_foreground_pct |
37.60 ±0.00 | 37.60 ±0.00 | +0.0% | — |
poi_map_labels |
0.20 ±0.01 | 0.23 ±0.02 | +15.4% (noise) | 0.009 |
nii_get_array |
0.02 ±0.00 | 0.02 ±0.00 | -10.6% (noise) | 0.006 |
nii_set_dtype |
0.47 ±0.02 | 0.42 ±0.02 | -9.8% (noise) | 0.001 |
nii_load_img |
1.72 ±0.08 | 1.55 ±0.03 | -9.8% (noise) | 0.003 |
nii_apply_crop |
0.77 ±0.02 | 0.70 ±0.02 | -9.5% (noise) | 0.000 |
nii_reorient |
0.95 ±0.04 | 0.86 ±0.03 | -9.5% (noise) | 0.002 |
poi_local_to_global_arr |
0.36 ±0.01 | 0.33 ±0.02 | -8.8% (noise) | 0.098 |
poi_rescale |
0.29 ±0.03 | 0.27 ±0.01 | -8.3% (noise) | 0.037 |
nii_unique |
0.14 ±0.01 | 0.12 ±0.01 | -7.9% (noise) | 0.028 |
nii_fill_holes |
0.95 ±0.01 | 0.88 ±0.02 | -7.9% (noise) | 0.000 |
poi_load |
1.13 ±0.04 | 1.04 ±0.03 | -7.7% (noise) | 0.033 |
nii_map_labels |
0.57 ±0.02 | 0.53 ±0.03 | -7.4% (noise) | 0.033 |
poi_to_global |
0.27 ±0.02 | 0.25 ±0.02 | -7.3% (noise) | 0.357 |
nii_erode_msk |
1.11 ±0.03 | 1.03 ±0.03 | -7.1% (noise) | 0.003 |
nii_compute_crop |
0.16 ±0.01 | 0.15 ±0.01 | -6.7% (noise) | 0.021 |
poi_calc_centroids_nocrop |
1.28 ±0.02 | 1.20 ±0.03 | -6.5% (noise) | 0.001 |
nii_get_connected_components |
0.71 ±0.05 | 0.67 ±0.04 | -6.2% (noise) | 0.231 |
nii_pad_to |
0.64 ±0.03 | 0.60 ±0.08 | -5.9% (noise) | 0.881 |
poi_reorient |
0.49 ±0.02 | 0.47 ±0.02 | -4.2% (noise) | 0.026 |
nii_rescale_seg |
0.81 ±0.04 | 0.78 ±0.06 | -4.1% (noise) | 0.721 |
nii_extract_label |
0.48 ±0.02 | 0.46 ±0.01 | -4.1% (noise) | 0.045 |
poi_save |
0.49 ±0.03 | 0.51 ±0.02 | +3.9% (noise) | 0.427 |
nii_volumes |
0.31 ±0.03 | 0.30 ±0.02 | -3.9% (noise) | 0.172 |
poi_calc_centroids |
1.00 ±0.07 | 0.96 ±0.04 | -3.2% (noise) | 0.104 |
poi_resample_from_to |
0.74 ±0.01 | 0.76 ±0.03 | +2.5% (noise) | 0.493 |
nii_filter_connected_components |
0.86 ±0.01 | 0.88 ±0.05 | +1.8% (noise) | 0.914 |
nii_load_seg |
1.74 ±0.10 | 1.72 ±0.04 | -1.1% (noise) | 0.138 |
nii_save |
1.41 ±0.06 | 1.40 ±0.04 | -0.6% (noise) | 0.837 |
nii_center_of_masses |
0.22 ±0.01 | 0.22 ±0.01 | -0.4% (noise) | 0.266 |
mri_3d — shape (68, 52, 67)
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_seg |
3.03 ±0.03 | 2.88 ±0.12 | -4.9% | 0.019 |
poi_calc_centroids |
3.02 ±0.04 | 2.88 ±0.07 | -4.9% | 0.006 |
nii_save |
9.81 ±0.25 | 9.41 ±0.12 | -4.1% | 0.043 |
nii_rescale_seg |
3.23 ±0.07 | 3.12 ±0.04 | -3.4% | 0.036 |
nii_erode_msk |
7.65 ±0.15 | 7.89 ±0.08 | +3.1% | 0.049 |
… 31 more measurements
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
poi_calc_centroids_nocrop |
8.94 ±0.36 | 8.71 ±0.19 | -2.6% | 0.303 |
nii_load_img |
9.07 ±0.10 | 8.88 ±0.11 | -2.1% | 0.020 |
poi_calc_poi_from_subreg_vert |
12.01 ±0.26 | 12.24 ±0.24 | +1.9% | 0.477 |
nii_filter_connected_components |
4.67 ±0.07 | 4.71 ±0.02 | +0.9% | 0.480 |
nii_rescale |
38.19 ±0.18 | 38.47 ±1.42 | +0.7% | 0.233 |
nii_fill_holes |
5.43 ±0.21 | 5.40 ±0.04 | -0.7% | 0.489 |
nii_dilate_msk |
160.23 ±0.98 | 161.25 ±0.88 | +0.6% | 0.064 |
nii_resample_from_to |
40.31 ±0.23 | 40.10 ±0.72 | -0.5% | 0.858 |
metric_voxels |
236912.00 ±0.00 | 236912.00 ±0.00 | +0.0% | — |
metric_labels |
8.00 ±0.00 | 8.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
18.21 ±0.00 | 18.21 ±0.00 | +0.0% | — |
nii_unique |
0.73 ±0.02 | 0.64 ±0.02 | -13.1% (noise) | 0.002 |
nii_apply_crop |
0.84 ±0.04 | 0.73 ±0.03 | -12.9% (noise) | 0.001 |
nii_extract_label |
0.55 ±0.02 | 0.48 ±0.02 | -12.6% (noise) | 0.000 |
poi_to_global |
0.27 ±0.02 | 0.30 ±0.01 | +12.2% (noise) | 0.010 |
nii_get_array |
0.06 ±0.00 | 0.05 ±0.00 | -11.7% (noise) | 0.001 |
poi_local_to_global_arr |
0.31 ±0.01 | 0.35 ±0.02 | +10.8% (noise) | 0.012 |
nii_map_labels |
1.10 ±0.04 | 0.98 ±0.03 | -10.1% (noise) | 0.002 |
nii_pad_to |
0.81 ±0.02 | 0.74 ±0.02 | -9.3% (noise) | 0.000 |
poi_resample_from_to |
0.77 ±0.02 | 0.84 ±0.04 | +8.0% (noise) | 0.028 |
nii_set_dtype |
0.61 ±0.06 | 0.56 ±0.03 | -7.1% (noise) | 0.454 |
poi_reorient |
0.49 ±0.01 | 0.52 ±0.02 | +5.5% (noise) | 0.010 |
poi_load |
2.19 ±0.06 | 2.30 ±0.10 | +5.4% (noise) | 0.042 |
nii_center_of_masses |
2.09 ±0.01 | 2.03 ±0.04 | -2.6% (noise) | 0.007 |
nii_volumes |
2.05 ±0.04 | 2.00 ±0.05 | -2.1% (noise) | 0.159 |
poi_rescale |
0.30 ±0.01 | 0.29 ±0.01 | -2.0% (noise) | 0.521 |
nii_reorient |
0.98 ±0.03 | 0.97 ±0.06 | -1.8% (noise) | 0.910 |
poi_save |
0.59 ±0.03 | 0.58 ±0.02 | -1.5% (noise) | 0.612 |
nii_compute_crop |
0.34 ±0.00 | 0.35 ±0.03 | +0.9% (noise) | 0.389 |
nii_get_connected_components |
2.20 ±0.08 | 2.21 ±0.08 | +0.7% (noise) | 0.557 |
poi_map_labels |
0.26 ±0.02 | 0.27 ±0.01 | +0.7% (noise) | 0.909 |
mri_2d — shape (68, 52, 1)
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_resample_from_to |
7.47 ±0.14 | 7.71 ±0.02 | +3.2% | 0.012 |
nii_rescale |
5.36 ±0.11 | 5.45 ±0.04 | +1.7% | 0.053 |
nii_dilate_msk |
19.37 ±0.09 | 19.54 ±0.13 | +0.9% | 0.019 |
metric_voxels |
3536.00 ±0.00 | 3536.00 ±0.00 | +0.0% | — |
metric_labels |
7.00 ±0.00 | 7.00 ±0.00 | +0.0% | — |
… 30 more measurements
| Measurement | baseline ms (median ±½·range) | head ms (median ±½·range) | Δ % | p |
|---|---|---|---|---|
metric_foreground_pct |
50.17 ±0.00 | 50.17 ±0.00 | +0.0% | — |
poi_to_global |
0.24 ±0.01 | 0.29 ±0.01 | +19.2% (noise) | 0.000 |
nii_get_connected_components |
0.60 ±0.03 | 0.70 ±0.03 | +16.1% (noise) | 0.001 |
nii_unique |
0.12 ±0.01 | 0.13 ±0.01 | +16.1% (noise) | 0.015 |
nii_rescale_seg |
0.76 ±0.01 | 0.88 ±0.05 | +15.9% (noise) | 0.005 |
nii_extract_label |
0.40 ±0.03 | 0.46 ±0.01 | +15.8% (noise) | 0.007 |
poi_rescale |
0.28 ±0.02 | 0.32 ±0.01 | +12.5% (noise) | 0.018 |
nii_map_labels |
0.48 ±0.01 | 0.53 ±0.02 | +11.8% (noise) | 0.004 |
nii_reorient |
0.81 ±0.03 | 0.90 ±0.03 | +11.3% (noise) | 0.000 |
poi_calc_centroids_nocrop |
1.37 ±0.04 | 1.52 ±0.05 | +10.5% (noise) | 0.001 |
nii_set_dtype |
0.39 ±0.01 | 0.43 ±0.01 | +10.5% (noise) | 0.000 |
nii_volumes |
0.45 ±0.02 | 0.49 ±0.01 | +8.6% (noise) | 0.005 |
poi_calc_centroids |
1.10 ±0.02 | 1.20 ±0.07 | +8.5% (noise) | 0.017 |
poi_save |
0.62 ±0.03 | 0.57 ±0.04 | -8.4% (noise) | 0.267 |
nii_compute_crop |
0.14 ±0.01 | 0.16 ±0.01 | +8.4% (noise) | 0.149 |
poi_reorient |
0.50 ±0.02 | 0.54 ±0.02 | +8.2% (noise) | 0.057 |
nii_load_seg |
1.68 ±0.05 | 1.81 ±0.02 | +7.6% (noise) | 0.001 |
nii_load_img |
1.44 ±0.05 | 1.55 ±0.04 | +7.5% (noise) | 0.045 |
nii_apply_crop |
0.66 ±0.03 | 0.70 ±0.02 | +7.2% (noise) | 0.012 |
nii_save |
1.36 ±0.03 | 1.45 ±0.04 | +7.2% (noise) | 0.001 |
nii_erode_msk |
1.28 ±0.02 | 1.36 ±0.04 | +6.6% (noise) | 0.006 |
poi_local_to_global_arr |
0.32 ±0.01 | 0.34 ±0.01 | +6.2% (noise) | 0.030 |
poi_resample_from_to |
0.83 ±0.02 | 0.87 ±0.02 | +5.0% (noise) | 0.077 |
nii_filter_connected_components |
0.84 ±0.03 | 0.88 ±0.05 | +5.0% (noise) | 0.205 |
nii_fill_holes |
1.08 ±0.03 | 1.13 ±0.03 | +4.8% (noise) | 0.016 |
poi_load |
1.98 ±0.09 | 2.07 ±0.05 | +4.6% (noise) | 0.082 |
nii_pad_to |
0.55 ±0.04 | 0.58 ±0.06 | +3.9% (noise) | 0.146 |
poi_map_labels |
0.26 ±0.01 | 0.25 ±0.01 | -1.1% (noise) | 0.769 |
nii_center_of_masses |
0.40 ±0.02 | 0.40 ±0.01 | +0.9% (noise) | 0.294 |
nii_get_array |
0.02 ±0.00 | 0.02 ±0.00 | -0.2% (noise) | 0.875 |
Gate: a measurement fails when the baseline is ≥ 1 ms, the median grows by ≥ 50%, and Welch's t-test gives p < 0.05. metric_* rows are context only.
Memory (peak RSS growth per call)
baseline a163cab vs head a163cab · python 3.11.16 · 5 repeats + 1 warmup · sampler proc-status, isolation fork · measurement floor ≈ 0.90 MiB
Showing the 5 most-changed measurements per case; the rest are collapsed. Rows with a baseline below 3 MiB are tagged (noise) — runner jitter on those swamps any real change.
ct_3d — shape (73, 47, 73)
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_img |
3.57 ±0.00 | 3.53 ±0.00 | -1.1% | — |
nii_set_dtype |
5.23 ±0.00 | 5.27 ±0.00 | +0.7% | — |
nii_pad_to |
5.41 ±0.00 | 5.45 ±0.00 | +0.7% | — |
nii_extract_label |
5.42 ±0.00 | 5.46 ±0.00 | +0.7% | — |
nii_map_labels |
5.48 ±0.00 | 5.52 ±0.00 | +0.7% | — |
… 31 more measurements
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_apply_crop |
5.86 ±0.00 | 5.89 ±0.00 | +0.7% | — |
poi_calc_centroids_nocrop |
5.91 ±0.00 | 5.95 ±0.00 | +0.7% | — |
nii_rescale_seg |
5.93 ±0.00 | 5.97 ±0.00 | +0.7% | — |
poi_calc_centroids |
6.04 ±0.00 | 6.08 ±0.00 | +0.6% | — |
nii_fill_holes |
6.27 ±0.00 | 6.31 ±0.00 | +0.6% | — |
nii_get_connected_components |
6.61 ±0.00 | 6.64 ±0.00 | +0.6% | — |
nii_filter_connected_components |
6.86 ±0.00 | 6.89 ±0.00 | +0.6% | — |
poi_calc_poi_from_subreg_vert |
7.10 ±0.00 | 7.14 ±0.00 | +0.6% | — |
nii_erode_msk |
5.91 ±0.00 | 5.93 ±0.00 | +0.3% | — |
nii_dilate_msk |
5.92 ±0.00 | 5.93 ±0.00 | +0.3% | — |
nii_load_seg |
6.00 ±0.00 | 6.00 ±0.00 | +0.0% | — |
nii_save |
3.71 ±0.00 | 3.71 ±0.00 | +0.0% | — |
nii_reorient |
5.89 ±0.00 | 5.89 ±0.00 | +0.0% | — |
nii_rescale |
6.16 ±0.00 | 6.16 ±0.00 | +0.0% | — |
nii_resample_from_to |
6.29 ±0.00 | 6.29 ±0.00 | +0.0% | — |
nii_volumes |
3.53 ±0.00 | 3.53 ±0.00 | +0.0% | — |
nii_center_of_masses |
3.28 ±0.03 | 3.28 ±0.00 | +0.0% | 0.374 |
poi_reorient |
3.84 ±0.00 | 3.84 ±0.00 | +0.0% | — |
poi_to_global |
3.09 ±0.00 | 3.09 ±0.00 | +0.0% | — |
poi_resample_from_to |
5.27 ±0.00 | 5.27 ±0.00 | +0.0% | — |
metric_voxels |
250463.00 ±0.00 | 250463.00 ±0.00 | +0.0% | — |
metric_labels |
3.00 ±0.00 | 3.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
14.51 ±0.00 | 14.51 ±0.00 | +0.0% | — |
nii_get_array |
1.65 ±0.00 | 1.65 ±0.00 | +0.0% (noise) | — |
nii_compute_crop |
2.90 ±0.00 | 2.90 ±0.00 | +0.0% (noise) | — |
nii_unique |
2.96 ±0.00 | 2.96 ±0.00 | +0.0% (noise) | — |
poi_rescale |
2.61 ±0.00 | 2.61 ±0.00 | +0.0% (noise) | — |
poi_local_to_global_arr |
2.96 ±0.00 | 2.96 ±0.00 | +0.0% (noise) | — |
poi_save |
1.41 ±0.00 | 1.41 ±0.00 | +0.0% (noise) | — |
poi_map_labels |
1.78 ±0.00 | 1.78 ±0.00 | +0.0% (noise) | — |
poi_load |
1.62 ±0.00 | 1.62 ±0.00 | +0.0% (noise) | — |
ct_2d — shape (73, 47, 1)
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_img |
3.50 ±0.00 | 3.46 ±0.00 | -1.0% | — |
nii_set_dtype |
5.16 ±0.00 | 5.20 ±0.00 | +0.8% | — |
nii_pad_to |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_extract_label |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_map_labels |
5.41 ±0.00 | 5.45 ±0.00 | +0.7% | — |
… 30 more measurements
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_apply_crop |
5.79 ±0.00 | 5.83 ±0.00 | +0.7% | — |
nii_rescale_seg |
5.87 ±0.00 | 5.91 ±0.00 | +0.7% | — |
poi_calc_centroids_nocrop |
5.91 ±0.00 | 5.95 ±0.00 | +0.7% | — |
poi_calc_centroids |
5.98 ±0.00 | 6.02 ±0.00 | +0.7% | — |
nii_fill_holes |
6.20 ±0.00 | 6.24 ±0.00 | +0.6% | — |
nii_get_connected_components |
6.54 ±0.00 | 6.58 ±0.00 | +0.6% | — |
nii_filter_connected_components |
6.79 ±0.00 | 6.83 ±0.00 | +0.6% | — |
nii_erode_msk |
5.85 ±0.00 | 5.86 ±0.00 | +0.3% | — |
nii_dilate_msk |
5.85 ±0.00 | 5.87 ±0.00 | +0.3% | — |
nii_load_seg |
5.93 ±0.00 | 5.93 ±0.00 | +0.1% | — |
nii_save |
3.65 ±0.00 | 3.65 ±0.00 | +0.0% | — |
nii_reorient |
5.83 ±0.00 | 5.83 ±0.00 | +0.0% | — |
nii_rescale |
6.09 ±0.00 | 6.09 ±0.00 | +0.0% | — |
nii_resample_from_to |
6.22 ±0.00 | 6.22 ±0.00 | +0.0% | — |
nii_volumes |
3.46 ±0.00 | 3.46 ±0.00 | +0.0% | — |
nii_center_of_masses |
3.21 ±0.00 | 3.21 ±0.00 | +0.0% | — |
poi_reorient |
3.77 ±0.00 | 3.77 ±0.00 | +0.0% | — |
poi_to_global |
3.02 ±0.00 | 3.02 ±0.00 | +0.0% | — |
poi_resample_from_to |
5.20 ±0.00 | 5.20 ±0.00 | +0.0% | — |
metric_voxels |
3431.00 ±0.00 | 3431.00 ±0.00 | +0.0% | — |
metric_labels |
3.00 ±0.00 | 3.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
37.60 ±0.00 | 37.60 ±0.00 | +0.0% | — |
nii_get_array |
1.59 ±0.00 | 1.59 ±0.00 | +0.0% (noise) | — |
nii_compute_crop |
2.84 ±0.00 | 2.84 ±0.00 | +0.0% (noise) | — |
nii_unique |
2.90 ±0.00 | 2.90 ±0.00 | +0.0% (noise) | — |
poi_rescale |
2.54 ±0.00 | 2.54 ±0.00 | +0.0% (noise) | — |
poi_local_to_global_arr |
2.89 ±0.00 | 2.89 ±0.00 | +0.0% (noise) | — |
poi_save |
1.34 ±0.00 | 1.34 ±0.00 | +0.0% (noise) | — |
poi_map_labels |
1.71 ±0.00 | 1.71 ±0.00 | +0.0% (noise) | — |
poi_load |
1.55 ±0.00 | 1.55 ±0.00 | +0.0% (noise) | — |
mri_3d — shape (68, 52, 67)
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_img |
3.56 ±0.00 | 3.53 ±0.00 | -1.0% | — |
nii_set_dtype |
5.23 ±0.00 | 5.27 ±0.00 | +0.7% | — |
nii_pad_to |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_extract_label |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_map_labels |
5.41 ±0.00 | 5.45 ±0.00 | +0.7% | — |
… 31 more measurements
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_apply_crop |
5.79 ±0.00 | 5.83 ±0.00 | +0.7% | — |
poi_calc_centroids_nocrop |
5.85 ±0.00 | 5.89 ±0.00 | +0.7% | — |
nii_rescale_seg |
5.87 ±0.00 | 5.91 ±0.00 | +0.7% | — |
poi_calc_centroids |
5.98 ±0.00 | 6.02 ±0.00 | +0.7% | — |
nii_fill_holes |
6.20 ±0.00 | 6.24 ±0.00 | +0.6% | — |
nii_get_connected_components |
6.54 ±0.00 | 6.58 ±0.00 | +0.6% | — |
nii_filter_connected_components |
6.79 ±0.00 | 6.83 ±0.00 | +0.6% | — |
poi_calc_poi_from_subreg_vert |
7.10 ±0.00 | 7.14 ±0.00 | +0.6% | — |
nii_erode_msk |
5.85 ±0.00 | 5.86 ±0.00 | +0.3% | — |
nii_dilate_msk |
5.85 ±0.00 | 5.87 ±0.00 | +0.3% | — |
nii_load_seg |
5.93 ±0.00 | 5.93 ±0.00 | +0.1% | — |
nii_save |
3.65 ±0.00 | 3.65 ±0.00 | +0.0% | — |
nii_reorient |
5.83 ±0.00 | 5.83 ±0.00 | +0.0% | — |
nii_rescale |
6.09 ±0.00 | 6.09 ±0.00 | +0.0% | — |
nii_resample_from_to |
6.22 ±0.00 | 6.22 ±0.00 | +0.0% | — |
nii_volumes |
3.46 ±0.00 | 3.46 ±0.00 | +0.0% | — |
nii_center_of_masses |
3.21 ±0.00 | 3.21 ±0.00 | +0.0% | — |
poi_reorient |
3.77 ±0.00 | 3.77 ±0.00 | +0.0% | — |
poi_to_global |
3.02 ±0.00 | 3.02 ±0.00 | +0.0% | — |
poi_resample_from_to |
5.20 ±0.00 | 5.20 ±0.00 | +0.0% | — |
metric_voxels |
236912.00 ±0.00 | 236912.00 ±0.00 | +0.0% | — |
metric_labels |
8.00 ±0.00 | 8.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
18.21 ±0.00 | 18.21 ±0.00 | +0.0% | — |
nii_get_array |
1.59 ±0.00 | 1.59 ±0.00 | +0.0% (noise) | — |
nii_compute_crop |
2.84 ±0.00 | 2.84 ±0.00 | +0.0% (noise) | — |
nii_unique |
2.90 ±0.00 | 2.90 ±0.00 | +0.0% (noise) | — |
poi_rescale |
2.54 ±0.00 | 2.54 ±0.00 | +0.0% (noise) | — |
poi_local_to_global_arr |
2.89 ±0.00 | 2.89 ±0.00 | +0.0% (noise) | — |
poi_save |
1.40 ±0.00 | 1.40 ±0.00 | +0.0% (noise) | — |
poi_map_labels |
1.71 ±0.00 | 1.71 ±0.00 | +0.0% (noise) | — |
poi_load |
1.55 ±0.00 | 1.55 ±0.00 | +0.0% (noise) | — |
mri_2d — shape (68, 52, 1)
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_load_img |
3.56 ±0.00 | 3.53 ±0.00 | -1.0% | — |
nii_set_dtype |
5.23 ±0.00 | 5.27 ±0.00 | +0.7% | — |
nii_pad_to |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_extract_label |
5.35 ±0.00 | 5.39 ±0.00 | +0.7% | — |
nii_map_labels |
5.41 ±0.00 | 5.45 ±0.00 | +0.7% | — |
… 30 more measurements
| Measurement | baseline MiB (median ±½·range) | head MiB (median ±½·range) | Δ % | p |
|---|---|---|---|---|
nii_apply_crop |
5.79 ±0.00 | 5.83 ±0.00 | +0.7% | — |
nii_rescale_seg |
5.87 ±0.00 | 5.91 ±0.00 | +0.7% | — |
poi_calc_centroids_nocrop |
5.91 ±0.00 | 5.95 ±0.00 | +0.7% | — |
poi_calc_centroids |
5.98 ±0.00 | 6.02 ±0.00 | +0.7% | — |
nii_fill_holes |
6.20 ±0.00 | 6.24 ±0.00 | +0.6% | — |
nii_get_connected_components |
6.54 ±0.00 | 6.58 ±0.00 | +0.6% | — |
nii_filter_connected_components |
6.79 ±0.00 | 6.83 ±0.00 | +0.6% | — |
nii_erode_msk |
5.85 ±0.00 | 5.86 ±0.00 | +0.3% | — |
nii_dilate_msk |
5.85 ±0.00 | 5.87 ±0.00 | +0.3% | — |
nii_load_seg |
5.93 ±0.00 | 5.93 ±0.00 | +0.1% | — |
nii_save |
3.65 ±0.00 | 3.65 ±0.00 | +0.0% | — |
nii_reorient |
5.83 ±0.00 | 5.83 ±0.00 | +0.0% | — |
nii_rescale |
6.09 ±0.00 | 6.09 ±0.00 | +0.0% | — |
nii_resample_from_to |
6.22 ±0.00 | 6.22 ±0.00 | +0.0% | — |
nii_volumes |
3.46 ±0.00 | 3.46 ±0.00 | +0.0% | — |
nii_center_of_masses |
3.21 ±0.00 | 3.21 ±0.00 | +0.0% | — |
poi_reorient |
3.77 ±0.00 | 3.77 ±0.00 | +0.0% | — |
poi_to_global |
3.02 ±0.00 | 3.02 ±0.00 | +0.0% | — |
poi_resample_from_to |
5.20 ±0.00 | 5.20 ±0.00 | +0.0% | — |
metric_voxels |
3536.00 ±0.00 | 3536.00 ±0.00 | +0.0% | — |
metric_labels |
7.00 ±0.00 | 7.00 ±0.00 | +0.0% | — |
metric_foreground_pct |
50.17 ±0.00 | 50.17 ±0.00 | +0.0% | — |
nii_get_array |
1.59 ±0.00 | 1.59 ±0.00 | +0.0% (noise) | — |
nii_compute_crop |
2.84 ±0.00 | 2.84 ±0.00 | +0.0% (noise) | — |
nii_unique |
2.90 ±0.00 | 2.90 ±0.00 | +0.0% (noise) | — |
poi_rescale |
2.54 ±0.00 | 2.54 ±0.00 | +0.0% (noise) | — |
poi_local_to_global_arr |
2.89 ±0.00 | 2.89 ±0.00 | +0.0% (noise) | — |
poi_save |
1.40 ±0.00 | 1.40 ±0.00 | +0.0% (noise) | — |
poi_map_labels |
1.71 ±0.00 | 1.71 ±0.00 | +0.0% (noise) | — |
poi_load |
1.55 ±0.00 | 1.55 ±0.00 | +0.0% (noise) | — |
Gate: a measurement fails when the baseline is ≥ 1 MiB, the median grows by ≥ 50%, and Welch's t-test gives p < 0.05. metric_* rows are context only.
Adds a rib-labelling pipeline on top of an existing vertebra + spine
segmentation and makes full-body nnU-Net inference survivable on
workstations with modest RAM.
Rib pipeline (
TPTBox.segmentation.rib)add_ribs_to_vert_spine(vert, spine, rib_seg=None, ct=None, ...)mergesleft/right rib labels into an existing vertebra instance + spine
subregion segmentation. If no raw rib mask is passed, VibeSeg dataset 12
is run on the CT; if
vert/spineare missing, SPINEPS is invoked. Pathresolution works from either explicit paths or a
BIDS_FILE+ datasetroot.
assign_ribs_to_vert_segmentationperforms deterministiccranial→caudal matching with a centroid-based left/right split and a T1
presence heuristic based on adaptive vertebral spacing.
split_touching_rib_ccsbreaks apart rib CCs that fuse the ribsof adjacent vertebrae using a multi-pass erosion strategy (Euclidean →
standard → direction-restricted), with optional
short_cutearly exitonce the expected CC count is reached and optional thread-parallel
evaluation of splits.
from TPTBox.segmentation import add_ribs_to_vert_spine.Low-RAM nnU-Net inference
TPTBox/segmentation/nnUnet_utils/inference_api.pyandVibeSeg/inference_nnunet.py:estimate_peak_ram_mb(shape, num_classes, num_channels)estimatesthe peak allocation of a single-pass nnU-Net run (logits + counts +
input tensor + output seg, with 1.3× headroom).
compute_cpu_chunks_for_ram(...)picks the smallest chunk countsuch that one chunk fits under a target RAM budget.
run_inference_on_filenow checks the estimate against 50 % of systemRAM and transparently switches to chunked inference before OOM instead
of only reacting to
MemoryError. This was needed for the 0.8 mmfull-CT model, which previously required ~250 GB of RAM on whole-body
images.
_run_inference_patchessupports auto-chunking (_cpu_chunks=None)with a configurable
ram_fraction.Bug fixes
np_map_labels: castmax(...) + 1throughint()so a label ofexactly 255 in a
uint8array no longer overflows the LUT bound.np_bbox_binary: acceptfloatvalues forpx_dist(rounded up) socallers that pass a spacing-derived distance don't crash.
Documentation + cleanup
docs/api/segmentation.mdand the segmentationpackage README (public API, dependency row, worked example).
coverage for
add_ribs_to_vert_spine,assign_ribs_to_vert_segmentation,split_touching_rib_ccs(includingshort_cut), and removal of aphantom
max_span_factorkwarg.gui/snapshot_reviewer/review_gui.py: silence ruffARG001byrenaming the unused callback arg to
_fam.