neuralib.atlas.view.AbstractSliceView

class neuralib.atlas.view.AbstractSliceView[source]

Bases: object

SliceView ABC for different plane type

Dimension parameters:

AP = anterior-posterior

DV = dorsal-ventral

ML = medial-lateral

W = view width

H = view height

__init__(view_type, plane, resolution, reference)[source]
Parameters:
  • view_type (Literal['annotation', 'reference']) – DATA_SOURCE_TYPE. {‘ccf_annotation’, ‘ccf_template’, ‘allensdk_annotation’}

  • plane (Literal['coronal', 'sagittal', 'transverse']) – PLANE_TYPE`. {‘coronal’, ‘sagittal’, ‘transverse’}

  • resolution (int) – um/pixel

  • reference (ndarray) – Array[uint16, [AP, DV, ML]]

Methods

__init__(view_type, plane, resolution, reference)

coor_on(plane, o)

map slice point (x, y) at plane plane back to volume point (ap, dv, ml)

offset(h, v)

plane(offset)

Get image plane.

plane_at(slice_index)

plot_max_projection(ax, *[, ...])

Plot max projection for the given plane_type

Attributes

REFERENCE_FROM

reference from which axis

bregma

height

height (pixel) in a specific plane view

height_mm

height (um) in a specific plane view

max_projection_axis

n_ap

number of slices along AP axis

n_dv

number of slices along DV axis

n_ml

number of slices along ML axis

n_planes

number of planes in a specific plane view

project_index

plane(p), x, y of index order in (AP, DV, ML)

reference_point

reference point in a specific plane view.

width

width (pixel) in a specific plane view

width_mm

width (um) in a specific plane view

view_type

VIEW_TYPE.

plane_type

PLANE_TYPE`.

resolution

um/pixel

reference

Array[float, [AP, DV, ML]]

grid_x

Array[int, [W, H]]

grid_y

Array[int, [W, H]]

REFERENCE_FROM: ClassVar[str] = ''

reference from which axis

static __new__(cls, view_type, plane, resolution, reference)[source]
Parameters:
  • view_type (Literal['annotation', 'reference'])

  • plane (Literal['coronal', 'sagittal', 'transverse'])

  • resolution (int)

  • reference (ndarray)

__init__(view_type, plane, resolution, reference)[source]
Parameters:
  • view_type (Literal['annotation', 'reference']) – DATA_SOURCE_TYPE. {‘ccf_annotation’, ‘ccf_template’, ‘allensdk_annotation’}

  • plane (Literal['coronal', 'sagittal', 'transverse']) – PLANE_TYPE`. {‘coronal’, ‘sagittal’, ‘transverse’}

  • resolution (int) – um/pixel

  • reference (ndarray) – Array[uint16, [AP, DV, ML]]

view_type: Final[Literal['annotation', 'reference']]

VIEW_TYPE. {‘annotation’, ‘reference’}

plane_type: Final[Literal['coronal', 'sagittal', 'transverse']]

PLANE_TYPE`. {‘coronal’, ‘sagittal’, ‘transverse’}

resolution: Final[int]

um/pixel

reference: Final[ndarray]

Array[float, [AP, DV, ML]]

grid_y: Final[ndarray]

Array[int, [W, H]]

grid_x: Final[ndarray]

Array[int, [W, H]]

property bregma: ndarray
property n_ap: int

number of slices along AP axis

property n_dv: int

number of slices along DV axis

property n_ml: int

number of slices along ML axis

abstract property n_planes: int

number of planes in a specific plane view

abstract property width: int

width (pixel) in a specific plane view

abstract property height: int

height (pixel) in a specific plane view

property width_mm: float

width (um) in a specific plane view

property height_mm: float

height (um) in a specific plane view

abstract property reference_point: int

reference point in a specific plane view. aka, bregma plane index

abstract property project_index: tuple[int, int, int]

plane(p), x, y of index order in (AP, DV, ML)

Returns:

(p, x, y)

abstract property max_projection_axis: int
plot_max_projection(ax, *, annotation_regions=None, annotation_cmap='hsv')[source]

Plot max projection for the given plane_type

Parameters:
  • ax (Axes) – Axes

  • annotation_regions (str | list[str] | None) – annotation_regions

  • annotation_cmap (str) – camp for the annotation regions, defaults to ‘hsv’

plane_at(slice_index)[source]
Parameters:

slice_index (int)

Return type:

SlicePlane

offset(h, v)[source]
Parameters:
  • h (int) – horizontal plane diff to the center. right side positive.

  • v (int) – vertical plane diff to the center. bottom side positive.

Returns:

(H, W) array

Return type:

ndarray

plane(offset)[source]

Get image plane.

Parameters:

offset (int | tuple[int, int, int] | ndarray) – Array[int, height, width] or tuple (plane, dh, dv)

Returns:

Return type:

ndarray

coor_on(plane, o)[source]

map slice point (x, y) at plane plane back to volume point (ap, dv, ml)

Parameters:
  • plane (ndarray) – plane number of array

  • o (tuple[ndarray, ndarray]) – tuple of (x, y)

Returns:

(ap, dv, ml)

Return type:

tuple[int | ndarray, …]