Python data backend for neuroglancer, a WebGL-based viewer for volumetric data
Project description
Neuroglancer Python Integration
This package provides a Python interface for controlling Neuroglancer, a web-based 3-d volumetric data viewer.
The following features are supported:
- Viewing in-memory NumPy arrays (or any other array type with a similar interface, including HDF5 arrays loaded through h5py)
- Reading and writing the Neuroglancer viewer state from Python
- Changing Neuroglancer key and mouse bindings
- Defining actions (to be triggered by key or mouse bindings) that cause a Python callback to be invoked.
It starts a local web server for communicating state changes using sockjs, serving a copy of the Neuroglancer client code, and for serving data to the Neuroglancer client if Python data sources are used.
Installation
It is recommended that you activate a suitable Python virtual environment before installing.
Python 3.5 or later is required.
You can install the latest published package from PyPI with:
pip install neuroglancer
In most cases, this will use a prebuilt binary wheel, which requires neither node.js (to build the Neuroglancer client) nor a C++ compiler. If no binary wheel is available for your platform, a source distribution (sdist) will be used instead, which requires a C++ compiler to build but does not require node.js (the source distribution includes a prebuilt copy of the Neuroglancer client).
Direct installation from remote git repository
To install the latest version from the Neuroglancer git repository, you can use:
pip install git+https://github.com/google/neuroglancer
Note that installing from a git repository requires Node.js and a C++ compiler.
To install a specific commit XXXXXXXXX
:
pip install git+https://github.com/google/neuroglancer@XXXXXXXXX
In another Python package, you can declare a dependency on a git version using the syntax:
setup(
name='<package>',
...,
install_requires=[
...,
'neuroglancer @ git+https://github.com/google/neuroglancer@XXXXXXXXX',
],
)
Installation from local checkout of git repository
You can also install from a local checkout of the git repository. Two forms of installation are supported: normal installation, and an editable installation for development purposes.
As with installation from a remote git repository, installation from a local checkout requires Node.js to build the Neuroglancer client and a C++ compiler to build the C++ mesh generation extension module.
Normal installation
For normal installation, run the following from the root of the repository:
python setup.py install
That will automatically build the Neuroglancer client using Node.js if it has not already been built
(i.e. if neuroglancer/static/index.html
does not exist). To rebuild the Neuroglancer client
explicitly, you can use:
python setup.py bundle_client
or
npm run build-python
Note: Installing from a local checkout using pip install .
also works, but it may be slower
because it makes a full copy of the local directory (https://github.com/pypa/pip/pull/7882),
including the possibly-large .git
and node_modules
directories.
Editable installation (for development purposes)
During development, an editable installation allows the package to be imported directly from the local checkout directory:
pip install -e .
Any changes you make to the .py source files take effect the next time the package is imported,
without the need to reinstall. If you make changes to the Neuroglancer client, you still need to
rebuild it with npm run build-python
. You can also keep the Neuroglancer client continuously
up-to-date by running npm run dev-server-python
.
Examples
See the example programs in the examples/ directory. Run them using the Python interpreter in interactive mode, e.g.
python -i example.py
or using the IPython magic command
%run -i python.py
Do not run an example non-interactively as
python example.py
because then the server will exit immediately.
Mesh generation
For in-memory segmentation volumes, mesh representations of the surface of each object can be generated on-demand as they are requested by the client (e.g. due to the user selecting a segment)
Security
By default the server binds only to the 127.0.0.1
address, and for protection
against cross-site scripting attacks only accepts requests that include a valid
randomly-generated 160-bit secret key.
Test suite
The test suite can be run using the tox
command. Some of the tests require a WebGL2-enabled web
browser in order to test interaction with the Neuroglancer client. Both Chrome and Firefox are
supported, but currently due to bugs in Swiftshader, Chrome Headless does not work. Firefox
Headless also currently does not support WebGL at all. On Linux, you can successfully run the tests
headlessly on Firefox using xvfb-run
. On other platforms, tests can't be run headlessly.
# For headless using Firefox on xvfb (Linux only)
sudo apt-get instrall xvfb # On Debian-based systems
tox -e firefox-xvfb # Run tests using non-headless Firefox
# For non-headless using Chrome
tox -e chrome
# For non-headless using Firefox
tox -e firefox
# To run only tests that do not require a browser
tox -e skip-browser-tests
Refer to tox.ini for details of the test procedure.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file neuroglancer-2.18.tar.gz
.
File metadata
- Download URL: neuroglancer-2.18.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05afc8ddc56fc8166f91fab959e407834d4f0e9f3cde0193ef4d3f829f2a888f |
|
MD5 | a4d449814eb2844d73fb49c519c8cac9 |
|
BLAKE2b-256 | 08fb323230e1be30436cfbbebccbe6d479bf49c7c8874e408651fed6263afd60 |
File details
Details for the file neuroglancer-2.18-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06e7c4b75a293f81aa5e7498349ec6765e58b25b337d3fe0129208cf31bcd74a |
|
MD5 | f3d9847dd5f42ec6c51a7eef718500fe |
|
BLAKE2b-256 | a8ef8292d050d91e8bbd761b672c9f2ad9c5044389b35b7439a3bce0f0d559f7 |
File details
Details for the file neuroglancer-2.18-cp39-cp39-manylinux2010_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f2aa7a39b48ebfbc1bb558beb3fa0ee5d1f9f7cb35069ef5936a94db1913bcb |
|
MD5 | 4769323964c93f21cb942b33dda3ed84 |
|
BLAKE2b-256 | f8585c78ae432e9b9e12b023c580085023f661b620649f9c78fd979c04e922bd |
File details
Details for the file neuroglancer-2.18-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a8728ce0ca0018654324eef895ae8c410a014189427b1078ad4876854a23cb9 |
|
MD5 | c500be54eb51d8273a71ce4680ee0afc |
|
BLAKE2b-256 | 99cdaf8ba7ed3d89b26c4216a303d8395cd475098e74235b3dffb15ec35b1698 |
File details
Details for the file neuroglancer-2.18-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cf6b827114515c91aa3addec019aca0d6617b3d0afdc84e37d97f3e58289a55 |
|
MD5 | a3454991e738ae6a236ff8fa4669b060 |
|
BLAKE2b-256 | d1a1127f91478b07e410eae83dede9a95d1be6f7fef8d56e7fb1408f80172c2b |
File details
Details for the file neuroglancer-2.18-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdef143130d3e7405f2941d4c04392378459f7f357063e444341fba35627121e |
|
MD5 | ce1219359b222844a6aa1b66fa2505f7 |
|
BLAKE2b-256 | 86697f9fd8f3300d1d39bb53c55bda2bd573c20cb76fb51c61e3f50b1e706351 |
File details
Details for the file neuroglancer-2.18-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6887229fb40bbe1627f4cf4d425a98cca570b137ad868fa9d5f410eaad69719b |
|
MD5 | 9134c7a58770eafcb63539b2fc1db067 |
|
BLAKE2b-256 | 63ca6b995a90bea62040d3d045e67199a967c6eb315d84cdf4db697d4a20d2e3 |
File details
Details for the file neuroglancer-2.18-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e5d6f2b535752953d76ea4f8009491a2cd9ad1d61532f9dd3a1006f9409342f |
|
MD5 | 210a25779e9275914c708ad667b2fe9f |
|
BLAKE2b-256 | 9d7a60d30169481c1bbc21ee1a15383f80cd2a44dd52b9fe604f2e3f7eb3d9b7 |
File details
Details for the file neuroglancer-2.18-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70b7f91de64b92adb6ea534cc148af804fe7b984423cfb745668b5ff7da99609 |
|
MD5 | 2aaa6d6fe8ea8ec1b9c451c6186137ef |
|
BLAKE2b-256 | d4c5549e3eac9b2b36616b0a3e482b6308cbadbdde04dbdabefdf2d83fd8125c |
File details
Details for the file neuroglancer-2.18-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cc4b6da418eb7baee863770287635ee40e9bdc115542d679d160a75dfdd7e9a |
|
MD5 | 75c34a254709e0cc6100bf785f283756 |
|
BLAKE2b-256 | 08ac527600ddf17639bdccb5b2aac79d3e294cb0f315431aaca32f92d870c731 |
File details
Details for the file neuroglancer-2.18-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ed0295848156c8c29e476d2b2d95b2ad475877b6c06b58ffac498171cfbc8d3 |
|
MD5 | d67c4044b9f61cae01a80b1af690f24f |
|
BLAKE2b-256 | 447fa4587acabec3f139602bdfb6f1bc355539716c9da5b5931eb620ab7cefd6 |
File details
Details for the file neuroglancer-2.18-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e83ccb21bf85fb156015535cc7e87ec0e3354e46e9c80382c80c7ac72ce70280 |
|
MD5 | 550f40ef4c24b441ae983f8770c4e2fa |
|
BLAKE2b-256 | d2dd378c4a6026ed338650fb8019bd52596847a413131f81e05c21717486b845 |
File details
Details for the file neuroglancer-2.18-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede6f08e84e2519f0df6ada1601ff32c3d439fdf7ea70c9f365f6b7223da7cf8 |
|
MD5 | d91f12562a1f718f8dfd3eadcc8c6ffb |
|
BLAKE2b-256 | 44a0f14390bd22eb905517c41841b429fcba8dd8a0fea95c6a889a2ec71c2f13 |
File details
Details for the file neuroglancer-2.18-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69dc2bc5885c23d0b254ef73009a70f7b0be643ab6a2562ecc216f5224acd4b6 |
|
MD5 | c1986b92aac7b3ea15e1d4d0e84758b3 |
|
BLAKE2b-256 | 0c3daee284f65b00c1236fe62c54faddbf8238468b5fcb20720deccaae85df4a |
File details
Details for the file neuroglancer-2.18-cp35-cp35m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp35-cp35m-manylinux2010_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da0bbb632be8b13f3ad5ecd8f94b1871a28e1bd6dff48c1ff4524eea09f547b5 |
|
MD5 | b63e42d5274e45441916c818cb95973b |
|
BLAKE2b-256 | 05fa78854097e335887c71d190e034b6e4167f2e8ce2db624ddf2f53f94e811f |
File details
Details for the file neuroglancer-2.18-cp35-cp35m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: neuroglancer-2.18-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812e2f96e1e213dfdb2422ce88cd7bce50acfb497b175bb8f57195cf583fce8e |
|
MD5 | 56171e05ec236948c4490c02c68982ed |
|
BLAKE2b-256 | 49c1aa417719dbbd663f060ca1075029a9000c515889dcb90559fa8b3094e678 |