@@ -0,0 +1,1537 @@
+%0Apackage net.restlesscoder.sandbox.imagej;%0A%0Aimport net.imagej.Dataset;%0Aimport net.imagej.ImageJ;%0Aimport net.imagej.ops.Ops;%0Aimport net.imagej.ops.special.computer.Computers;%0Aimport net.imagej.ops.special.computer.UnaryComputerOp;%0Aimport net.imglib2.algorithm.neighborhood.DiamondShape;%0Aimport net.imglib2.algorithm.neighborhood.HyperSphereShape;%0Aimport net.imglib2.algorithm.neighborhood.RectangleShape;%0Aimport net.imglib2.algorithm.neighborhood.Shape;%0Aimport net.imglib2.img.Img;%0Aimport net.imglib2.type.numeric.integer.UnsignedByteType;%0Aimport net.imglib2.type.numeric.real.FloatType;%0A%0Apublic class MedianBySlice %7B%0A%0A%09public static void main(final String... args) throws Exception %7B%0A%09%09final ImageJ ij = new ImageJ();%0A%09%09ij.ui().showUI();%0A%09%09%0A%09%09Dataset mriStack = ij.scifio().datasetIO().open(%22/Users/curtis/data/mri-stack.tif%22);%0A%09%09ij.ui().show(%22Original%22, mriStack);%0A%09%09%0A%09%09final Img%3CUnsignedByteType%3E img = mriStack.typedImg(new UnsignedByteType());%0A%09%09final Img%3CFloatType%3E in = ij.op().convert().float32(img);%0A%09%09final Img%3CFloatType%3E out = ij.op().create().img(in);%0A%0A%09%09ij.ui().show(%22Rectangle%22, median(ij, in, out, new RectangleShape(5, false)));%0A%09%09ij.ui().show(%22Circle%22, median(ij, in, out, new HyperSphereShape(5)));%0A%09%09ij.ui().show(%22Diamond%22, median(ij, in, out, new DiamondShape(5)));%0A%09%7D%0A%0A%09private static Object median(ImageJ ij, Img%3CFloatType%3E in, Img%3CFloatType%3E out,%0A%09%09Shape shape)%0A%09%7B%0A%09%09UnaryComputerOp op = Computers.unary(ij.op(), Ops.Filter.Median.class, out, in, shape);%0A%09%09return ij.op().slice(out, in, op, new int%5B%5D %7B0, 1%7D);%0A%09%7D%0A%7D%0A

Add example of slicewise op with median filter