Skip to content

EasyViewer

EasyViewerBase()

Bases: ABC

add_image_layer(layer_name, source, contrast_range=None, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer image layer contrast_range = (float, float): contrast range for image layer either in 0-1 (floats) or 0-255 (ints).

add_multilayer_annotations(layer_anno_dict)

layer_anno_dict is a layer_name to annotation list dict.

add_segmentation_layer(layer_name, source, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer segment layer

assign_colors(layer_name, seg_colors) abstractmethod

Assign colors to root ids in a segmentation layer

Parameters:

  • layer_name ((str)) –

    Segmentation layer name

  • seg_colors (dict) –

    dict with root ids as keys and colors as values.

set_annotation_layer_color(layer_name, color)

Set the color for the annotation layer

EasyViewerMainline(**kwargs)

Bases: UnservedViewer, EasyViewerBase

add_image_layer(layer_name, source, contrast_range=None, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer image layer contrast_range = (float, float): contrast range for image layer either in 0-1 (floats) or 0-255 (ints).

add_multilayer_annotations(layer_anno_dict)

layer_anno_dict is a layer_name to annotation list dict.

add_segmentation_layer(layer_name, source, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer segment layer

append_source_to_segmentation_layer(layer_name, source)

Append source or sources to an existing segmentation layer.

Parameters:

  • layer_name (str) –

    Name of an existing layer

  • source (str or list of str) –

    Source or sources to add to the layer. Can be segment properties or skeleton sources, for example.

load_url(url)

Parse a neuroglancer state based on URL and load it into the state

set_annotation_layer_color(layer_name, color)

Set the color for the annotation layer

EasyViewerSeunglab(**kwargs)

Bases: UnsynchronizedViewer, EasyViewerBase

add_image_layer(layer_name, source, contrast_range=None, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer image layer contrast_range = (float, float): contrast range for image layer either in 0-1 (floats) or 0-255 (ints).

add_multilayer_annotations(layer_anno_dict)

layer_anno_dict is a layer_name to annotation list dict.

add_segmentation_layer(layer_name, source, **kwargs)

Add segmentation layer to viewer instance.

Attributes: layer_name (str): name of layer to be displayed in neuroglancer ui. source (str): source of neuroglancer segment layer

assign_colors(layer_name, seg_colors)

Assign colors to root ids in a segmentation layer

Parameters:

  • layer_name ((str)) –

    Segmentation layer name

  • seg_colors (dict) –

    dict with root ids as keys and colors as values.

load_url(url)

Parse a neuroglancer state based on URL and load it into the state

screenshot(size=None)

Capture a screenshot synchronously.

:param size: Optional. List of [width, height] specifying the dimension in pixels of the canvas to use. If specified, UI controls are hidden and the canvas is resized to the specified dimensions while the screenshot is captured.

:returns: The screenshot.

set_annotation_layer_color(layer_name, color)

Set the color for the annotation layer

set_multicut_points(layer_name, seg_id, points_red, points_blue, supervoxels_red=None, supervoxels_blue=None, focus=True)

Configures multicut points in the neuroglancer state. Note that points need to be in mesh units (e.g. nanometers), not voxels!

Parameters:

  • layer_name (str) –

    Segmentation layer name

  • seg_id (uint64) –

    Segmentation id of the object in question

  • points_red (array) –

    Nx3 array of locations in voxel space for side 1 of the cut.

  • points_blue (array) –

    Mx3 array of locations in voxel space for side 2 of the cut.

  • supervoxels_red (array or None, default: None ) –

    N-length array of supervoxel ids associated with locations in points_red or None. If None, supervoxels lookup occurs based on the mesh. By default None

  • supervoxels_blue (array or None, default: None ) –

    M-length array of supervoxel ids associated with locations in points_blue or None. If None, supervoxels lookup occurs based on the mesh. By default None

  • focus (bool, default: True ) –

    If True, makes the layer and graph tool focused. By default True

set_timestamp(layer_name, timestamp=None)

Set timestamp of a segmentation layer

Parameters:

  • layer_name (str) –

    Name of a segmentation layer

  • timestamp (float, default: None ) –

    Timestamp in unix epoch time (e.g. time.time.now() in python), by default None

set_view_options(show_slices=None, layout=None, show_axis_lines=None, show_scale_bar=None, orthographic=None, position=None, zoom_image=None, zoom_3d=None, background_color=None)

Set options relating to the neuroglancer view state. Only changes the values of the parameters provided.

Parameters:

  • show_slices (bool, default: None ) –

    Show slice cutout in the 3d view, by default None

  • layout (str, default: None ) –

    Change the layout type ('xy', 'yz', 'zx', '3d', 'xy-3d', 'yz-3d', 'zx-3d', or '4panel'), by default None

  • show_axis_lines (bool, default: None ) –

    Show the red/blue/green lines indicating the axis directions, by default None

  • show_scale_bar (bool, default: None ) –

    Controls showing of scale bar, by default None

  • orthographic (bool, default: None ) –

    Controls whether the 3d perspective view is orthographic or not, by default None

  • position (list, default: None ) –

    Sets the location of center point of the view in Neuroglancer coordinates, by default None

  • zoom_image (int, default: None ) –

    Sets the zoom factor for the imagery, by default None

  • zoom_3d (int, default: None ) –

    Sets the zoom factor for the 3d view, by default None

  • background_color (list or str, default: None ) –

    hex, rgb, or named color for the background of the 3d viewer, by default None