itasc.cellpose.shape

Layout-free input canonicalisation for the standalone tool.

The standalone Cellpose tool supports neither stitching-as-a-mode nor true 3D segmentation, so it never needs the 4-way 2D/2D+t/3D/3D+t layout: it segments every plane individually. The only place axis identity matters is tracking, which links the z axis by spatial overlap (stitch) and the t axis by motion (laptrack). By convention the shorter of the two leading axes is z (few z-slices, many timepoints is the common case) and the longer is t.

to_canonical_tzyx() applies that convention so the rest of the pipeline can keep working in canonical (T, Z, Y, X) without the user declaring a layout.

Functions

describe_axes(shape)

Human-readable summary of how an input shape is interpreted.

to_canonical_tzyx(arr)

Coerce any 2-D..4-D input to canonical (T, Z, Y, X) without a layout.

itasc.cellpose.shape.to_canonical_tzyx(arr)[source]

Coerce any 2-D..4-D input to canonical (T, Z, Y, X) without a layout.

  • 2-D (Y, X)(1, 1, Y, X).

  • 3-D → one leading axis, read as time (the common 2D+t case); Z is a singleton: (T, 1, Y, X).

  • 4-D → two leading axes; the shorter is Z and the longer is T, so the result is reordered to (T, Z, Y, X) (a no-op when already so).

Return type:

ndarray

Parameters:

arr (ndarray)

itasc.cellpose.shape.describe_axes(shape)[source]

Human-readable summary of how an input shape is interpreted.

Used for widget status so the user can see the inferred T/Z without a picker, e.g. "6×512×512 T=6, Z=1" or "40×5×512×512 T=40, Z=5".

Return type:

str

Parameters:

shape (tuple[int, ...])