neurocarto.util.edit.atlas

neurocarto.util.edit.atlas.atlas_get_region_name(controller, region)

Get region acronym.

Parameters:
Returns:

region acronym

See:

Structure

See:

BlueprintFunctions. atlas_get_region_name()

Return type:

str | None

neurocarto.util.edit.atlas.atlas_get_region(controller, region)
Parameters:
Return type:

Structure | None

neurocarto.util.edit.atlas.atlas_get_slice(controller, *, um=False)

Get atlas brain image projection view and slicing plane.

Parameters:
Returns:

tuple of (projection name, plane index)

See:

BlueprintFunctions. atlas_get_slice()

Return type:

tuple[str | None, int | None]

neurocarto.util.edit.atlas.atlas_set_slice(controller, view=None, plane=None, *, um=False)

Set atlas image projection view and slicing plane.

Parameters:
  • view (str) – ‘coronal’, ‘sagittal’, or ‘transverse’

  • plane (int) – plane index

  • um – is plane um? If so, then use bregma as origin.

  • controller (ControllerView | AtlasBrainView)

See:

AtlasBrainView. update_brain_view()

See:

AtlasBrainView. update_brain_slice()

See:

BlueprintFunctions. atlas_set_slice()

neurocarto.util.edit.atlas.atlas_add_label(controller, text, pos, *, origin='bregma', color='cyan', replace=True)

Add a label on atlas image view.

Parameters:
  • text (str) – text content.

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

  • origin (str) – origin reference point

  • color (str) – label color

  • replace – replace label which has same text content

  • controller (ControllerView | AtlasBrainView)

Returns:

label

See:

AtlasBrainView. add_label()

See:

BlueprintFunctions. atlas_add_label()

Return type:

Label | None

neurocarto.util.edit.atlas.atlas_get_label(controller, index)

Get the label from atlas image view.

Parameters:
See:

AtlasBrainView. get_label()

See:

AtlasBrainView. index_label()

See:

BlueprintFunctions. atlas_get_label()

Return type:

Label | None

neurocarto.util.edit.atlas.atlas_focus_label(controller, label)

Move slice to the label’s position.

Note

Only works on the labels which its origin is referring on the bregma. Otherwise, nothing will happen.

Parameters:
See:

AtlasBrainView. focus_label()

See:

BlueprintFunctions. atlas_focus_label()

neurocarto.util.edit.atlas.atlas_del_label(controller, i)

Remove labels from atlas image.

Parameters:
See:

AtlasBrainView. del_label()

See:

BlueprintFunctions. atlas_del_label()

neurocarto.util.edit.atlas.atlas_clear_labels(controller)

Clear all labels on the atlas image.

See:

AtlasBrainView. clear_labels()

See:

BlueprintFunctions. atlas_clear_labels()

Parameters:

controller (ControllerView | AtlasBrainView)

neurocarto.util.edit.atlas.atlas_set_transform(controller, p=None, s=None, rt=None)

updating atlas image transforming.

Parameters:
  • p (tuple[float, float]) – center position (x, y)

  • s (float | tuple[float, float]) – scaling (sx, sy)

  • rt (float) – rotating degree

  • controller (ControllerView | AtlasBrainView)

See:

BoundView. update_boundary_transform()

See:

BlueprintFunctions. atlas_set_transform()

neurocarto.util.edit.atlas.atlas_set_anchor(controller, p, a=(0, 0))

Update atlas image boundary transform to move a onto p.

Parameters:
  • p (tuple[float, float]) – target point on figure. figure (probe) origin as origin.

  • a (tuple[float, float]) – anchor point on image, center point as origin.

  • controller (ControllerView | AtlasBrainView)

See:

BoundView. set_anchor_to()

See:

BlueprintFunctions. atlas_set_anchor()

neurocarto.util.edit.atlas.atlas_new_probe(controller, ap, dv, ml, shank=0, rx=0, ry=0, rz=0, depth=0, ref='bregma')

Create a probe coordinate instance.

Parameters:
  • ap (float) – ap um, from ref (default bregma).

  • dv (float) – dv um, from ref (default bregma).

  • ml (float) – ml um, from ref (default bregma).

  • shank (int) – shank index

  • rx (float) – ap-axis rotate

  • ry (float) – dv-axis rotate

  • rz (float) – ml-axis rotate

  • depth (float) – insert depth

  • ref (str) – reference origin.

  • controller (ControllerView | AtlasBrainView)

Returns:

a probe coordinate. None if origin not set.

See:

BlueprintFunctions. atlas_new_probe()

Return type:

probe_coor.ProbeCoordinate | None

neurocarto.util.edit.atlas.atlas_current_probe(bp, controller, shank=0, ref='bregma')

Get the current coordinate of the probe.

The dv value of the returned coordinate always zero.

Parameters:
Returns:

a probe coordinate. None if origin not found.

See:

BlueprintFunctions. atlas_current_probe()

Return type:

probe_coor.ProbeCoordinate | None

neurocarto.util.edit.atlas.atlas_set_anchor_on_probe(bp, controller, coor)

Update atlas image boundary transform to anchor insertion point onto the probe.

Parameters:
See:

BlueprintFunctions. atlas_set_anchor_on_probe()

neurocarto.util.edit.atlas.atlas_coor_electrode(bp, controller, coor=None, electrode=None, bregma='bregma')

Transform electrode position to altas coordinate (AP,DV,ML) according the given probe coordinate.

Parameters:
Returns:

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

See:

use atlas_current_probe() when coor is None.

See:

BlueprintFunctions. atlas_coor_electrode()

Return type:

NDArray[np.float64]

neurocarto.util.edit.atlas.atlas_mask_region(bp, controller, region, coor=None, electrode=None)

Return a mask that electrode located in the given region.

Parameters:
Returns:

Array[bool, N]

See:

use atlas_current_probe() when coor is None.

See:

use atlas_coor_electrode()

See:

BlueprintFunctions. atlas_mask_region()

Return type:

NDArray[np.bool_]