Skip to content

Stitching refactor + RAM-saving overlap + c_val option + trivial-memory warning - #157

Merged
Hendrik-code merged 9 commits into
mainfrom
robert-pc-pr-stitching-refactor
Oct 19, 2026
Merged

Hendrik-code merged 9 commits into
mainfrom
robert-pc-pr-stitching-refactor

Conversation

@robert-graf

Copy link
Copy Markdown
Collaborator

Summary

Follow-up cleanup on top of robert-pc. Four self-contained commits, cherry-picked cleanly onto main:

  • Refactor TPTBox/stitching/stitching.py to use existing TPTBox helpers instead of duplicated logic — ~370 LOC deleted, ~220 added.
  • stitching.py + stitching_tools.py: fix min_value handling and keep the overlap NII smaller to save RAM on multi-station stitches.
  • TPTBox/core/nii_wrapper.py + core/internal/nii_help.py: add a c_val option so callers can control the constant fill value used during padding/resampling.
  • TPTBox/segmentation/VibeSeg/inference_nnunet.py: only warn about memory pressure when the required memory is non-trivial (silences the noisy warning for small volumes).

The four commits do not touch files that any of the open PRs below rewrite, so this can go in independently — but see prerequisites for context.

Prerequisite / related PRs

These are the currently open PRs that were merged into robert-pc while this work was developed. None are strict blockers for this PR (the diff here does not overlap with theirs), but they're the natural merge partners and should land around the same time so robert-pc can be rebased away cleanly:

Test plan

  • pytest unit_tests/ passes
  • ruff check . clean
  • Manual: run stitching on a multi-station CT/MRI case and confirm output matches pre-refactor result within tolerance
  • Manual: run a VibeSeg inference on a small volume and confirm the memory warning is no longer emitted
  • Manual: use the new c_val argument in a NII.resample_* / pad path and confirm the fill value is honored

🤖 Generated with Claude Code

@robert-graf robert-graf self-assigned this Sep 25, 2026
- Reflow docstring to satisfy D205 (blank line between summary and body)
- Replace ambiguous MULTIPLICATION SIGN with ASCII '*' in comment

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Benchmark comparison

Speed (wall time per call)

baseline 7bdbf63 vs head 7bdbf63 · python 3.11.17 · 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_save 9.57 ±0.57 9.22 ±0.25 -3.6% 0.105
nii_filter_connected_components 3.49 ±0.01 3.60 ±0.10 +3.2% 0.053
nii_fill_holes 4.10 ±0.15 4.00 ±0.11 -2.4% 0.516
nii_resample_from_to 33.79 ±0.68 33.07 ±0.40 -2.1% 0.085
nii_dilate_msk 97.00 ±0.70 95.32 ±1.30 -1.7% 0.020
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_load_img 9.62 ±0.15 9.50 ±0.10 -1.3% 0.189
nii_erode_msk 4.95 ±0.11 5.01 ±0.03 +1.1% 0.741
poi_calc_centroids_nocrop 3.73 ±0.04 3.76 ±0.14 +0.8% 0.452
poi_calc_poi_from_subreg_vert 9.45 ±0.13 9.42 ±0.16 -0.3% 0.410
nii_rescale 32.06 ±1.23 32.14 ±0.96 +0.2% 0.862
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_rescale 0.16 ±0.01 0.22 ±0.04 +37.6% (noise) 0.043
nii_get_array 0.05 ±0.01 0.04 ±0.00 -26.5% (noise) 0.004
poi_to_global 0.15 ±0.01 0.19 ±0.03 +24.0% (noise) 0.014
poi_reorient 0.36 ±0.04 0.30 ±0.02 -16.5% (noise) 0.010
poi_resample_from_to 0.59 ±0.03 0.50 ±0.04 -15.3% (noise) 0.009
nii_compute_crop 0.33 ±0.01 0.29 ±0.02 -12.7% (noise) 0.005
poi_local_to_global_arr 0.21 ±0.01 0.24 ±0.02 +12.4% (noise) 0.140
nii_set_dtype 0.49 ±0.02 0.43 ±0.04 -12.2% (noise) 0.039
nii_extract_label 0.36 ±0.03 0.40 ±0.02 +10.5% (noise) 0.129
poi_calc_centroids 2.02 ±0.05 2.22 ±0.04 +10.0% (noise) 0.000
nii_load_seg 2.44 ±0.02 2.24 ±0.05 -8.1% (noise) 0.000
nii_reorient 0.75 ±0.03 0.69 ±0.03 -7.7% (noise) 0.002
nii_rescale_seg 2.68 ±0.03 2.54 ±0.09 -5.3% (noise) 0.034
poi_map_labels 0.15 ±0.02 0.14 ±0.02 -5.1% (noise) 0.305
poi_save 0.36 ±0.03 0.38 ±0.03 +3.9% (noise) 0.489
poi_load 0.75 ±0.03 0.72 ±0.02 -3.8% (noise) 0.098
nii_apply_crop 0.59 ±0.03 0.57 ±0.02 -3.8% (noise) 0.127
nii_pad_to 0.64 ±0.04 0.63 ±0.03 -2.0% (noise) 0.833
nii_volumes 1.61 ±0.01 1.63 ±0.04 +1.7% (noise) 0.325
nii_get_connected_components 1.76 ±0.02 1.75 ±0.06 -0.8% (noise) 0.720
nii_center_of_masses 1.50 ±0.02 1.51 ±0.04 +0.7% (noise) 0.589
nii_unique 0.55 ±0.01 0.55 ±0.03 -0.7% (noise) 0.518
nii_map_labels 0.79 ±0.03 0.79 ±0.05 +0.2% (noise) 0.426

ct_2d — shape (73, 47, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_rescale 4.34 ±0.20 5.01 ±0.08 +15.3% 0.005
nii_resample_from_to 6.08 ±0.18 6.31 ±0.13 +3.8% 0.045
nii_dilate_msk 11.16 ±0.15 10.87 ±0.12 -2.6% 0.027
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_reorient 0.44 ±0.01 0.40 ±0.01 -10.2% (noise) 0.000
poi_rescale 0.26 ±0.01 0.24 ±0.01 -8.9% (noise) 0.189
nii_set_dtype 0.41 ±0.01 0.44 ±0.01 +7.9% (noise) 0.008
nii_reorient 0.77 ±0.04 0.83 ±0.02 +7.7% (noise) 0.012
nii_map_labels 0.52 ±0.02 0.49 ±0.01 -6.7% (noise) 0.010
poi_calc_centroids_nocrop 1.06 ±0.05 0.99 ±0.02 -6.4% (noise) 0.045
nii_apply_crop 0.66 ±0.03 0.70 ±0.05 +6.3% (noise) 0.189
nii_unique 0.14 ±0.00 0.14 ±0.01 +5.9% (noise) 0.059
nii_rescale_seg 0.74 ±0.01 0.79 ±0.01 +5.8% (noise) 0.000
nii_compute_crop 0.15 ±0.01 0.16 ±0.01 +5.7% (noise) 0.022
nii_pad_to 0.54 ±0.01 0.57 ±0.01 +4.7% (noise) 0.029
nii_get_array 0.02 ±0.00 0.02 ±0.00 -4.5% (noise) 0.305
nii_extract_label 0.42 ±0.01 0.44 ±0.02 +4.4% (noise) 0.625
poi_load 0.86 ±0.01 0.83 ±0.01 -3.8% (noise) 0.001
poi_resample_from_to 0.67 ±0.03 0.64 ±0.02 -3.8% (noise) 0.269
nii_erode_msk 0.88 ±0.03 0.84 ±0.03 -3.6% (noise) 0.050
nii_volumes 0.28 ±0.01 0.27 ±0.01 -3.4% (noise) 0.277
poi_calc_centroids 0.87 ±0.01 0.85 ±0.03 -2.3% (noise) 0.088
poi_map_labels 0.19 ±0.01 0.20 ±0.01 +2.1% (noise) 0.801
nii_fill_holes 0.77 ±0.02 0.76 ±0.02 -1.8% (noise) 0.796
nii_load_img 1.31 ±0.03 1.33 ±0.03 +1.3% (noise) 0.179
nii_save 1.23 ±0.02 1.22 ±0.06 -1.3% (noise) 0.285
poi_to_global 0.24 ±0.01 0.24 ±0.01 -1.2% (noise) 0.765
nii_load_seg 1.44 ±0.02 1.42 ±0.05 -1.1% (noise) 0.299
nii_get_connected_components 0.62 ±0.01 0.63 ±0.03 +0.9% (noise) 0.356
nii_center_of_masses 0.22 ±0.00 0.22 ±0.01 -0.9% (noise) 0.223
poi_local_to_global_arr 0.26 ±0.02 0.26 ±0.00 -0.5% (noise) 0.274
poi_save 0.48 ±0.03 0.48 ±0.02 -0.5% (noise) 0.943
nii_filter_connected_components 0.79 ±0.01 0.79 ±0.02 -0.2% (noise) 0.588

mri_3d — shape (68, 52, 67)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_resample_from_to 31.14 ±0.32 32.98 ±0.31 +5.9% 0.000
poi_calc_poi_from_subreg_vert 8.89 ±0.15 9.23 ±0.15 +3.8% 0.028
nii_filter_connected_components 3.83 ±0.04 3.93 ±0.08 +2.7% 0.008
nii_erode_msk 6.58 ±0.17 6.75 ±0.15 +2.5% 0.132
nii_rescale 30.36 ±0.94 31.08 ±0.53 +2.4% 0.075
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_fill_holes 4.95 ±0.06 5.02 ±0.07 +1.5% 0.140
poi_calc_centroids_nocrop 7.36 ±0.12 7.46 ±0.08 +1.3% 0.052
nii_save 7.73 ±0.08 7.66 ±0.07 -0.9% 0.050
nii_dilate_msk 125.47 ±1.27 126.41 ±1.26 +0.7% 0.085
nii_load_img 7.72 ±0.18 7.69 ±0.12 -0.3% 0.756
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.07 ±0.01 0.04 ±0.01 -35.0% (noise) 0.002
poi_to_global 0.26 ±0.01 0.29 ±0.02 +11.0% (noise) 0.008
nii_compute_crop 0.34 ±0.01 0.37 ±0.01 +10.4% (noise) 0.001
poi_map_labels 0.23 ±0.00 0.25 ±0.01 +7.8% (noise) 0.016
poi_reorient 0.44 ±0.01 0.48 ±0.02 +7.3% (noise) 0.009
nii_map_labels 0.88 ±0.02 0.94 ±0.03 +6.5% (noise) 0.016
poi_local_to_global_arr 0.27 ±0.00 0.28 ±0.01 +6.1% (noise) 0.032
poi_rescale 0.27 ±0.01 0.29 ±0.01 +5.7% (noise) 0.001
nii_get_connected_components 1.76 ±0.01 1.86 ±0.04 +5.5% (noise) 0.008
nii_extract_label 0.45 ±0.01 0.47 ±0.01 +5.4% (noise) 0.007
nii_apply_crop 0.71 ±0.02 0.74 ±0.02 +4.3% (noise) 0.028
nii_unique 0.54 ±0.01 0.57 ±0.02 +4.3% (noise) 0.043
nii_set_dtype 0.53 ±0.03 0.51 ±0.02 -4.2% (noise) 0.212
poi_resample_from_to 0.69 ±0.02 0.72 ±0.02 +3.9% (noise) 0.372
nii_reorient 0.82 ±0.03 0.79 ±0.04 -3.7% (noise) 0.085
nii_pad_to 0.74 ±0.03 0.76 ±0.03 +3.7% (noise) 0.178
poi_calc_centroids 2.37 ±0.03 2.45 ±0.05 +3.3% (noise) 0.010
nii_center_of_masses 1.66 ±0.01 1.71 ±0.03 +2.6% (noise) 0.029
nii_load_seg 2.42 ±0.09 2.46 ±0.01 +1.5% (noise) 0.841
nii_rescale_seg 2.60 ±0.04 2.64 ±0.05 +1.4% (noise) 0.289
nii_volumes 1.70 ±0.01 1.72 ±0.01 +1.3% (noise) 0.004
poi_save 0.55 ±0.03 0.56 ±0.03 +1.1% (noise) 0.760
poi_load 1.70 ±0.02 1.68 ±0.03 -0.9% (noise) 0.325

mri_2d — shape (68, 52, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_rescale 4.62 ±0.17 4.77 ±0.23 +3.2% 0.217
nii_resample_from_to 5.88 ±0.16 6.01 ±0.27 +2.1% 0.089
nii_dilate_msk 14.53 ±0.16 14.73 ±0.13 +1.4% 0.078
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.00 +15.5% (noise) 0.098
nii_map_labels 0.49 ±0.01 0.54 ±0.01 +9.4% (noise) 0.000
nii_apply_crop 0.64 ±0.01 0.70 ±0.04 +8.9% (noise) 0.046
nii_load_seg 1.43 ±0.05 1.52 ±0.06 +6.7% (noise) 0.023
nii_unique 0.14 ±0.01 0.15 ±0.00 +6.4% (noise) 0.024
poi_save 0.54 ±0.03 0.51 ±0.02 -6.3% (noise) 0.444
nii_extract_label 0.42 ±0.02 0.45 ±0.01 +5.9% (noise) 0.009
nii_set_dtype 0.39 ±0.03 0.41 ±0.03 +4.9% (noise) 0.682
poi_local_to_global_arr 0.26 ±0.01 0.27 ±0.01 +4.1% (noise) 0.167
nii_rescale_seg 0.74 ±0.05 0.71 ±0.02 -3.7% (noise) 0.271
nii_fill_holes 0.91 ±0.02 0.94 ±0.04 +3.4% (noise) 0.060
nii_pad_to 0.55 ±0.03 0.56 ±0.02 +2.9% (noise) 0.637
nii_save 1.22 ±0.03 1.26 ±0.05 +2.6% (noise) 0.667
nii_center_of_masses 0.36 ±0.00 0.37 ±0.02 +2.3% (noise) 0.248
poi_resample_from_to 0.69 ±0.04 0.70 ±0.03 +1.8% (noise) 0.633
poi_calc_centroids_nocrop 1.18 ±0.03 1.16 ±0.03 -1.7% (noise) 0.611
poi_to_global 0.26 ±0.01 0.25 ±0.01 -1.7% (noise) 0.384
nii_get_connected_components 0.61 ±0.01 0.61 ±0.02 +1.4% (noise) 0.068
nii_reorient 0.78 ±0.04 0.79 ±0.04 +1.3% (noise) 0.629
nii_erode_msk 1.05 ±0.10 1.06 ±0.02 +1.2% (noise) 0.603
poi_calc_centroids 1.01 ±0.02 1.02 ±0.02 +1.2% (noise) 0.184
nii_compute_crop 0.15 ±0.00 0.15 ±0.01 +1.1% (noise) 0.284
poi_rescale 0.26 ±0.01 0.26 ±0.01 -0.8% (noise) 0.302
nii_filter_connected_components 0.79 ±0.04 0.80 ±0.04 +0.8% (noise) 0.840
nii_volumes 0.41 ±0.01 0.42 ±0.01 +0.7% (noise) 0.340
poi_load 1.51 ±0.02 1.52 ±0.04 +0.6% (noise) 0.584
nii_load_img 1.26 ±0.02 1.26 ±0.04 +0.3% (noise) 0.399
poi_reorient 0.43 ±0.01 0.43 ±0.02 +0.1% (noise) 0.449
poi_map_labels 0.22 ±0.01 0.22 ±0.01 -0.1% (noise) 0.274

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 7bdbf63 vs head 7bdbf63 · python 3.11.17 · 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_erode_msk 6.07 ±0.00 6.05 ±0.00 -0.4% —
nii_load_img 3.56 ±0.00 3.55 ±0.00 -0.3% —
nii_save 3.83 ±0.00 3.82 ±0.00 -0.2% —
nii_load_seg 6.07 ±0.00 6.06 ±0.00 -0.2% —
nii_apply_crop 5.93 ±0.00 5.92 ±0.00 -0.1% —
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale_seg 6.19 ±0.00 6.18 ±0.00 -0.1% —
nii_rescale 6.42 ±0.00 6.41 ±0.00 -0.1% —
nii_resample_from_to 6.54 ±0.00 6.54 ±0.00 -0.1% —
nii_get_connected_components 6.68 ±0.00 6.67 ±0.00 -0.1% —
nii_filter_connected_components 6.99 ±0.00 6.98 ±0.00 -0.1% —
poi_calc_poi_from_subreg_vert 7.30 ±0.00 7.29 ±0.00 -0.1% —
nii_set_dtype 5.37 ±0.00 5.37 ±0.00 +0.0% —
nii_reorient 5.97 ±0.00 5.97 ±0.00 +0.0% —
nii_pad_to 5.49 ±0.00 5.49 ±0.00 +0.0% —
nii_volumes 3.52 ±0.00 3.52 ±0.00 +0.0% —
nii_center_of_masses 3.21 ±0.00 3.21 ±0.00 +0.0% —
nii_extract_label 5.49 ±0.00 5.49 ±0.00 +0.0% —
nii_map_labels 5.55 ±0.00 5.55 ±0.00 +0.0% —
nii_dilate_msk 6.05 ±0.00 6.05 ±0.00 +0.0% —
nii_fill_holes 6.41 ±0.00 6.41 ±0.00 +0.0% —
poi_calc_centroids 6.18 ±0.00 6.18 ±0.00 +0.0% —
poi_calc_centroids_nocrop 6.05 ±0.00 6.05 ±0.00 +0.0% —
poi_reorient 3.89 ±0.00 3.89 ±0.00 +0.0% —
poi_to_global 3.14 ±0.00 3.14 ±0.00 +0.0% —
poi_local_to_global_arr 3.02 ±0.00 3.02 ±0.00 +0.0% —
poi_resample_from_to 5.53 ±0.00 5.53 ±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% —
poi_save 1.46 ±0.00 1.45 ±0.00 -0.5% (noise) —
nii_get_array 1.65 ±0.00 1.65 ±0.00 +0.0% (noise) —
nii_compute_crop 2.96 ±0.00 2.96 ±0.00 +0.0% (noise) —
nii_unique 2.90 ±0.00 2.90 ±0.00 +0.0% (noise) —
poi_rescale 2.61 ±0.00 2.61 ±0.00 +0.0% (noise) —
poi_map_labels 1.77 ±0.00 1.77 ±0.00 +0.0% (noise) —
poi_load 1.61 ±0.00 1.61 ±0.00 +0.0% (noise) —

ct_2d — shape (73, 47, 1)

Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_erode_msk 6.01 ±0.00 5.98 ±0.00 -0.4% —
nii_load_img 3.50 ±0.00 3.49 ±0.00 -0.2% —
nii_save 3.77 ±0.00 3.76 ±0.00 -0.2% —
nii_apply_crop 5.86 ±0.00 5.86 ±0.00 -0.1% —
nii_load_seg 6.00 ±0.00 6.00 ±0.00 -0.1% —
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale_seg 6.13 ±0.00 6.12 ±0.00 -0.1% —
nii_rescale 6.36 ±0.00 6.35 ±0.00 -0.1% —
nii_resample_from_to 6.48 ±0.00 6.47 ±0.00 -0.1% —
nii_get_connected_components 6.62 ±0.00 6.61 ±0.00 -0.1% —
nii_filter_connected_components 6.93 ±0.00 6.92 ±0.00 -0.1% —
nii_set_dtype 5.30 ±0.00 5.30 ±0.00 +0.0% —
nii_reorient 5.91 ±0.00 5.91 ±0.00 +0.0% —
nii_pad_to 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_volumes 3.46 ±0.00 3.46 ±0.00 +0.0% —
nii_center_of_masses 3.15 ±0.00 3.15 ±0.00 +0.0% —
nii_extract_label 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_map_labels 5.49 ±0.00 5.49 ±0.00 +0.0% —
nii_dilate_msk 5.99 ±0.00 5.99 ±0.00 +0.0% —
nii_fill_holes 6.34 ±0.00 6.34 ±0.00 +0.0% —
poi_calc_centroids 6.12 ±0.00 6.12 ±0.00 +0.0% —
poi_calc_centroids_nocrop 6.05 ±0.00 6.05 ±0.00 +0.0% —
poi_reorient 3.83 ±0.00 3.83 ±0.00 +0.0% —
poi_to_global 3.08 ±0.00 3.08 ±0.00 +0.0% —
poi_resample_from_to 5.46 ±0.00 5.46 ±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% —
poi_save 1.40 ±0.00 1.39 ±0.00 -0.6% (noise) —
nii_get_array 1.59 ±0.00 1.59 ±0.00 +0.0% (noise) —
nii_compute_crop 2.90 ±0.00 2.90 ±0.00 +0.0% (noise) —
nii_unique 2.84 ±0.00 2.84 ±0.00 +0.0% (noise) —
poi_rescale 2.54 ±0.00 2.54 ±0.00 +0.0% (noise) —
poi_local_to_global_arr 2.96 ±0.00 2.96 ±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_erode_msk 6.01 ±0.00 5.98 ±0.00 -0.4% —
nii_load_img 3.56 ±0.00 3.55 ±0.00 -0.2% —
nii_save 3.77 ±0.00 3.76 ±0.00 -0.2% —
nii_apply_crop 5.86 ±0.00 5.86 ±0.00 -0.1% —
nii_load_seg 6.00 ±0.00 6.00 ±0.00 -0.1% —
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale_seg 6.13 ±0.00 6.12 ±0.00 -0.1% —
nii_rescale 6.36 ±0.00 6.35 ±0.00 -0.1% —
nii_resample_from_to 6.48 ±0.00 6.47 ±0.00 -0.1% —
nii_get_connected_components 6.62 ±0.00 6.61 ±0.00 -0.1% —
nii_volumes 3.46 ±0.00 3.46 ±0.00 -0.1% —
nii_filter_connected_components 6.93 ±0.00 6.92 ±0.00 -0.1% —
poi_calc_poi_from_subreg_vert 7.30 ±0.00 7.29 ±0.00 -0.1% —
nii_set_dtype 5.37 ±0.00 5.37 ±0.00 +0.0% —
nii_reorient 5.91 ±0.00 5.91 ±0.00 +0.0% —
nii_pad_to 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_center_of_masses 3.15 ±0.00 3.15 ±0.00 +0.0% —
nii_extract_label 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_map_labels 5.49 ±0.00 5.49 ±0.00 +0.0% —
nii_dilate_msk 5.99 ±0.00 5.99 ±0.00 +0.0% —
nii_fill_holes 6.34 ±0.00 6.34 ±0.00 +0.0% —
poi_calc_centroids 6.12 ±0.00 6.12 ±0.00 +0.0% —
poi_calc_centroids_nocrop 5.99 ±0.00 5.99 ±0.00 +0.0% —
poi_reorient 3.83 ±0.00 3.83 ±0.00 +0.0% —
poi_to_global 3.08 ±0.00 3.08 ±0.00 +0.0% —
poi_resample_from_to 5.46 ±0.00 5.46 ±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% —
poi_save 1.46 ±0.00 1.45 ±0.00 -0.5% (noise) —
nii_get_array 1.59 ±0.00 1.59 ±0.00 +0.0% (noise) —
nii_compute_crop 2.90 ±0.00 2.90 ±0.00 +0.0% (noise) —
nii_unique 2.84 ±0.00 2.84 ±0.00 +0.0% (noise) —
poi_rescale 2.54 ±0.00 2.54 ±0.00 +0.0% (noise) —
poi_local_to_global_arr 2.96 ±0.00 2.96 ±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_erode_msk 6.01 ±0.00 5.98 ±0.00 -0.4% —
nii_load_img 3.56 ±0.00 3.55 ±0.00 -0.2% —
nii_save 3.77 ±0.00 3.76 ±0.00 -0.2% —
nii_apply_crop 5.86 ±0.00 5.86 ±0.00 -0.1% —
nii_load_seg 6.00 ±0.00 6.00 ±0.00 -0.1% —
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale_seg 6.13 ±0.00 6.12 ±0.00 -0.1% —
nii_rescale 6.36 ±0.00 6.35 ±0.00 -0.1% —
nii_resample_from_to 6.48 ±0.00 6.47 ±0.00 -0.1% —
nii_get_connected_components 6.62 ±0.00 6.61 ±0.00 -0.1% —
nii_filter_connected_components 6.93 ±0.00 6.92 ±0.00 -0.1% —
nii_set_dtype 5.37 ±0.00 5.37 ±0.00 +0.0% —
nii_reorient 5.91 ±0.00 5.91 ±0.00 +0.0% —
nii_pad_to 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_volumes 3.46 ±0.00 3.46 ±0.00 +0.0% —
nii_center_of_masses 3.15 ±0.00 3.15 ±0.00 +0.0% —
nii_extract_label 5.43 ±0.00 5.43 ±0.00 +0.0% —
nii_map_labels 5.49 ±0.00 5.49 ±0.00 +0.0% —
nii_dilate_msk 5.99 ±0.00 5.99 ±0.00 +0.0% —
nii_fill_holes 6.34 ±0.00 6.34 ±0.00 +0.0% —
poi_calc_centroids 6.12 ±0.00 6.12 ±0.00 +0.0% —
poi_calc_centroids_nocrop 6.05 ±0.00 6.05 ±0.00 +0.0% —
poi_reorient 3.83 ±0.00 3.83 ±0.00 +0.0% —
poi_to_global 3.08 ±0.00 3.08 ±0.00 +0.0% —
poi_resample_from_to 5.46 ±0.00 5.46 ±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% —
poi_save 1.46 ±0.00 1.45 ±0.00 -0.5% (noise) —
nii_get_array 1.59 ±0.00 1.59 ±0.00 +0.0% (noise) —
nii_compute_crop 2.90 ±0.00 2.90 ±0.00 +0.0% (noise) —
nii_unique 2.84 ±0.00 2.84 ±0.00 +0.0% (noise) —
poi_rescale 2.54 ±0.00 2.54 ±0.00 +0.0% (noise) —
poi_local_to_global_arr 2.96 ±0.00 2.96 ±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 merged commit 72c00d7 into main Oct 19, 2026
6 checks passed
@Hendrik-code
Hendrik-code deleted the robert-pc-pr-stitching-refactor branch October 19, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants