Need help with pyimagej?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

imagej
133 Stars 24 Forks Other 311 Commits 29 Opened issues

Description

Use ImageJ from Python

Services available

!
?

Need anything else?

Contributors list

PyImageJ: Python wrapper for ImageJ

Build Status

PyImageJ provides a set of wrapper functions for integration between ImageJ and Python. A major advantage of this approach is the ability to combine ImageJ with other tools available from the Python software ecosystem, including NumPy, SciPy, scikit-image, CellProfiler, OpenCV, ITK and more.

Installation

PyImageJ can be installed using conda. Here is how to create and activate a new conda environment with pyimageJ available:

conda create -n pyimagej -c conda-forge pyimagej openjdk=8
conda activate pyimagej

Alternately, it is possible to install pyimagej with pip.

For detailed installation instructions and requirements, see Install.md.

Usage

The first step when using pyimagej is to create an ImageJ gateway. This gateway can point to any official release of ImageJ or to a local installation. Using the gateway, you have full access to the ImageJ API, plus utility functions for translating between Python (NumPy, xarray, pandas, etc.) and Java (ImageJ, ImgLib2, etc.) structures.

For instructions on how to start up the gateway for various settings see Initialization.md.

Here is an example of opening an image using ImageJ and displaying it:

# Create an ImageJ gateway with the newest available version of ImageJ.
import imagej
ij = imagej.init()

Load an image.

image_url = 'https://samples.fiji.sc/new-lenna.jpg' jimage = ij.io().open(image_url)

Convert the image from ImageJ 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 instructions on how to do certain tasks, see USAGE.md

Getting Help

The Scientific Community Image Forum is the best place to get general help on usage of pyimagej, ImageJ, and any other image processing tasks. Bugs can be reported to the pyimagej GitHub issue tracker.

Contributing

All contributions, reports, and ideas are welcome. Contribution is done via pull requests onto the pyimagej repository.

Most development discussion takes place on the pyimagej GitHub repository. You can also reach the developers at the pyimagej gitter.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.