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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

neuroglancer-2.38-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.38-cp312-cp312-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.38-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.38-cp311-cp311-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.38-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.38-cp310-cp310-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.38-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.38-cp39-cp39-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

neuroglancer-2.38-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.38.tar.gz.

File metadata

  • Download URL: neuroglancer-2.38.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.38.tar.gz
Algorithm Hash digest
SHA256 3378029def4f144a4dac538d92f3a910c47fe2e12422148f3e65b851e9c68d66
MD5 1d3e8d2835c671b42949ee1d6a68a9ec
BLAKE2b-256 24a78fe6e4ca33275d1d91fbb77d2005149fe2f55a8a9ca96e65cacfab4d161b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a93a07599eb546ad0550e3c8a64cba94986434f5a9f683d2fbb5ad58b989c57f
MD5 063bccf08d95e49d8832e1dccd688cb8
BLAKE2b-256 24fab7ba36baa6ab1e254c36607cf260dc0c8600b2a4a626faf2b3b2d2d3f3f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 201bcd7700c72a3720ab0c793a4a566e00e5eb19154c74cf4927210802a2dee1
MD5 2616e68d53e5572a74beabd05ec12794
BLAKE2b-256 85e54c3ad33491369aaf4a0f06bcfb98c073cce10c11440f3b88e9ebf8945832

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b98875bf91837d21303b45141014e45c0423c69f19a92a944410ac3267372212
MD5 e1e4eca8cf90e8dad54819217acbc759
BLAKE2b-256 2ce449bfd61a3410e5941960482d8cd48500e3dab1ceece0fac3d1f1a7721088

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b00ede4c8d02b81d28890fbbd9bda8d25d55d4d851bb47e97f02aba11491c90
MD5 5cbbb7e119e8929e0bd8111c8aa08383
BLAKE2b-256 106376fd14cc81dcf9ddd80c36c4e1e038e820e9c6b541b9aff4694be67d2f35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 062abed885d896153aebf672ec2543e1d40023bc2c69c359b5996a2f84f3c70e
MD5 e3f38f0ce6ac81b5f7537dc4126e9fc5
BLAKE2b-256 8807ccf3a1791c27508fa7221009fa9f2eb6eea9dc148e5fe601bc563e1b33b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d92902395386f265595832432c73f3402d3a8cd5bfed6958e9523f84d12e9d8d
MD5 a6520f3aa049ef2d9eb00263cc480b6e
BLAKE2b-256 f7e2de3cd21a2364c1ff48fa3ff9af7891b6b2110ee52497a1fb2dcec7eb402f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 261094e8963c8825ca775161267bb6a690bbc5968ccded4baed34be5890d35a7
MD5 0e0f4e4d76958bb3608011c736cb4fe7
BLAKE2b-256 567c3a7f964c2e8cd5717ee22005320d11d0ccef938bf45960eec444fddee96d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f64690d294e21ce6d7fccba51c069af537795fe03657f3d10dd5a38a155409b
MD5 a37675e8e1a54cf129839b81112bbb88
BLAKE2b-256 402df0fe964f6eb69383044dcf1de15a4702941729ec34e12b771a33fe1e6477

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6647fca6ad6fbcf72fee794cecfae666ab0fc5e0ca8a0774cb531fcc56c2f45c
MD5 3ba5c1894c8c24b91bb3818613377b40
BLAKE2b-256 9003510668da538aa6f1fffb92af69c95b49f9ce4d0f3eb60daa45bc3e16a3e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76467f1b58b22662e12c17ac4edd224aa9b7de2490e598c9307d1fc21a1a20c1
MD5 1cfc3273d7bd4753b25f9ab53b9ee23e
BLAKE2b-256 a33b4d0a17d4f1c1608138fb7fc170c5a2fe44ee1184e55e2503cb551f20db19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0559c45384e7a6e83ccdedf6cd52e873bec60bdbcfaad440df60bed766709aee
MD5 18f5eea182fd0b0a0419c147e7a462aa
BLAKE2b-256 32152a9d66331d446f73ab1c325b8649a5cc0f6a62f3428201527aecf61d22f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b989e0669d820b15555f159cb7438e6eb46e9a8245e12397c7966b123cfd2f2f
MD5 b92a61509c441fa600d818de82b151ae
BLAKE2b-256 66116f8bc2b5a632934952645856fb76bc250b7b80439c316be6f3055c5f0201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6994cb716bd0e951258b670257ee149155814f75c55aa9336c2e6331b2d05a5d
MD5 02b8729993f5e836bf6d22d937b707ff
BLAKE2b-256 db2b1e0b09a89474d86258090a697e22a08ce05eda312c01fbbb4ea261be9594

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2145fce007b09bfded3c90a9c5c6d925afbe6d839e1a1bae4432704c9abc5048
MD5 b197997079c2249cff5430b278242f06
BLAKE2b-256 f73cdc93587211e3f1f62fb8f0bc244d5e5157173d3eb8d18547d00554f68815

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f6f6f51507b0cf5ed4d15c07351bb82d1da418438d86aee4590142f2f6fa139
MD5 cc9d3e2c4b1b58ccbdf2349773a32671
BLAKE2b-256 cc5378b7372ba57f26ad215d22b05e83378d6cbf9b9cddc826cd8a460c82f003

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.38-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 919824affd7d86f589a34947e558db8708c07691731e1f1937640440a85b38c2
MD5 6b1432a955bc55c59c5be84cd3da356b
BLAKE2b-256 4b762e1b9bf016e1ef20ebb96481c41e2589655db217a21c1edd30ae5a00e8c9

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