Skip to main content

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


Download files

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

Source Distribution

neuroglancer-2.22.tar.gz (2.5 MB view details)

Uploaded Source

Built Distributions

neuroglancer-2.22-cp39-cp39-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.22-cp39-cp39-manylinux2010_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

neuroglancer-2.22-cp39-cp39-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

neuroglancer-2.22-cp38-cp38-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.22-cp38-cp38-manylinux2010_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

neuroglancer-2.22-cp38-cp38-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

neuroglancer-2.22-cp37-cp37m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.22-cp37-cp37m-manylinux2010_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

neuroglancer-2.22-cp37-cp37m-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

neuroglancer-2.22-cp36-cp36m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.6m Windows x86-64

neuroglancer-2.22-cp36-cp36m-manylinux2010_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

neuroglancer-2.22-cp36-cp36m-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

neuroglancer-2.22-cp35-cp35m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.5m Windows x86-64

neuroglancer-2.22-cp35-cp35m-manylinux2010_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

neuroglancer-2.22-cp35-cp35m-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.5m macOS 10.9+ x86-64

File details

Details for the file neuroglancer-2.22.tar.gz.

File metadata

  • Download URL: neuroglancer-2.22.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22.tar.gz
Algorithm Hash digest
SHA256 e11c5004fa72e667d4d4300c8fb1205b70b306e83fc74e680cb203e38f01bb0b
MD5 0d2b3fb050d68200516b1092dc33830c
BLAKE2b-256 116c066aece63b82c05109a00b38aa8010e2c36c63cb1b5a196cd6ded2fcace1

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fe583e41564b69da3142efe09ee10f173bb77073e0f64e5ca6155ed775fddb79
MD5 d970dc8b946e3a9d76018164ff5c8b5d
BLAKE2b-256 5331416d395c22321f427a0d41f26993b064ef8cd0c5a8e76d0f250ae7a7eaa8

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 83c7357f96c8244a5c84ce718c21f8c9ae153c6ffe689b042ef9caf54fa1a3c5
MD5 6876687baa00ad288a9cdee2f8adabe1
BLAKE2b-256 ef1c79ad989e1e6d19dbe47f6f7e698328a267a3d59f5de17224c0a03951df89

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a738bbb0d82e79f8b5ebc199762cf98ecca6d3ac4f1261d335e93b292a2f3068
MD5 6526206985bc9cbdf4f237fccc998bdd
BLAKE2b-256 7eeac5fc43524b55d7d94e3e31253e5187eab8e25d4573f872e0132f70943df1

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c250e13ab25b3cfbf6361c74322ab1848e34200ceeca7cd40227734979d733f5
MD5 f6d41dc0338a1cf62c173b0d44f10536
BLAKE2b-256 7f75710a18302f1322427d2beebd71dfb4b6bc14b965c09e3ed0f30060d9dc1b

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 98722bef3a4547b582cef566f4aa0550323808425654b62406dd5e882a2bb2d8
MD5 e3c8de84734beb70e91e4e63116c4809
BLAKE2b-256 e02e0287ed1c5c429450e3fadedc618780d520779442e8897dc76ac9bbab9214

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 94a57ade8b97a05e70291cbbfa69085d8a98c12b9fe9b1d10f7bffd52082464f
MD5 189d57c8e157692f6cc1d76cd3ced9de
BLAKE2b-256 78f96423bffa895cf24c52ff7fa1f001e7a712d73107e008c9d66fafba03dad5

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f2ce5c020dad4eae7170b4b7bebacaee513f1bba5886f51933f843d373bdd9d4
MD5 c246750a016b4c26a22b566b5f556c81
BLAKE2b-256 50b8468f82cd595a9bc93eabdb0f6391a90a64d16a76d697706e84614c683a0d

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d660a18f17934b416c30b94b593552727e62f6e143a72c71545071963fbb5126
MD5 b1f448ebef7be8b1fc0393b265814902
BLAKE2b-256 3328ba84eed02fd766aea3bcc69b8ace1dd45fc0e0de699e7b8778d294dbd100

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12bc4853b9b4e89289cc11aa1bdc86ee2eb346ca5c43715c98a5414689bc516b
MD5 71374d7b5fe773ab0fe1fc64c3e5b6b9
BLAKE2b-256 35d108d673d962d2fdd995b1966ae6b530e5cac172f91a2ac460c56c3a39543b

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c72adaa1feb87f60ffcc78dc8df13f3e1f1f3423ae9486a5bc58ec6a4e9d42ff
MD5 d7d408d4f03350b3c23a9cae4abb05f6
BLAKE2b-256 8d8bb26274eed617acff1330496b009731204dfa17c5ea468acf3657af463e05

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0202e1b051c047d9120cb6aac2760b654974f49c75edd815b9576aa8c04322ce
MD5 faf03c47311605a3d8b9e0d9f3abac04
BLAKE2b-256 0ebdae0584c78f3b578595af361331ad2baf5089bad16055a90aad0c0c859945

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 26699f543884005e183ff2ef44634efb83fcf834effa25cddb30da52c6c608e6
MD5 837e1a6982223219cda6cc0d71b65723
BLAKE2b-256 99614a2956bb73867ea675488fc903a1d70b42367e009ae6b56bc1c6fbca0b78

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 5641616b97ec8e5c74c3435965a3ca30ecd7779385dac771dddd8938b69b4642
MD5 ec025822c6e603470f0637e92d4da838
BLAKE2b-256 d91da7ad194a78c68c92ced94fd087c44698496c41fa4580dc094041d4783eb9

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8a4284a809c7f1f97acd91240e102b63b3f850d83181130854c05203ebe74355
MD5 e955d239a68fef1e1fc5c725d0e7e427
BLAKE2b-256 e63eab76178c02c4083b57a1e87366fc03860eb6eac4da961661acd5fa934335

See more details on using hashes here.

File details

Details for the file neuroglancer-2.22-cp35-cp35m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: neuroglancer-2.22-cp35-cp35m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.5m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.22-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d673e63451fa376af2205180cb46515107e204e718a75023a7728d3d73638f0
MD5 af9cc12b6fff82903e0ba82061e09780
BLAKE2b-256 b998aab958d01540256aedb82f27d660eaf0e93758277969eab380d5a118037e

See more details on using hashes here.

Supported by

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