neu_proc.ops.kernels¶
The one place a physical length becomes voxels.
Parameters are declared in nanometres and functions take voxels; the conversion lives only here, for two reasons:
A halo must be derived from the converted parameter. A Gaussian whose halo assumes
truncate=3.0while scipy uses 4.0 is wrong in a shell around every block seam, which shows as faint block edges rather than as an error.A voxel count means nothing without a
Frame:sigma_vox=2is different smoothing at level 0 and level 2, and along z and x on an anisotropic volume.
Nothing here imports scipy.
Attributes¶
Functions¶
|
A boolean footprint of this per-axis radius in voxels: an ellipsoid when the radii |
|
An odd per-axis footprint size in whole voxels, at least 1. Odd, because an even |
|
The read margin a Gaussian of this sigma needs, per axis, in whole voxels. |
|
A scalar or per-axis sequence as a length- |
|
A physical length, per axis, in voxels of |
|
A volume in nm^3 as a voxel count, dividing by the product of the voxel sizes (a |
Module Contents¶
- neu_proc.ops.kernels.ball(radius_vox: float | Sequence[float], *, rank: int = 3) numpy.ndarray¶
A boolean footprint of this per-axis radius in voxels: an ellipsoid when the radii differ, which is what a physical ball becomes on an anisotropic volume.
- neu_proc.ops.kernels.box(size_vox: float | Sequence[float], *, rank: int = 3) tuple[int, ...]¶
An odd per-axis footprint size in whole voxels, at least 1. Odd, because an even window shifts a centred filter’s result by half a voxel.
- neu_proc.ops.kernels.gaussian_halo(sigma_vox: float | Sequence[float], *, truncate: float = GAUSSIAN_TRUNCATE, rank: int = 3) tuple[int, ...]¶
The read margin a Gaussian of this sigma needs, per axis, in whole voxels.
ceil(truncate * sigma), scipy’s kernel radius. Pass the same voxel sigma andtruncatethe filter will get.
- neu_proc.ops.kernels.per_axis(value: float | Sequence[float], rank: int = 3) tuple[float, ...]¶
A scalar or per-axis sequence as a length-
ranktuple, zyx; a scalar is repeated.
- neu_proc.ops.kernels.to_voxels(length_nm: float | Sequence[float], voxel_size_nm: Sequence[float], *, rank: int = 3) tuple[float, ...]¶
A physical length, per axis, in voxels of
voxel_size_nm. Not rounded: a sigma stays fractional, while a footprint radius is rounded by its caller.
- neu_proc.ops.kernels.volume_to_voxels(volume_nm3: float, voxel_size_nm) float¶
A volume in nm^3 as a voxel count, dividing by the product of the voxel sizes (a 40x8x8 nm voxel is 2560 nm^3, so 1 um^3 is 390 voxels). Not rounded; the caller picks
ceilorfloor.
- neu_proc.ops.kernels.GAUSSIAN_TRUNCATE = 4.0¶