Skip to main content

isotropic_resample_2d_nn

Function isotropic_resample_2d_nn 

Source
pub fn isotropic_resample_2d_nn(
    input: &[f32],
    in_w: usize,
    in_h: usize,
    in_spacing: (f64, f64),
    target_spacing: f64,
    out: &mut [f32],
) -> Result<(usize, usize), MedicalError>
Expand description

Resample a 2D image from anisotropic pixel spacing to isotropic.

in_spacing = (sx, sy) physical size of input pixels. Target isotropic spacing is target_spacing (same units). Output dimensions are chosen so physical extent is preserved: out_w = round(in_w * sx / target), etc.

Layout: row-major in_w * in_h. Returns (out_w, out_h).