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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.31-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.31-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.31-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.31.tar.gz.

File metadata

  • Download URL: neuroglancer-2.31.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.31.tar.gz
Algorithm Hash digest
SHA256 4806df4967cf7599c31c002982970b91d6b7ef6631e2c0ec1c27afa7ed7eae8f
MD5 166196bf45f5a817d4c2886937719b50
BLAKE2b-256 0d3a82c505fc9d859dbced5f0d57ed229c753cd170ed7fa4649a8d819dc78dba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0f30256d922248e380f8b3ff1ff0906cb246291ff823b9dc9674e1af7ada6e09
MD5 db45e17481ef99ad4b305b58f1a9b42b
BLAKE2b-256 3c57b98b24ffb2b15852d60130f73142563d76dfbd229fb0f68be3c740fe3b38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f6e39524d25792f2cf111e4ea4c59e8dab4da5174383c86af4e017ecba149f73
MD5 99f355685b76aeea708e2e7953a67e4b
BLAKE2b-256 fb66eea0703cb3dc598338ac0a25a4cda133833cf6268b9ca0bb3da6b415fd4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6231acf247cf85875e1b7a561c36a8fb76820a6f376d81fb47f9a4147c4e83f9
MD5 66cca218a1395234f511fe1fd589d31b
BLAKE2b-256 4de024ac7d57d0bdd55947700f0f12406792366d8e419a38811f9a348c6c6151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3960336cc4fc3a8055954b832b240f3a996dcc332776c05989be81496a73fa57
MD5 db5c2cda444dedfea2580610bc3cd0da
BLAKE2b-256 49a53ef23570f5252d0bff115f90a686d2526bc220c7be629c3429d3e10a0429

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6eba13a0e1367678883109f5713fcf3f630715e87507e69f0f5e7e3c41f57927
MD5 bad2d2dabdebc775e7f64722a739cda3
BLAKE2b-256 d9cf33cbdaf080201530e88e4d10acb0ee3494adfd1436d4f578ceea8f3b309f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e144d0f97ff26210c21a99c2dbb89cde5cc7a20de8d98e2a77be5c6f62b669cd
MD5 1f0794e297f21a032fe8618db5bc409a
BLAKE2b-256 5bf4c0bc1a302bf614b8a9eb21d7dc7656cf7229fcf27f3f819c82a83f87c914

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 fbd0a57a6fa4c56e213a582de52029192e96d6cc29c4747d1e79bbd12a6fbd28
MD5 38869ec674fc02ddaa7faca6a4cefef0
BLAKE2b-256 46de1c49cef0131cba62ce21f4d6fc349ac1f67ed87f89278bf178724811f319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e48a0dc0afbbbf7a1287b29e09dab5cf01ec1836b97ee1f1025e51cd08f812f
MD5 1f5174a14f0817704048e7ec22386e84
BLAKE2b-256 210c50aaa83277e2d8db1cf0ffb9afb7717cdc41ac1047350b89f3d307bbb7e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a38797775e52ef71f7d73953735b6032c002706b5e2f0846a9935a3474392d66
MD5 5cbad92611eaf8c8218305212409e999
BLAKE2b-256 292aafb447ba7dd178c50ef52202337a297e917ead791dcc34069b0c5e9e0ab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c992db10fb2cfec62d5b8bf6846eac3947aa13cfd5c8df2deef9e25a6ca70ff5
MD5 b77c773f3f47a19641aaba5300e2f461
BLAKE2b-256 fa53a02cbd85a92a1ef3506bc545330efb25990b1f2a8b2b30dd55f376a0b3a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c2559c7c2a6d176d9e1e6274b1d07ea650eebfb34d9c2601e69e008bdebc0b9b
MD5 b2fef413f96aa254aac49f88e4c55da7
BLAKE2b-256 5b6c786c892164913a91ca9d6d6bc04318baec535252b7a2d6dad279d8c37041

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ce88e4e00cc59886e6297a64171b2f87daccfc13d251c2ca8495a02e7e9106e0
MD5 c92afb61bb407df096a5097828004d42
BLAKE2b-256 3e926d4175d30bc18b8019f9617331abd8c4e62f6604835cf2cfd68f85fb1039

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a8cab394ac3cabea58ede9e3b3fcbdbae7f80dd34198b1c5aae3f28e0d02dd0c
MD5 d6c6022085fa09af331a2ace2f005c6b
BLAKE2b-256 882ea1fb1e2c94db8dc3cf59cc8c18604a600c6b022c6f78f5df22615193a7a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 996a20206de288d5fcbd4ea66c442ab10bbea6bea8da9856d807db7a86f550e0
MD5 96dc96a66d9c6eab035401a9e7e7f864
BLAKE2b-256 992177c415938fc91090be172bd0379d14c1f2935877420569323053d0e35a24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8d83ce57c2f6379edf7f52522b8499217bd6cb8eb1da3b06a362481804945246
MD5 5d9f17b4fb0dec4497e8fbebf4ee0a3c
BLAKE2b-256 d04b38c1bc4a8c89940794e59bb465dc76bfda8252d540f1bb834ac62ffba833

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 6e4ccfb8d829645eaeeacf43e40e06afcfde4e629006a86820e92fba91493e85
MD5 bad16fada4069a9603ee7a0f2d251435
BLAKE2b-256 08bab87a983823650adf5693281e362ab50a52b1c10405503941bbbc834330ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 839d15e060edca01c6f2980416e5e275c6273b44774c820da9d02b94957aeea5
MD5 9f7a659312b3df427bac537d3d9b3a00
BLAKE2b-256 dd5de4d7a2f0b48cc328f9ce38a854d1c9e54fd749659c6baadd62a4c6be771e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb250c3821318b9c92691d6ba98d79b501fb38bbf758fd3d0ebc9cd8ce08fcb4
MD5 6645774a20fee0b1597555cd54fffe25
BLAKE2b-256 e0fd412b38e5249b26c823aed6a2a08fb8818d9248f4a641262746b3092b7459

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6c36467d232759c6144505370ea45e761a04ae674413ca507754b803439b618
MD5 24568ee41896f523e3e2868871085971
BLAKE2b-256 e0123c2101f7c770c89ac6d49c8b6517bebf9b4ef3fb5bf3c9f5c1e1217482b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d79ceefb76a178a24285941a659bdeb9f82a15f5c465fa8dffc211a24d5fdf43
MD5 f959c29c73e2b4b49899f66f45e1b2a2
BLAKE2b-256 7358f10e6c6832b60cb479d8e0fa492a3020fedbb900a5dc598e517ac8e23d80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5b29480b885e7031deb87f8b40973c22026701305b08598cf5cf0ddb70875e57
MD5 fff170128f24c6ff3ea8d847b7b949bb
BLAKE2b-256 c59618bae0fb9c175b1425070a5e020070e817c99c1853e421d9c400547607b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 404d7730eebaabff2df7c5f37bb3fda96cef2839b9e72aec58e41d88747bc2e5
MD5 7baaf6e2174e170ad166a9ae686ac00d
BLAKE2b-256 ffbac6a868988f1390e450cea32f98899a1e5fd382f8523e95dc041378a85275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 463f29e50c392c8ff94c87b49a4f47773f2b93159443c7813469116396d8aeda
MD5 882ed1702db855505ffc24ba1b4827c6
BLAKE2b-256 17fefe5aec088f89b62287e15bb2c5a5e8f6ee4495275581bba7692d0c74196a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.31-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4b04d57239a719170fa018aee8d9ccaf656eedaf23769590fe0ae1901fdeaef
MD5 eadcc9a9cd04004af6c5342a3fffa44f
BLAKE2b-256 e1f1cebb917c7743e73660e2c047a6d2cb0737633117adc260d48e2576259629

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