Skip to content

Rib segmentation + low-RAM nnU-Net inference - #135

Merged
Hendrik-code merged 18 commits into
mainfrom
rib
Aug 25, 2026
Merged

Rib segmentation + low-RAM nnU-Net inference#135
Hendrik-code merged 18 commits into
mainfrom
rib

Conversation

@robert-graf

Copy link
Copy Markdown
Collaborator

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, ...) merges
    left/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/spine are missing, SPINEPS is invoked. Path
    resolution works from either explicit paths or a BIDS_FILE + dataset
    root.
  • Internal assign_ribs_to_vert_segmentation performs deterministic
    cranial→caudal matching with a centroid-based left/right split and a T1
    presence heuristic based on adaptive vertebral spacing.
  • Internal split_touching_rib_ccs breaks apart rib CCs that fuse the ribs
    of adjacent vertebrae using a multi-pass erosion strategy (Euclidean →
    standard → direction-restricted), with optional short_cut early exit
    once the expected CC count is reached and optional thread-parallel
    evaluation of splits.
  • Re-exported at package level: from TPTBox.segmentation import add_ribs_to_vert_spine.

Low-RAM nnU-Net inference

TPTBox/segmentation/nnUnet_utils/inference_api.py and
VibeSeg/inference_nnunet.py:

  • New estimate_peak_ram_mb(shape, num_classes, num_channels) estimates
    the peak allocation of a single-pass nnU-Net run (logits + counts +
    input tensor + output seg, with 1.3× headroom).
  • New compute_cpu_chunks_for_ram(...) picks the smallest chunk count
    such that one chunk fits under a target RAM budget.
  • run_inference_on_file now checks the estimate against 50 % of system
    RAM and transparently switches to chunked inference before OOM instead
    of only reacting to MemoryError. This was needed for the 0.8 mm
    full-CT model, which previously required ~250 GB of RAM on whole-body
    images.
  • _run_inference_patches supports auto-chunking (_cpu_chunks=None)
    with a configurable ram_fraction.

Bug fixes

  • np_map_labels: cast max(...) + 1 through int() so a label of
    exactly 255 in a uint8 array no longer overflows the LUT bound.
  • np_bbox_binary: accept float values for px_dist (rounded up) so
    callers that pass a spacing-derived distance don't crash.

Documentation + cleanup

  • New rib API section in docs/api/segmentation.md and the segmentation
    package README (public API, dependency row, worked example).
  • Docstring cleanup in the rib module: module docstrings, full argument
    coverage for add_ribs_to_vert_spine, assign_ribs_to_vert_segmentation,
    split_touching_rib_ccs (including short_cut), and removal of a
    phantom max_span_factor kwarg.
  • gui/snapshot_reviewer/review_gui.py: silence ruff ARG001 by
    renaming the unused callback arg to _fam.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

Benchmark comparison

Speed (wall time per call)

baseline 8cd1efe vs head 8cd1efe · python 3.11.16 · 5 repeats + 1 warmup

Showing the 5 most-changed measurements per case; the rest are collapsed. Rows with a baseline below 3 ms are tagged (noise) — runner jitter on those swamps any real change.

ct_3d — shape (73, 47, 73)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_fill_holes 4.66 ±0.08 4.81 ±0.03 +3.3% 0.049
nii_erode_msk 6.02 ±0.07 6.16 ±0.05 +2.4% 0.031
nii_dilate_msk 120.51 ±0.86 119.43 ±0.20 -0.9% 0.015
poi_calc_centroids_nocrop 4.47 ±0.09 4.50 ±0.05 +0.8% 0.747
poi_calc_poi_from_subreg_vert 11.79 ±0.15 11.70 ±0.18 -0.7% 0.774
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_save 11.63 ±0.06 11.70 ±0.12 +0.6% 0.956
nii_filter_connected_components 4.34 ±0.05 4.32 ±0.05 -0.5% 0.908
nii_load_img 11.85 ±0.04 11.80 ±0.06 -0.4% 0.093
nii_resample_from_to 41.59 ±0.16 41.74 ±0.23 +0.4% 0.479
nii_rescale_seg 3.17 ±0.06 3.16 ±0.10 -0.3% 0.999
nii_rescale 39.92 ±0.42 39.86 ±0.16 -0.1% 0.609
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_reorient 0.35 ±0.02 0.44 ±0.03 +24.4% (noise) 0.001
poi_to_global 0.19 ±0.02 0.23 ±0.02 +22.2% (noise) 0.019
poi_map_labels 0.18 ±0.02 0.21 ±0.01 +18.1% (noise) 0.018
nii_compute_crop 0.28 ±0.03 0.33 ±0.03 +17.8% (noise) 0.090
nii_extract_label 0.43 ±0.04 0.36 ±0.03 -17.7% (noise) 0.032
poi_resample_from_to 0.59 ±0.03 0.65 ±0.04 +11.2% (noise) 0.006
nii_set_dtype 0.43 ±0.05 0.48 ±0.02 +10.9% (noise) 0.238
poi_save 0.41 ±0.02 0.45 ±0.01 +9.5% (noise) 0.001
poi_rescale 0.20 ±0.02 0.21 ±0.03 +5.4% (noise) 0.568
nii_apply_crop 0.58 ±0.05 0.55 ±0.02 -5.2% (noise) 0.334
nii_get_array 0.05 ±0.00 0.05 ±0.00 +5.0% (noise) 0.328
nii_load_seg 2.83 ±0.08 2.73 ±0.11 -3.8% (noise) 0.469
poi_load 0.90 ±0.03 0.93 ±0.02 +3.6% (noise) 0.028
nii_pad_to 0.60 ±0.04 0.61 ±0.03 +1.9% (noise) 0.775
nii_reorient 0.77 ±0.03 0.78 ±0.04 +1.9% (noise) 0.683
nii_map_labels 0.89 ±0.05 0.88 ±0.07 -1.6% (noise) 0.908
nii_center_of_masses 1.84 ±0.03 1.82 ±0.01 -1.1% (noise) 0.157
poi_calc_centroids 2.55 ±0.03 2.57 ±0.08 +1.1% (noise) 0.735
nii_get_connected_components 2.14 ±0.05 2.12 ±0.03 -1.0% (noise) 0.812
nii_unique 0.62 ±0.01 0.63 ±0.05 +0.8% (noise) 0.902
nii_volumes 1.93 ±0.03 1.95 ±0.03 +0.6% (noise) 0.698
poi_local_to_global_arr 0.27 ±0.01 0.27 ±0.02 +0.4% (noise) 0.620

ct_2d — shape (73, 47, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_dilate_msk 13.98 ±0.20 13.71 ±0.03 -2.0% 0.019
nii_resample_from_to 7.29 ±0.17 7.43 ±0.13 +1.9% 0.091
nii_rescale 5.63 ±0.10 5.66 ±0.23 +0.5% 0.707
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%
nii_get_array 0.02 ±0.00 0.02 ±0.00 +18.7% (noise) 0.133
nii_unique 0.13 ±0.01 0.15 ±0.00 +8.5% (noise) 0.051
poi_resample_from_to 0.76 ±0.03 0.80 ±0.08 +6.3% (noise) 0.078
poi_load 1.02 ±0.01 1.07 ±0.11 +5.5% (noise) 0.185
poi_map_labels 0.22 ±0.01 0.23 ±0.02 +5.1% (noise) 0.257
nii_apply_crop 0.70 ±0.02 0.73 ±0.02 +5.0% (noise) 0.224
nii_reorient 0.83 ±0.03 0.87 ±0.03 +5.0% (noise) 0.013
poi_save 0.52 ±0.01 0.54 ±0.02 +4.4% (noise) 0.160
nii_rescale_seg 0.82 ±0.01 0.79 ±0.03 -3.5% (noise) 0.565
poi_rescale 0.27 ±0.01 0.28 ±0.01 +2.6% (noise) 0.096
nii_get_connected_components 0.70 ±0.02 0.68 ±0.01 -2.2% (noise) 0.558
nii_center_of_masses 0.23 ±0.01 0.24 ±0.01 +2.2% (noise) 0.205
nii_filter_connected_components 0.88 ±0.04 0.86 ±0.03 -2.1% (noise) 0.762
nii_pad_to 0.61 ±0.02 0.62 ±0.02 +2.1% (noise) 0.083
nii_set_dtype 0.42 ±0.02 0.43 ±0.02 +1.8% (noise) 0.392
nii_load_img 1.52 ±0.03 1.55 ±0.04 +1.7% (noise) 0.047
nii_fill_holes 0.86 ±0.08 0.85 ±0.01 -1.6% (noise) 0.259
nii_save 1.44 ±0.04 1.42 ±0.04 -1.6% (noise) 0.502
poi_calc_centroids 0.94 ±0.00 0.95 ±0.03 +1.5% (noise) 0.257
nii_erode_msk 0.97 ±0.02 0.99 ±0.06 +1.4% (noise) 0.505
nii_map_labels 0.52 ±0.03 0.52 ±0.02 -1.4% (noise) 0.374
nii_compute_crop 0.17 ±0.01 0.17 ±0.01 -1.1% (noise) 0.954
poi_calc_centroids_nocrop 1.15 ±0.04 1.14 ±0.01 -1.1% (noise) 0.289
poi_local_to_global_arr 0.29 ±0.01 0.30 ±0.01 +1.0% (noise) 0.995
nii_extract_label 0.47 ±0.01 0.47 ±0.01 -0.8% (noise) 0.301
poi_reorient 0.49 ±0.02 0.49 ±0.01 +0.5% (noise) 0.622
nii_volumes 0.31 ±0.01 0.31 ±0.01 +0.3% (noise) 0.524
poi_to_global 0.26 ±0.03 0.26 ±0.01 -0.1% (noise) 0.594
nii_load_seg 1.72 ±0.06 1.72 ±0.04 +0.1% (noise) 0.643

mri_3d — shape (68, 52, 67)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
poi_calc_poi_from_subreg_vert 11.05 ±0.11 10.80 ±0.11 -2.3% 0.023
nii_fill_holes 5.62 ±0.06 5.51 ±0.03 -1.9% 0.006
nii_rescale_seg 3.17 ±0.04 3.11 ±0.03 -1.8% 0.051
poi_calc_centroids_nocrop 9.23 ±0.09 9.07 ±0.03 -1.7% 0.029
nii_dilate_msk 155.18 ±0.26 152.71 ±0.58 -1.6% 0.000
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_load_seg 3.01 ±0.02 2.97 ±0.08 -1.2% 0.188
nii_load_img 9.69 ±0.07 9.58 ±0.08 -1.1% 0.345
nii_filter_connected_components 4.62 ±0.04 4.58 ±0.06 -0.9% 0.484
nii_resample_from_to 39.44 ±0.70 39.25 ±0.37 -0.5% 0.450
nii_rescale 37.41 ±0.27 37.28 ±0.35 -0.4% 0.911
nii_save 9.58 ±0.11 9.59 ±0.13 +0.2% 0.504
nii_erode_msk 7.59 ±0.06 7.60 ±0.06 +0.2% 0.765
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 0.04 ±0.00 0.06 ±0.00 +31.9% (noise) 0.002
nii_set_dtype 0.57 ±0.03 0.52 ±0.02 -7.6% (noise) 0.092
poi_rescale 0.31 ±0.01 0.33 ±0.01 +6.2% (noise) 0.009
poi_local_to_global_arr 0.29 ±0.01 0.31 ±0.01 +5.6% (noise) 0.072
nii_pad_to 0.76 ±0.05 0.80 ±0.02 +4.9% (noise) 0.047
poi_resample_from_to 0.82 ±0.05 0.79 ±0.04 -4.2% (noise) 0.261
poi_load 2.09 ±0.02 2.17 ±0.02 +4.2% (noise) 0.000
nii_map_labels 1.05 ±0.03 1.01 ±0.02 -3.9% (noise) 0.012
nii_reorient 0.90 ±0.02 0.93 ±0.06 +3.7% (noise) 0.165
nii_apply_crop 0.76 ±0.02 0.78 ±0.05 +3.3% (noise) 0.979
poi_save 0.61 ±0.02 0.59 ±0.02 -3.0% (noise) 0.093
poi_reorient 0.51 ±0.02 0.53 ±0.01 +2.8% (noise) 0.061
nii_compute_crop 0.36 ±0.01 0.35 ±0.01 -2.7% (noise) 0.076
nii_extract_label 0.51 ±0.02 0.49 ±0.02 -2.6% (noise) 0.362
poi_to_global 0.31 ±0.01 0.31 ±0.01 +1.5% (noise) 0.637
poi_map_labels 0.27 ±0.01 0.28 ±0.01 +1.5% (noise) 0.602
poi_calc_centroids 2.91 ±0.02 2.87 ±0.04 -1.2% (noise) 0.242
nii_get_connected_components 2.10 ±0.01 2.12 ±0.03 +0.6% (noise) 0.752
nii_center_of_masses 2.09 ±0.02 2.10 ±0.02 +0.5% (noise) 0.635
nii_unique 0.61 ±0.01 0.61 ±0.06 -0.2% (noise) 0.379
nii_volumes 2.05 ±0.03 2.05 ±0.01 +0.2% (noise) 0.927

mri_2d — shape (68, 52, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_rescale 5.67 ±0.05 5.43 ±0.07 -4.4% 0.000
nii_resample_from_to 7.17 ±0.10 7.39 ±0.09 +2.9% 0.013
nii_dilate_msk 18.37 ±0.05 18.13 ±0.05 -1.3% 0.000
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%
nii_get_array 0.02 ±0.00 0.02 ±0.01 +16.9% (noise) 0.642
nii_erode_msk 1.17 ±0.02 1.24 ±0.03 +5.4% (noise) 0.007
nii_reorient 0.85 ±0.03 0.81 ±0.02 -4.8% (noise) 0.087
nii_extract_label 0.44 ±0.01 0.46 ±0.02 +4.1% (noise) 0.037
nii_load_seg 1.64 ±0.03 1.71 ±0.06 +4.0% (noise) 0.102
nii_center_of_masses 0.42 ±0.01 0.41 ±0.01 -3.7% (noise) 0.164
poi_local_to_global_arr 0.28 ±0.01 0.29 ±0.01 +3.2% (noise) 0.210
poi_calc_centroids 1.16 ±0.02 1.12 ±0.04 -3.1% (noise) 0.683
nii_get_connected_components 0.69 ±0.02 0.67 ±0.03 -3.0% (noise) 0.221
nii_unique 0.15 ±0.01 0.14 ±0.01 -2.9% (noise) 0.508
nii_volumes 0.47 ±0.01 0.46 ±0.01 -2.6% (noise) 0.226
nii_apply_crop 0.71 ±0.01 0.73 ±0.02 +2.5% (noise) 0.891
poi_map_labels 0.26 ±0.01 0.26 ±0.01 +2.4% (noise) 0.083
nii_rescale_seg 0.80 ±0.02 0.79 ±0.03 -2.3% (noise) 0.298
poi_resample_from_to 0.76 ±0.02 0.75 ±0.03 -2.2% (noise) 0.367
nii_compute_crop 0.16 ±0.00 0.16 ±0.01 -2.2% (noise) 0.252
poi_reorient 0.52 ±0.02 0.50 ±0.02 -2.1% (noise) 0.186
nii_set_dtype 0.43 ±0.02 0.42 ±0.00 -2.1% (noise) 0.417
nii_save 1.41 ±0.04 1.38 ±0.06 -2.1% (noise) 0.557
nii_filter_connected_components 0.90 ±0.03 0.88 ±0.03 -1.8% (noise) 0.941
poi_calc_centroids_nocrop 1.35 ±0.01 1.37 ±0.03 +1.6% (noise) 0.432
nii_fill_holes 1.07 ±0.03 1.05 ±0.09 -1.4% (noise) 0.382
poi_load 1.90 ±0.05 1.93 ±0.01 +1.2% (noise) 0.499
poi_save 0.58 ±0.04 0.57 ±0.01 -0.6% (noise) 0.970
nii_load_img 1.51 ±0.08 1.50 ±0.04 -0.6% (noise) 0.900
nii_map_labels 0.52 ±0.02 0.52 ±0.02 -0.5% (noise) 0.935
poi_to_global 0.29 ±0.01 0.29 ±0.02 -0.5% (noise) 0.278
nii_pad_to 0.60 ±0.01 0.60 ±0.02 +0.5% (noise) 0.656
poi_rescale 0.31 ±0.01 0.31 ±0.02 +0.2% (noise) 0.414

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 8cd1efe vs head 8cd1efe · 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_rescale_seg 5.93 ±0.00 5.93 ±0.00 +0.1%
nii_rescale 6.15 ±0.00 6.16 ±0.00 +0.1%
poi_to_global 3.09 ±0.00 3.09 ±0.00 +0.1%
nii_resample_from_to 6.28 ±0.00 6.29 ±0.00 +0.1%
nii_center_of_masses 3.28 ±0.00 3.28 ±0.00 +0.1%
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_volumes 3.53 ±0.00 3.53 ±0.00 +0.1%
nii_save 3.71 ±0.00 3.72 ±0.00 +0.1%
poi_reorient 3.84 ±0.00 3.84 ±0.00 +0.1%
nii_set_dtype 5.23 ±0.00 5.23 ±0.00 +0.1%
nii_pad_to 5.41 ±0.00 5.42 ±0.00 +0.1%
nii_extract_label 5.42 ±0.00 5.42 ±0.00 +0.1%
nii_map_labels 5.48 ±0.00 5.48 ±0.00 +0.1%
nii_apply_crop 5.86 ±0.00 5.86 ±0.00 +0.1%
nii_reorient 5.89 ±0.00 5.90 ±0.00 +0.1%
poi_calc_centroids_nocrop 5.91 ±0.00 5.92 ±0.00 +0.1%
nii_dilate_msk 5.92 ±0.00 5.92 ±0.00 +0.1%
poi_calc_centroids 6.04 ±0.00 6.05 ±0.00 +0.1%
nii_fill_holes 6.27 ±0.00 6.27 ±0.00 +0.1%
nii_get_connected_components 6.61 ±0.00 6.61 ±0.00 +0.1%
nii_filter_connected_components 6.86 ±0.00 6.86 ±0.00 +0.1%
nii_load_img 3.57 ±0.00 3.57 ±0.00 +0.0%
nii_load_seg 6.00 ±0.00 6.00 ±0.00 +0.0%
nii_erode_msk 5.93 ±0.00 5.93 ±0.00 +0.0%
poi_resample_from_to 5.27 ±0.00 5.27 ±0.00 +0.0%
poi_calc_poi_from_subreg_vert 7.10 ±0.00 7.10 ±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.66 ±0.00 +0.2% (noise)
poi_rescale 2.61 ±0.00 2.61 ±0.00 +0.1% (noise)
poi_local_to_global_arr 2.96 ±0.00 2.96 ±0.00 +0.1% (noise)
nii_unique 2.96 ±0.00 2.97 ±0.00 +0.1% (noise)
nii_compute_crop 2.90 ±0.00 2.90 ±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_rescale_seg 5.86 ±0.00 5.86 ±0.00 +0.1%
nii_erode_msk 5.87 ±0.00 5.86 ±0.00 -0.1%
nii_rescale 6.09 ±0.00 6.09 ±0.00 +0.1%
nii_resample_from_to 6.21 ±0.00 6.21 ±0.00 +0.1%
nii_load_img 3.50 ±0.00 3.50 ±0.00 +0.0%
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_load_seg 5.93 ±0.00 5.93 ±0.00 +0.0%
nii_save 3.65 ±0.00 3.65 ±0.00 +0.0%
nii_set_dtype 5.16 ±0.00 5.16 ±0.00 +0.0%
nii_reorient 5.83 ±0.00 5.83 ±0.00 +0.0%
nii_apply_crop 5.79 ±0.00 5.79 ±0.00 +0.0%
nii_pad_to 5.35 ±0.00 5.35 ±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%
nii_extract_label 5.35 ±0.00 5.35 ±0.00 +0.0%
nii_map_labels 5.41 ±0.00 5.41 ±0.00 +0.0%
nii_dilate_msk 5.85 ±0.00 5.85 ±0.00 +0.0%
nii_fill_holes 6.20 ±0.00 6.20 ±0.00 +0.0%
nii_get_connected_components 6.54 ±0.00 6.54 ±0.00 +0.0%
nii_filter_connected_components 6.79 ±0.00 6.79 ±0.00 +0.0%
poi_calc_centroids 5.98 ±0.00 5.98 ±0.00 +0.0%
poi_calc_centroids_nocrop 5.91 ±0.00 5.91 ±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_rescale_seg 5.86 ±0.00 5.86 ±0.00 +0.1%
nii_erode_msk 5.87 ±0.00 5.86 ±0.00 -0.1%
nii_rescale 6.09 ±0.00 6.09 ±0.00 +0.1%
nii_resample_from_to 6.21 ±0.00 6.21 ±0.00 +0.1%
nii_load_img 3.56 ±0.00 3.56 ±0.00 +0.0%
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_load_seg 5.93 ±0.00 5.93 ±0.00 +0.0%
nii_save 3.65 ±0.00 3.65 ±0.00 +0.0%
nii_set_dtype 5.23 ±0.00 5.23 ±0.00 +0.0%
nii_reorient 5.83 ±0.00 5.83 ±0.00 +0.0%
nii_apply_crop 5.79 ±0.00 5.79 ±0.00 +0.0%
nii_pad_to 5.35 ±0.00 5.35 ±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%
nii_extract_label 5.35 ±0.00 5.35 ±0.00 +0.0%
nii_map_labels 5.41 ±0.00 5.41 ±0.00 +0.0%
nii_dilate_msk 5.85 ±0.00 5.85 ±0.00 +0.0%
nii_fill_holes 6.20 ±0.00 6.20 ±0.00 +0.0%
nii_get_connected_components 6.54 ±0.00 6.54 ±0.00 +0.0%
nii_filter_connected_components 6.79 ±0.00 6.79 ±0.00 +0.0%
poi_calc_centroids 5.98 ±0.00 5.98 ±0.00 +0.0%
poi_calc_centroids_nocrop 5.85 ±0.00 5.85 ±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%
poi_calc_poi_from_subreg_vert 7.10 ±0.00 7.10 ±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_rescale_seg 5.86 ±0.00 5.86 ±0.00 +0.1%
nii_erode_msk 5.87 ±0.00 5.86 ±0.00 -0.1%
nii_rescale 6.09 ±0.00 6.09 ±0.00 +0.1%
nii_resample_from_to 6.21 ±0.00 6.21 ±0.00 +0.1%
nii_load_img 3.56 ±0.00 3.56 ±0.00 +0.0%
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_load_seg 5.93 ±0.00 5.93 ±0.00 +0.0%
nii_save 3.65 ±0.00 3.65 ±0.00 +0.0%
nii_set_dtype 5.23 ±0.00 5.23 ±0.00 +0.0%
nii_reorient 5.83 ±0.00 5.83 ±0.00 +0.0%
nii_apply_crop 5.79 ±0.00 5.79 ±0.00 +0.0%
nii_pad_to 5.35 ±0.00 5.35 ±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%
nii_extract_label 5.35 ±0.00 5.35 ±0.00 +0.0%
nii_map_labels 5.41 ±0.00 5.41 ±0.00 +0.0%
nii_dilate_msk 5.85 ±0.00 5.85 ±0.00 +0.0%
nii_fill_holes 6.20 ±0.00 6.20 ±0.00 +0.0%
nii_get_connected_components 6.54 ±0.00 6.54 ±0.00 +0.0%
nii_filter_connected_components 6.79 ±0.00 6.79 ±0.00 +0.0%
poi_calc_centroids 5.98 ±0.00 5.98 ±0.00 +0.0%
poi_calc_centroids_nocrop 5.91 ±0.00 5.91 ±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.

@Hendrik-code Hendrik-code added enhancement New feature or request spine Spine specific features labels Aug 25, 2026
@Hendrik-code
Hendrik-code merged commit 9f0d44b into main Aug 25, 2026
6 checks passed
@Hendrik-code
Hendrik-code deleted the rib branch August 25, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request spine Spine specific features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants