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

Uploaded Source

Built Distributions

neuroglancer-2.39-cp312-cp312-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.12 Windows x86-64

neuroglancer-2.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

neuroglancer-2.39-cp312-cp312-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

neuroglancer-2.39-cp312-cp312-macosx_10_9_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

neuroglancer-2.39-cp311-cp311-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

neuroglancer-2.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

neuroglancer-2.39-cp311-cp311-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

neuroglancer-2.39-cp311-cp311-macosx_10_9_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

neuroglancer-2.39-cp310-cp310-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

neuroglancer-2.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

neuroglancer-2.39-cp310-cp310-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

neuroglancer-2.39-cp310-cp310-macosx_10_9_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

neuroglancer-2.39-cp39-cp39-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

neuroglancer-2.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

neuroglancer-2.39-cp39-cp39-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

neuroglancer-2.39-cp39-cp39-macosx_10_9_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: neuroglancer-2.39.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for neuroglancer-2.39.tar.gz
Algorithm Hash digest
SHA256 31c6afe1df33879970c8b6ab56520b1e114d5a44be423f4da0204eb48d0383b3
MD5 17c29dd16deddbb4579bf7ec774449d2
BLAKE2b-256 0f86727a19972433723baf4146f3a1e762e3dde0a5f884bc690969159d17b4f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 72923978f18e40941cecce220a57ab9c07736ecd4c3f05496f4515c7e94cc4c5
MD5 c9ddb6ede32957e28a1aaef7610cf1ba
BLAKE2b-256 15ae6d57562a2ace54537b83b4e4d519945f6ca30fdfff32d08699a03f044355

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46bfc2891170a2bcccba3b9e84a92c1580728742b3f8d98af6fb221509db89ca
MD5 6117e4a2e774e5e291837ed4c3b0f307
BLAKE2b-256 7cbfb6c65823a36ea66a28f548d1f75eccef9fbe62b6ddb45ae1b140f861f85b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8afa37747cdcea0591581b49b71839f30cfa8f54549398fb37b1b2d8c2d7a5b5
MD5 56a19dbe38037f9cffd0a6120d57b87f
BLAKE2b-256 c81de3d3da04bb7ae5d3fe01ccc2ddbeb1d336c82cf4b613e35a9101b1b921bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7be63acc82f3480e8c5615d7918ac6138c086a153942fb3010f1006c8fba3bcb
MD5 fb520a29ae5b6d4794642212d723eb9c
BLAKE2b-256 6e29d700f89a37e1d4920b6d981560a70b072e1ead56f521306be4c9817aa30c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 44b8b7c1d14d9c937d13377598eb72f4d462bc2787a4fa47b2138d9a0344a6f0
MD5 f77cb36e994a573d6a91ac187f3b0335
BLAKE2b-256 b9e7868df1d58bcd735ee286fa70ddc53e1aa7124839c236e6eda493fad9be36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df25c20307b7ed54940602af7e3dfd98a961052521f49091b7798ad5daeb909f
MD5 24c01cc999040bbdfd89ef807b155440
BLAKE2b-256 eaa89f417eabe415f14f21371b6ba4d817dd43d9a9b6d6555a0997a994c1e202

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09ab4099f9ef635b47a0313d40796873f5204ae37f3b0fb7b9d47d0a0337cf3e
MD5 d632db65c2cd45e1eab16c8cc181f03c
BLAKE2b-256 12a6ecd1dc1d1afa8adc9345988b256ec5a4b0899f0b4713f517097e72ef1497

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0eab2971bb6cda989a046582f4ffbdd2d49bf07c20e3ec50787e3980c92da55b
MD5 3d64dcf19632f6ad3ce70b4d02e7a71e
BLAKE2b-256 00df5a6cb5209544214f4ac8c5a98e8fae96ac1a20dfb43437492197d4c6cc8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 61712fa9971c71942f6e4ffc26e1566f139cc12a1373418dcd93e4ec8ed309da
MD5 818d5a318e446398b4796ba38b42137c
BLAKE2b-256 775e11e3c2512f7fe1e8269bf360a02e94258ac62acf666b9ab4dd133b933dc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92f66f70c8da1a03860d9f8b4f15522f1c2851936815131c1c84ec7f55ea18e1
MD5 e86fb4cfe5bd835aeadd4c5f612ce725
BLAKE2b-256 5fc40ec85e20d89af5e37f7f47740e2de06474c0765762e0c5edd991cd29482c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2014f6f4e9b78611d088e789c474048dcf8b5e2b162a96a76f23bed942088e97
MD5 fe3e6fa157ed54bce63c794a86eecf09
BLAKE2b-256 b8be0bc9a7a46b53bdce5342ab4791b8269a77fd1b7ae7e5a9f3008ca153bbbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b7049b8a24be1b6065db4871c13615310153cdfecb17bc5eb019832864187e7
MD5 7e6e4cab8468721ae19283caf1c707e8
BLAKE2b-256 3003771e5f12c19c7de2a01f47b1e073d60e65da2b46d3356a02832a12000648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 895c21ea631bb724b1f55fb89879268a97a446758a14d486abbbe3a29d79cc32
MD5 1e0e19b30df408166e11e57ae706fff1
BLAKE2b-256 74780b66b853d1343b7d4dde0d90d49cf9ffae5ff50ea64f9405324f253dea82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5da467a08c0997dd5d0fe855a8585427c5c78562afb799aad798ba77f7bdfb07
MD5 fb0e212d80b104a855bfdeab255d9256
BLAKE2b-256 5e048e6ebac790d36d7649efae73a299873d4c81997d2f59c4f1f4ad98c98931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9698ca5e25cb5e0cdf0f7fbce2d241b1df4386547f62ff8fd1c3f7e3dd36c59
MD5 de9a8f9a174e64c9c497acf3772e57ed
BLAKE2b-256 b8f8f4f4361eeda5965dda6d0ba770c3d6c24c8aed94379cd4245e45e5b385b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.39-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39ac5742222014f7695048458db1ca4fa2154cc6f759d09a97074948aea4692c
MD5 75de451cc2d547c8838591df4c33804f
BLAKE2b-256 7bef6199237facb2de607a74746f466789f3beb67cf1f71d5ae08f23ffbe879c

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