neu_glance.config

Site defaults for neu-glance gen --config: display choices kept out of the package.

Pure: parses TOML into checked settings and applies them to layer dicts. Nothing is read unless --config names a file, so a state is reproducible from its command line. A flag on the command line wins over the file.

[volume]
bounds = false              # draw each volume's bounding box

[annotations.shader_controls]
line_color = "#ffff00"      # any #uicontrol of the layer's shader

[view]                      # as neuroglancer writes them: copy from a saved state
position = [6476.7, 4508.8, 5568.2]          # x, y, z, in the state's voxels
projection_orientation = [-0.1, 0.715, 0.682, 0.116]   # the 3D view's quaternion
projection_scale = 15812.5  # 3D zoom
cross_section_scale = 15.8  # 2D zoom
layout = "4panel"
select = "seg"              # the layer the side panel opens on

[layer.head]                # by layer name
silhouette = 5              # meshSilhouetteRendering, 0-10
opacity_2d = 0              # selectedAlpha
opacity_3d = 1              # objectAlpha
color = "white"             # segmentDefaultColor: every segment without its own colour
pick = false                # clicks go through it, to what is inside
skeletons = false           # the source's skeletons subsource (its Source-tab box)
tab = "segments"            # the side panel's tab for this layer
hide = true                 # added switched off
all_segments = true         # every id its segment_properties lists
color_by = ["col", "group"] # segmentColors by property, first one present (--color-by)

A [layer.NAME] the state has no layer for is reported, not refused: one site file serves many states. An unknown key is refused, since neuroglancer ignores what it does not know.

Attributes

Exceptions

ConfigProblem

A config file that cannot be applied as written.

Functions

apply(config, layers, *[, kept]) → list[str]

Apply [annotations] and [layer.*] display settings in place. Returns notes.

load(path[, read_bytes]) → dict[str, Any]

Parse and check a config file. Returns {"volume", "shader_controls", "layers"}.

parse(doc, *[, where]) → dict[str, Any]

shader_control_names(shader) → set[str]

The #uicontrol names a shader declares.

Module Contents

exception neu_glance.config.ConfigProblem

Bases: ValueError

A config file that cannot be applied as written.

Initialize self. See help(type(self)) for accurate signature.

neu_glance.config.apply(config: Mapping[str, Any], layers: list[dict], *, kept: Sequence[str] = ()) → list[str]

Apply [annotations] and [layer.*] display settings in place. Returns notes.

hide, all_segments and color_by are not applied here: the caller merges them with its flags, and color_by reads the layer’s segment properties. kept names layers of a state being added to, which a section naming them leaves as they are.

neu_glance.config.load(path: str, read_bytes=None) → dict[str, Any]

Parse and check a config file. Returns {"volume", "shader_controls", "layers"}.

neu_glance.config.parse(doc: Mapping[str, Any], *, where: str = 'config') → dict[str, Any]
neu_glance.config.shader_control_names(shader: str) → set[str]

The #uicontrol names a shader declares.

neu_glance.config.CALLER_KEYS = ('hide', 'all_segments', 'color_by')
neu_glance.config.LAYER_COLORS
neu_glance.config.LAYER_DISPLAY
neu_glance.config.LAYER_FLAGS = ('hide', 'all_segments')
neu_glance.config.LAYER_SUBSOURCES = ('skeletons',)
neu_glance.config.LAYER_SWITCHES
neu_glance.config.LAYER_TABS = ('source', 'rendering', 'annotations', 'segments')
neu_glance.config.VIEW_KEYS