//load ImageJ
%classpath config resolver imagej.public https://maven.imagej.net/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: imagej.public
net.imagej.ImageJ@7b00c550
Given a decimal x
such that 0 <= x < 100
, this Op
provides the x * 100
th Quantile on any Iterable
. This Op
is used by the percentile
Op
, and most times it is preferable to use percentile
instead.
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 quantile()
:
import net.imglib2.type.numeric.real.DoubleType
percents = [0, 0.25, 0.5, 0.75, 0.999]
for(percent in percents)
println(((percent * 100) as int) + "th quantile = " + ij.op().stats().quantile(sinusoid32, percent))
0th quantile = 1.293813403205192 25th quantile = 86.23904508345876 50th quantile = 129.34019425677636 75th quantile = 176.38650829067143 99th quantile = 252.8726096451634
null