Coder Social home page Coder Social logo

imagej / imagej-ops Goto Github PK

View Code? Open in Web Editor NEW
88.0 37.0 42.0 14.53 MB

ImageJ Ops: "Write once, run anywhere" image processing

Home Page: https://imagej.net/libs/imagej-ops

License: BSD 2-Clause "Simplified" License

Groovy 0.21% Java 99.79%

imagej-ops's Introduction

developer chat

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:

sum = math.add(a, b)
(phase, amplitude) = fft(image)

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

math.add(sum, 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("math.add", 5)
output_image = map(input_image, add_op)

For more details, see the "Introduction to ImageJ Ops" tutorial notebook:

https://imagej.github.io/tutorials

Working example

Try this Jython script in ImageJ's Script Editor!

#@ ImageJ ij

# create a new blank image
from jarray import array
dims = array([150, 100], 'l')
blank = ij.op().create().img(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().image().equation(blank, formula)

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

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

# add the two images
composite = ij.op().create().img(dims)
ij.op().math().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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.