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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.34-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.34-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.34-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.34.tar.gz.

File metadata

  • Download URL: neuroglancer-2.34.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.34.tar.gz
Algorithm Hash digest
SHA256 a8b90fc3c8e47551ce556d7b314d6b4d4959a798779ef04c7b3758d7bf88e2c3
MD5 d4d6590c06d5a17e50abe7ff0f879a00
BLAKE2b-256 7bcb9e71ddc52d5c05630d2198dfc1f2371b268a4351313bb722823050af7cb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 03cb425a4dc6a3f34e3bfb4d66f1d4ee6cdf68249ae2ced3cc1deba43c12136d
MD5 5bc37172d45a1c287105418d0a717bb9
BLAKE2b-256 7e55b62e84619c6311d6d4d7bf9c022734dad591d2d34e3602ca12a01147aa57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 cff0e3dc245a143ccb0c6aa6056fd2de28d5d5e3509792c50b60deaad93a2997
MD5 37f0793e939781bb928774cb6c2cd013
BLAKE2b-256 2ba85173224bea4826a7e43337d2b695f9424dc6921375bb841c7af2671de85a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 632514fc2d8be99998e13d4df056537bcae178bf2f35d3133fb8aa97495148b5
MD5 c64bb572e6553013749e5b62538160db
BLAKE2b-256 fab3707355da7fa253ea3fae62b321dfc52be08caa118ddfdd7d9f693d859f74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa13d047a47990f4d4e9f86b0c074d64beb67676110871a87163f3135ed5a5f1
MD5 68b81df086568dad5505059d5f24850b
BLAKE2b-256 0af1e580bc60da70925cca4712f714eb2880df5ca10e6e5b0ef3546420e7022b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b88c7a0499639d83bbaa6e0e16feda64793ebd92287d4a68422b3dba8fe57d44
MD5 0fcb66bd1eef69d82f7d9401f2fb0c2d
BLAKE2b-256 530ea00a708553fbca5d3425266cf32c060c461d0bc2524e3aeae70dab35d62a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b5e763677bb819978daba394918ee5548ef1e48ebb570614024f3f1554f9324d
MD5 c999eedf26bde49e7693488414fb0a94
BLAKE2b-256 ec51ddf806d92ed5e6dab2829e0df21b63d3bdd5f84d9d26384be97e5978d6e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d7a07071f429b67d0c4e989c984fcce031186fce9267230107f68831395a2595
MD5 19f5e6c220b298cdf1561925c6999ca2
BLAKE2b-256 b6b926e5934d2c649c7d1bf058407fb226ce5ecf6d14163048c0bcb08dff2bee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74e46dc5329cd13c766702730b43bd185835d8aec5c11238278ca099e73f866e
MD5 29203c357bc7fa327c50a973b4651537
BLAKE2b-256 aeabc12ce927203d808a2f28c615c99df96d2280b05f5cf4e8ed2590af635313

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e833f200defd5be32fe6af4a5abc30e996966d422dfe82a12990004de826d791
MD5 86774ab3bb862ab6503bdd724b1fc96e
BLAKE2b-256 7d7123aa3feefc19431d4ba73e453672a797a66f8a161ab154e1893939474576

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c75a77f2cb31712682a962461e29addde43343bc70b9822508c387e2ce3250a1
MD5 923f7c750b68da8d2ad2080358f2d0df
BLAKE2b-256 f42703a6f22791ae068e011dc14e3469712855ba9d853de7191f65168ea8aee3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 42dc27cedf6a634dfaded1e4d42010b26ef64aec85d600b6def3299a1f3873ff
MD5 ac16835de860f19b50afff266ec6c894
BLAKE2b-256 fbb600308800a8e7d1ed7c5b0f1f6bcc10ca01c1968d4af172825a277a4a69f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 1b47e63e2909bc6cd32f840d3eba51bdbcd4eefa036fb05d2a1e5c67a70848d9
MD5 65656cf291fc61a625340569f14d508f
BLAKE2b-256 2918dcd4e871e1d526c40ac7dfb7fcdaccec7771647731d768bc0e6d2e314727

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e505e53f2b62feb9343c4eb7bce645989f60703344205e31d5ca49c86731fe8a
MD5 80985ce99fe89aa2373cc45c9d161e07
BLAKE2b-256 6b5dd71122b645b2740f5d8e10855ce47a73646280c1447a230d6484bbc68c13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f88a708c671a9e7caa6bb096edc9426440ebb916dc489392ae95b1cb3c525ef
MD5 d46c09c2e75af856511e90564f9d0f9d
BLAKE2b-256 de252adf2ed60367cfbcc304a691c4a244ccba52f3a7d8e4abe6df06b534c573

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 224d129dc3723b501bd4b2cd17a235c697db9015e2843ab16d324ba83c72c74c
MD5 99c6ada1ebc86cb498893e23d1e46278
BLAKE2b-256 e9ec24ea7f774d0f8ca5c235ca7a8554ca97e88cf2f7214d4291aea00939b5a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9880534ed9e0ffc380ae6dd33ad07aa625b986e46cc99a8a386f33453dfe8f47
MD5 9baa866aa237684b830b4b3cb5b69b18
BLAKE2b-256 578f81ecd9bdddf40d2abdf4bd42242f31446428f2c24c5a3050c6d352530534

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ba0d4b6e564179240512e3088ccc819f2f68842935f625d761bf8f5362a866d4
MD5 e98bf0f2e7068064a2b44d712ce01861
BLAKE2b-256 1251914dfab5d1fa85e4f1b87c68b392cab07b5dbaf78a3507af360b0c6078fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6221b873c4c150ec6a75aada8429133af48a9ba9c5edaad3c22f7cbe5a03b7d
MD5 c80deec7a7d5710d98d130336553c0b1
BLAKE2b-256 d77725ade301f48895ad1b9f8484d0b777bf2f8983ee44285d7aa887ef27db40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40fc1ec9120ee63fd3d695471b0560dfa9b3cd918ee74cac4ad31f858e71bc37
MD5 4b46b9214002e23d991b16465cc34750
BLAKE2b-256 fa721f599a8d6bbc2ea81967ba2b0f38899e7587dd976684dff07e9ff93f9807

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 85244b3548aab7dc902460975b7476cbe48e372d0bd06c3a6a9ee91d65cd4349
MD5 d3b3d50cb154f4af077b56b2870c4808
BLAKE2b-256 b14b4b9ba29e041522c5ac8466996e7de4f9fc145762beb41f93d808702f7830

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5c90f82c154d95d81aaa8af6a0be59a3fe0b82168ebe0de757c83ed7dca24a47
MD5 b9f3853f80c68bee5edd3778ceee6090
BLAKE2b-256 f4a98330da4210750faf318588ee3164761c36a7b9dd843152ab7e0647c25ee2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b3f2dac5ab7aa038a4dacfade2a45085964a9ef862eb49192051c610f236db4b
MD5 307efb871df08d8d55ce58c8288144a0
BLAKE2b-256 77aaba4fce74e8a887734d5e3ad46dad90b1cce2a768cc20963ec9bde4543a76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c946d8d9e0e8494941f8dab37db904b5d48d527822d5b28cc76ccc1bccf67215
MD5 b4a9b7082a9538dd504bc8107b2e2157
BLAKE2b-256 c7ad3e6375914d7f789d067bcf5ae37b0ac5552460fe2ae376e1cfa66d48f5df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.34-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6e573d105843cd2f6565f836530b1c0fdf29dd7fec86563724cd438f28cb13b
MD5 01bc0cd5dfe5378994fbbcb6e0a4eb68
BLAKE2b-256 b1bf80d117980331a1ee66665a9ebec898873b5312fc4c20772d6ce154a41e34

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