//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() ij.op().help('project') input = ij.scifio().datasetIO().open("http://imagej.net/images/clown.jpg") ij.notebook().display(input) import net.imglib2.FinalInterval //create the output using only the first two dimensions of the input interval = new FinalInterval(input.dimension(0), input.dimension(1)) imgType = input.firstElement() projected = ij.op().create().img(interval, imgType) //create the stats Op instance using op() statsOp = ij.op().op("stats.mean", input) //do the projection in the second dimension projectDim = 2 ij.op().run("project", projected, input, statsOp, projectDim) ij.notebook().display(projected)