kernels.lmedian

kernels.lmedian(arr, *, validate=True)

IRAF-style lower median along the stack axis.

Parameters

arr : (ndarray, shape(N, *spatial))

Image stack. Accepted dtypes are uint8, uint16, int16, int32, float32, and float64. Integer inputs are promoted to the package’s floating workspace when validate is True. Inputs with more than 3 dimensions are flattened internally; output shapes match the trailing spatial dimensions of the input.

validate : bool = True

If True, check dimensionality and normalize dtype/contiguity before entering the Rust kernel. If False, callers must provide inputs that satisfy the compiled kernel assumptions.

Returns

lmedian : (ndarray, shape(*spatial))

Per-pixel lower median. For an even number of finite values, this is the lower of the two middle values rather than their average.

Notes

Accepted integer dtypes (uint8, uint16, int16, int32) are passed through without promotion so the output dtype matches the input. Any path that needs NaN masking, rejection, zero, or scale should convert the stack to a floating workspace before calling this function.