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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.27-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.27-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.27-cp310-cp310-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.27-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.27-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.27-cp39-cp39-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.27-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.27-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.27-cp38-cp38-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.27-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.27-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.27-cp37-cp37m-macosx_10_9_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for neuroglancer-2.27.tar.gz
Algorithm Hash digest
SHA256 1e8a70abe908bfb83dc5e27e7d6b0e56fddd4d893368a59b143dc2f64e0800ed
MD5 3924f94254d35b77f67df1e7c819b630
BLAKE2b-256 409402f5626f4c0df8a0a075d03f3b786c8c6d1039a611dbc7cae0c68db3439f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d6b6789316e2984d2b0379f40e37dbd3c2cd7975564b818e113a9f2568f17341
MD5 41203714b53bfd0697ef91875721c021
BLAKE2b-256 307fdca4b17eaf4be5c45a40222853b72a2c69f1788c58237354169194dd5153

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d74638b3dd30b0fb6d0217df48ff9e000d8c82d7fdae1b5aebb93fb15ce2171d
MD5 4172dcf0c0b1442777f7dbe7085fe72e
BLAKE2b-256 f146b33b79ffe00a449593c3183fa2b0e1e0f80707e0da8656c1c587677bb5b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f098dfd9ba7f87d5499699299694245023724bc2f949ce06ff4f110ce345544b
MD5 21ed90eba4571cc86983d6289d5d1bff
BLAKE2b-256 a50318ec4a1c2e3ca5475eeb73b5c210598e99e52d837737a643df03c735fcf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36b2507b6fe50f3b797cd1e6ddd7a7639f6af72894c2f0b731a3c6a29d0fd6dd
MD5 0f6518c7a7a1f29c0cbfceacf6e22a2f
BLAKE2b-256 ab2fb2e3cb6f8ab3f6bf985e9bde531915938430fefd249eb55c4686f99abcee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 93f3db94c1cf83ca510dc941642b9a0705bd39a3897c61bd2504c1e8572bbcc6
MD5 7843f53df3910a4fd0327284bdf3e411
BLAKE2b-256 cde6e8243cfd8b30e4c731dc3610649e8c11cce60185323615ed162b39ee92fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3b8a798155112f5dfcd408777e0bb44b7bfcafaada300a41b28568bf577c12e1
MD5 cd1723c657bccbd1c52c12e5cb4326e3
BLAKE2b-256 ceabeef337637e4576b7e86a8482f138636f8b32795d0204b4e02bfd31d1f9de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e7c0274a132756287f8b460a56505f05d7eee23f3eb2ec1ad0d8396ef43eb4e
MD5 acef32ee08d2c784c4d6752eba7400b3
BLAKE2b-256 65e73992b6f6eb7175c8e2eed77cf58b2499aad82f0bc3edb3f71dd2d85b7793

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4d7f85d5afad5b08cb33a817d6f2a9dcd7a4a47b34164cd08d0489412ac9fa1e
MD5 ef458527ae83ba90218b19ee68afcedc
BLAKE2b-256 fd9484a8b3dc69df85ffe418ca84df80d83908094a540b8bedc60b442a81f4cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 90e18fd355f904f7f1c824b731eaf69ccc310ee716bd4552c2995140ec02c416
MD5 8f192335a7f83670c75ed603a8a155cd
BLAKE2b-256 e084faf15a8d1e26196399da3e3454d423a8254731683c0e3d0d8be5d5af0cd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f8151171d20a7d35c0c8d5751015addad9423c37dcae3f19a34ca9bf3ffac487
MD5 80e411af9afa83c98278ce1b8e7169ab
BLAKE2b-256 80631280529919ce458c142e727249f8a9e83ce23186edb9b809187ef9317504

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 148cc51c7375c89385b4bf29066613edab31ac4f5cfa96e3e76c10b212d0d8ad
MD5 642cab13fa07b1382ededaa150a0c29c
BLAKE2b-256 6fc6e1ef07ae2ad5e198dc9e9383ea62dd88e461f585f0cfd561324d747c37a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 077aebfac030014f7fab04d3dd287bacb54dcd05482ff84df4d99135e95de08a
MD5 1c31f60e8744a52930f1744b26ffc799
BLAKE2b-256 aa78d1dfb96d6afc4ca6d1f1ca841f4ecd421042869cbdc6ea71fbc85cb8c136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c9635092c9dad97cdbf72e312704ee3b985f0db6f323faf764d18d423fc9f3ea
MD5 3349e495d858f65d4204d743d8c869ee
BLAKE2b-256 d587fbe6bd2b5135ecd6bb68012ca701b736a1fd07a7f5c9c3eaf29211ff2a41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d9c37aedc13ae0c9eed88bb74e5df7fa0e87795a97c96ec2d7d879ccd2c75665
MD5 88d148bcf72d0dd80d6bfadb783d05ce
BLAKE2b-256 17072b8e2191ec97c81c529951e8b71d962bf11db04b4b5531f1ab38f3ee55a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bf5eecfb3b823297b2fa474eb71121817a8a2fcf4b5cab49546d51e81291985c
MD5 d4399f45a19a910205e5c2650d2ae95c
BLAKE2b-256 2d5db7e435cf45b9450ee373bccc0b65adf050a67d957f20fbbf1242aa3375d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.27-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 779112e65aa8bdc422fea8aefe9f9db7348495d4b41bee38e550ecd6ee65ae2c
MD5 2083e3c1b017e387105020439c8c666d
BLAKE2b-256 4e1edab59fcec4b6a98f570adb3820ef9a5717aacff52081646b80076627ec85

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