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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

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

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

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

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

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

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

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

Uploaded CPython 3.5m Windows x86-64

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

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

neuroglancer-2.20-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.20.tar.gz.

File metadata

  • Download URL: neuroglancer-2.20.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20.tar.gz
Algorithm Hash digest
SHA256 c24450f40fc5eca1cc4af1755e20609d7e9a2220edd52b6c83041c3c70343698
MD5 7c8a54d3ec2e53fae861f47ca8c24778
BLAKE2b-256 59e7299ff9de9e749f8a6f74882551ff28d43e24f23fea5ecaf280e41604da96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4dc4776f1c4d52b8cf15f8bff89c843f1d69668576255ab28e462ba892b1ab29
MD5 0c066db4251cf0d9f13d605d29e0e882
BLAKE2b-256 bcbe4ebba405bbaf5fdb3e7a975402bfd18c89d6b6bde642644fb90e4af238e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5d92782de87f4b5dad8966b515a405cb71e8ab04dcc5cada4f22d9ed30dd7033
MD5 fef6c0ba5062438525b87f2757b635f7
BLAKE2b-256 987e28b14061a168ac8d75e15d2db71b53d5b8225430a16a879375d9c9cca1e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 384898bcb1dc93379fa6c27d1eb1b307702ebc060fc90faa9073963adc43e7df
MD5 b021eb8641dfd9266f2d01868634ec71
BLAKE2b-256 03c840a507478bf60e0ddfca504d90cabbcac59f63158b24a1f5092a085e49cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f8347197b5b1d15eb464d5c369b104c34a4a1c007372c6e3279d63123341d1f1
MD5 0fdefcc4330d2176eb379e30ee92938e
BLAKE2b-256 fad8df760b24836acedcad77efe91dce652d2779ff2dabc313b860ef9622b0a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6c50945e5a023ef71a0d7725044eec1b18b7473eb664a5620fe994eba435a801
MD5 f95ee7a37f90a833cfb14e13b0c614ad
BLAKE2b-256 0dda4c85613516fcc1d6cff5dc5b7f72981d09f5cc6d207899de9e7b12ac7cf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e08fd8b0369234cd7ef7d87861c23ee6df17a24f38ecf519023a71bb1554ea8f
MD5 1363b7f709257c392c0edf023a28b07c
BLAKE2b-256 9205d7b13d2b8ae8f8b5f88a91d652f8c928c41045f8a50dabeceb9434254875

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 68a677d0a70b47065e43201dc33d109a327e8495720a440dc92d44bf65bfd26c
MD5 9644ffb8ab11ee08022619e517af8f89
BLAKE2b-256 e336f5ed3db02cfafb418db086e42a884bb5a24f99df5680cb2fe3d6565772cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3011141e40f36af36081e3dd76e93e8db861d8cc1150cc15a5c05abce36938ea
MD5 735bf7ebd94cdfe51b1a22a69376320d
BLAKE2b-256 5002e277d1c7603bb18fbc6ddda94599784dae6a9c18d7cc097fad74e2d70f3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 91bc18baf71f9f0c99c3c11c0648b4de59bcf317c968f63053d63a6b6f0749af
MD5 aa05df8320d3b58a56c335388cc1e150
BLAKE2b-256 5df4f3eac2f8d387734c4a72538e5724be9a871aceb65dcb13d0a55f8fc4a89e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ca864d3244d4a0f3d44b72046aa9f8cd0bc5beb0365121e3cb06651bff405f60
MD5 502b971cdac8d8fc53f273021309a832
BLAKE2b-256 21f893e1a53642bf19a6aace3b75a0b8039c6a3b76c9da558c2ba0ca03741009

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0a368754e3b478854b971348c94ddffb1c005273d60e5c16367d9437447b4b52
MD5 65824370174e3c25c9e558d364ce4f1a
BLAKE2b-256 9c182e7662edd9dfdb8d19907cd9a9ce743eb309ad432170a11c59fb2d0c7701

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a16afc140c32c5d61135f6a13c3a32940cb0eed3fa7679a94ae0e1ab7c321e81
MD5 57815aac781016fbe6815c9893baf1a4
BLAKE2b-256 ff3b2473575938114a8e3cca884c3f27263aa9763e571460e4eee49c0202003b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 84121b70d59197e8075f48bfcee58b0b1d5ad15ae16cafc9e48ef616c471e81a
MD5 c4b71bc8292736c5eca0225871f370a7
BLAKE2b-256 0da563dc66674f7b0dc7f3bfe1ef259b2c3b68b6740e12fb90f5d9b25f2bff12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7e1a281052744148364b784540be842273bb0f3a235fd2669008c705ec1121cb
MD5 667bc840cba81ad76c73f0d2bf85868a
BLAKE2b-256 ec01c6f1be0645aea8aa06c088ca1be28361cd240d17f7743435611c3425b71c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroglancer-2.20-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for neuroglancer-2.20-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 405d84215ae3bba6c31362132ad118ac53f46e0bf6008f2108558c9bb672e938
MD5 b1d8c1dc4fa5216512dbd3d2b66976bc
BLAKE2b-256 6760467c88e79012e75e3846f2b77ffd537ebf247d53077a915a36aeffe0da1a

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