Skip to main content

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.

Release files for neuroglancer 2.39

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neuroglancer 2.39
File Size Uploaded
neuroglancer-2.39.tar.gz 3.5 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for neuroglancer 2.39
File
neuroglancer-2.39-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
neuroglancer-2.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
neuroglancer-2.39-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
neuroglancer-2.39-cp312-cp312-macosx_10_9_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.9+ x86-64 Details
neuroglancer-2.39-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
neuroglancer-2.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
neuroglancer-2.39-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
neuroglancer-2.39-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
neuroglancer-2.39-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
neuroglancer-2.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
neuroglancer-2.39-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
neuroglancer-2.39-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
neuroglancer-2.39-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
neuroglancer-2.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
neuroglancer-2.39-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
neuroglancer-2.39-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details

Total release size: 65.6 MB

Release files / neuroglancer-2.39.tar.gz

Download URL neuroglancer-2.39.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
31c6afe1df33879970c8b6ab56520b1e114d5a44be423f4da0204eb48d0383b3
BLAKE2b-256 checksum
How to use checksums
0f86727a19972433723baf4146f3a1e762e3dde0a5f884bc690969159d17b4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp312-cp312-win_amd64.whl

Download URL neuroglancer-2.39-cp312-cp312-win_amd64.whl
Size 3.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
72923978f18e40941cecce220a57ab9c07736ecd4c3f05496f4515c7e94cc4c5
BLAKE2b-256 checksum
How to use checksums
15ae6d57562a2ace54537b83b4e4d519945f6ca30fdfff32d08699a03f044355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL neuroglancer-2.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
46bfc2891170a2bcccba3b9e84a92c1580728742b3f8d98af6fb221509db89ca
BLAKE2b-256 checksum
How to use checksums
7cbfb6c65823a36ea66a28f548d1f75eccef9fbe62b6ddb45ae1b140f861f85b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp312-cp312-macosx_11_0_arm64.whl

Download URL neuroglancer-2.39-cp312-cp312-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8afa37747cdcea0591581b49b71839f30cfa8f54549398fb37b1b2d8c2d7a5b5
BLAKE2b-256 checksum
How to use checksums
c81de3d3da04bb7ae5d3fe01ccc2ddbeb1d336c82cf4b613e35a9101b1b921bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp312-cp312-macosx_10_9_x86_64.whl

Download URL neuroglancer-2.39-cp312-cp312-macosx_10_9_x86_64.whl
Size 3.5 MB
Tags CPython 3.12 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
7be63acc82f3480e8c5615d7918ac6138c086a153942fb3010f1006c8fba3bcb
BLAKE2b-256 checksum
How to use checksums
6e29d700f89a37e1d4920b6d981560a70b072e1ead56f521306be4c9817aa30c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp311-cp311-win_amd64.whl

Download URL neuroglancer-2.39-cp311-cp311-win_amd64.whl
Size 3.5 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
44b8b7c1d14d9c937d13377598eb72f4d462bc2787a4fa47b2138d9a0344a6f0
BLAKE2b-256 checksum
How to use checksums
b9e7868df1d58bcd735ee286fa70ddc53e1aa7124839c236e6eda493fad9be36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL neuroglancer-2.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
df25c20307b7ed54940602af7e3dfd98a961052521f49091b7798ad5daeb909f
BLAKE2b-256 checksum
How to use checksums
eaa89f417eabe415f14f21371b6ba4d817dd43d9a9b6d6555a0997a994c1e202
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp311-cp311-macosx_11_0_arm64.whl

Download URL neuroglancer-2.39-cp311-cp311-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
09ab4099f9ef635b47a0313d40796873f5204ae37f3b0fb7b9d47d0a0337cf3e
BLAKE2b-256 checksum
How to use checksums
12a6ecd1dc1d1afa8adc9345988b256ec5a4b0899f0b4713f517097e72ef1497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp311-cp311-macosx_10_9_x86_64.whl

Download URL neuroglancer-2.39-cp311-cp311-macosx_10_9_x86_64.whl
Size 3.5 MB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
0eab2971bb6cda989a046582f4ffbdd2d49bf07c20e3ec50787e3980c92da55b
BLAKE2b-256 checksum
How to use checksums
00df5a6cb5209544214f4ac8c5a98e8fae96ac1a20dfb43437492197d4c6cc8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp310-cp310-win_amd64.whl

Download URL neuroglancer-2.39-cp310-cp310-win_amd64.whl
Size 3.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
61712fa9971c71942f6e4ffc26e1566f139cc12a1373418dcd93e4ec8ed309da
BLAKE2b-256 checksum
How to use checksums
775e11e3c2512f7fe1e8269bf360a02e94258ac62acf666b9ab4dd133b933dc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL neuroglancer-2.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
92f66f70c8da1a03860d9f8b4f15522f1c2851936815131c1c84ec7f55ea18e1
BLAKE2b-256 checksum
How to use checksums
5fc40ec85e20d89af5e37f7f47740e2de06474c0765762e0c5edd991cd29482c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp310-cp310-macosx_11_0_arm64.whl

Download URL neuroglancer-2.39-cp310-cp310-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2014f6f4e9b78611d088e789c474048dcf8b5e2b162a96a76f23bed942088e97
BLAKE2b-256 checksum
How to use checksums
b8be0bc9a7a46b53bdce5342ab4791b8269a77fd1b7ae7e5a9f3008ca153bbbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp310-cp310-macosx_10_9_x86_64.whl

Download URL neuroglancer-2.39-cp310-cp310-macosx_10_9_x86_64.whl
Size 3.5 MB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5b7049b8a24be1b6065db4871c13615310153cdfecb17bc5eb019832864187e7
BLAKE2b-256 checksum
How to use checksums
3003771e5f12c19c7de2a01f47b1e073d60e65da2b46d3356a02832a12000648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp39-cp39-win_amd64.whl

Download URL neuroglancer-2.39-cp39-cp39-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
895c21ea631bb724b1f55fb89879268a97a446758a14d486abbbe3a29d79cc32
BLAKE2b-256 checksum
How to use checksums
74780b66b853d1343b7d4dde0d90d49cf9ffae5ff50ea64f9405324f253dea82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL neuroglancer-2.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5da467a08c0997dd5d0fe855a8585427c5c78562afb799aad798ba77f7bdfb07
BLAKE2b-256 checksum
How to use checksums
5e048e6ebac790d36d7649efae73a299873d4c81997d2f59c4f1f4ad98c98931
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp39-cp39-macosx_11_0_arm64.whl

Download URL neuroglancer-2.39-cp39-cp39-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e9698ca5e25cb5e0cdf0f7fbce2d241b1df4386547f62ff8fd1c3f7e3dd36c59
BLAKE2b-256 checksum
How to use checksums
b8f8f4f4361eeda5965dda6d0ba770c3d6c24c8aed94379cd4245e45e5b385b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / neuroglancer-2.39-cp39-cp39-macosx_10_9_x86_64.whl

Download URL neuroglancer-2.39-cp39-cp39-macosx_10_9_x86_64.whl
Size 3.5 MB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
39ac5742222014f7695048458db1ca4fa2154cc6f759d09a97074948aea4692c
BLAKE2b-256 checksum
How to use checksums
7bef6199237facb2de607a74746f466789f3beb67cf1f71d5ae08f23ffbe879c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

2.41.2

5 release files

2.40.1

5 release files

2.39.2

5 release files

2.39.1

5 release files

This release

2.39 This release

17 release files

2.38

17 release files

2.37

17 release files

2.36

25 release files

2.35

25 release files

2.34

25 release files

2.33

25 release files

2.32

25 release files

2.31

25 release files

2.30

25 release files

2.29

17 release files

2.28

17 release files

2.27

17 release files

2.22

16 release files

2.21

16 release files

2.20

16 release files

2.19

16 release files

2.18

16 release files

2.17

1 release file

2.16

1 release file

2.15

1 release file

2.14

1 release file

2.13

1 release file

2.12

1 release file

2.11

1 release file

2.10

1 release file

2.9

1 release file

2.8

1 release file

2.7

1 release file

2.6

1 release file

2.5

1 release file

2.4

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.1.6

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.15

1 release file

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page