Skip to main content

sti_even_box

Function sti_even_box 

Source
fn sti_even_box(
    lo: [usize; 3],
    hi: [usize; 3],
    n: [usize; 3],
) -> ([usize; 3], [usize; 3])
Expand description

STI Suite’s MaskBoundingBox(mask, voxelsize) (V_SHARP’s crop): the mask’s bounding box made even along every axis. An odd extent grows by one voxel at its high end, or at its low end when the high end is the array’s last voxel; an odd axis the mask fills entirely loses its last voxel. The voxel size plays no part. Probed black-box in licensed MATLAB R2023b on 17,952 boxes (lengths 8–40, eleven voxel sizes 0.5–3 mm, every position), all reproduced.

This was the anisotropic-voxel gap (astewartau/QSM.rs#329): the extra slice holds phase from outside the mask, and on a non-1 mm axis the resampling carries it onto the working grid next to the mask edge. See the module docs.