//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@465e45d7
This Op
calculates the Size (number of elements) of any Iterable
. It is used in many of the other stats
Op
s.
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 size()
. We are expecting 15,000, since the size of our image is 150 x 100:
import net.imglib2.type.numeric.real.DoubleType
output = new DoubleType()
ij.op().stats().size(output, sinusoid32)
output
15000.0