neu_lib.frame¶
Voxel indices to physical nanometres (Frame), and the zyx-to-xyz flip.
A level’s voxel size comes from the source’s metadata, never from 2 ** level: real
pyramids are anisotropic (halving x and y but not z is common). Arrays are zyx;
to_xyz() is the one conversion to a renderer’s xyz, and getting the order wrong
mirrors data through the z=x diagonal without any error.
Classes¶
Maps voxel indices at one level to physical nanometres, zyx, per axis: |
Functions¶
|
|
Module Contents¶
- class neu_lib.frame.Frame¶
Maps voxel indices at one level to physical nanometres, zyx, per axis:
nm = index * voxel_size_nm + origin_nm.origin_nmis where voxel(0, 0, 0)sits, which is how a crop stays in its parent’s coordinates.- to_nm(points_zyx: Sequence | numpy.ndarray) numpy.ndarray¶
Voxel indices → nm. Accepts a single point or an
(N, 3)array.
- to_voxel(points_nm: Sequence | numpy.ndarray) numpy.ndarray¶
nm → fractional voxel indices, unrounded.
- voxel_box(bounds_nm, *, outward: bool = True) neu_lib.grid.BBox¶
A physical
(lo, hi)in nm, as a box in this frame’s voxels. Use it to find the same place at another level, or in a crop’s parent.outward=Truefloorsloand ceilshi, so the result contains the physical box even when this frame is coarser (a 200-voxel box at 8 nm covers 25 or 26 voxels at 64 nm, depending on where it starts).outward=Falserounds each end to the nearest voxel instead.
- property is_isotropic: bool¶
- origin_nm: tuple[float, float, float] = (0.0, 0.0, 0.0)¶
- voxel_size_nm: tuple[float, float, float]¶
- neu_lib.frame.to_xyz(points_zyx: numpy.ndarray) numpy.ndarray¶
(N, 3)zyx points as xyz, in a new C-contiguousfloat32array (what a GPU buffer needs; a reversed view is not contiguous).