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.
Metadata
Release files for nglui 4.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nglui-4.9.0.tar.gz | 1.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nglui-4.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / nglui-4.9.0.tar.gz
| Download URL | nglui-4.9.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f73bf0bd5e29257b76f816442b30afdd63dc087551e147bd6afb1cddb87fd59
|
|
BLAKE2b-256 checksum How to use checksums |
3fadf6adbbeaea9bf9fc73aed0be7bef3020931e8f0de87de67adec5d4610d79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nglui-4.9.0-py3-none-any.whl
| Download URL | nglui-4.9.0-py3-none-any.whl |
|---|---|
| Size | 101.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec9e07e888100ad3f8651a1a0e63478530f885ddbba9a482f7ba391de5880d1d
|
|
BLAKE2b-256 checksum How to use checksums |
0fca004829a5f0b74a41fd700c69e415493989ef8c89e746b50bc9a449784794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|