Skip to content

ImageJ OPS: A framework for reusable algorithms

License

Notifications You must be signed in to change notification settings

iarganda/imagej-ops

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageJ OPS

ImageJ OPS is an extensible Java framework for algorithms, particularly image processing algorithms. OPS seeks to be a unifying library for scientific image processing. See the Motivation page for details.

Getting started

Each op has a list of typed input and output parameters on which it operates. You can think of an op as a (potentially multi-variable) function:

c = add(a, b)
(phase, amplitude) = fft(image)

In many cases you can also pass a pre-allocated output which will be populated:

add(c, a, b)

Some ops take other ops as inputs, which allows for things like "execute this op on every pixel of that image":

add_op = op("add", 5)
output_image = map(input_image, add_op)

For more details, see these tutorials:

Working example

Try this Jython script in ImageJ2's Script Editor!

# @ImageJ ij

# create a new blank image
from jarray import array
dims = array([150, 100], 'l')
blank = ij.op().createImg(dims)

# fill in the image with a sinusoid using a formula
formula = "10 * (Math.cos(0.3*p[0]) + Math.sin(0.3*p[1]))"
sinusoid = ij.op().equation(blank, formula)

# add a constant value to an image
ij.op().add(sinusoid, 13.0)

# generate a gradient image using a formula
gradient = ij.op().equation(ij.op().createImg(dims), "p[0]+p[1]")

# add the two images
composite = ij.op().createImg(dims)
ij.op().add(composite, sinusoid, gradient)

# display the images
ij.ui().show("sinusoid", sinusoid)
ij.ui().show("gradient", gradient)
ij.ui().show("composite", composite)

The output:

sinusoid gradient composite

How to contribute

We welcome pull requests!

About

ImageJ OPS: A framework for reusable algorithms

Resources

License

Stars

Watchers

Forks

Packages

No packages published