Open xp1632 opened 10 months ago
https://nbviewer.org/github/guiwitz/neubias_academy_biapy/blob/master/14-PyImageJ.ipynb
ImageJ based on python interpreter as a base line for evaluation
https://imagej.net/scripting/pyimagej https://www.nature.com/articles/s41592-022-01655-4
PyImageJ enables two-way communication between ImageJ and Python by initializing Java as a subprocess of Python, such that any Java-based functionality can be used from Python programs, and new Python-based routines can be written to augment Java programs.
PyImageJ paper (https://www.nature.com/articles/s41592-022-01655-4.pdf):
- Why?
- Accessibility of Python libraries for researchers at various programming proficientcy level
- ImageJ : a Java-based open-source software package and platform widely used for scientific image analysis.
- allow researchers to perform image-processing and analysis tasks
- operations can be combined to construct complex workflows in the form of macros and scripts
- Communities across both languages require a bridge enabling seamless feature integration without
duplicated effort
----
- To address this need:
- PyImageJ: Python-based package built on ImageJ2 that provides fundamental interoperability between Python and ImageJ
---
- Features:
- Enables two way communication between ImageJ and Python by initializing Java as a sub-process of Python.
- ImageJ2 consists of two key layer
- SciJava(infrastructure https://scijava.org/, https://github.com/scijava/scyjava ),
- ImgLib2(image data model)
- Accordingingly, PyImageJ is built on two fundamentalPython packages
- scyjava( https://github.com/scijava/scyjava)
- imglyb ((https://github.com/imglib/imglyb))
- as Python-based intergration layer for Java-based SciJava and ImageLib2 respectively
- PyImageJ offers access to **ImageJ2 API**
- PyImageJ supports **headless mode** with GUI that enables workflows on systems without monitor(such as a remote server)
---
- Technical details:
**For scyjave Layer**:
- It utilizes two parts:
1. To retrieve ImageJ2 java libraries:
- **jgo**: Launch Java code from the CLI, installation-free (https://github.com/scijava/jgo)
2. To create a special Python-intergrated Java environment to include the libraries:
- **jPype**: a Python module that let python call JAVA via jar within Python by intergrating JVM into pythonruntime
- (https://blog.csdn.net/u013250861/article/details/120383456)
- (https://jpype.readthedocs.io/en/latest/)
- Functionalities:
- download and cacheJAVA libraries from remote online repositories
- start java environment as a sub process in python
- warp java classes as dynamically generated Python classes with same functions
- convert common data structures between Java and python
---
**For imglyb Layer**:
- Using shared memory to store image data and exchange image between Python and ImageJ
- ImageJ images can be converted into Python type that is NumPy or xarray
Example notebook of using PyImageJ:
https://nbviewer.org/github/guiwitz/neubias_academy_biapy/blob/master/14-PyImageJ.ipynb