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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.32-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.32-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.32-cp311-cp311-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.32-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.32-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.32-cp310-cp310-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.32-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.32-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.32-cp39-cp39-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.32-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.32-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.32-cp38-cp38-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.32-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.32-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.32-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.32.tar.gz.

File metadata

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

File hashes

Hashes for neuroglancer-2.32.tar.gz
Algorithm Hash digest
SHA256 634bd856864a6035567dab1683d5eacb0df1e20cb3518630eaab9bf933f238f5
MD5 22a94e95f2dea68987a725e9a85758f5
BLAKE2b-256 9c419e2e8d591c2e827676caaf719cd2d83057d9201ef438c8a05a10fed5c787

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 543554866e4f831cec3b54c198b4e641dfd7b3f737f26b7b1158329654379c1b
MD5 19441b210120f0120e6dc7d84929f7a0
BLAKE2b-256 4fa61460478afb187263fe5e9bcd56a75ea2560f29d0fc384a181afe5cde84eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c25543f90e9684ef2556dd1a57ee8487e47a101efb9e936d1d347c4643fd21b1
MD5 c9cb40f0c114a35716e728391f34d52e
BLAKE2b-256 913c5db7b5102ba5b7568b1ba355048507cb5f074861b30b7cd95af7716afb19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e82673f275cd2d80b70a99785410178d205af3635e32aa8a933cada2b2681a19
MD5 728acb7be9b7fd44949c11a97196bf34
BLAKE2b-256 40d79e828532f8d618fa97a402d238cd5bd18c93acb4b341d0743479b3e7293e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d193e0fdee645017e0dba5185c715b3d9084e8450a00c6636fd8311597388af
MD5 266dd6a3aac08256f89f8b45fc24a7a0
BLAKE2b-256 788170ff7a7d454b72dd1a856d97a8587f34037e75208bb4e93fde7067923535

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d5a4f78c28463ca6964085970e6f79812e39786c3d4986353f4aa280f2b5941f
MD5 d358a35f351381d095160cfd2e9acd55
BLAKE2b-256 4f7b803b512c177483127ce9c38c0db0c70dab983dfbfcf2fe1b746cb6bb8aa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a890be19f99faf0d3ba9e0efb48308eadcc2486f131cd0bd225b764e52114892
MD5 d34332935547865bf99577b16da8e401
BLAKE2b-256 836263666ae535c9b8322d311dbcc23ad2448eb457d420e1b20d871d51d817ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 6c62cb78417c96427a3185e298101acafc4c051f7d057604eb99c645cc92d02f
MD5 c96398753758461b73ba2d0dfd685bd3
BLAKE2b-256 024ecaf0fa2800bd0b3d95167d97ad4bb7c681eb0f92a2c437484aa198690cca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d61e54f93f76db3d66d266389a8d51264fcbd0b09852e10edd22b47318aeda7c
MD5 12e4f0dcef3ad5e9b21dfc60e22cc761
BLAKE2b-256 35d10260ef07776be1832c0409f18e908194e3e8ed507a37b1be188cbe1a7a2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9073bda6ba5e3cd981a38df9b303d6c35dd46b066d761a612e45aca5c32fc3fb
MD5 8f9233531f60cf2cd4f1c46cffd57f75
BLAKE2b-256 201b92b716dfe88e3d1df45918b9eef5ee849f27d3591f3ecd0de38b34f784e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 045e633468cf75812147e042a9e240a905b031c36796f37d5bf50c9fabb9772d
MD5 da0caa55d1fe050c6c394225d29482a9
BLAKE2b-256 63e54c31257d5f768155edd8c26f686a2ed5085341987fddc7454a1a86394600

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d1df14d9dcba512d5977e21b4172355976a4f81e8d9cbbd4d995d418590c81f4
MD5 4a93e45645973c669f6870be4b9c8783
BLAKE2b-256 eba79051804012807394a89ddc1deb506dc40572f8158972fa4b8a38e87cb95a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 368ff1c61322f2edb3fe6694a85e65f9382e6adb5c5bf3e05a45a262f57ed581
MD5 2cf88b1b0e25ef5968c259edb29236f7
BLAKE2b-256 4e1a9680f83f63bc54280a5e31070273d8a921d67db66bcdbebc04008418061b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4bd52a6105dc9fd9b21c90eccd002e52008383ee32f52abbe1fc1baca00deca7
MD5 60026f1d65fdbbe131960f2d8da08bae
BLAKE2b-256 48b66b234ef0d32acc2a0ff322e456997da4f6607f395dfe4d966b88cfa5f2d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f90ba416272156e837a8ea090459fb204f9420d5d708069434fcb41a4aa9f87e
MD5 326342a2ae0b9b1811a22f4f09c5a31a
BLAKE2b-256 0257e8a9c0cd8839a3e155930bca2bebbe5427b07c7413667b4aacba8a8d8f39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ed217411d5a2f7bc31706f6d6159f3d1dc5bd5ab9d86c00b4f34ba83f422657
MD5 89451a4c5811db8ebe547bcdbb8f4aac
BLAKE2b-256 7547226956f21c9073b339f3c49aab5c355851a79fa34d83f70f39afd1841c8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d5212da998f0a3ca1cffa17367ea65ed2ef7431738e4bd8f3d712be648be4139
MD5 1eaadaaf0cf1767cd6dd7066bff0d0ff
BLAKE2b-256 2810c8438e710bf50f655b29408925a094413dc93270bea8b261a774446dc411

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4c12c177a19c4025e7c821dab209f1f748829539220c2d159b1cce9c382fa555
MD5 993bd666ddab1a04f14bb85db1d52393
BLAKE2b-256 50449a63030cc737053ca97e6b7e2c4247c45a4ee5fd2992e82e8fc533e7f7be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9a57c9ac05181fc383f870e9f974c933c9b19f2ddf5fa9ef3b86cba662e89fb
MD5 fb5383dce00aa48fb30d43c40a3bbc1a
BLAKE2b-256 ba01e4fc7dc049798285da57d7f28602e710b53f84add4f538c01ed00106ecab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 813e2ce9507768b85bcd5e16d9f141a79781556a8631fc226461ee41a80aef52
MD5 d3a3d39f97f2b729ccd006facf3d1a37
BLAKE2b-256 d1e516543adde3cf300b389db405ad7f7ee628a009e2342dac934546645d899c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dfd0904e2739a9665309005cae7c494aad9a0f9832986a4426f895cfacfd8418
MD5 181a344d48ba478951a4dac660cad360
BLAKE2b-256 8d431e693a35b03a94cfe201c3443b9a0f83308ccf6ccf2a1778acb1e8ca1ba1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0bb913dda5b8d3d9e1a154b238046db188455f1f2de1e9857ffec4a28b29a5a4
MD5 ae936a4c9f9821f5d0df09a8aaa37f92
BLAKE2b-256 b0262a16a9676f67966a56d0717735207901ace0aba4eb8cde5d6c3fc9407d4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5f633555379728bbbf22713257299b8b81588728a171a789121ec248d0ba5c85
MD5 39b6573f2d5f08f3dbb87e52b326fc8b
BLAKE2b-256 655b18173d59867783f23067ac5f8bd93e0c113c0901ae39080a494ea7918039

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd327be7940f3d09f4cf2ebbaaa701f213f854b748cde97d2c3b148bd460ae8b
MD5 a8e6c1a92902c92342142fb01d184598
BLAKE2b-256 e04b2e390026fd8a79b8d70b449f389c0d71207aac69f7be4402ee46f0834904

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.32-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b642e7e13ec6882ea4568c1e476a2556dedd494b58bd2d35cb10687b6a20bbb2
MD5 bbdbf7956fd8c9959c838ed858d85fdb
BLAKE2b-256 494e1ac0587a4cf2d211f49a7d69e5f7a132e58ca9e4a2eb9fe1a81958d38bcf

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