//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('addNoise') input = ij.scifio().datasetIO().open("https://imagej.net/images/Tree_Rings.jpg") ij.notebook().display(input) import net.imagej.ops.map.MapIterableToIterable import net.imagej.ops.Ops import net.imagej.ops.special.computer.Computers //temporary type to pass through to the Op instance so that the Op knows what Type it is working on tempType = input.firstElement() //the minimum and maximum values allowed in the output - all values in the output //will be clamped to this value if below it in the input, so be careful rangeMin = input.firstElement().getMinValue() rangeMax = input.firstElement().getMaxValue() //the standard deviation for the gaussian kernel stdDev = 30d //create the op that is passed through to the Mapper, using the help() op syntax above noiseOp = Computers.unary(ij.op(), Ops.Filter.AddNoise.class, tempType, tempType, rangeMin, rangeMax, stdDev) //output image actualOutput = ij.op().create().img(input) //run a map op over the image using the noise Op above ij.op().run(MapIterableToIterable.class, actualOutput, input, noiseOp) ij.notebook().display(actualOutput)