Skip to content

layers

ngtools.layers

A neuroglancer scene with a programmatic interface.

LayerFactory

Bases: type

Metaclass for layers.

__call__

__call__(arg=None, *args, **kwargs)

Parameters:

Name Type Description Default
arg ng.Layer or [list of] (str | dict | None)
None

Layer

Layer(*args, **kwargs)

Bases: Wraps(Layer)

Base class for all layers.

See ImageLayer, SegmentationLayer, MeshLayer for keyword-parameters specific to these layers types.

Parameters:

Name Type Description Default
json_data dict | Layer | LayerDataSource | str

Either a Layer (or its JSON representation), or a data source (or its JSON representation).

required

Other Parameters:

Name Type Description
type (image, segmentation, mesh, annotation, pointAnnotation)

Layer type -- guessed from source by default.

source [list of] LayerDataSource | str

Data source. Except if layer is a PointAnnotationLayer.

layer_dimensions CoordinateSpace

Local dimensions specific to the layer.

layer_position CoordinateSpace

Position within the local dimensions.

local_velocity DimensionPlaybackVelocity

Speed for playback along local dimensions.

tab str
panels list[LayerSidePanelState]
pick bool
tool_bindings dict[str, Tool | str]

Key binding to tools, specific to this layer.

tool Tool | str

Active tool (or tool name).

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

ImageLayer

ImageLayer(*args, **kwargs)

Bases: _SourceMixin, Wraps(ImageLayer), Layer

Image layer.

See Layer for keyword parameters common to all layers.

Other Parameters:

Name Type Description
source [list of] LayerDataSource | str
shader str

Default shader:

#uicontrol invlerp normalized
    void main() {
    emitGrayscale(normalized());
}

shader_controls dict[str, float | dict | InvlerpParameters | TransferFunctionParameters]
  • InvlerpParameters: range: tuple[float, float] window: tuple[float, float] channel: list[int]
  • TransferFunctionParameters: window: tuple[float, float] channel: list[int] controlPoints : list[list[float]] defaultColor : str
opacity float
blend (default, additive)
volume_rendering_mode bool | {off, on, max, min}
volume_rendering_gain float
volume_rendering_depth_samples float
cross_section_render_scale float

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

SegmentationLayer

SegmentationLayer(*args, **kwargs)

Bases: _SourceMixin, Wraps(SegmentationLayer), Layer

Segmentation layer.

See Layer for keyword parameters common to all layers.

Other Parameters:

Name Type Description
source [list of] LayerDataSource | str
starred_segments StarredSegments | dict[int, bool]
equivalences EquivalenceMap | list[list[int]]
hide_segment_zero bool
hover_highlight bool
base_segment_coloring bool
selected_alpha float
not_selected_alpha float
object_alpha float
saturation float
ignore_null_visible_set bool
skeleton_rendering SkeletonRenderingOptions | dict

shader : str, optional shader_controls : dict[str, float | dict | ng.InvlerpParameters | ng.TransferFunctionParameters] - InvlerpParameters: range: tuple[float, float] window: tuple[float, float] channel: list[int] - TransferFunctionParameters: window: tuple[float, float] channel: list[int] controlPoints : list[list[float]] defaultColor : str mode2d : {"lines", "lines_and_points"}, optional line_width2d : float, default=2 mode3d: {"lines", "lines_and_points"}, optional line_width3d : float, default=3

color_seed int
cross_section_render_scale float
mesh_render_scale float
mesh_silhouette_rendering float
segment_query str
segment_colors dict[uint64, str]
segment_default_color str
linked_segmentation_group str
linked_segmentation_color_group str | False

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

SkeletonLayerFactory

Bases: LayerFactory

Factory for skeletons.

SkeletonLayer

SkeletonLayer(*args, **kwargs)

Bases: SegmentationLayer

Skeleton layer.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

TractLayer

TractLayer(arg=None, *args, **kwargs)

Bases: SkeletonLayer

Tract layer.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

MeshLayer

MeshLayer(*args, **kwargs)

Bases: Layer

Common ancestors to all mesh layers.

See also: SingleMeshLayer, MultiscaleMeshLayer

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

SingleMeshLayer

SingleMeshLayer(*args, **kwargs)

Bases: _SourceMixin, Wraps(SingleMeshLayer), MeshLayer

Single mesh layer.

See Layer for keyword parameters common to all layers.

See also: MeshLayer, MultiscaleMeshLayer.

Other Parameters:

Name Type Description
source [list of] LayerDataSource | str
vertex_attribute_sources list[str]
shader str

Default shader:

void main() {
    emitGray();
}

vertex_attribute_names list[str]

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

MultiscaleMeshLayer

MultiscaleMeshLayer(*args, **kwargs)

Bases: SegmentationLayer

Multiscale mesh layer.

See also: MeshLayer, SingleMeshLayer.

Other Parameters:

Name Type Description
render_scale float
silhouette_rendering float

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

AnnotationLayer

AnnotationLayer(*args, **kwargs)

Bases: _SourceMixin, Wraps(AnnotationLayer), Layer

Annotation layer.

See Layer for keyword parameters common to all layers.

Other Parameters:

Name Type Description
source [list of] LayerDataSource | str
annotations list[AnnotationBase | dict]

Valid annotations:

{
    "point": PointAnnotation,
    "line": LineAnnotation,
    "axis_aligned_bounding_box": AxisAlignedBoundingBoxAnnotation,
    "ellipsoid": EllipsoidAnnotation,
}

annotation_properties list[AnnotationPropertySpec | dict]

id : str type : str description : str default : float | str enum_values : list[int | str] enum_labels : list[str]

annotation_relationships list[str]
linked_segmentation_layer dict[str, str]
filter_by_segmentation list[str]
ignore_null_segment_filter bool
shader str

Default shader:

void main() {
    setColor(defaultColor());
}

shader_controls dict[str, float | dict | InvlerpParameters | TransferFunctionParameters]
  • InvlerpParameters: range: tuple[float, float] window: tuple[float, float] channel: list[int]
  • TransferFunctionParameters: window: tuple[float, float] channel: list[int] controlPoints : list[list[float]] defaultColor : str

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

TractAnnotationLayer

TractAnnotationLayer(*args, **kwargs)

Bases: AnnotationLayer

Tract annotation layer.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

LocalAnnotationLayer

LocalAnnotationLayer(*args, **kwargs)

Bases: Wraps(LocalAnnotationLayer), AnnotationLayer

TODO.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PointAnnotationLayer

PointAnnotationLayer(*args, **kwargs)

Bases: Wraps(PointAnnotationLayer), Layer

Point annotation layer.

Parameters:

Name Type Description Default
points list[tuple[float, float, float]]
required

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

ManagedLayer

ManagedLayer(*args, **kwargs)

Bases: Wraps(ManagedLayer), _SourceMixin

Named layer.

Layers

Bases: Wraps(Layers)

List of named layers.