@@ -0,0 +1,2029 @@
+%0Apackage net.imagej.ops.filter.derivativeGauss;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport net.imagej.ops.AbstractOpTest;%0Aimport net.imglib2.Cursor;%0Aimport net.imglib2.RandomAccess;%0Aimport net.imglib2.img.Img;%0Aimport net.imglib2.type.numeric.real.DoubleType;%0Aimport net.imglib2.view.Views;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * Contains tests for %7B@link DefaultDerivativeGauss%7D.%0A * %0A * @author Gabe Selzer%0A */%0Apublic class DefaultDerivativeGaussTest extends AbstractOpTest %7B%0A%0A%09@Test(expected = IllegalArgumentException.class)%0A%09public void testTooFewDimensions() %7B%0A%09%09Img%3CDoubleType%3E input = ops.convert().float64(generateFloatArrayTestImg(%0A%09%09%09false, 30));%0A%0A%09%09Img%3CDoubleType%3E output = ops.create().img(input);%0A%0A%09%09ops.filter().derivativeGauss(output, input, new int%5B%5D %7B 1, 0 %7D, 1d);%0A%09%7D%0A%0A%09@Test(expected = IllegalArgumentException.class)%0A%09public void testTooManyDimensions() %7B%0A%09%09Img%3CDoubleType%3E input = ops.convert().float64(generateFloatArrayTestImg(%0A%09%09%09false, 30, 30, 30));%0A%0A%09%09Img%3CDoubleType%3E output = ops.create().img(input);%0A%0A%09%09ops.filter().derivativeGauss(output, input, new int%5B%5D %7B 1, 0 %7D, 1d);%0A%09%7D%0A%09%0A%09@Test%0A%09public void regressionTest() %7B%0A%09%09int width = 10;%0A%09%09Img%3CDoubleType%3E input = ops.convert().float64(generateFloatArrayTestImg(%0A%09%09%09false, width, width));%0A%0A%09%09Img%3CDoubleType%3E output = ops.create().img(input);%0A%0A%09%09// Draw a line on the image%0A%09%09RandomAccess%3CDoubleType%3E inputRA = input.randomAccess();%0A%09%09inputRA.setPosition(5, 0);%0A%09%09for (int i = 0; i %3C 10; i++) %7B%0A%09%09%09inputRA.setPosition(i, 1);%0A%09%09%09inputRA.get().set(255);%0A%09%09%7D%0A%0A%09%09// filter the image%0A%09%09ops.filter().derivativeGauss(output, input, new int%5B%5D %7B 1, 0 %7D, 0.5);%0A%0A%09%09Cursor%3CDoubleType%3E cursor = output.localizingCursor();%0A%09%09int currentPixel = 0;%0A%09%09while (cursor.hasNext()) %7B%0A%09%09%09cursor.fwd();%0A%09%09%09assertEquals(cursor.get().getRealDouble(), regressionRowValues%5BcurrentPixel %25 width%5D, 0);%0A%09%09%09currentPixel++;%0A%09%09%7D%0A%09%7D%0A%0A%09double%5B%5D regressionRowValues = %7B 0.0, 0.0, 0.0, 2.1876502452391353,%0A%09%09117.25400606437196, 0.0, -117.25400606437196, -2.1876502452391353, 0.0,%0A%09%090.0 %7D;%0A%0A%7D%0A

Add tests for derivative gauss op