//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('offsetView') input = ij.scifio().datasetIO().open("http://imagej.net/images/clown.png") ij.notebook().display(input) import net.imglib2.FinalInterval w = input.dimension(0) h = input.dimension(1) interval = FinalInterval.createMinSize(-50, -50, 0, w, h, 3) typeMin = input.firstElement().getMinValue() typeMax = input.firstElement().getMaxValue() extended = ij.op().run("extendRandomView", input, typeMin, typeMax) offset = ij.op().run("offsetView", extended, interval) ij.notebook().display(offset) //move the same offset as the interval two code cells above translation = [-50, -50, 0] as long[] translated = ij.op().run("translateView", input, translation) ij.notebook().display(translated) "minimum of offset image: (" + offset.min(0) + ", " + offset.min(1) + ")\n" + "minimum of translated image: (" + translated.min(0) + ", " + translated.min(1) + ")"