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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

neuroglancer-2.33-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.33-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.33-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.33.tar.gz.

File metadata

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

File hashes

Hashes for neuroglancer-2.33.tar.gz
Algorithm Hash digest
SHA256 993a5a5cb47de82101400563557f25a3d3d14ad849d5e5aa1c6e90993cb93366
MD5 6f4e7ca84cc882283dc990577e458dd7
BLAKE2b-256 44b5f889a0888f9bca86eb83cf2ee18f148cbe04af2554ad6671237fd5c9f9cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b500b1b7f053db836b9f3884a98c164c3b177e130eb46a92069aff1d0ffd7b13
MD5 7acc1309d75241bf197971800a336f44
BLAKE2b-256 3c1bcb5937c42cb5e347274321c62843f009dbc570a91b6d56fe9a07f76de01f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 607d838702d64f0f44ff094a51179d6d63aa95bdbee76929c0ec9b3ddb48c098
MD5 c4117e64acefcde148e82fd7cc3e8753
BLAKE2b-256 43e952c1ce43b1521a43df3d18c7fa8227cd1beeca12ce2c549c218369de9eb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3eede292ad0551cdadc8b7bfb60e6f01f09517ba6820a385d8030f42c66d080
MD5 93c273dc3b29e10a72fa930ea5be7e4c
BLAKE2b-256 8732b5ceebbeb481eae8dea7fa6bac90e3f0eb4dc391571f03be13a265f276c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 099894f020ff68f00ce526d9914eaadae0297e7c609dbdc23ad1e599e713dde9
MD5 7c3cca7db19b31790083cf018a99b558
BLAKE2b-256 0b22765c742dfc76bbea9400ab2161266427113c0ae900ba3293f93b3ef2db5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7099e6be3208d671548fa5a9654505a5f12884d9498bdcd0bfd5015c63dafa8c
MD5 92accb5a66a0ee2f0d44e2b24f75799d
BLAKE2b-256 802e0a195238f949f276e1f7bdf3a58d7e6322b92d7fa3c71477f8418e31634b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d7655bb028c387d89471fbe26c1578e22e8d3877f97299b646bdb91febb0c5b
MD5 215655ae9b43290803400ad5bfa1be09
BLAKE2b-256 3c3878547f28c152dc4fac7c8cea7e76b00826d819e3d9b6fa82945aee869a96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 de40b61e9502b8af600e3c69dedaefd33d88db3b89dc552d3d4bc10154610d90
MD5 e422e8f873b431e93ae648dc64d3b601
BLAKE2b-256 1a17e97dbdf6c1b1909b44b924958e4322024bf4cacc495f6ca344a6db508d24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 077c5d86d93f7588ed50b84a165b3f6ac784b78dfbca78cab41bf05c9bf1ea1e
MD5 72cf59185765806d73599923c6782dd9
BLAKE2b-256 0ab5e86b2f661c562372747340826ccdf3fc72ac9a30fb7b9180bf1f175b1927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f706e6a49810800cf834833c4ead24519d48e868703fb86b1ad856099e058ae
MD5 1dce0ed2d1747ab6e7851272cf53ba3d
BLAKE2b-256 06de541833e6f9d86fb1c6b447a93816c731ab8af6159d70ef046c6b52501bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a55c980f7848a325da11d079ac220f2925eaaaffb846e0d2bb9bc6bd6f76067e
MD5 6f66a8b3c5b0a6cf11492401688b9649
BLAKE2b-256 3aeca591907e5426d67f4d0c7b1fe21b2965afebecaf846fbda69e6906111ea1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b41a6ac0171ae9bd6ec06cca05a43133457754697c3a11c6a8511ea9a33e6db3
MD5 d32a152bc09a348cb180e8f886f3db23
BLAKE2b-256 4f0ca1cd8342da71bf68aca24a78613d025ec622709c40e549b76fb3f4b3a500

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 9dd1ecfb3229d486731e4bed18f2c14bc12799cdd0d2e4c4b55346be1decd60c
MD5 60cf7686a23dc49b4db2c676c4a56f23
BLAKE2b-256 e34e5c96b076a59a50ccdd93b14b0efa056c7d1140b6d82f699348802459b733

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1744d4693bdb0afa35be49a6bff00398ed62a636e6c13979bac7b6ec01e6a99
MD5 60689d73c6035134960805af09bb1d89
BLAKE2b-256 abd0f54a37a2ffcaafc5c359f19989bbdb4810e34cc663cd847de5d81c544718

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 783382475d5fdefff641c179cb46df6607844b59e79049f5cd62b6cf6e9574cb
MD5 2705d814fdf81d1bf5e8a230b728ba2a
BLAKE2b-256 0157b5deb6ae829e8164a85b5aeb11ab3440f2ca670b462ecde1ed9d65f5102b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f1bbc9a5b629acd137a2cd1e7700960779185f406398eadb38e06cb4fc4aeb0
MD5 a1f7a041f70a7d4b57fddeb6af0e2e3c
BLAKE2b-256 fa9355a66b1aeedf7b12616f209273a5518511e140653a8cdee276321d9b0326

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5a52b3739b50b0bf6d6a65a9ea9c66dbb1ba8f915e844417045fb17420cf5c78
MD5 177dc3c341a08b9239e733e5c4a6000f
BLAKE2b-256 4940b88c2598548e400bc8f38c99afdf968f69d83b137fbc4a4b8969264856dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 68022b6e8b617429c36da34c30279b2f2a13d4bf231e6f886ccdb827c3a234eb
MD5 552a903c5c60a172c28c31758a84a8a6
BLAKE2b-256 c920306a9c9f01f2700fb704359596c8a556829136917c80822bd6ee5bee17ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50455be18c93aeb0b2efb462a29b0e92ed7200a33d5661d65445d7e4d8358127
MD5 c08e86e8b6d870c294e6ad5bc0667329
BLAKE2b-256 8e23692a5bf381d1b7712c2653ef5f4a4657563677844dfd8c6f4649d9a7e9b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c0c4caa45a8d2d345f6178c59856a6013db8a85b65ad88f413250a548d5f91d
MD5 89b15dacc28f32c7b0a4f3374aa57832
BLAKE2b-256 29bc26c66eb51f4772b41a621c8c5ef06d78355c57c75732946203ac813c2911

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c65eff5b730f9fa094e12b48c1f36ab2338ad1ffe1745a0bd9f9b7f9d0f1b97b
MD5 51f5223d52f34e1d3a72d3b702d7d591
BLAKE2b-256 4755e8145ffd95f27cf8eda3d0d43095d88ec6a9cdb068f68b86eff9a4995623

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b232879772c43211abfb1963eacd7f18313df1ba3dda8abacff7d337d9f5ebb7
MD5 c88e3d56449d31d17617858ed30e3b1d
BLAKE2b-256 eda91c9aa5ef85a8a2bde3cd007daa32a1c0830a1f3f0fafe2d9a0298dce08cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4b91ddee4e869146d543d57e4cd3146b4d29175058effc4d55c730831647a2e5
MD5 a4c3bb9099006d5b10d80c84d2edcbf1
BLAKE2b-256 91686160082b8f97b2fe6a1f46348cd6c1c31b5d6a1e8bebb7e00a3d7f4e48e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7b109e011707fc9e231cbc20f481be8d3a186b253ef60e06f840ce207724e81
MD5 2d7d8c2c89c1ee453975c911e104e9cd
BLAKE2b-256 18e0f914f5170d33249534cb60f1a82f95e5354775a984a7f869c3adcc736291

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuroglancer-2.33-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 86026611e0b904124ea7058b2e06e3e47616765f7b689dad09beca2cde6a78e0
MD5 f1763b7c9072c204b1b77e4eac5a7a44
BLAKE2b-256 57672ccb26a74eed35e7dab9a31fb8d0fec8d4e21f5bbd547303b56c378edd4d

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