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.19.tar.gz (2.6 MB view details)

Uploaded Source

Built Distributions

neuroglancer-2.19-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.19-cp39-cp39-manylinux2010_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

neuroglancer-2.19-cp39-cp39-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

neuroglancer-2.19-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.19-cp38-cp38-manylinux2010_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

neuroglancer-2.19-cp38-cp38-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

neuroglancer-2.19-cp37-cp37m-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.19-cp37-cp37m-manylinux2010_x86_64.whl (4.0 MB view details)

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

neuroglancer-2.19-cp37-cp37m-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

neuroglancer-2.19-cp36-cp36m-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.6m Windows x86-64

neuroglancer-2.19-cp36-cp36m-manylinux2010_x86_64.whl (4.0 MB view details)

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

neuroglancer-2.19-cp36-cp36m-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

neuroglancer-2.19-cp35-cp35m-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.5m Windows x86-64

neuroglancer-2.19-cp35-cp35m-manylinux2010_x86_64.whl (4.0 MB view details)

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

neuroglancer-2.19-cp35-cp35m-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.5m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: neuroglancer-2.19.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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19.tar.gz
Algorithm Hash digest
SHA256 3625e700c01552d01f4e13bed1a395255628e36434835d5dc2a6a1d331ecced2
MD5 a7e2411a75d3e3474f7a2c656c911966
BLAKE2b-256 e253b6fed3cf186cc6007e2c9a68eb69b5a5b15e500e360863b550360528e16e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 02a227b8493c5c35e4bab652ab3bef27d8c6b94d73111f80418de68ba0666028
MD5 331edf6f594071320f3fc63fc948bc38
BLAKE2b-256 6d2b5250e6a9f8eef8c11a1b6c6577093fb689c85d48dd912ec4199d1dd53d24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 86084f2aff02e384f7817d6f948b6d8860fddbd64e14ebd18c0ac03dac787749
MD5 dfc5384ea336c4bd4c5c99ece06966ce
BLAKE2b-256 5ef1b82ed54f27e712b938079de3692a5d6f89355ca9aae6fd889ca0d6679e93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f8c691f78ba045358191e36356e5b7c5a18f4501559b456b0d2e05e9fff953c6
MD5 a24fa203f9d80ab2fac8964990d74482
BLAKE2b-256 81b4b3d0d7fc263b8fb3e87fba22d8dcdebec5f2465efe7037bfbb3c5fcca520

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 da25ac7a5996f92c444e6dded7bf347a8a7753af3bba85b5bb0938c6344e3d72
MD5 edffd15e1906cbb7b361630fcc85eda2
BLAKE2b-256 ada8a1a9b0b4134c6ce54497f1bf5d751946ccfd0c2e7ded66e6e56c2c01bd8b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3540a9194525d74c48d0d7e08129f1c161701057e6285ac6081ce33d461a75f7
MD5 7c9f49ace5628f6c1b74d3a446892076
BLAKE2b-256 43b8a892767dedec35432bdb95abe411b20380a6a4d186b0c9246e7921dfd91d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 edfe47358c887df816445f3b5d394f64008e9fd19174604913f997b29755d8cf
MD5 9da1b49c1fee5c644470531fa2ca26df
BLAKE2b-256 5d2a63b89f48ec8ce95af6c9c3b5ff45947d8eefe82220f1b5ee5e3c016f9d68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ab89779f40c19f5840abfafa1baba1af4f5e030a230dc23ac46ab02006b53f9c
MD5 ddd3b247f94fcc4697efcf5a12be9196
BLAKE2b-256 44420b425e55c4f0bfc60a28b9abfa8d32361ae61b7edde6c4935694eacca90b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d00d8a0c9b43c807bc28560cb4fbde9004e318283a49b56f8e42fcec90a6f186
MD5 ee558e7dd36433d6e38b8f66b4848a3f
BLAKE2b-256 4c52ad58ba746c3cd281ba55b65a20d460cfb9d2497e724b599e294917e24002

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb9e80f571f2877bd593e5caf851cd28e6fd593b95a5065d4b37c57adfa171a0
MD5 db6d24640b6c62f17cea0a79c949eb1c
BLAKE2b-256 46eae9a0ac3b8b0b5be93e474c3c917224cc4e5db7f4b7b4ebd98a2d03009d3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 246122acfa1e7f4600fb121e8e676e6f2bbe1bb36fa3321a487375f9c725fbdb
MD5 c69d608b5f880c4d47b820e41acd740b
BLAKE2b-256 70bffaf92fc8c894e3b540262f83ee045b3c5dd6c8402fa4f89df52068ba6804

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 351df6c9c1d87313a485d3735e71bffc760b9bf34a099c67c74dbe20adc0ab83
MD5 ac27bcacf4e87b640f367db3af849f93
BLAKE2b-256 3465def40e1b58aca6a2395d91779589a8a096a505b1e2555a8ddd037e7851ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3b8102856b10a9f5198f1ad522304761cfc0af9e944f0d78e99124b7038b4fb0
MD5 66302027db04c937d09d22b151f024e1
BLAKE2b-256 64249133d4aad83ba49fc718649c7ce53efdbb03aa35fdb8fef4d1ba4c5ad145

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 36deaaa9582b8ebf71b878033b91e62df5aacf08693bfbc2e1967da46dc000ff
MD5 333835230d4a440e8a1cc6344e3eaecf
BLAKE2b-256 92a0a6d21a1cbea8c8f479626f24f78b182c0cb41affcdb1aeb0a953dc236794

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 034f58255b94a03b14bd4b5a4b2ab9bdff75270355ac53133883d85f714ccece
MD5 9d034eaa7c076500f5843580bf421317
BLAKE2b-256 8c66359650f08fa6cd793c6d77e93dada1b33f4eb0efdb95465906812ae8bf3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.19-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.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for neuroglancer-2.19-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f76ec1977a1155d702b5202117260dcdc48a1f80b17d6a06a6a52387a4c395e
MD5 e872416b3549678119818acaf98558b1
BLAKE2b-256 35bac7da29568869eb2cb5350f6672d8df787d1553f60bfb890e8c965a228a86

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