linumpy.geometry.resampling#
Mosaic grid resampling utilities.
Consolidated from linum_resample_mosaic_grid.py.
Functions#
|
Heuristic: source resolution in mm if all components < 1, otherwise µm. |
|
Resample a mosaic grid volume to a target isotropic resolution. |
Module Contents#
- linumpy.geometry.resampling.resolution_is_mm(source_res)[source]#
Heuristic: source resolution in mm if all components < 1, otherwise µm.
Used across the pipeline to accept either unit in OME-Zarr metadata or CLI arguments without breaking legacy data. Pixel sizes below 1 µm would imply sub-nanometre voxels, so the heuristic is safe for all realistic acquisitions.
- linumpy.geometry.resampling.resample_mosaic_grid(vol, source_res, target_res_um, n_levels=5, out_path=None)[source]#
Resample a mosaic grid volume to a target isotropic resolution.
Processes tiles individually to avoid loading the entire mosaic into memory. Uses anti-aliasing and 1st-order interpolation.
- Parameters:
vol (dask array or zarr array) – Mosaic grid volume with chunk structure (each chunk = one tile). Shape: (Z, nx*tile_h, ny*tile_w)
source_res (tuple) – Source resolution (res_z, res_y, res_x) in whatever unit.
target_res_um (float) – Target isotropic resolution in microns.
n_levels (int) – Number of pyramid levels in output.
out_path (str or None) – If provided, save the result to this OME-Zarr path.
- Returns:
Resampled array if out_path is None, else None (writes to file).
- Return type:
np.ndarray or None