Skip to main content

A python module to bring together the worlds of NumPy (Python) and ImgLib2 (Java).

Project description

build status

imglyb

imglyb aims at connecting two worlds that have been seperated for too long:

imglyb uses jpype to access numpy arrays and expose them to ImgLib2 through imglib2-imglyb. This means shared memory between numpy and ImgLib2, i.e. any ImgLib2 algorithm can run on numpy arrays without creating copies of the data! For example, Python users can now make use of the BigDataViewer extension to visualize dense volumetric data.

If you are interested in using imglyb, have a look at the examples folder and extend the examples as needed!

Note: NEP 18 has the potential to improve numpy - imglib interoperability, especially when converting imglib2 data structures to numpy.

Installation

Prerequisites

imglyb has been tested on Linux, macOS, and Windows.

The following tools are required:

  • Python 3
  • Java 8 or 11 JDK (JRE is not enough)
  • Apache Maven

If you use conda, these will be installed for you.

Installing with conda

conda install -c conda-forge imglyb

Installing with pip

First, install the prerequisites above. Then run:

pip install imglyb

It is recommended to do this from inside a virtualenv or conda environment, rather than system-wide.

Installing from source

First, install the prerequisites above. Then run:

git clone https://github.com/imglib/imglyb
cd imglyb
pip install -e .

It is recommended to do this from inside a virtualenv or conda environment, rather than system-wide.

Usage

It is suggested to follow and extend the examples in the examples folder according to your needs.

Or, for a higher-level way to use imglyb, check out pyimagej.

Known Issues

AWT on macOS

AWT and Cocoa do not get along perfectly. In general, the Cocoa event loop needs to be started before the JVM is loaded. (Thanks to @tpietzsch for figuring this out!) This requires some macOS specific code, written using PyObjC, to properly start up and shut down the Cocoa application and start the Java/Python code within it.

The OSXAWTwrapper.py script included in the imglyb library provides an example of Cocoa code and can be used to run the imglyb examples. Two packages from PyObjC are required for this wrapper (pyobjc-core and pyobjc-framework-cocoa), and they should be installed with imglyb on macOS.

When running the wrapper, one can either provide the name of the target module (as if using python -m) or the full path to the target script. So using the module name, the command to run the "butterfly" script in imglyb-examples looks like this:

python imglyb/OSXAWTwrapper.py imglyb-examples.butterfly

Running OSXAWTwrapper.py via python -m does not work at this time.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imglyb-2.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

imglyb-2.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file imglyb-2.1.0.tar.gz.

File metadata

  • Download URL: imglyb-2.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for imglyb-2.1.0.tar.gz
Algorithm Hash digest
SHA256 9651860278bd4f05d74b47d7ea06df7f24e39cfbfb541208d913fbd01c48c276
MD5 35bdd480d1bcb12e306bcd8a3f60e2bf
BLAKE2b-256 97e69fa4ff8aab684dd3ae58be7d782155ba72a2584dcf5779785206c1ca2b8a

See more details on using hashes here.

File details

Details for the file imglyb-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: imglyb-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for imglyb-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9630171d869e4d0d1d138552f9c08562c7f7dffa9482d9c25383928a6c8ada7
MD5 7ce0c27278aebbdae784054faa5783f1
BLAKE2b-256 0c61d088cd14e5a56b3fe0be6390d9b06cfb5f5974cd504c5c81126df4853e0f

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