neu_proc.ops.offset

Shift an array by whole voxels, keeping its shape: offset().

The far side is filled by one of two methods:

  • extend repeats the edge plane outward, adding only what the boundary already holds; the default, and right for a label volume.

  • const writes fill_const (0, background, by default).

There is no “dilate” fill: edt dilation is unbounded and would fill interior background too, and even bounded it would invent labels where the edge is background. Fill the margin, then dilate explicitly if that is wanted.

Attributes

Functions

offset(arr, offset[, fill_method, fill_const]) → numpy.ndarray

arr shifted by offset whole voxels, keeping its shape.

Module Contents

neu_proc.ops.offset.offset(arr, offset, fill_method: str = 'extend', fill_const=0) → numpy.ndarray

arr shifted by offset whole voxels, keeping its shape.

offset(labels, 1) # one voxel along every axis offset(labels, (2, 0, -3)) # per axis, either direction offset(labels, 4, “const”, fill_const=0)

offset is a scalar for all three axes or one value per axis, zyx, positive toward higher indices. What falls off one side is dropped and the other side is filled by fill_method (FILL_METHODS).

The origin is not adjusted: through Piece.apply the shifted data keeps the old frame. If the shift should move the data in physical space, pass a frame= with the origin moved accordingly.

neu_proc.ops.offset.FILL_METHODS