Repository navigation
make_ng_link
jaybgager edited this page Oct 6, 2026
·
2 revisions
Warning
PAGE UNDER CONSTRUCTION
This function generates a neuroglancer link from a datastack name, optionally adding a list of segment IDs, annotation layers, custom meshes, and other options. Only works on tracertools config-supported datastacks.
Arguments:
-
datastack(string, mandatory)- the name of the CAVE datastack to build a link for
-
seg_ids(list of integers, optional, default=[])- the IDs of any segments you want included with the link
-
anno_layers(list of dictionaries, optional, default=[])- a list of annotation layer dictionaries to make layers out of
-
region_meshes(boolean, optional, default=False)- if set to
True, includes a layer with the default region meshes for the volume if any exist
- if set to
-
region_meshes_on(boolean, optional, default=True)- if set to
Falseandregion_meshesis set toTrue, will hide the region mesh layer
- if set to
-
seg_colors(list of strings, optional, default=[])- Optional list of hexadecimal value colors for segments starting with #
-
seg_opacity(float, optional, default=1.0)- sets segmentation 3D opacity between 0.0 (invisible) and 1.0 (opaque)
- this is useful for doing segment proofreading comparisons, where the old seg is set to red (#FF0000) and the proofread seg is set to cyan (#00FFFF); this causes the overlap to turn grey, showing added regions as cyan and removed regions as red (any pair of directly complementary colors can be used)
-
viewer_site(string, optional, default="default")- setting this to anything other than
"default"will override the datastack's default viewer site with custom viewer site url
- setting this to anything other than
-
custom_mesh_source(string, optional, default=None)- If a mesh source url is given, will create a custom mesh layer
- Attempts to turn on mesh segment with ID of
1, may break if one isn't present
-
custom_mesh_name(string, optional, default=None)- name for custom mesh layer if passed, default
Nonewill name the layer"Custom Mesh"
- name for custom mesh layer if passed, default
-
custom_mesh_seg_ids(list of integers, optional, default=None)- the segment IDs of any segments in the custom mesh volume to be selected
-
custom_mesh_colors(list of strings, optional, default=None)- list of colors of custom mesh in hexadecimal notation starting with # (e.g
"#00ff00"for green) - default
Nonewill use color list generated by make_color_list
- list of colors of custom mesh in hexadecimal notation starting with # (e.g
-
custom_mesh_opacity(float, optional, default=1.0)- sets custom mesh 3D opacity between
0.0(invisible) and1.0(opaque)
- sets custom mesh 3D opacity between
-
view_coords(optional, list, default=None)- if volume-resolution point coordinates are passed, will set the viewer start postiion
- default value of
Nonewill use the tracertools config default start position for the chosen datastack
-
long_url(bool, optional, default=False)- setting to
Truereturns the url in the long-form neuroglancer format instead of using a shortened link - by default, uses a link shortener to make output postable on platforms with character limits (e.g. Slack)
- setting to
Returns:
-
output_link(string)- the final neuroglancer link
INPUT:
import tracertools as tt
ng_url = tt.make_ng_link(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941441350235,
720575941519923628,
720575941703820762,
],
region_meshes = True,
)
print(ng_url)
OUTPUT:
https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/6639015473184768
INPUT:
import tracertools as tt
ng_url = tt.make_ng_link(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941473274509, # outdated version of 720575941441350235 #
720575941524660200, # outdated version of 720575941519923628 #
720575941565377335, # outdated version of 720575941703820762 #
720575941441350235,
720575941519923628,
720575941703820762,
],
seg_colors = [
"#FF0000",
"#FF0000",
"#FF0000",
"#00FFFF",
"#00FFFF",
"#00FFFF",
],
translucent_seg = True,
)
print(ng_url)
OUTPUT:
https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/5192707382181888
INPUT:
import tracertools as tt
ng_url = tt.make_ng_link(
datastack = "brain_and_nerve_cord",
custom_mesh_source = "https://c10s.pni.princeton.edu/tracers/examples/mesher/volume_02|neuroglancer-precomputed:",
custom_mesh_name = "Orange you glad you can customize mesh names?",
custom_mesh_color = "#FF7800",
view_coords = [123757, 180557, 4582],
)
print(ng_url)
OUTPUT:
https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/4819158423306240
Note
This output was generated on 2026/06/16 and may vary if this code is run in the future.