brain_deer.plugins.warpdrive.geometry¶
Geometry helpers for WarpDrive tools (plane rings, contours, path resample).
Pure numpy (+ optional nibabel); no Qt. Used by Draw / ShrinkExpand tools and tests.
Functions¶
|
Return |
|
Polyline resampled at approximately |
|
Build source/target rings in the slice plane (Slicer ShrinkExpand parity). |
|
Boundary voxels of a label mask on one slice, as RAS mm points |
|
For each query, the closest point in |
|
Resample the longer path so both have the same point count (min length ≥ 2). |
|
Pick the contour cloud whose nearest point is closest to |
Module Contents¶
- brain_deer.plugins.warpdrive.geometry.plane_basis(view_name: str) tuple[FloatArray, FloatArray]¶
Return
(plane_normal, in_plane_u)unit vectors for a slice view.
- brain_deer.plugins.warpdrive.geometry.resample_path(path: Sequence[WorldPoint], step_mm: float) list[WorldPoint]¶
Polyline resampled at approximately
step_mmspacing (keeps endpoints).
- brain_deer.plugins.warpdrive.geometry.shrink_expand_ring(center: WorldPoint, view_name: str, radius_mm: float, amount_pct: float, *, mode: str = 'Shrink', n_angles: int = 12) tuple[list[WorldPoint], list[WorldPoint]]¶
Build source/target rings in the slice plane (Slicer ShrinkExpand parity).
amount_pctis 5–95. Shrink pulls the outer ring inward; Expand pushes out. Returns(source_points, target_points)each of lengthn_angles.
- brain_deer.plugins.warpdrive.geometry.label_slice_contour(data: FloatArray, affine: FloatArray, slice_axis: int, slice_index: int, *, label: int | None = None) FloatArray¶
Boundary voxels of a label mask on one slice, as RAS mm points
(N,3).
- brain_deer.plugins.warpdrive.geometry.nearest_points_on_cloud(queries: FloatArray, cloud: FloatArray) FloatArray¶
For each query, the closest point in
cloud(brute force; contours are small).
- brain_deer.plugins.warpdrive.geometry.match_path_counts(source: Sequence[WorldPoint], target: Sequence[WorldPoint]) tuple[list[WorldPoint], list[WorldPoint]]¶
Resample the longer path so both have the same point count (min length ≥ 2).
- brain_deer.plugins.warpdrive.geometry.best_cloud_for_seed(seed: WorldPoint, clouds: Iterable[FloatArray]) FloatArray¶
Pick the contour cloud whose nearest point is closest to
seed.