@@ -0,0 +1,1997 @@
+%0Apackage net.imagej.ops.filter;%0A%0Aimport net.imagej.ops.AbstractComputerOp;%0Aimport net.imagej.ops.ComputerOp;%0Aimport net.imagej.ops.OpService;%0Aimport net.imglib2.RandomAccessibleInterval;%0Aimport net.imglib2.algorithm.neighborhood.Shape;%0Aimport net.imglib2.outofbounds.OutOfBoundsFactory;%0Aimport net.imglib2.view.Views;%0A%0Aimport org.scijava.plugin.Parameter;%0A%0A/**%0A * Abstract superclass of all non-linear filters.%0A * %0A * @author Jonathan Hale (University of Konstanz)%0A * @param %3CI%3E type of the input %7B@link RandomAccessibleInterval%7D%0A * @param %3CO%3E type of the output %7B@link RandomAccessibleInterval%7D%0A */%0Apublic abstract class AbstractNonLinearFilter%3CI, O%3E extends%0A%09AbstractComputerOp%3CRandomAccessibleInterval%3CI%3E, RandomAccessibleInterval%3CO%3E%3E%0A%7B%0A%0A%09@Parameter%0A%09protected OpService ops;%0A%0A%09@Parameter%0A%09private Shape shape;%0A%0A%09@Parameter(required = false)%0A%09private OutOfBoundsFactory%3CI, RandomAccessibleInterval%3CI%3E%3E outOfBoundsFactory;%0A%0A%09@Override%0A%09public void compute(final RandomAccessibleInterval%3CI%3E input,%0A%09%09final RandomAccessibleInterval%3CO%3E output)%0A%09%7B%0A%09%09// optionally extend input if outOfBoundsFactory is set%0A%09%09RandomAccessibleInterval%3CI%3E extInput = input;%0A%09%09if (outOfBoundsFactory != null) %7B%0A%09%09%09extInput = Views.interval(Views.extend(input, outOfBoundsFactory), input);%0A%09%09%7D%0A%0A%09%09I in = input.randomAccess().get();%0A%09%09O out = output.randomAccess().get();%0A%0A%09%09// map computer to neighborhoods%0A%09%09ops.map(output, extInput, getComputer(in.getClass(), out.getClass()),%0A%09%09%09getShape());%0A%09%7D%0A%0A%09/**%0A%09 * Get the shape (structuring element) used by this filter.%0A%09 * %0A%09 * @return the shape%0A%09 */%0A%09public Shape getShape() %7B%0A%09%09return shape;%0A%09%7D%0A%0A%09/**%0A%09 * Set the shape (structuring element) to be used by this filter.%0A%09 * %0A%09 * @param s the shape%0A%09 */%0A%09public void setShape(Shape s) %7B%0A%09%09shape = s;%0A%09%7D%0A%0A%09/**%0A%09 * @return the %7B@link ComputerOp%7D to evaluate for every neighborhood of every%0A%09 *         pixel%0A%09 */%0A%09protected abstract ComputerOp%3CIterable%3CI%3E, O%3E getComputer(%0A%09%09final Class%3C?%3E inClass, final Class%3C?%3E outClass);%0A%0A%7D%0A

Add abstract class for non-linear filters