Skip to main content

crop_box_for_mask

Function crop_box_for_mask 

Source
pub fn crop_box_for_mask(
    mask: &[u8],
    full_dims: (usize, usize, usize),
    voxel_size: (f64, f64, f64),
    margin_mm: f64,
) -> CropBox
Expand description

The box to reconstruct in: the mask’s bounding box, grown by margin_mm on every side, each axis then rounded up to an FFT-friendly size and clamped to the grid.

Returns the full grid when the mask is empty, when it already fills the volume, or when an axis cannot usefully shrink — so a caller can apply this unconditionally.