Search in sources :

Example 96 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class ExtendMirrorSingleViewTest method extendMirrorSingleTest.

@Test
public void extendMirrorSingleTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendMirrorSingle(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendMirrorSingleView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 97 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class ExtendPeriodicViewTest method extendPeriodicTest.

@Test
public void extendPeriodicTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendPeriodic(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendPeriodicView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 98 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class ExtendViewTest method defaultExtendTest.

@Test
public void defaultExtendTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extend(img, new OutOfBoundsBorderFactory<DoubleType, RandomAccessibleInterval<DoubleType>>()).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendView(img, new OutOfBoundsBorderFactory<DoubleType, RandomAccessibleInterval<DoubleType>>()).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) OutOfBoundsBorderFactory(net.imglib2.outofbounds.OutOfBoundsBorderFactory) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 99 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class ExtendZeroViewTest method extendZeroTest.

@Test
public void extendZeroTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendZero(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendZeroView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 100 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method assertRandomGaussian.

private void assertRandomGaussian(final double i, final double o) {
    final DoubleType in = new DoubleType(i);
    final DoubleType out = (DoubleType) ops.run(RandomGaussian.class, in.createVariable(), in);
    assertEquals(o, out.get(), 0);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) RandomGaussian(net.imagej.ops.math.UnaryRealTypeMath.RandomGaussian)

Aggregations

DoubleType (net.imglib2.type.numeric.real.DoubleType)142 Test (org.junit.Test)114 AbstractOpTest (net.imagej.ops.AbstractOpTest)104 LongType (net.imglib2.type.numeric.integer.LongType)37 Random (java.util.Random)19 Img (net.imglib2.img.Img)9 FinalInterval (net.imglib2.FinalInterval)8 ArrayList (java.util.ArrayList)7 Ops (net.imagej.ops.Ops)7 BitType (net.imglib2.type.logic.BitType)7 UnaryComputerOp (net.imagej.ops.special.computer.UnaryComputerOp)6 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)6 RealLocalizable (net.imglib2.RealLocalizable)6 LocalThresholdMethod (net.imagej.ops.threshold.LocalThresholdMethod)5 FinalDimensions (net.imglib2.FinalDimensions)5 CreateImgFromImg (net.imagej.ops.create.img.CreateImgFromImg)4 Dimensions (net.imglib2.Dimensions)4 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)4 Module (org.scijava.module.Module)4 CreateImgFromDimsAndType (net.imagej.ops.create.img.CreateImgFromDimsAndType)3