Skip to main content

Framework for data-driven generation of neuroglancer states.

Project description

NGLui

Documentation

Please find documentation here.

Installation

To get the most out of NGLui (interacting with source info, uploading skeletons, and more), we suggest installing the full version of NGLui, which includes the cloud-volume dependency:

pip install nglui[full]

You can also install a more minimal version of NGLui without the cloud-volume dependency:

pip install nglui

However, note that cloud-volume is required for some features such as uploading skeletons and getting information about sources during state generation.

Quick Usage

Building a Neuroglancer state directly

Here, let's use the Hemibrain dataset information to build a Neuroglancer state.

from nglui import statebuilder

viewer_state = (
    statebuilder.ViewerState(dimensions=[8,8,8])
    .add_image_layer(
        source='precomputed://gs://neuroglancer-janelia-flyem-hemibrain/emdata/clahe_yz/jpeg',
        name='emdata'
    )
    .add_segmentation_layer(
        source='precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.2/segmentation',
        name='seg',
        segments=[5813034571],
    )
    .add_annotation_layer(
        source='precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.2/synapses',
        linked_segmentation={'pre_synaptic_cell': 'seg'},
        filter_by_segmentation=True,
        color='tomato',
    )
)
viewer_state.to_link(target_url='https://hemibrain-dot-neuroglancer-demo.appspot.com')

This will return the link: Neuroglancer link.

Additional features

NGLui also has additional features such as:

  • CAVE: Broad integrations with existing CAVE tooling.
  • Parser: Parse neuroglancer states to extract information about layers and annotations.
  • SegmentProperties: Easily build segment property lists from data to make segmentation views more discoverable.
  • SkeletonManager: Upload skeletons to cloud buckets and push quickly into neuroglancer (requires cloud-volume, see Installation).
  • Shaders: Support for better default shaders for neuroglancer layers.

Development

If you want to clone the repository and develop on NGLui, note that it uses uv for development and packaging, material for mkdocs for documentation, and pre-commit with ruff for code quality checks. Poe-the-poet is used to simplify repetitive tasks, and you can run poe help to see the available tasks.

Migration from older versions

If you are migrating from nglui v3.x to v4.0.0+, you will need to dramatically update your code.

First and foremost, nglui now only works with contemporary versions of neuroglancer, not the older Seung-lab version. If you still need to support the older deployment, do not upgrade.

Please read the new usage documentation! The main change is that it is now recommended to create states directly where possible, and there are now many more convenience functions. Instead of making a bunch of layer configs, now you make a ViewerState object and directly add layers and their information with functions like add_image_layer, add_segmentation_layer, and add_annotation_layer. Instead of always mapping annotation rules and data separately, you can now directly add annotation data through functions like add_points and then export with functions like to_url. You can still use the old pattern of rendering a state and mapping data with DataMap objects. A new "pipeline" pattern makes it more efficient to build complex states in a smaller number of lines of code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nglui-4.4.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

nglui-4.4.0-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file nglui-4.4.0.tar.gz.

File metadata

  • Download URL: nglui-4.4.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for nglui-4.4.0.tar.gz
Algorithm Hash digest
SHA256 81f3c3b7c2e46feb6ff7da49c843ef4473ac05375654aed521c1a7edfc0f9de7
MD5 9944e3d49a1877995374e41763f3e5bf
BLAKE2b-256 d3c7d775984dcc5b9468fcf8bce2fd29b4ff86c89741a6dc09fdbe0d5b68cfed

See more details on using hashes here.

File details

Details for the file nglui-4.4.0-py3-none-any.whl.

File metadata

  • Download URL: nglui-4.4.0-py3-none-any.whl
  • Upload date:
  • Size: 52.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for nglui-4.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65b00cce4025d488956f433a09030994e13dfb774d373539b14f3537eb7860ee
MD5 a04f932502afd75c63d3f2042a9e47c6
BLAKE2b-256 61f14413ee22ba97a8f9e2af614a5ac67a28a9629f23b6f639abb4ca5d0ba4f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page