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

Uploaded Source

Built Distributions

neuroglancer-2.28-cp310-cp310-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.28-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.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

neuroglancer-2.28-cp39-cp39-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.28-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.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

neuroglancer-2.28-cp38-cp38-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.28-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.28-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

neuroglancer-2.28-cp37-cp37m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.28-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.28-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

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

neuroglancer-2.28-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.28.tar.gz.

File metadata

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

File hashes

Hashes for neuroglancer-2.28.tar.gz
Algorithm Hash digest
SHA256 839e90c1efca9c8acda34f7ecc3443678815fd758a3e1e9dfa7f641396694c23
MD5 cbde96420792d504d96ec787bcb47575
BLAKE2b-256 df0b27173492ac322b4ca52f9fb4a1117eca5a99b8eac374a251b2c622a3e158

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a1f045932ade0fdefadf53ad5d223101da46a53a8d3592298bd7c71945174f1b
MD5 0de91adfdb41ef3db468799483e5390a
BLAKE2b-256 b7d6a97e41ce56a9925d3dbebd5af9c23f17d98af8425ed6a196ccea31d4dec2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b1a80629c1ddf5209f6799c7062f98779ab2701f8fd1b30b370f164d164bfa1a
MD5 3d8cc1f85685ff8a5e73b6cac6862f5f
BLAKE2b-256 2c438f58c45ed12f737858b5a1d264a0458bc8b53eaeda6d48b2f16fa34894a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d150993c7695e47ce383149d16f0b7132704f0177d683fc6c56882935155a6b8
MD5 97e488e70e1573179c4b34d8e54fd97e
BLAKE2b-256 6870666257ce7dfc196fa9bf50fa3a64b9404c68c69b6ec6dd345f07bac7f1a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 799736e47f885f460ebdc64729d30a7dcb677a0bf255dd553670970b4fa102bf
MD5 c73c42becf2cee003cf9008b1a96e820
BLAKE2b-256 4d8abff7d4077f728f245dc4665ecec4c9b9460d96f333df8b1a62c60166c042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6b2da8f46877092092340b81c75a551648de0d6bf4329314c02de69fa526b96c
MD5 396b6cbc6efcdea7befa1a06b59c2d1a
BLAKE2b-256 818eb7a24fe6d040c9e1a63dfce9f974d897f93ac671f6de6a00d452167f212b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 6feaf838eac16f32d2b78d22991de2211401d9a302636f836a73f5ece066ca55
MD5 3e7c238e538ee515d9978ece485a446b
BLAKE2b-256 a38c3f961c45ebf215696bf4ce0e53b8706556581380e886769868f0dd0b89aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6221c4ca504f261f7d1d48a1ffe9578666be7058d51a4cb3436c3a2756593889
MD5 fe911374ab994ae91acfc37769ea2aec
BLAKE2b-256 deb27e20199461e7e265aeb7532a506221e4bb8c6b128d3a5d4983effbfb85ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e2179d048f3b987632b7c4335d583ab72167169921a58e9090f985bedcbea42
MD5 2b10bed2abce1e133c79d7805d85e9c4
BLAKE2b-256 a3ecde9b97b2751cd13ad5c1ffdb46d2a7f0a1c9e1366eb22cf366ad04081699

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2973d763db20f9e79ce7ba4a75b91760c8de34f0819647f7b7d103daf869ed63
MD5 2c3440e6ccb39112f98d651985448085
BLAKE2b-256 efd837f708ebe269c08663f402b0d843aaf1030845d4559f22dd06d979eb9c73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b93a102a3c25ef285ee9ea150fac9b2df31b4b5fc856f6ffe19fb6ab3a69b386
MD5 26bd0cfbff425bb5a29a370c3543dd42
BLAKE2b-256 0f5e623501e0086cba795f34c29b9f88e10658f6331e53cf9b86513ef34f86fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36cfa89cfc77b3d98053d17ed0d13340f4bf948bfb20e9d78e6839bbf1067d9b
MD5 25290156545bcc7c6f24a90aa043ba1a
BLAKE2b-256 d675e0c5824668a57746286a9bed2250fa68cc68fe873dfad4b80f0a5e9943d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d5bbd2c4b6fc6e61740c05de1d76cede3e450957290d2c449e59780007af43a3
MD5 2896aafa606956349ae26bebf8103fc3
BLAKE2b-256 60c2fe92f3af89c505cae01834c6e6c527d0e0479615636b00deef03850d5b49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c4305a1a77b33d00ecf86169644bfbd5b8f7950b679d5a5c7bd443d0e2dc2b0c
MD5 a435354d751090c9943f6e5630d8fbf6
BLAKE2b-256 cb9c9b874e366c04a8aa102e17c615ffd03aec83370d959240676d7d374c0747

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 7e2a795c8013b4003d66febaa499c5c4026a822cc4a996ebfbee14534e905ce7
MD5 1c877ec6b2eb846e03199401655578db
BLAKE2b-256 7f17718ac6a40a5eb84e603bf7d12666f11d908539cc06e92d676df45ce8aec3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36c0a251018489e8794a2b6dd217b72b8214e7e90b2237f5bc1508f5371f92a1
MD5 ed04716e646846ddb5471ca627d66338
BLAKE2b-256 3faef512d584ce1bef0b1392fb8ae886b116a534d7b2d43402823a1966c81e7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.28-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b11999f19218720e511d2244b899f4d3f90dd228a51c6b6d7816ef25b287170
MD5 a21fb083a9287d49760e3d481181b3fb
BLAKE2b-256 5ceff0d3881bf89264c719878afdf48da6fb380bbf4f6f0783ba2eef7e0a597d

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