neurocarto.views.atlas

class neurocarto.views.atlas.AtlasBrainView

Atlas mouse brain displaying view component.

Used command-line arguments: * ‘–atlas’ : brain name. * ‘–atlas-root’ : data saving directory.

Event Call chain

(boundary UI components)
    -/-> (event callback)
        -> update_boundary_transform()
            -> on_boundary_transform()

(atlas UI components)
    (slice_select) -/-> (event callback)
        -> update_brain_view()
            -> update_brain_slice(update_image=False)
            -> update_boundary_transform()
                -> on_boundary_transform()
                    -> update_image()
                        -> update_region_image()
    (region_choose) -/-> (event callback)
        -> update_region_image()
    (other) -/-> (event callback)
        -> update_brain_slice()
            -> update_image()
                -> update_region_image()
__init__(config, *, logger='neurocarto.view.atlas')
Parameters:
property name: str

view name

property width: float

Width of image

property height: float

Height of image

setup(f, **kwargs)

Setup controls and plotting.

Parameters:
  • f (figure) – figure in middle panel

  • kwargs – control or plotting related parameters.

Returns:

row list.

Return type:

list[UIElement]

save_state()

Save current state into S.

Returns:

json-serializable instance.

Return type:

AtlasBrainViewState | None

restore_state(state)

Restore state from state.

Parameters:

state (AtlasBrainViewState) – json-deserializable instance.

start()

Invoked when figure is ready.

clear_labels()

Clear all labels

len_label()

number of the labels

Return type:

int

get_label(i)

Get the label text at index i.

Parameters:

i (int) – index

Returns:

label text

Raises:

IndexError – index i out of bound

Return type:

Label

find_label(pos)

Find a label around the given position.

Parameters:

pos (tuple[float, float]) – (x, y) um

Returns:

found label

Return type:

Label | None

index_label(text)

Find index of a label which its content equals to text.

Parameters:

text (str) – label text

Returns:

label index. None if not found.

Return type:

int | None

focus_label(label)

Move slice to the label’s position.

Note

Only label which its origin refer on bregma works. Otherwise, nothing will happen.

Parameters:

label (int | str | Label) – label index, content or a {Label}.

add_label(text, pos, *, origin='bregma', color='cyan', replace=True)

Add a label.

Parameters:
  • text (str) – label text

  • pos (tuple[float, float] | tuple[float, float, float]) – label position

  • origin (str) – origin reference point

  • color (str) – label color

  • replace – replace label which has same text content

Return type:

Label

del_label(index)

Remove labels.

Parameters:

index (int | str | Label | list[int | str | Label]) – index, list of index.

on_boundary_transform(state)

Image transforming updating callback.

Parameters:

state (BoundaryState) – updated boundary parameters.

class neurocarto.views.atlas.AtlasBrainViewState
class neurocarto.views.atlas.Label

Label(text, pos, ref, color)

text: str

Alias for field number 0

pos: tuple[float, float, float]

position, either (x, y, 1) or (ap, dv, ml) depends on origin

ref: int

Alias for field number 2

color: str

Alias for field number 3

static __new__(_cls, text, pos, ref, color)

Create new instance of Label(text, pos, ref, color)

Parameters:
  • text (str)

  • pos (tuple[float, float, float])

  • ref (int)

  • color (str)