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

Uploaded Source

Built Distributions

neuroglancer-2.37-cp312-cp312-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.12 Windows x86-64

neuroglancer-2.37-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

neuroglancer-2.37-cp312-cp312-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

neuroglancer-2.37-cp312-cp312-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

neuroglancer-2.37-cp311-cp311-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.37-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

neuroglancer-2.37-cp311-cp311-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

neuroglancer-2.37-cp311-cp311-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

neuroglancer-2.37-cp310-cp310-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.37-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

neuroglancer-2.37-cp310-cp310-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

neuroglancer-2.37-cp310-cp310-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

neuroglancer-2.37-cp39-cp39-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.37-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

neuroglancer-2.37-cp39-cp39-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

neuroglancer-2.37-cp39-cp39-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.37.tar.gz
Algorithm Hash digest
SHA256 a5f0309dbb38136ded8251902c39f540fe5a6f05b5cb10f35c28725ec34614b7
MD5 253eb24df34553333bec20d6155bdb18
BLAKE2b-256 868b03c6189853cae45634b75495763a727036b407ea2235e9c47a734d9ce1cd

See more details on using hashes here.

File details

Details for the file neuroglancer-2.37-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.37-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a4dae9f75317e281e91daba9be6b466d2ff8901ba1ac115313544b4c4cdb7d7e
MD5 c949fde35c3886768b9246f740e81a71
BLAKE2b-256 a85e541472adab6997e474aecb8d3b343117d4a6c4d0e933838230a30d846271

See more details on using hashes here.

File details

Details for the file neuroglancer-2.37-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.37-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd802fd64c382a7dbe562604b947a280e8c814d1a171533a1a8da310df854da7
MD5 e86e8595bdcac6ada435b99540a262f0
BLAKE2b-256 4fca2b6ce85db06c1cd8002146e69fbbbe042b834ab57e7f4f95eec72d67bb2d

See more details on using hashes here.

File details

Details for the file neuroglancer-2.37-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.37-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32f3357571e21611016e35012467d11844c46359c8f45c928c27dbed185d1e15
MD5 3ea2c103488a517e8fa5d02c81825679
BLAKE2b-256 7e8194927a81c82f0f356ed47f5ba2ac49890bfc46a050a1f0a2ec55c2e14989

See more details on using hashes here.

File details

Details for the file neuroglancer-2.37-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for neuroglancer-2.37-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8dd896bf3f767e1b915f17f7ad21dc6bad92fd919845023f837b5aa9ee3ccd57
MD5 6ce02031e3ed370af83e82bf3c11cb48
BLAKE2b-256 0798c4d040d56b73ef1048ddf8accf37527631584a69041b435a55bfaf7f200b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7d6f22b753940fe752ef0cd035d1f451a048171b3e6185d6e96a5bffdea91965
MD5 2d705bf23285f7bd323b6c275155f55e
BLAKE2b-256 9192a2c1c34c09f492a8fa1660f86d940bc6a1a6a500b3b2af47acfb967fa0b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83fa76997ec47d4c6e8797a71bea99ce9ae1ebe37f1efce03d36f6f7bcf71a17
MD5 da5b12ce17957491dbd2cf770e730ebc
BLAKE2b-256 4e002d86fca7fb3b59822fe3c86cc1118c42a9bae078dff7394a9fb7da7297dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf9d4cc6d5f9618066e9294289784b1dfdb0fca47003a7f4f79e0bf6aa4c69e1
MD5 a99930294a775d0d27624edc93557398
BLAKE2b-256 22b1f19fba55df6dc3ac2d482f9ad08f956b3bdd6ee521d4054507464ca65ed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9175bd84cbf3c8e55491011eb896630d3ba4c9f5357eaf2311f0fdbea50f88a0
MD5 75d887cad57bd21737c4d712cda85aae
BLAKE2b-256 0f8e7059f9817727129657daa0c10525a9567932b8c625d97f9113fd3918b0f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a4d1bd3a7a7300c857037d217f1924892de09d7a420abdffbc9b8e87041a9171
MD5 5a433b246faf17403aece2de6b3a7262
BLAKE2b-256 d6bedacc8a86faa92be8dfeda5e428a53f67d4e67295c93b990911741ca7e51e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c58d204544de28084ffb3ecf2ad65746a7fffde018f26041e0575e9ea1e23047
MD5 242f80deba9f723707e98ef566033133
BLAKE2b-256 430dfaf32186844405b31d49b64c8fda4827eacd533a32505c5d01f261dc26dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 800d07b007bb7131f698ed956b6cd40381e989346266880df1b06efb1d579442
MD5 d1e40dbc425e85624a33efcd6312f663
BLAKE2b-256 b4e497bc4b59cfc96ab12ce8c4aee323108fe41224606e57d9898c91ddedc50b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 23822af9d1ab1e7110a897a773b53cfe5faa0b7803e83b966610ef4001a826ab
MD5 3093b31968230145286ab987ac60b8da
BLAKE2b-256 af59456c0d06d9ad45bb7f8bd712ad6c9481f54c263c45aea1f610a0c090ccfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 02065e86fdd09ebc8989d9554add5b98aa47e6d86a74b1af28ac87d605a2d3ff
MD5 5af595efb644180d137e2a80edece04b
BLAKE2b-256 e4ab3ae675aafe1c189e56edb1b20a017b56f13fa4cc85167efe1df7907d91aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1446b5e693efaaefe936abecd6de8fd7da98ddcfa22564b30f5845f25de904c
MD5 f85c61181af3c17f90e9c91f46cc3d53
BLAKE2b-256 225669f160b3cdeb032e89a004af6c0897140fb10d3e758fc0b00718b9508c13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c45ecfdb0675ee518c9464c4e4561e8ed06efef34ec9ccc5b5a362a7dccd3e3
MD5 454c60904ca39306d08cb6644caf0343
BLAKE2b-256 796b5a85caea271ac922d03d7d5849794d5246158f8a5e46cc6b0cadaec0efc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.37-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5a015a5f24004ac7298866cf842ba3c4db315b5c766943108f88b89ba88c89dc
MD5 620e6bb6efa864315c4b873dec8e1155
BLAKE2b-256 7ce150f0ad3cb5ef1a9a6b9987ff4fbb7cd105bee0d3f9eba47a108062bc4f58

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