//load ImageJ
%classpath config resolver scijava.public https://maven.scijava.org/content/groups/public
%classpath add mvn net.imagej imagej 2.0.0-rc-67
//create ImageJ object
ij = new net.imagej.ImageJ()
Added new repo: scijava.public
net.imagej.ImageJ@7b00c550
This Op
calculates the Minimum and Maximum of any Iterable
. The return for this Op
is an imglib2 Pair
, with the first element being the minimum and the second element being the maximum.
sinusoid32 = ij.op().run("create.img", [150, 100])
formula = "63 * (Math.cos(0.3*p[0]) + Math.sin(0.3*p[1])) + 127"
ij.op().image().equation(sinusoid32, formula)
ij.notebook().display(sinusoid32)
All Img
s are Iterable
s, so we can just pass through the Img
to minMax()
:
pair = ij.op().stats().minMax(sinusoid32)
output = "Min = " + pair.getA() + ", Max = " + pair.getB()
Min = 1.293813403205192, Max = 252.9996057999923