Skip to main content

tiled_volume_algorithm

Function tiled_volume_algorithm 

Source
pub fn tiled_volume_algorithm(
    field: &[f64],
    mask: &[u8],
    grid: &Grid,
    divisor: usize,
    cfg: &TileConfig,
    run_patch: impl Fn(&[f64], &[u8], &Grid) -> Result<Vec<f64>, OnnxError> + Sync,
    progress: impl FnMut(usize, usize),
) -> Result<Vec<f64>, OnnxError>
Expand description

Overlap-tile an entire volume→volume algorithm (not just one forward pass). For each tile, a padded sub-volume of field/mask is cut out (with halo context, zero outside the volume), run_patch(field_patch, mask_patch, patch_grid) is run on it, and the central core is written back. Use this for the FFT-unrolled nets (lpcnn/modl-qsm/nextqsm) whose Rust-side physics loop wraps a whole-volume CNN — running the whole algorithm per patch bounds memory. Strongly off-design (the dipole/k-space step then sees only a patch), so results are approximate; callers should warn and steer users to a full-volume run for real work.