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

Uploaded Source

Built Distributions

neuroglancer-2.36-cp311-cp311-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.36-cp311-cp311-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

neuroglancer-2.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

neuroglancer-2.36-cp311-cp311-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

neuroglancer-2.36-cp311-cp311-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

neuroglancer-2.36-cp310-cp310-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.36-cp310-cp310-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

neuroglancer-2.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

neuroglancer-2.36-cp310-cp310-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

neuroglancer-2.36-cp310-cp310-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

neuroglancer-2.36-cp39-cp39-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.36-cp39-cp39-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

neuroglancer-2.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

neuroglancer-2.36-cp39-cp39-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

neuroglancer-2.36-cp39-cp39-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

neuroglancer-2.36-cp38-cp38-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.36-cp38-cp38-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

neuroglancer-2.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

neuroglancer-2.36-cp38-cp38-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

neuroglancer-2.36-cp38-cp38-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

neuroglancer-2.36-cp37-cp37m-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.36-cp37-cp37m-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

neuroglancer-2.36-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

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

neuroglancer-2.36-cp37-cp37m-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: neuroglancer-2.36.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for neuroglancer-2.36.tar.gz
Algorithm Hash digest
SHA256 15548cc1419790cf07eb62d90d0f6d311ab01c006956cb7ba1a30f0a970190ce
MD5 d59f7f34b1eb0e85657c4ed378b94b7b
BLAKE2b-256 c94c0b433830d596f94151700a426d3d40862147046f251331dd12a82538d324

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e42e7ea1e341d79eebabf0fcf10eecbf1f2067f4a714a44990ae9c9f77cf21fc
MD5 1a8fc4ad3ed092ea365334cbdcc833b4
BLAKE2b-256 3f60b3c8602adccf54cf8370fbcd694dee1dd5f0d6be3a11fb99c15c21e90f9e

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 be2d27907cfd0d42d6b4758c33669301c76a024493be6655ad0eeca05780f43f
MD5 8a8f42c32cc7ff926091a170791aeb25
BLAKE2b-256 4d914bd12ae2e52df89e4099a65198efac3c8de0ab516835ebbeed0afb89087e

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8895dd2691ce5bdde98aca241d7947b5f951f4a4c6b0cd0bb10d46e96eaaa537
MD5 7f84fde6557564a4a2a40237dcf74b36
BLAKE2b-256 6befd1374b43a0ebcebb80284ab032fd0e713f9c25150ab4d7a6025165ce5c6c

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cdcdd887c26399462501c3176e7bec4fd688911825ba8e2e56205a2a00c97f4
MD5 653ac455ff854d204d565a8a6494b818
BLAKE2b-256 8e4b9365f796dab1428fe9e624e8fed71889ecf42d628856eeb21d1983f804d6

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 83188963901da8e2d2330fb8a1c7b69a5138666f6d28502a245450d4b37ef01f
MD5 7541abc82064296b951909d9553824e4
BLAKE2b-256 c5bf429ce11d80ef99f9aeca8f86d1a9486ae5cd5db83e1f88909f13be098b6b

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 28cef0ed105fb0edf14bd8b176e1d5b7d4450e01f77b88ccb1227ed51dab570d
MD5 9e5633f7448ecab94ac557661440782c
BLAKE2b-256 20da6f44eb258f02dc0d382c4b284e10b0e9d6535a06cd50444f1899b1f5ce4a

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 8171746c86effe87864ee047f11a992b9d769766788f23f6d0f727bc49ecbe1b
MD5 d062ca55648634cc07cc11fc2f68cb74
BLAKE2b-256 e6bc0886465b6fa37663e2c602e6f55f9161adf94beee9ecf438689d3e7ac3ec

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb8e451cb0286b0e3470dbaab0ef962b6ab07067c252b50b8119a5bcbe047e6c
MD5 06f8f56653a8d1b09adea80c8a4a4c1b
BLAKE2b-256 7cc019e7432207e23e6abb768a832a808620f4f38cf40c791f21952b65a82e67

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b11e4bad0c420ea4a1b5cba4cbc7e27d42669bdea53b5786918915d72c0f2fc7
MD5 814e1bcda9c18881b5e88c68c24ed53b
BLAKE2b-256 4dbf4c817a640d484fe65f4d89375ab4bd087331b821160534e48b94e91a7061

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 edd89ce7912264c0e1509bca2a85aaee3703ec97d223af065c6a94e2fc3a4412
MD5 314045f7dd28370b9d1080fda0d82ca5
BLAKE2b-256 9bbbb5a54ca6ee0d1e5e2b5665472e23f496f17fcdca105309e689248c6596bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2913ada62314a224faedc9b49c0e28614804e83c488d702be963e1ee50507a76
MD5 f1c6822338e6630be02f09db7f7550ad
BLAKE2b-256 3aa84726a01ac72d43fe72607610e27dd473097dc58b6bcced009d27a26c6308

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 59caaf2254629d2c4771e0473bf5f50966e2de639a91cb098bc6d55703829041
MD5 4bca217a44d5667a5316f51472a1aa87
BLAKE2b-256 bf7d9ec60aa8505ac1398d098a2f91653c3ee259d60bedb1311a5cd542bbe7c7

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3641bf019e88bd5a32d080f6472492962372cdeb9675c6d2e80a0239201143bc
MD5 c4fefc2e5cca7f751004ce603c8d2d48
BLAKE2b-256 bb088f5701a734ed1460a57bf76d89a0e07bb808dd42ed5f0f0923958c471ed8

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6b465359a4062480926ff6d0f397b6ac7e23bd63171da6403b9e83694af37cc
MD5 f375f0dabe0ce1d92f10cb37612a6156
BLAKE2b-256 ec7de408d18696e564678d0d2aca3882254f0d3135abba65b0187f9a69c4e454

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 85967d629165934427d51bc409974b0c602dea2c6cda0e8c1405380fd7ab139f
MD5 c4616c56d131f2714766159e00c856e2
BLAKE2b-256 c710b54512f02a5975caae16af2c6a9049d2a62c81f3b60e389be3e9de821ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 543918f60e4c483d4290d3ef6d0d73bd5aa8ac722e34709262b6d00f500daa50
MD5 5fbdacc8308cabe6f374710a0f7dea1d
BLAKE2b-256 de8c2540640d77dcd13cc129ddf1bf1435097f14da77f50efb010657db7b3a55

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 8952a8845ccf3b2e083a616dd38c212915709a35cb32c2436b385e7d642dfb1b
MD5 38a239e3de0ba5d2cbe4b343c8a11507
BLAKE2b-256 bcebb883b46f4fdea57303bacbdc75ff31e3bb5a505a4c819d9d468673162bc7

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 016cddcf96a41178beaf1289af26b22581bb9319a7923618c9bc5b029d781be6
MD5 a3709ba3db177eb40ce3054d4161e1e1
BLAKE2b-256 bd04e7ae12472e74803f49072169e35379f57ae2340256f2730509dbee522fa5

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5347c54fe8bbc56d064f16113e877de35a85d87d3daa2e69a657198d0429b521
MD5 526067786647118e4d3f2d2725e83bca
BLAKE2b-256 ce0abf0e047c2a3d86126c1a72b4ff02c2ad560bcb26401410448953d79af21f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cbeacf13fc76b5791b8ed0676752c0caa7d85618c80b18ac7d04058b71cfce3b
MD5 4104a7c74cc3d9e0d2b595e90e2602d4
BLAKE2b-256 5c58345e8f9cc9e8e75ab5cf25ef133e3d246346f160b7bd46139cfed307a810

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 efe7e9af4342b69d74994dacc3dc447dab6ddf6c0b2a699dbfcf62e1047e511b
MD5 80afe7c592675156648ab693d83fad0d
BLAKE2b-256 69e4663811d01f4acf6156a33668066def63c4d19aa8ac0aaca322e4e9736bdf

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp37-cp37m-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 313aa7c0d853ce505c839e6a51faea7bdf1af3f6d75f63ea30e57187d1444120
MD5 79ab4a7aa3756260ab84df4f71c611d1
BLAKE2b-256 4eb45da2738063ab90689c4c9191533ca6841d8dbe6d3c8be34a08c6c049c058

See more details on using hashes here.

File details

Details for the file neuroglancer-2.36-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.36-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24c173754a8465c3aa8ef95d1b08813828c41e0e81dab7cfd7c1500b0273823e
MD5 68deb00b32d1905273df10c49cd8a8af
BLAKE2b-256 83ac46c76c61d6b4400768c3da058463a85dc5562f71da253b41788d3b572349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.36-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 90ae16a6803e77554b788e8808ed2d3918db397f07f217d1ccc03e9c9c7447b4
MD5 83749a9f1956b71b32885368f9805d13
BLAKE2b-256 89611fe82499a7576fc00b78505a6eccc9fd075f9318794e8e33e8a2a35179ec

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