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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.29-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.29-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.29-cp310-cp310-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.29-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.29-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.29-cp39-cp39-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

neuroglancer-2.29-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.29-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.29-cp38-cp38-macosx_10_9_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.29-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.29-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.29-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.29.tar.gz.

File metadata

  • Download URL: neuroglancer-2.29.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.29.tar.gz
Algorithm Hash digest
SHA256 0b446e994d2fd7c9e396fb1108599fc6ea3e48d8d74773b07bfdeef255ee6a5b
MD5 0d6682771ef5be95beb91a98ca26cfd8
BLAKE2b-256 02475255f0666cfef243a25a8af030819b3756eb26f19a88cb52dc2751dfdc6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 91fc2596aefac731047dbc792eb5a9bb37660d3a40d8d7c06a98c1660b4ae403
MD5 a83fda24f0fec7cf5f4efa5af9a08428
BLAKE2b-256 7d192cd30f08067958dc109e3ac340a71e2c852410c6ec9c91442b5311518508

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b365f6b185a9c84627d35dd010728c0292d1ad65bfd5b5d92984b313818f56f3
MD5 34c2a1c8765c93c8294ac18543b5cfad
BLAKE2b-256 4410f67e0f2b1b3348a507d0cd7f4835d1ea4dc210ae09aa65bd1875a7b2acdb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cff74a82eeb05b14802a1640030634b14c401a804b23e8969e5d043515bd218b
MD5 98ea48b6fbdcd3eb6da61323af320c60
BLAKE2b-256 041624e8d12572ed62e1c9e26cd819302f23b0b3736094f2f12170f98a3ae8cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5723fe89a797b41fedb50e809f1171f2237da9e247ab35ce8e6e7a164404326e
MD5 12e54e3c360282ff87964941613d159d
BLAKE2b-256 7cbcb2c91e05bb369b2a5ef61b82813f8a39d633ec01aebe7f9b87956d44aace

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7a03ba475fdb7b4c6f662a6327f25066e64d1cdfd8ed3b39f43c5230812607de
MD5 4ac545fadcc061bb9c5decc7020df333
BLAKE2b-256 3fe7eaf3e0add544a3da2bb5e558ee65866104d8f0f61eb4b2ce2319d60b5827

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ef264c84f7558d1582838a4781aedbab800d736a25e8a5ce7d21d9155e43bd62
MD5 990c4c723ae2cd61ab413dbd492a6e76
BLAKE2b-256 c6a6957116a3406901301a32338efc5f9c2eb589dace9d4dbf5854cccaea45d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da1c41255fc9a698f3230a5cc0104c754e99b9fc27672249b71c91823985d1c0
MD5 58fc08d2d23f47ffa1f5daeaab188fee
BLAKE2b-256 be86354e843948c2379a7ce0d327c23a40f2a99acad9089eb179d37cb5d37db7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7ecc8f9ba7549e8d6053c54f29f167d423b3b93d53e3806f19ed2e215649f12b
MD5 ad6972bbc84a0ca604186cf1040acf6b
BLAKE2b-256 24d246d5229d828746fbb19abb1b77ea864223a3ca1c720e99b19b0bea8d9a32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d189f9bdafe353ce797033e39987d52ff7f7018fdfe0f1a3a8012c5ed47aa1a1
MD5 b52eb79a96b6885e6119ffdb89199223
BLAKE2b-256 fa337c73cc90e283cd226a93424013f483ad3502bab751190338e095a268751d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b66f9d84fc7b3117114dbbf7419ec281d88f713764ef7c8908c5a94c2878831c
MD5 6915fe2fc6e03fab18d3907918f13001
BLAKE2b-256 883fa4a4990de81a43f9674a1bc72dcddfbc70e79c2cc1590452ccdcad687cfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df8214c307f5886e82a2cf402a440eabbfefc6c0a33cbe1521aacf21107f17df
MD5 d8f885dbcbad7a8fd521eb9345814e3a
BLAKE2b-256 341fbf22387b5724e97d564363158f78ef748d612814867594d5b71b0f4045bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22dee1787f391ec3d3d4503b400856e827c26a72f8a26c3cb3e8a727faca29f2
MD5 79e5e2c612abe4e262ba4e749b2aab5a
BLAKE2b-256 da6f9ffa3f2302b467cacde493938207d3ac57143ebdb111dac13b6876077a85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7b11a83423d6a8fe76403c811c1f2db97ed043426465de8aa0b9306a1c842510
MD5 9dffd110fcc769b470dd4cd246c5d416
BLAKE2b-256 6b7dbdf6c0eb83edb8189d45bcd5502e22c31e3d0bef154b1addb58bf4ceee4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c1d78e76c293c0b9fa3455c0a36fba2f7f696131bdba9ed0f6c793554897c2cf
MD5 4b21e0399cf4aeaec5464ae93baff0f7
BLAKE2b-256 7bd6e0e04b532b4cbb81ecaa2246bb8e3ff760ef68b765b2a6440b5d17f66b9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec1e93fa8b54f72777b164bb6e4e2ae2644d158b63135a22badd2c290aad52fb
MD5 45f7ec3f05b404be7f552fea4e3169f5
BLAKE2b-256 213e4b630239d4652f1f7e7ea60778f1b259fa1624b6fe01a554d34894a4eee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.29-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8acafad5db8e6be2624d0aa16226fbf82a2250472d4706a87443b0499c83faa2
MD5 095227f9687872dcfb2f833c17118491
BLAKE2b-256 361f0651cf71f507842cabd0c2877e9c7227ae09d1b21914ca501e75a836b19b

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