Skip to content

Example

Example

Editglancer is a small Python package for generating neuroglancer links which depict the edits to a neuron in a PyChunkedGraph. This notebook demonstrates how to use it.

Start a CAVEclient for your datastack, here "minnie65_phase3_v1". Note that you may need to change the datastack to one you have access too. For more information, first visit the CAVEclient tutorials.

from caveclient import CAVEclient

client = CAVEclient(
    "minnie65_phase3_v1",
    pool_maxsize=20,
    pool_block=True,
)

Select a root ID (a neuron in this case) to visualize.

root_id = 864691136487559186

Generate a neuroglancer link to visualize the neuron and its edits.

from editglancer import generate_link_for_root

generate_link_for_root(root_id, client)

If everything worked the link should take you to a page that looks like this, with merges shown in blue and splits shown in red.

Example neuroglancer link

If you right click on the "merge" or "split" layer in the neuroglancer window, you can select individual edits. For splits, the segments which were separated from the root will be shown.

Example neuroglancer link after click

Advanced

If you are familiar with NGLUI, you can also extract the edits and pass them to a statebuilder yourself. For more on NGLUI, see the GitHub page.

from editglancer import get_detailed_operations

operations = get_detailed_operations(root_id, client)
operations.head()
root_id op_id user timestamp type location n_points roots disjoint_roots
0 864691136487559186 94559 161 2020-08-03 14:43:34.305000+00:00 merge [178936.0, 259568.0, 23569.5] 2 [864691135494087312] []
1 864691136487559186 226309 56 2021-04-14 01:32:20.568000+00:00 split [159415.0, 261368.0, 22931.75] 4 [864691136011127459] []
2 864691136487559186 226338 56 2021-04-14 01:41:14.665000+00:00 split [150491.5, 259895.0, 22283.0] 4 [864691136296957211] []
3 864691136487559186 226344 56 2021-04-14 01:46:18.347000+00:00 split [156857.5, 261701.0, 22775.5] 4 [864691135571396645, 864691135660624624] [864691135571396645]
4 864691136487559186 279988 56 2021-10-06 22:20:10.203000+00:00 merge [170666.0, 200516.0, 20531.5] 2 [864691136118737944] []
from editglancer import generate_statebuilder

statebuilder = generate_statebuilder(client)
statebuilder
<nglui.statebuilder.statebuilder.StateBuilder at 0x17b723fd0>
statebuilder.render_state(operations, return_as="html")