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

Uploaded Source

Built Distributions

neuroglancer-2.35-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.35-cp311-cp311-musllinux_1_1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

neuroglancer-2.35-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

neuroglancer-2.35-cp311-cp311-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

neuroglancer-2.35-cp311-cp311-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

neuroglancer-2.35-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.35-cp310-cp310-musllinux_1_1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

neuroglancer-2.35-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

neuroglancer-2.35-cp310-cp310-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

neuroglancer-2.35-cp310-cp310-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.35-cp39-cp39-musllinux_1_1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

neuroglancer-2.35-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

neuroglancer-2.35-cp39-cp39-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.35-cp38-cp38-musllinux_1_1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

neuroglancer-2.35-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

neuroglancer-2.35-cp38-cp38-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.35-cp37-cp37m-musllinux_1_1_x86_64.whl (4.6 MB view details)

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

neuroglancer-2.35-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

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

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.35.tar.gz
Algorithm Hash digest
SHA256 a4bd6f2e06b5022c5578e948a60cc869ef9d111088b7216114bc00428bb06722
MD5 24e65d73ddc0c22f8b26faa12505ce58
BLAKE2b-256 40fdc531afa05968e62f477ef7f66f93d6ba560446d2dad740a1dd4bb79cb755

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 19bbb749948e8f16d28d4ded8c091e617af278792597b277469685af5753dcbe
MD5 1babe433cc2dd9194f20d7d1f0ae6b9f
BLAKE2b-256 3b05139b8d9ebe006613d8489166df1e615cb07455fe27ef2ff260ec2a772351

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 8cd65880c75b46c37f1ab4a20e9366592d4cfb2bbb522ed2ded2ee1cfad9b722
MD5 d0e3a320bc024b76c73d792d01b9cdbb
BLAKE2b-256 5e63162242693588118526471c80ab6819abb250d322e1fa9af5a536fa7786ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28de2d367123aa2ec71b7baf3d964779470af0988999375c8ccb8ee1828e9380
MD5 bbe36dffa8149a271ba0c3c14e543cc5
BLAKE2b-256 38501f682f4517acc46abd626c6153e6bb13bead7bf48269d1b16a548f0f5668

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ea5a957bfc9cf5dde14473e09ea0b1cebe28d0804a1bfbba3a2f17dbc8fc76e
MD5 a706bd7ab0122a2b700d8fd9bf9183e1
BLAKE2b-256 1c54c2868fe3a0ab4ddc4554587c39957841e7bca7b899e91baab6b1785f5ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9474acdd875d74de348a347a6f168a552cdf0b8b2df0e68eafd961b1f64835d7
MD5 ec3a846fe090c42f2ef89ad3a3a94618
BLAKE2b-256 5fae9d32a2e9bd0525bd73f02f0c6744fd06105ab193e72728de93bf188a78c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5f0bdff868839cb5d80a8304755884fe7a3f298914382c29d3411ce00e192836
MD5 bf66ad4d6be1cbd3fe7f1bc2db42137d
BLAKE2b-256 9dde3a8e00a0dbaf8078ca6cc4abc5c93f5fa211e62d277e7b95c6cc7691a275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 de1f260c2056d6e4daf1fa8318decc788b54185a75bacc3f1fa9f2d2e9a0e099
MD5 fe578b23a1fbd95e8f74753939571d21
BLAKE2b-256 01ef0527804e98c56c684af2efb1cdcd07915d7c6786e66732888f477d2969db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f8133c780f6d91ab22bf6f973e91cb7004c3e85bc92fe19cc49a4faf8092582
MD5 23930e9ad07c9665ac0975246a8e4314
BLAKE2b-256 a56dca6f973cc5ca5d68b0492a40741ffc72f6d1c439fc23c46d03c310a3d50d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff23e1ddb6ba751533a458ccf3070ef67e792b55c8ce5eaa05d4a8cbcea89a19
MD5 6e979e77c3d2848b793775909c13a635
BLAKE2b-256 cdd265da87b7b3fcb3a6da92b8f259eb1e5ea9b0d7e251e7b9c8ea5daa7f52e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 59f82258ae5ae1eb38673f7af0d1818de8c2c816241b51e7298ba9f56658d8d6
MD5 c2347032439254847f86b336dc65e3e8
BLAKE2b-256 bcb1b98d1b4a9aa0fb1f51faa0085197597ef952ee5afb88289d7bdb7ac5b9e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 62bad0326c99e9dab0e9c720798952d604518dfa213652b4b523899aa5e365c9
MD5 b38791f7522d210085583477b58a37aa
BLAKE2b-256 bf2b6e51a6212882648a4902a0a38aba62149cd53c704b25da0503c60544fa8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4cf6ce4ef9ab98e6cd1d245b0a1bd7671ed295b2c74b975f59ad3a507499f6aa
MD5 8ee5de2991fded9cda69e145b1b5d51c
BLAKE2b-256 8e237070df39700ec509bcafb8868ac049c04e7b51f2348ef962b2ac2c9277ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c04c7b13b4b9ffa1014975f430c943d2271f4f21a468c2abe4f895ef69ae2a8
MD5 edea8a6184c3f0466878dcdcc14f03dd
BLAKE2b-256 eedd145bf583382f6a22363ad82c6feeca1f4a3aa91d0fb51ceab10332c286f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 33d905ff7d9871b6cb1b29010c78655048e31e356c13efcb1aba9bffc7c045dc
MD5 becdc809707c96ea6a220e8547d18f95
BLAKE2b-256 844916fe9d3e6c2c567c6b49a1fc5627c107ee69450302025200b3486e311861

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 37c09b0f4420cc809b76a4e30b7de7dc6a755414843554152aa0269ecb7d97f8
MD5 7d8811b5e5955afa78d129a522b8a1e6
BLAKE2b-256 06a5190fb61bde053c2309c1dae80f52f297dfde21667af7101c72cf37f69335

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 61cb4eab45b68ea6a7ed25f862afd06143c33fcd96a9be47d6e5c551f2974229
MD5 7da2942ec6dbc873e20fa08a4e131e86
BLAKE2b-256 618cc72ccedd9d7987f4d6e1534e780304e65d271560b1e4c27f2b25d8441dd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3594d2890f3d353701444bdcebb7680ecce53b3fcc432a3b7825b1342f315fd9
MD5 00836601ccb867c5a8fe1e9550fa6a79
BLAKE2b-256 c435037cc7e2fd4319d00697bb3dd7bc5654daf3d31b43837267c672282b097b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d653d74c04057fa8d097210dc2e976a8860e50c9f2cdd6754ec97e2ab6bcaa33
MD5 716ec20147b4030c8f755c2866d8c1e6
BLAKE2b-256 cd12f7c5eb0329b3d96a7f30c87408f623932f330b7f9b5a460cbb439828acf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e57f96edec8b592f294a1e1f4c3967455a73876c30dedee686e7d3f1c7fe21c0
MD5 fbe8a0a661e1a0bfae018e316c08f55d
BLAKE2b-256 a9387c9cf2ed8d9d261fd9cf4d79a3bf95234faf40e1c058f34be5447df8e3e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d97a08740c250d7cd8ffbdf74fefec5de2c8c437e3acb39b1a25c148e361c775
MD5 ad7253f73b4ee719bbfbffdf63e37759
BLAKE2b-256 d813c2049d0a00d3a721d3fc19ee4e733c2242ab269e9821592560c83c9a5a99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 eda1f62f60ba2e9bb073afaff70b60fc1eb5441020f8d973ad0b520a2ab7c275
MD5 4788f4fd62d6bd3ad178269ccabc521d
BLAKE2b-256 12963b3a65f0186de7f5a3d08d673312eb1c2e6301978a1de7540be8f54748c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b8de5705bf9d14769b772797ce5702781b20c3136e2c0c56bc2795a15789e9d3
MD5 791138b0cd610c8345de344976bb2362
BLAKE2b-256 b216d41575721041ce7a6364c0f904f00f344956759f5a0794e6676961a687fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8dc084e133f0befe69c98d5031ed7c4b94f1b5fc086651aa25105d1c7d24c735
MD5 b651fc62417b8067f97d66fc72648754
BLAKE2b-256 ea1044833400f0d371e703add7f6fa43ca4025c2e9c12b957eeb68a9b9cdcb91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.35-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4f38eccb3a72cb78d13a7d644a8b05eee21b74a1fc451bed83188e67165bb719
MD5 4f554b0ea3d9d6144f4cfbf3c677b1fc
BLAKE2b-256 b05b2e69f5facb7cda2b65b7c427614e5b93cec3f8c66cfb992b19207d90023b

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