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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.30-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.30-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.30-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.30.tar.gz.

File metadata

  • Download URL: neuroglancer-2.30.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.30.tar.gz
Algorithm Hash digest
SHA256 a87f265edc71f0d124ca167d631c07e9b0e2f0536d2d86ee68ce068e89d12817
MD5 f6235744d00db4df29191492f832e4ff
BLAKE2b-256 049e0edb55a53c3ad77638d830cacf2d97e2c104acc9b53cd407274e51f24806

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 253d5c1b10cb6ebaf3ef210e681215bd0d22044cc9db9fde8215dfbc976dc39a
MD5 81143d1ebbac6159d9f7661e6e4d00a4
BLAKE2b-256 346ea114c7d408a9ffcd77c2207d92262d17bdd9329055ce624cc5d72f506f33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5d8faa5ecea83cee8014262dbc89224e64222f4b203d1e87a31f728227c09f11
MD5 4e8e37371c41fae41b1fb1e6f3f35f20
BLAKE2b-256 c56f66fb89f9528d32443d922f4bc546f28cd020740ba14db381569cdc5f8e18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 611b24c4883dfa9b8c44236dd73a63e3bd7a2ac7f1f61e6556ca0fd0771b6986
MD5 f47c1459b249f46953974fe84205373e
BLAKE2b-256 9924397e8d2988508c13a85837ade7e4fcbb36a43065ccc86d250ef57e949709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3168e4b04024a90b60ee263b68e83c1e3144aee608056588498421e46ce87394
MD5 9a3dbb66690b280d1779a9a607792912
BLAKE2b-256 6c63022fe57040102424ae9e6e943572b1d76ba0fd97a3a65a984671bd647cc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0ccc708b20ffd85d4c1c3c409c0d56cb248069f6190ed7a51c1f95789f3f4fd1
MD5 dcde950de1762fb47448227efabebc43
BLAKE2b-256 8389e6a5b9a23e20b51e16bea8ffe9a9d89c9cac4f51ec0ab88fc9d5ee055968

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 13a6d61bd83f659c551e8c768c86d64bdeae7099a8cd5ca38b837e5468f6db5b
MD5 2b24848da348ca9bee47243220ea792a
BLAKE2b-256 7890ce871fb0bf084f4671129af4579ed01bfd4238e2e34aa0efb20002b63241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 0ed97abd6b9b0770797a79c07ec2afc8d94ae7e3b65211b996559d0865423fe0
MD5 45d9fb5b26925df6b6f23ff1de4476b4
BLAKE2b-256 4e226e0148a049ba1c89bb17f40d4d56d1301583247a984f7a2475c2389b116f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 887c4cfba10ad0465c52a829be67d3afdde61505ea22e068d20d5eaca00a8e5d
MD5 eaae1d84112543b955e85cc79ef3de82
BLAKE2b-256 a8d3f11d0f464c79a26ad0046f36aa439d76a51268c541528c5414f6cdd81346

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f41319c7eed5f052dd81cf17973e7b8b6850daa34a648200a95e0bdff2923eb9
MD5 a870bfe55d6ea917077b5c8a6eb31626
BLAKE2b-256 a26cc80c0e05683d2a2284a1fdc9488954390019babb290219846b08b131fe8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 03b1b30c065fa03b9d26eeb7c8165a7e37859e1aeed3aced7bea2166b1d3dd59
MD5 9e31ab11bbf37bf03899a5c58282544f
BLAKE2b-256 e472515b9236755ea9a4a9b24fc3db3c102b2edf215a31417dfa61e09edbfe60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e2173c1e07e8462814adcf571dcdb2af2119986cb50d3481fe4e5b6619022362
MD5 a06c4f9554a9795bad3aa751f81b0732
BLAKE2b-256 2d2f07955753d53d3625660fbcdcca40a64b13986cd9308f65c122e70fa014ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4eff82293a3ddfbaf48d78f858a566190436bfa8ce72f223e8a91019aeaa539d
MD5 82b7d5e7b89c6bb58726548a4d189bd8
BLAKE2b-256 045bb5202bbd1e5732b2e24a5d030da24bf969fa591c10ada762ba0ea4a41651

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f6705203dabd3fc33c13dcdc2cb2e1d0b7b095c2a0c0b633dda7a948f867779
MD5 15fe1d14d624118df533c03baf9bfbaa
BLAKE2b-256 f61aae0e29b9e0d97ea438b615536554c3f6b215caa37a653cd7c1d59af1e880

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c5913f02975118ed3f6515ef05409dc32773871a251aa8b6a3ba42c66f7331f0
MD5 bf6a74d545cd31237e06cd71cde6523c
BLAKE2b-256 3b74feaf3b823f23371b4caf8e424d583e7351b6228d0dbc1ba18f9a023668ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 73361954bff4f036c2d1f9e994f7f5a963849f36e3fc6710ef0b09f94c9c744d
MD5 5b2fafe2203630216d997acca18476c5
BLAKE2b-256 43cafd043a68a6c6006055d8f406b670efd3df42558ec54322b448214424a92d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a1a9120186476997ce7e5bdd8bfc86e4ffd099c37b032b661fa2c125ca134d04
MD5 1acfb17451096ad9528377f040295cd6
BLAKE2b-256 f9276dcb474e591dd21befbcf2efaddf20c3b2ab683fc2593974352f19cfb87c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 df77b0c61060ff7d4ba2d0153155a337b9675dc6c3ee2a67e9e8e6e80000cb66
MD5 e4d13b53b189713917246db7ef672036
BLAKE2b-256 cddef36890077b5f484c7689794989b3ad3215f40482c0cfa803b9e69de1c6c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35ebaf0c0669d79870b0be3d8394dcc709be242b207787d3ed34de3608c7730c
MD5 b0e8de703f0c2b973492431fb2c03522
BLAKE2b-256 fc25abc171494c06c56d4c3979175dbbecab7a34a03b21d99d7cea7c046b8588

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b43d926ec08b1989edff0709555aedea1f6b67c809681cfca4c54011073b513d
MD5 ea68502079955117dea12ff5a7bffce2
BLAKE2b-256 a3d96e5ec7520b15a2891f68abd1dfd4ee5fe7844d06009eb9cb0969115bcb6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 25a055eaadc209e56e41b913e571eeae397d7ed31ebf550af853ae274cb8c08d
MD5 77370b4115e7c568e7100a816e0aa8f3
BLAKE2b-256 439e7673fde2657772dad109b003a8d92589e2d62905ce0b5ca51d0a490e96c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c95c417d0166c57abede2fce77b22750aa8a739689fa1a17028c2caa7b9e5ec3
MD5 189696134dbb0cccf1785b269e3bc72a
BLAKE2b-256 8503b5397b8fd8b33ff9688f1370bb9f0cee98d988c55c9ca3a309537e5fc33b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 19f5e182c472df08ea75d2b9248a0c374a3c9285ad40420f71d1e7b90dee16c6
MD5 79e2906d8645d59051e101bdda36ca15
BLAKE2b-256 5d8a005a3fc1ad5af3fdde194ba96e7e4fd7459d03bc5a87d627ac763f020743

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99d9f85c60f5639dfa6ff5aeda5097a95d2e59f96c74a470224d024932697e28
MD5 403188f5853485cbb4bd5de19cff3357
BLAKE2b-256 7b48c89225b82d570a7090e566abde8ce8d956d8cd1e9e330fe09deb8d5bc137

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.30-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f1e657587115bb59f6ed888c30beb639ce9aaf9056265dd4cea3fec8594c059
MD5 f44701703a778c02b7e8c256ff57eb24
BLAKE2b-256 d3992dcea11b3378f489d33b34cd3c15ce230ed104752e7cc795036f2c2ff9f5

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