[![build status](https://github.com/imglib/imglyb/actions/workflows/build.yml/badge.svg)](https://github.com/imglib/imglyb/actions/workflows/build.yml)
# imglyb
`imglyb` aims at connecting two worlds that have been seperated for too long:
* Python with [numpy](https://github.com/numpy/numpy)
* Java with [ImgLib2](https://github.com/imglib/imglib2)
`imglyb` uses [jpype](http://jpype.org) to access `numpy` arrays and expose
them to `ImgLib2` through
[`imglib2-imglyb`](https://github.com/imglib/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](https://github.com/imglib/imglyb-bdv) 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`](https://numpy.org/neps/nep-0018-array-function-protocol.html) 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](https://maven.apache.org/)
If you use [conda](https://conda.io/), these will be installed for you.
### Installing with conda
```shell
conda install -c conda-forge imglyb
```
### Installing with pip
First, install the prerequisites above. Then run:
```shell
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:
```shell
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](https://github.com/imagej/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:
```shell
python imglyb/OSXAWTwrapper.py imglyb-examples.butterfly
```
Running `OSXAWTwrapper.py` via `python -m` does not work at this time.
Raw data
{
"_id": null,
"home_page": "",
"name": "imglyb",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "java,maven,cross-language,numpy,imglib2",
"author": "Philipp Hanslovsky, Edward Evans, Mark Hiner, Gabriel Selzer",
"author_email": "Curtis Rueden <ctrueden@wisc.edu>",
"download_url": "https://files.pythonhosted.org/packages/97/e6/9fa4ff8aab684dd3ae58be7d782155ba72a2584dcf5779785206c1ca2b8a/imglyb-2.1.0.tar.gz",
"platform": null,
"description": "[![build status](https://github.com/imglib/imglyb/actions/workflows/build.yml/badge.svg)](https://github.com/imglib/imglyb/actions/workflows/build.yml)\n\n# imglyb\n\n`imglyb` aims at connecting two worlds that have been seperated for too long:\n * Python with [numpy](https://github.com/numpy/numpy)\n * Java with [ImgLib2](https://github.com/imglib/imglib2)\n\n`imglyb` uses [jpype](http://jpype.org) to access `numpy` arrays and expose\nthem to `ImgLib2` through\n[`imglib2-imglyb`](https://github.com/imglib/imglib2-imglyb).\nThis means **shared memory** between `numpy` and `ImgLib2`, i.e. any `ImgLib2`\nalgorithm can run on `numpy` arrays without creating copies of the data!\nFor example, Python users can now make use of the\n[BigDataViewer extension](https://github.com/imglib/imglyb-bdv) to visualize dense volumetric\ndata.\n\nIf you are interested in using `imglyb`, have a look at the `examples` folder\nand extend the examples as needed!\n\n**Note**:\n[`NEP 18`](https://numpy.org/neps/nep-0018-array-function-protocol.html) has\nthe potential to improve `numpy` - `imglib` interoperability, especially when\nconverting `imglib2` data structures to `numpy`.\n\n## Installation\n\n### Prerequisites\n\n`imglyb` has been tested on Linux, macOS, and Windows.\n\nThe following tools are required:\n\n * Python 3\n * Java 8 or 11 JDK (JRE is not enough)\n * [Apache Maven](https://maven.apache.org/)\n\nIf you use [conda](https://conda.io/), these will be installed for you.\n\n### Installing with conda\n\n```shell\nconda install -c conda-forge imglyb\n```\n\n### Installing with pip\n\nFirst, install the prerequisites above. Then run:\n\n```shell\npip install imglyb\n```\n\nIt is recommended to do this from inside a virtualenv or conda environment,\nrather than system-wide.\n\n### Installing from source\n\nFirst, install the prerequisites above. Then run:\n\n```shell\ngit clone https://github.com/imglib/imglyb\ncd imglyb\npip install -e .\n```\n\nIt is recommended to do this from inside a virtualenv or conda environment,\nrather than system-wide.\n\n## Usage\n\nIt is suggested to follow and extend the examples in the `examples` folder\naccording to your needs.\n\nOr, for a higher-level way to use `imglyb`, check out\n[pyimagej](https://github.com/imagej/pyimagej).\n\n## Known Issues\n\n### AWT on macOS\n\nAWT and Cocoa do not get along perfectly. In general, the Cocoa event loop\nneeds to be started before the JVM is loaded. (Thanks to @tpietzsch for\nfiguring this out!) This requires some macOS specific code, written using\n`PyObjC`, to properly start up and shut down the Cocoa application and start\nthe Java/Python code within it.\n\nThe `OSXAWTwrapper.py` script included in the `imglyb` library provides an\nexample of Cocoa code and can be used to run the `imglyb` examples. Two\npackages from `PyObjC` are required for this wrapper (`pyobjc-core` and\n`pyobjc-framework-cocoa`), and they should be installed with `imglyb`\non macOS.\n\nWhen running the wrapper, one can either provide the name of the target module\n(as if using `python -m`) or the full path to the target script. So using the\nmodule name, the command to run the \"butterfly\" script in `imglyb-examples`\nlooks like this:\n```shell\npython imglyb/OSXAWTwrapper.py imglyb-examples.butterfly\n```\nRunning `OSXAWTwrapper.py` via `python -m` does not work at this time.\n",
"bugtrack_url": null,
"license": "Simplified BSD License",
"summary": "A python module to bring together the worlds of NumPy (Python) and ImgLib2 (Java).",
"version": "2.1.0",
"split_keywords": [
"java",
"maven",
"cross-language",
"numpy",
"imglib2"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0c61d088cd14e5a56b3fe0be6390d9b06cfb5f5974cd504c5c81126df4853e0f",
"md5": "7ce0c27278aebbdae784054faa5783f1",
"sha256": "a9630171d869e4d0d1d138552f9c08562c7f7dffa9482d9c25383928a6c8ada7"
},
"downloads": -1,
"filename": "imglyb-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ce0c27278aebbdae784054faa5783f1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16767,
"upload_time": "2023-03-10T22:01:01",
"upload_time_iso_8601": "2023-03-10T22:01:01.880788Z",
"url": "https://files.pythonhosted.org/packages/0c/61/d088cd14e5a56b3fe0be6390d9b06cfb5f5974cd504c5c81126df4853e0f/imglyb-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "97e69fa4ff8aab684dd3ae58be7d782155ba72a2584dcf5779785206c1ca2b8a",
"md5": "35bdd480d1bcb12e306bcd8a3f60e2bf",
"sha256": "9651860278bd4f05d74b47d7ea06df7f24e39cfbfb541208d913fbd01c48c276"
},
"downloads": -1,
"filename": "imglyb-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "35bdd480d1bcb12e306bcd8a3f60e2bf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 18015,
"upload_time": "2023-03-10T22:01:03",
"upload_time_iso_8601": "2023-03-10T22:01:03.564419Z",
"url": "https://files.pythonhosted.org/packages/97/e6/9fa4ff8aab684dd3ae58be7d782155ba72a2584dcf5779785206c1ca2b8a/imglyb-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-10 22:01:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "imglyb"
}