Skip to content

DICOM extract cleanup, spinestats v3 (endplate Cobb), point registration, stitching refactor - #160

Open
robert-graf wants to merge 40 commits into
mainfrom
dicom-extract-cleanup
Open

robert-graf wants to merge 40 commits into
mainfrom
dicom-extract-cleanup

Conversation

@robert-graf

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #154. That branch's scope grew well beyond the Cobb endplate work and had conflicts with main; this PR carries all of #154's commits on a fresh merge of main, plus the DICOM / stitching / registration work that accumulated alongside.

Grouped highlights

  • DICOM: 2D support, more 4D edge-case handling, cleanup of the extraction pipeline.
  • spinestats v3 (originally spinestats: version 3 — endplate-plane Cobb + apex + tightened multi-Cobb #154): endplate-plane Cobb + apex + tightened multi-Cobb; S1 endplate; Veridah lordosis; skip T13 for apex; skip missing plane/source POIs; wider sacrum-endplate crop; bumped `run_all` defaults.
  • POI: auto-transform of direction-vector fields in `POI.info`; `label_name` integrated into `map_labels` remap.
  • Registration: Deepali point registration + cleanup.
  • Rib assign: `_rib_assign` bug fixes (NII `&` TypeError on bool-backed NIIs; misplaced bracket in `extract_label`); tests added.
  • Stitching: refactored to use TPTBox functions directly; smaller overlap NII to save RAM; `c_val` option; `min_value` fix.
  • Internal: smauglab support in the internal trainer; parallel prewarm of `get_grid_info`.

38 commits ahead of main; +2277 / -174 across 23 tracked file groups.

Test plan

  • `pytest unit_tests/` passes locally
  • CI green on 3.9 and 3.10+ legs
  • `ruff check .` / `ruff format --check .` clean
  • Spot-check Cobb endplate output on a known case
  • Spot-check DICOM 2D extraction on a sample
  • Spot-check stitching on a multi-station case

robert-graf and others added 30 commits September 17, 2026 11:51
Adds a small registration mechanism so producers can attach
per-vertebra direction vectors (endplate PCA normals, orientation
vectors, ...) or label-keyed scalars (endplate_internal_angle,
curvature_*) to poi.info and have them stay aligned with the POI
points automatically:

- New TPTBox/core/poi_fun/vector_fields.py with the constants
  POI_INFO_VECTOR_FIELDS_KEY / POI_INFO_LABEL_KEYED_FIELDS_KEY and
  three helpers (_transform_direction_vectors_inplace,
  _rotate_direction_vectors_inplace, _remap_vector_field_keys_inplace).
- POI.reorient signed-permutes vectors; POI.resample_from_to applies
  the real R_ref.T @ R_self rotation; POI.rescale is a no-op.
- POI_Global.to_cord_system flips vector components on RAS<->LPS.
- POI.map_labels remaps top-level keys of both registries.
- endplates.py registers angle_superior/inferior_endplate,
  endplate_internal_angle, and curvature_* when they're produced.
- Fix: vertebra_pois_non_centroids.py now (re)runs
  calc_endplate_points_ when S1 is present but its Sacrum_Endplate-
  derived superior-endplate landmark is missing, so the sacrum
  endplate direction actually lands in the buffer.
- Angles: _endplate_ap_direction preferred over Vertebra_Direction_
  Posterior for MoveTo.TOP/BOTTOM in _get_norm, yielding endplate-
  aligned Cobb-style lordosis/kyphosis lines.

Docs: new section in docs/api/poi_fun.md.
Tests: unit_tests/test_poi_vector_fields.py (13 tests).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Merges the poi-label-names branch (LABEL_NAME + nested
{region: {subregion: name, "name": group}} format in info["label_name"],
new label_name / set_label_name / level_one_name / set_level_one_name
accessors, migration helpers, and level_*_info propagation in copy /
_set_inplace / calc_poi_average / POI_Global.to_other).

Then wires label_name into the auto-transform mapping scheme:

- New vector_fields._remap_label_name_inplace handles the nested
  format: remaps top-level region keys via label_map_region and
  inner subregion keys via label_map_subregion, preserving the
  "name" group entry. Colliding regions merge with last-write-wins
  on inner keys.
- map_labels calls both _remap_vector_field_keys_inplace (for the
  registered flat vector / label-keyed fields) and the new
  _remap_label_name_inplace on all three return paths.
- Also triggers the legacy flat-format migration on remap.

Docs updated with a "Special-cased field" section for label_name.
Tests: 5 new cases in Test_LabelName_MapLabels covering region-only,
subregion-only, combined, region collision, and legacy-format
migration paths (18/18 passing).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…Cobb

Extends the endplate-plane direction machinery used for v2
lordosis/kyphosis to the coronal Cobb angle, and bumps
``CURRENT_VERSION`` to 3 so cached stat files recompute the angle keys
(POI buffers stay valid — no new landmarks).

Angles (``TPTBox/spine/spinestats/angles.py``):
- ``_get_norm`` now routes ``Vertebra_Direction_Right`` through a new
  ``_endplate_r_direction`` helper (analogue of ``_endplate_ap_direction``),
  so Cobb lines are true endplate lines averaged across the shared disc
  instead of the two flanking vertebrae disagreeing on the same boundary.
- ``plot_cobb_angle`` always uses that endplate right direction — the
  ``use_ivd_direction`` branch used ``Vertebra_Disc_Inferior`` from each
  vertebra separately, giving two different lines at one anatomic disc.
- ``compute_angel_between_two_points_`` orders ``id1``/``id2`` by
  ``Vertebra_Instance.order_dict()`` rather than by numeric label, so T13
  (label 28, anatomically between T12 and L1) pairs to the right endplates
  and ``MoveTo.TOP``/``BOTTOM`` are not swapped.
- ``compute_max_cobb_angle_multi`` uses an exclusive split (``+ 1`` on the
  ``below`` slice) so sibling curves cannot share an endpoint vertebra.
- ``VERT_START_COBB`` is C3 (C2 excluded from Cobb search).
- ``compute_lordosis_and_kyphosis`` emits ``{curve}_apex`` keys, computed
  by the new ``_find_curve_apex`` helper (same bisector heuristic as
  ``compute_max_cobb_angle``). ``plot_compute_lordosis_and_kyphosis``
  renders a ``*apex`` marker at that vertebra.
- ``plot_cobb_angle`` anchors the label at the apex disc and widens the
  coronal pad from 50 to 80 mm so labels don't get clipped.

Runner (``TPTBox/spine/spinestats/_run_all.py``):
- Introduces ``POI_INVALIDATING_VERSION = 2`` so the ``_poi_is_stale_wrt_stat``
  threshold is a named constant rather than a magic ``2``, and its docstring
  points at a symbol that actually exists (previously referenced a
  nonexistent ``ANGLES_VERSION``).
- Documents the v3 bump in the ``CURRENT_VERSION`` history comment.

Veridah (``TPTBox/spine/spinestats/veridah_angles.py``):
- ``_compute_k_variant`` also returns ``lumbar_lordosis_apex`` so the
  per-k variants carry the new apex key.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Manual fixes in ``TPTBox/spine/spinestats/_load_nako_wh.py``:
- D205 (verify_missing_images, verify_hardlink): reword docstrings so the
  summary line stands alone from the description body.
- PLW2901 (``v = preferred`` at line 787): add ``# noqa: PLW2901`` to
  match the existing noqa on the sibling ``k = mapping.get(k, k)``
  rebinding — the loop deliberately overrides both bindings.
- PERF102 (line 1385): iterate the ``t2w_chunk`` mapping via ``.values()``
  since only the value is used.
- TRY300 (``_grid_worker``): move the success ``return`` out of the
  ``try`` block; only ``_add_grid_info_to_json`` may raise.

Everything else is ``ruff check --fix`` and ``ruff format`` output.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tching-refactor

# Conflicts:
#	TPTBox/stitching/stitching.py
…all defaults

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

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Benchmark comparison

Speed (wall time per call)

baseline 9c15f60 vs head 9c15f60 · 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_rescale_seg 3.71 ±0.08 3.23 ±0.13 -13.1% 0.001
nii_save 12.14 ±0.12 11.50 ±0.25 -5.2% 0.012
poi_calc_centroids_nocrop 4.33 ±0.08 4.16 ±0.10 -3.9% 0.122
nii_erode_msk 6.30 ±0.08 6.53 ±0.19 +3.6% 0.024
nii_resample_from_to 44.09 ±0.23 42.87 ±0.25 -2.8% 0.000
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_fill_holes 4.52 ±0.08 4.60 ±0.06 +1.8% 0.121
nii_rescale 41.47 ±0.29 40.84 ±0.17 -1.5% 0.001
nii_dilate_msk 122.90 ±0.34 124.74 ±0.90 +1.5% 0.005
poi_calc_poi_from_subreg_vert 12.86 ±0.16 12.96 ±0.31 +0.8% 0.343
nii_filter_connected_components 4.36 ±0.12 4.38 ±0.10 +0.6% 0.727
nii_load_img 10.79 ±0.23 10.78 ±0.13 -0.1% 0.578
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_map_labels 0.98 ±0.06 1.20 ±0.12 +21.6% (noise) 0.004
nii_extract_label 0.34 ±0.05 0.40 ±0.05 +18.0% (noise) 0.140
poi_reorient 0.39 ±0.02 0.44 ±0.03 +13.6% (noise) 0.018
nii_apply_crop 0.73 ±0.06 0.64 ±0.08 -11.8% (noise) 0.430
nii_load_seg 2.94 ±0.16 2.64 ±0.07 -10.4% (noise) 0.005
nii_get_array 0.05 ±0.01 0.05 ±0.01 -10.2% (noise) 0.648
poi_local_to_global_arr 0.31 ±0.02 0.28 ±0.02 -9.9% (noise) 0.076
nii_unique 0.67 ±0.04 0.73 ±0.04 +9.2% (noise) 0.031
poi_load 1.26 ±0.11 1.16 ±0.10 -8.6% (noise) 0.051
nii_pad_to 0.63 ±0.07 0.69 ±0.06 +8.4% (noise) 0.303
poi_save 0.33 ±0.03 0.35 ±0.04 +5.4% (noise) 0.319
nii_volumes 1.93 ±0.08 2.02 ±0.04 +4.7% (noise) 0.052
poi_map_labels 0.15 ±0.02 0.16 ±0.02 +4.1% (noise) 0.306
nii_get_connected_components 2.29 ±0.06 2.37 ±0.13 +3.7% (noise) 0.084
nii_reorient 0.87 ±0.08 0.91 ±0.06 +3.7% (noise) 0.144
poi_calc_centroids 2.53 ±0.09 2.44 ±0.11 -3.4% (noise) 0.139
nii_center_of_masses 1.91 ±0.08 1.96 ±0.10 +2.8% (noise) 0.127
poi_to_global 0.17 ±0.02 0.17 ±0.03 -1.6% (noise) 0.815
nii_set_dtype 0.46 ±0.05 0.47 ±0.05 +1.5% (noise) 0.866
nii_compute_crop 0.35 ±0.03 0.36 ±0.02 +0.5% (noise) 0.572
poi_rescale 0.19 ±0.03 0.19 ±0.03 +0.3% (noise) 0.896
poi_resample_from_to 0.68 ±0.04 0.69 ±0.03 +0.2% (noise) 0.677

ct_2d — shape (73, 47, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_rescale 6.01 ±0.14 5.80 ±0.05 -3.4% 0.007
nii_resample_from_to 7.90 ±0.10 7.66 ±0.13 -2.9% 0.021
nii_dilate_msk 14.81 ±0.10 14.90 ±0.19 +0.6% 0.439
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_extract_label 0.48 ±0.03 0.55 ±0.04 +14.7% (noise) 0.006
nii_get_connected_components 0.73 ±0.04 0.66 ±0.05 -10.7% (noise) 0.041
nii_pad_to 0.60 ±0.04 0.66 ±0.10 +10.4% (noise) 0.079
nii_unique 0.13 ±0.00 0.14 ±0.00 +10.1% (noise) 0.001
nii_map_labels 0.51 ±0.02 0.55 ±0.05 +8.1% (noise) 0.070
poi_save 0.50 ±0.03 0.46 ±0.02 -8.0% (noise) 0.122
nii_get_array 0.02 ±0.01 0.02 ±0.00 -7.9% (noise) 0.506
nii_fill_holes 1.01 ±0.07 0.93 ±0.05 -7.6% (noise) 0.165
poi_reorient 0.49 ±0.02 0.47 ±0.01 -4.8% (noise) 0.079
poi_load 1.52 ±0.06 1.45 ±0.03 -4.6% (noise) 0.078
nii_save 1.52 ±0.07 1.58 ±0.09 +3.8% (noise) 0.162
nii_filter_connected_components 0.94 ±0.04 0.91 ±0.02 -3.7% (noise) 0.033
nii_erode_msk 1.13 ±0.03 1.09 ±0.07 -3.6% (noise) 0.597
nii_rescale_seg 0.89 ±0.02 0.86 ±0.04 -3.3% (noise) 0.083
nii_reorient 0.90 ±0.11 0.92 ±0.04 +3.0% (noise) 0.359
nii_compute_crop 0.16 ±0.02 0.16 ±0.01 -2.8% (noise) 0.604
poi_resample_from_to 0.83 ±0.02 0.81 ±0.03 -2.5% (noise) 0.138
nii_load_img 1.78 ±0.03 1.74 ±0.07 -2.4% (noise) 0.301
poi_rescale 0.28 ±0.01 0.28 ±0.02 -2.4% (noise) 0.297
nii_set_dtype 0.47 ±0.02 0.45 ±0.03 -2.3% (noise) 0.202
nii_volumes 0.34 ±0.03 0.33 ±0.02 -1.9% (noise) 0.658
poi_calc_centroids 1.03 ±0.03 1.04 ±0.04 +1.3% (noise) 0.643
poi_local_to_global_arr 0.42 ±0.02 0.42 ±0.01 +1.2% (noise) 0.270
poi_map_labels 0.23 ±0.02 0.23 ±0.04 +1.0% (noise) 0.289
poi_to_global 0.24 ±0.02 0.24 ±0.01 -0.9% (noise) 0.217
nii_center_of_masses 0.25 ±0.01 0.25 ±0.01 +0.9% (noise) 0.330
poi_calc_centroids_nocrop 1.29 ±0.05 1.29 ±0.07 -0.2% (noise) 0.380
nii_load_seg 1.84 ±0.05 1.84 ±0.03 +0.2% (noise) 0.821
nii_apply_crop 0.79 ±0.06 0.79 ±0.04 +0.1% (noise) 0.650

mri_3d — shape (68, 52, 67)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
poi_load 3.07 ±0.26 2.75 ±0.07 -10.6% 0.021
poi_calc_centroids 3.02 ±0.08 2.85 ±0.11 -5.6% 0.046
nii_filter_connected_components 5.19 ±0.07 5.02 ±0.16 -3.3% 0.048
nii_rescale_seg 3.73 ±0.08 3.62 ±0.06 -3.1% 0.020
poi_calc_centroids_nocrop 9.05 ±0.30 8.79 ±0.40 -2.9% 0.609
… 31 more measurements
Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_fill_holes 5.77 ±0.14 5.61 ±0.09 -2.9% 0.058
poi_calc_poi_from_subreg_vert 12.46 ±0.17 12.19 ±0.25 -2.2% 0.164
nii_resample_from_to 41.40 ±0.38 40.63 ±0.32 -1.9% 0.030
nii_save 9.78 ±0.15 9.61 ±0.04 -1.7% 0.029
nii_rescale 38.24 ±0.25 38.67 ±0.33 +1.1% 0.146
nii_erode_msk 8.07 ±0.13 7.98 ±0.13 -1.1% 0.102
nii_load_img 9.18 ±0.15 9.15 ±0.25 -0.3% 0.258
nii_load_seg 3.23 ±0.06 3.23 ±0.16 -0.2% 0.480
nii_dilate_msk 160.62 ±0.47 160.41 ±0.21 -0.1% 0.607
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_apply_crop 0.83 ±0.06 0.74 ±0.03 -11.4% (noise) 0.069
poi_local_to_global_arr 0.43 ±0.06 0.39 ±0.03 -10.5% (noise) 0.196
poi_to_global 0.31 ±0.02 0.28 ±0.02 -9.0% (noise) 0.050
nii_pad_to 0.83 ±0.02 0.76 ±0.05 -7.5% (noise) 0.212
nii_extract_label 0.52 ±0.02 0.48 ±0.04 -7.4% (noise) 0.090
nii_get_connected_components 2.64 ±0.05 2.45 ±0.04 -7.2% (noise) 0.000
nii_reorient 0.91 ±0.04 0.98 ±0.03 +7.1% (noise) 0.143
poi_resample_from_to 0.88 ±0.02 0.94 ±0.11 +7.1% (noise) 0.162
poi_rescale 0.31 ±0.01 0.33 ±0.02 +6.3% (noise) 0.209
nii_center_of_masses 2.29 ±0.05 2.14 ±0.10 -6.2% (noise) 0.045
poi_reorient 0.54 ±0.01 0.51 ±0.03 -5.3% (noise) 0.306
nii_map_labels 1.31 ±0.09 1.24 ±0.07 -5.3% (noise) 0.120
poi_map_labels 0.29 ±0.00 0.30 ±0.01 +5.2% (noise) 0.008
nii_unique 0.73 ±0.03 0.69 ±0.01 -4.9% (noise) 0.035
nii_compute_crop 0.38 ±0.01 0.36 ±0.02 -4.8% (noise) 0.311
nii_get_array 0.07 ±0.00 0.06 ±0.01 -3.8% (noise) 0.696
nii_set_dtype 0.58 ±0.02 0.59 ±0.01 +2.8% (noise) 0.023
nii_volumes 2.23 ±0.10 2.19 ±0.51 -1.8% (noise) 0.240
poi_save 0.54 ±0.03 0.55 ±0.04 +1.7% (noise) 0.757

mri_2d — shape (68, 52, 1)

Measurement baseline ms (median ±½·range) head ms (median ±½·range) Δ % p
nii_rescale 6.11 ±0.11 5.79 ±0.21 -5.2% 0.009
nii_resample_from_to 7.96 ±0.21 7.91 ±0.07 -0.6% 0.423
nii_dilate_msk 19.75 ±0.26 19.74 ±0.35 -0.1% 0.765
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_resample_from_to 0.82 ±0.03 0.95 ±0.08 +15.8% (noise) 0.008
poi_rescale 0.34 ±0.02 0.29 ±0.01 -14.7% (noise) 0.011
nii_set_dtype 0.44 ±0.03 0.48 ±0.03 +10.9% (noise) 0.065
nii_unique 0.13 ±0.01 0.14 ±0.01 +9.7% (noise) 0.367
nii_fill_holes 1.26 ±0.05 1.15 ±0.04 -8.6% (noise) 0.020
nii_extract_label 0.47 ±0.03 0.50 ±0.03 +7.0% (noise) 0.248
nii_get_array 0.02 ±0.00 0.02 ±0.01 -6.6% (noise) 0.502
poi_save 0.56 ±0.05 0.53 ±0.04 -6.1% (noise) 0.653
nii_get_connected_components 0.72 ±0.02 0.69 ±0.03 -5.3% (noise) 0.099
poi_calc_centroids_nocrop 1.64 ±0.08 1.56 ±0.03 -4.9% (noise) 0.059
nii_center_of_masses 0.54 ±0.03 0.51 ±0.02 -4.8% (noise) 0.055
nii_map_labels 0.58 ±0.04 0.55 ±0.03 -4.8% (noise) 0.302
poi_map_labels 0.27 ±0.01 0.28 ±0.02 +4.1% (noise) 0.249
nii_pad_to 0.62 ±0.03 0.64 ±0.02 +3.7% (noise) 0.228
poi_local_to_global_arr 0.42 ±0.01 0.41 ±0.02 -2.9% (noise) 0.293
nii_reorient 0.94 ±0.06 0.97 ±0.08 +2.9% (noise) 0.455
poi_to_global 0.29 ±0.02 0.29 ±0.03 -2.7% (noise) 0.765
nii_rescale_seg 0.83 ±0.04 0.85 ±0.07 +2.5% (noise) 0.288
nii_load_seg 1.91 ±0.06 1.87 ±0.07 -2.3% (noise) 0.548
nii_erode_msk 1.41 ±0.04 1.44 ±0.10 +2.1% (noise) 0.466
nii_compute_crop 0.16 ±0.01 0.16 ±0.01 +1.8% (noise) 0.936
nii_volumes 0.58 ±0.02 0.57 ±0.02 -1.3% (noise) 0.231
nii_save 1.55 ±0.16 1.53 ±0.11 -1.2% (noise) 0.427
nii_apply_crop 0.78 ±0.05 0.79 ±0.03 +1.0% (noise) 0.465
nii_filter_connected_components 0.92 ±0.04 0.92 ±0.04 -0.8% (noise) 0.130
poi_load 2.55 ±0.10 2.53 ±0.06 -0.8% (noise) 0.171
poi_calc_centroids 1.35 ±0.07 1.34 ±0.08 -0.6% (noise) 0.506
nii_load_img 1.66 ±0.09 1.65 ±0.14 -0.6% (noise) 0.630
poi_reorient 0.52 ±0.02 0.51 ±0.01 -0.0% (noise) 0.640

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 9c15f60 vs head 9c15f60 · python 3.11.17 · 5 repeats + 1 warmup · sampler proc-status, isolation fork · measurement floor ≈ 0.74 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 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_rescale_seg 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_resample_from_to 11.54 ±0.00 11.45 ±0.00 -0.8% —
poi_map_labels 3.07 ±0.00 3.05 ±0.00 -0.8% —
poi_load 3.10 ±0.00 3.08 ±0.00 -0.8% —
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_set_dtype 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_extract_label 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_pad_to 11.17 ±0.00 11.09 ±0.00 -0.7% —
poi_calc_centroids_nocrop 11.29 ±0.00 11.21 ±0.00 -0.7% —
nii_map_labels 11.30 ±0.00 11.21 ±0.00 -0.7% —
nii_apply_crop 11.40 ±0.00 11.32 ±0.00 -0.7% —
poi_calc_centroids 11.48 ±0.00 11.40 ±0.00 -0.7% —
nii_load_seg 11.51 ±0.00 11.43 ±0.00 -0.7% —
nii_fill_holes 11.71 ±0.00 11.63 ±0.00 -0.7% —
nii_reorient 12.11 ±0.00 12.02 ±0.00 -0.7% —
poi_calc_poi_from_subreg_vert 12.15 ±0.00 12.07 ±0.00 -0.7% —
nii_get_connected_components 12.92 ±0.00 12.84 ±0.00 -0.6% —
nii_filter_connected_components 13.11 ±0.00 13.03 ±0.00 -0.6% —
poi_rescale 5.28 ±0.00 5.26 ±0.00 -0.4% —
nii_unique 5.39 ±0.00 5.36 ±0.00 -0.4% —
nii_compute_crop 5.51 ±0.00 5.49 ±0.00 -0.4% —
nii_dilate_msk 11.30 ±0.00 11.25 ±0.00 -0.4% —
nii_erode_msk 11.38 ±0.00 11.33 ±0.00 -0.4% —
nii_center_of_masses 5.82 ±0.00 5.80 ±0.00 -0.4% —
nii_volumes 5.89 ±0.00 5.86 ±0.00 -0.4% —
nii_save 5.98 ±0.00 5.96 ±0.00 -0.4% —
nii_load_img 6.00 ±0.00 5.97 ±0.00 -0.4% —
poi_local_to_global_arr 7.45 ±0.00 7.42 ±0.00 -0.3% —
poi_to_global 7.51 ±0.00 7.48 ±0.00 -0.3% —
poi_reorient 7.95 ±0.00 7.92 ±0.00 -0.3% —
poi_resample_from_to 10.92 ±0.00 10.90 ±0.00 -0.2% —
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 2.05 ±0.00 2.03 ±0.03 -1.1% (noise) 0.035
nii_get_array 2.95 ±0.00 2.93 ±0.00 -0.8% (noise) —

ct_2d — shape (73, 47, 1)

Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_rescale_seg 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_resample_from_to 11.54 ±0.00 11.45 ±0.00 -0.8% —
poi_map_labels 3.07 ±0.03 3.05 ±0.00 -0.8% 0.317
poi_load 3.10 ±0.00 3.08 ±0.00 -0.8% —
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_set_dtype 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_extract_label 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_pad_to 11.17 ±0.00 11.09 ±0.00 -0.7% —
nii_map_labels 11.30 ±0.00 11.21 ±0.00 -0.7% —
poi_calc_centroids_nocrop 11.36 ±0.00 11.27 ±0.00 -0.7% —
nii_apply_crop 11.40 ±0.00 11.32 ±0.00 -0.7% —
poi_calc_centroids 11.48 ±0.00 11.40 ±0.00 -0.7% —
nii_load_seg 11.51 ±0.00 11.43 ±0.00 -0.7% —
nii_fill_holes 11.71 ±0.00 11.63 ±0.00 -0.7% —
nii_reorient 12.11 ±0.00 12.02 ±0.00 -0.7% —
nii_get_connected_components 12.92 ±0.00 12.84 ±0.00 -0.6% —
nii_filter_connected_components 13.11 ±0.00 13.03 ±0.00 -0.6% —
poi_rescale 5.28 ±0.00 5.26 ±0.00 -0.4% —
nii_unique 5.39 ±0.00 5.36 ±0.00 -0.4% —
nii_compute_crop 5.51 ±0.00 5.49 ±0.00 -0.4% —
nii_dilate_msk 11.30 ±0.00 11.25 ±0.00 -0.4% —
nii_erode_msk 11.38 ±0.00 11.33 ±0.00 -0.4% —
nii_center_of_masses 5.82 ±0.00 5.80 ±0.00 -0.4% —
nii_volumes 5.89 ±0.00 5.86 ±0.00 -0.4% —
nii_save 5.98 ±0.00 5.96 ±0.00 -0.4% —
nii_load_img 6.00 ±0.00 5.97 ±0.00 -0.4% —
poi_local_to_global_arr 7.45 ±0.00 7.42 ±0.00 -0.3% —
poi_to_global 7.51 ±0.00 7.48 ±0.00 -0.3% —
poi_reorient 7.95 ±0.00 7.92 ±0.00 -0.3% —
poi_resample_from_to 10.92 ±0.00 10.90 ±0.00 -0.2% —
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 2.05 ±0.00 2.03 ±0.00 -1.1% (noise) —
nii_get_array 2.95 ±0.00 2.93 ±0.00 -0.8% (noise) —

mri_3d — shape (68, 52, 67)

Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_rescale_seg 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_resample_from_to 11.54 ±0.00 11.45 ±0.00 -0.8% —
poi_map_labels 3.07 ±0.00 3.05 ±0.00 -0.8% —
poi_load 3.10 ±0.00 3.08 ±0.00 -0.8% —
… 31 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_extract_label 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_pad_to 11.17 ±0.00 11.09 ±0.00 -0.7% —
nii_set_dtype 11.17 ±0.00 11.09 ±0.00 -0.7% —
poi_calc_centroids_nocrop 11.29 ±0.00 11.21 ±0.00 -0.7% —
nii_map_labels 11.30 ±0.00 11.21 ±0.00 -0.7% —
nii_apply_crop 11.40 ±0.00 11.32 ±0.00 -0.7% —
poi_calc_centroids 11.48 ±0.00 11.40 ±0.00 -0.7% —
nii_load_seg 11.51 ±0.00 11.43 ±0.00 -0.7% —
nii_fill_holes 11.71 ±0.00 11.63 ±0.00 -0.7% —
nii_reorient 12.11 ±0.00 12.02 ±0.00 -0.7% —
poi_calc_poi_from_subreg_vert 12.15 ±0.00 12.07 ±0.00 -0.7% —
nii_get_connected_components 12.92 ±0.00 12.84 ±0.00 -0.6% —
nii_filter_connected_components 13.11 ±0.00 13.03 ±0.00 -0.6% —
poi_rescale 5.28 ±0.00 5.26 ±0.00 -0.4% —
nii_unique 5.39 ±0.00 5.36 ±0.00 -0.4% —
nii_compute_crop 5.51 ±0.00 5.49 ±0.00 -0.4% —
nii_dilate_msk 11.30 ±0.00 11.25 ±0.00 -0.4% —
nii_erode_msk 11.38 ±0.00 11.33 ±0.00 -0.4% —
nii_center_of_masses 5.82 ±0.00 5.80 ±0.00 -0.4% —
nii_volumes 5.89 ±0.00 5.86 ±0.00 -0.4% —
nii_save 5.98 ±0.00 5.96 ±0.00 -0.4% —
nii_load_img 6.00 ±0.00 5.97 ±0.00 -0.4% —
poi_local_to_global_arr 7.45 ±0.00 7.42 ±0.00 -0.3% —
poi_to_global 7.51 ±0.00 7.48 ±0.00 -0.3% —
poi_reorient 7.95 ±0.00 7.92 ±0.00 -0.3% —
poi_resample_from_to 10.92 ±0.00 10.90 ±0.00 -0.2% —
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 2.12 ±0.00 2.09 ±0.00 -1.1% (noise) 0.000
nii_get_array 2.95 ±0.00 2.93 ±0.00 -0.8% (noise) —

mri_2d — shape (68, 52, 1)

Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_rescale 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_rescale_seg 11.48 ±0.00 11.39 ±0.00 -0.8% —
nii_resample_from_to 11.54 ±0.03 11.45 ±0.00 -0.8% 0.002
poi_map_labels 3.07 ±0.00 3.05 ±0.00 -0.8% —
poi_load 3.10 ±0.00 3.08 ±0.00 -0.8% —
… 30 more measurements
Measurement baseline MiB (median ±½·range) head MiB (median ±½·range) Δ % p
nii_extract_label 11.11 ±0.00 11.03 ±0.00 -0.7% —
nii_pad_to 11.17 ±0.00 11.09 ±0.00 -0.7% —
nii_set_dtype 11.17 ±0.00 11.09 ±0.00 -0.7% —
nii_map_labels 11.30 ±0.00 11.21 ±0.00 -0.7% —
poi_calc_centroids_nocrop 11.36 ±0.00 11.27 ±0.00 -0.7% —
nii_apply_crop 11.40 ±0.00 11.32 ±0.00 -0.7% —
poi_calc_centroids 11.48 ±0.00 11.40 ±0.00 -0.7% 0.000
nii_load_seg 11.51 ±0.00 11.43 ±0.00 -0.7% —
nii_fill_holes 11.71 ±0.00 11.63 ±0.00 -0.7% —
nii_reorient 12.11 ±0.00 12.02 ±0.00 -0.7% —
nii_get_connected_components 12.92 ±0.00 12.84 ±0.00 -0.6% —
nii_filter_connected_components 13.11 ±0.00 13.03 ±0.00 -0.6% 0.000
poi_rescale 5.28 ±0.00 5.26 ±0.00 -0.4% —
nii_unique 5.39 ±0.00 5.36 ±0.00 -0.4% —
nii_compute_crop 5.51 ±0.00 5.49 ±0.00 -0.4% —
nii_dilate_msk 11.30 ±0.00 11.25 ±0.00 -0.4% —
nii_erode_msk 11.38 ±0.00 11.33 ±0.00 -0.4% 0.000
nii_center_of_masses 5.82 ±0.00 5.80 ±0.00 -0.4% —
nii_volumes 5.89 ±0.00 5.86 ±0.00 -0.4% —
nii_save 5.98 ±0.00 5.96 ±0.00 -0.4% —
nii_load_img 6.00 ±0.00 5.97 ±0.00 -0.4% —
poi_local_to_global_arr 7.45 ±0.00 7.42 ±0.00 -0.3% —
poi_to_global 7.51 ±0.00 7.48 ±0.00 -0.3% —
poi_reorient 7.95 ±0.00 7.92 ±0.00 -0.3% —
poi_resample_from_to 10.92 ±0.00 10.90 ±0.00 -0.2% —
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 2.12 ±0.00 2.09 ±0.00 -1.1% (noise) —
nii_get_array 2.95 ±0.00 2.93 ±0.00 -0.8% (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.

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