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

Uploaded Source

Built Distributions

neuroglancer-2.21-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

neuroglancer-2.21-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

neuroglancer-2.21-cp37-cp37m-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

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

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

neuroglancer-2.21-cp36-cp36m-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

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

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

neuroglancer-2.21-cp35-cp35m-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.5m Windows x86-64

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

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

neuroglancer-2.21-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.21.tar.gz.

File metadata

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

File hashes

Hashes for neuroglancer-2.21.tar.gz
Algorithm Hash digest
SHA256 0761f7b9c35e01a4a5efb21f60c2b0eb6cf619d8d51d218bd3c02a0bf66dc6d8
MD5 1ce4e2c813dade9d2b8c8d69fe2f9c8a
BLAKE2b-256 ea6d0435009bb70ac675ab02c2c074f9332947a593d79889f13cc9814e96c52c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.21-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 556d6b7e512995d07d15f7bec0c6c67e5028d77c136e5dec066d619d263f04de
MD5 82feb70837743ddd846e159d02e73a8b
BLAKE2b-256 ec66ce6f9c37449eb3a284ce4619fe333ef60d5c2ab4f4f8d64fab48d51ea705

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0a2274853b4427fc8e867608fff3970239559c3db6e610dff46e258434ba0299
MD5 6479ff86966e26d2a17282e8fd4ff3fe
BLAKE2b-256 a911adb5b738755ad5b47da6a0ef16f1f368bc0b436a5bab735067a993d70481

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7585176b509ef3f998225c53b56a49a7c7eef5274240fa61422eca19b53ec7bb
MD5 772d662255d83371d4de5dc401832cf4
BLAKE2b-256 2b4becccbf1a981ee1a2a2f27f7f70b773093704f1bcb6002737b76b9c06b1c8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.21-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d752ec996620f252742e80dd0a94aba15b28e75388e908d782a83500746e30fd
MD5 9464d1d3557d51ebb5196bd351f1184c
BLAKE2b-256 1e2963a82cc2806762cb8765fa3322bce7cd29f6b69fe004d5d5606f63b587e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7f9468337cd50bcec5a9e6014a4bee5bf92ac7646593045a28eba59d22ac36b9
MD5 c16aae58b2895d373d05290ea9a6e1d5
BLAKE2b-256 b098af1a12c7bf071b073796472815e7b5f5ebfc709cb9dc4b832dfbcdb2980c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e6610f14ff0cc0e8710bf358b0901844e1445d247071a52991fc39776adcce65
MD5 95da38cc4858799797c509086a0e45d0
BLAKE2b-256 4338fc116222ebf5caac59c1eeb9d6adbce1b843ef356b670de7e1864f282fab

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.21-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6f1a4be3d4f5e7d88c4516ef3cfac9b33b1589af087cc8632d49056321e8dab6
MD5 4ab6151bc91bc1039dd07bd2462889f9
BLAKE2b-256 e64bfab055d42e85a35ee6dc6accbf94513d46dd49f7f311d84bf8ba054bd066

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 201c3c104ff72253a114e6e9f1e0f492ff12ccba4b4ba5ade41d5e6fdd962e70
MD5 bcd08f1bbb4e8ee79b08f757ba2bd6b7
BLAKE2b-256 22dcbf09bc77310d7d5080cf674de440d34c4a9ba4878ca477e21fe7e39b749e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ae97910b9c677da0009f0c55de89de502842b2774c72361ef98cf8f9cd82b2da
MD5 e6c77396345ecc6ebaf0059d3aa30528
BLAKE2b-256 c618680172fc942ca12da6e4dd8c77b0a369ca21a44eadd2ba36bbc68770a644

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.21-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 767f80e947df1ebb9a2ad82b212051db9cf6a1522bf02e49e4e9cb205096a69a
MD5 46a7c9c4cdefa708341011730f50ee38
BLAKE2b-256 ff96edb675d06aad77987bcfa1925fd68e5ddc1c591d20219e920c3b9b4a21f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0af0c13969c4a7354119b782d50298c07e62b635915e8a925b5982761aaf6ca7
MD5 2d6f4a266ce722735d7576db85b97e8d
BLAKE2b-256 523f34c08f6de3fd652cc6b3ade60a82067516bd08c5fe19ee0a7befd067e469

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 851c3e39e9e134da23919deb9f834dd230775e232a7f5c301df3de0d4427d77e
MD5 a55961d57669aee289254f2618b2ba32
BLAKE2b-256 70e480daffa2a3b524261ec06de17c7ea1fe77332f5873db462c866383fcea9c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.21-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 8c8c879e0f36fda353a23d44b84fe2d2be8ad0d89a71ccb640a85955a94e0523
MD5 e11ff056b62d540db5a4961848c37fae
BLAKE2b-256 c03ff6c21d37ad406afdc6d42cf7aad8832ccad18ade6e44c418cc226cfd8aa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 77d3732b24de6b52b24028ad1a122d71516ffc84100f0fc8b02fc07f69b47562
MD5 55f409651f373360f24ac2d893ccdf24
BLAKE2b-256 36a77bb1b1b7d8c8b4fe82fc006cc04435417281895567e81e5434be16c00185

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.21-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.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for neuroglancer-2.21-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 66f1b717272fd3090379997326eec8f2894b09237c5423f7b692678dfd79d3c9
MD5 b2d7596b58661c78de197796093e1d53
BLAKE2b-256 ae3be8d3f496168a6cfcc367c0b070be166b2c0f81e3c2b306cd19cefe68b52c

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