Package: pyimagej
PyImageJ: Python wrapper for ImageJ2PyImageJ provides a set of wrapper functions for integration betweenImageJ2and Python. It also supports the originalImageJAPI and data structures.A major advantage of this approach is the ability to combine ImageJ and ImageJ2
with other tools available from the Python software ecosystem, including NumPy,
SciPy, scikit-image,CellProfiler,OpenCV,ITKand many more.Quick StartJump into thedocumentation and tutorialsto get started!System RequirementsHardware RequirementsPyImageJ requires at minimum a standard computer with enough RAM and CPU
performance to support the workflow operations defined by the user. While
PyImageJ will run on a range of hardware, we recommend the following RAM
and CPU specifications:RAM: >= 2 GB (64 MB minimum)CPU: >= 1 coreNotably, PyImageJ can be installed and used on server infrastructure for
large scale image processing.OS RequirementsPyImageJ has been tested on the following operating systems:Linux (Ubuntu 20.04 LTS)WindowsmacOSSoftware RequirementsPyImageJ requires the following packages:Python >= 3.7imglyb>= 2.0.1jgo>= 1.0.3JPype>= 1.3.0labeling>= 0.1.12matplotlib(optional, forij.py.showfunction only)NumPyscyjava>= 1.8.0xarrayPyImageJ will not function properly if dependency versions are too old.In addition, PyImageJ requiresOpenJDKandMavento be installed.InstallationPyImageJ can be installed usingConda+Mamba. Here is how to create
and activate a new conda environment with PyImageJ available:conda install mamba -n base -c conda-forge
mamba create -n pyimagej -c conda-forge pyimagej openjdk=8
conda activate pyimagejAlternately, you can install PyImageJ with pip, but in this
case you will need to install OpenJDK and Maven manually.Installation time takes approximately 20 seconds. Initializing PyImageJ
takes an additional ~30 seconds to ~2-3 minutes (depending on bandwidth)
while it downloads and caches the needed Java libraries.For detailed installation instructions and requirements, seeInstallation.UsageThe first step when using PyImageJ is to create an ImageJ2 gateway.
This gateway can point to any official release of ImageJ2 or to a local
installation. Using the gateway, you have full access to the ImageJ2 API,
plus utility functions for translating between Python (NumPy, xarray,
pandas, etc.) and Java (ImageJ2, ImgLib2, etc.) structures.For instructions on how to start up the gateway for various settings, seeHow to initialize PyImageJ.Here is an example of opening an image using ImageJ2 and displaying it:# Create an ImageJ2 gateway with the newest available version of ImageJ2.importimagejij=imagej.init()# Load an image.image_url='https://imagej.net/images/clown.jpg'jimage=ij.io().open(image_url)# Convert the image from ImageJ2 to xarray, a package that adds# labeled datasets to numpy (http://xarray.pydata.org/en/stable/).image=ij.py.from_java(jimage)# Display the image (backed by matplotlib).ij.py.show(image,cmap='gray')For more, see thetutorial notebooks.API ReferenceFor a complete reference of the PyImageJ API, please see theAPI Reference.Getting HelpThe Scientific Community Image Forumis the best place to get general help on usage of PyImageJ, ImageJ2, and any
other image processing tasks. Bugs can be reported to the PyImageJ GitHubissue tracker.ContributingAll contributions, reports, and ideas are welcome. Contribution is done
via pull requests onto the pyimagej repository.Most development discussion takes place on the pyimagejGitHub repository.
You can also reach the developers at theImage.sc Zulip chat.For details on how to develop the PyImageJ codebase, seeDevelopment.md.