neurocarto.util.probe_coor

class neurocarto.util.probe_coor.ProbeCoordinate

ProbeCoordinate(x, y, z, s, rx, ry, rz, depth, bregma)

x: float

ap (um)

y: float

dv (um)

z: float

ml (um)

s: int

i-th shank

rx: float

shank s x-axis (ap) rotate degree

ry: float

shank s y-axis (dv) rotate degree

rz: float

shank s z-axis (ml) rotate degree

depth: float

shank s insert depth (um)

static __new__(_cls, x, y, z, s=0, rx=0, ry=0, rz=0, depth=0, bregma=None)

Create new instance of ProbeCoordinate(x, y, z, s, rx, ry, rz, depth, bregma)

Parameters:
  • x (float)

  • y (float)

  • z (float)

  • s (int)

  • rx (float)

  • ry (float)

  • rz (float)

  • depth (float)

  • bregma (tuple[float, float, float] | None)

bregma: tuple[float, float, float] | None

bregma coordinate (ap, dv, ml)

to_origin()

move coordinate to atlas-origin.

Return type:

Self

to_bregma(atlas_name: tuple[float, float, float]) Self
to_bregma(atlas_name: str, ref: str = 'bregma') Self

move coordinate to bregma-origin.

Parameters:
  • atlas_name – atlas name

  • ref

Returns:

neurocarto.util.probe_coor.get_plane_at(view, pc)
Parameters:
Return type:

SlicePlane

neurocarto.util.probe_coor.prepare_affine_matrix(dx, dy, sx, sy, rt)
Parameters:
  • dx (float) – x-axis offset

  • dy (float) – y-axis offset

  • sx (float) – x-axis scaling

  • sy (float) – y-axis scaling

  • rt (float) – rotate in degree

Returns:

\(A_{3 \times 3}\)

Return type:

ndarray[tuple[int, …], dtype[float64]]

neurocarto.util.probe_coor.prepare_affine_matrix_both(dx, dy, sx, sy, rt)
Parameters:
  • dx (float) – x-axis offset

  • dy (float) – y-axis offset

  • sx (float) – x-axis scaling

  • sy (float) – y-axis scaling

  • rt (float) – rotate in degree

Returns:

tuple of (\(A_{3 \times 3}\), \(A_{3 \times 3}^{-1}\))

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

neurocarto.util.probe_coor.project(a, p)

project coordinate from image-origin to probe-origin, or opposite (depends on \(A_{3 \times 3}\) to probe-origin or \(A_{3 \times 3}^{-1}\) to image-origin).

Parameters:
  • a (ndarray[tuple[int, ...], dtype[float64]]) – Array[float, 3, 3] affine transform matrix

  • p (ndarray[tuple[int, ...], dtype[float64]]) – Array[float, (x,y[,1]) [,N]] position

Returns:

transform position, same shape as p.

Return type:

ndarray[tuple[int, …], dtype[float64]]

neurocarto.util.probe_coor.project_b2i(bregma, view, p, *, keep_plane=False)

project coordinate from bregma-origin to image-origin.

Parameters:
  • bregma (tuple[float, float, float] | None) – bregma (ap, dv, ml) in um

  • view (SlicePlane) – projection view

  • p (ndarray[tuple[int, ...], dtype[float64]]) – Array[float, (ap, dv, ml) [,N]] position in um

  • keep_plane (bool) – keep plane position (um) in return. Otherwise, p will be filled with 1.

Returns:

Array[float, (x, y, p) [,N]] transform position in um

Return type:

ndarray[tuple[int, …], dtype[float64]]

neurocarto.util.probe_coor.project_i2b(bregma, view, p)

project coordinate from image-origin to bregma-origin.

Parameters:
  • bregma (tuple[float, float, float] | None) – bregma (ap, dv, ml) in um

  • view (SlicePlane) – projection view

  • p (ndarray[tuple[int, ...], dtype[float64]]) – Array[float, (x,y[,1]) [,N]] position in um

Returns:

Array[float, (ap, dv, ml) [,N]] transform position in um

Return type:

ndarray[tuple[int, …], dtype[float64]]