Search in sources :

Example 36 with ArrayImgFactory

use of net.imglib2.img.array.ArrayImgFactory in project imagej-ops by imagej.

the class DropSingletonDimensionsViewTest method dropSingletonDimensionsTest.

@Test
public void dropSingletonDimensionsTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 1, 10 }, new DoubleType());
    RandomAccessibleInterval<DoubleType> il2 = Views.dropSingletonDimensions(img);
    RandomAccessibleInterval<DoubleType> opr = ops.transform().dropSingletonDimensionsView(img);
    assertEquals(il2.numDimensions(), opr.numDimensions());
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 37 with ArrayImgFactory

use of net.imglib2.img.array.ArrayImgFactory in project imagej-ops by imagej.

the class ExtendBorderViewTest method extendBorderTest.

@Test
public void extendBorderTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendBorder(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendBorderView(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 38 with ArrayImgFactory

use of net.imglib2.img.array.ArrayImgFactory in project imagej-ops by imagej.

the class ExtendMirrorDoubleViewTest method extendMirrorDoubleTest.

@Test
public void extendMirrorDoubleTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendMirrorDouble(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendMirrorDoubleView(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 39 with ArrayImgFactory

use of net.imglib2.img.array.ArrayImgFactory 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 40 with ArrayImgFactory

use of net.imglib2.img.array.ArrayImgFactory 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)

Aggregations

AbstractOpTest (net.imagej.ops.AbstractOpTest)52 Test (org.junit.Test)52 DoubleType (net.imglib2.type.numeric.real.DoubleType)47 Random (java.util.Random)14 Img (net.imglib2.img.Img)8 FinalInterval (net.imglib2.FinalInterval)7 ArrayImgFactory (net.imglib2.img.array.ArrayImgFactory)7 FloatType (net.imglib2.type.numeric.real.FloatType)6 FinalDimensions (net.imglib2.FinalDimensions)4 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)4 ArrayList (java.util.ArrayList)3 Dimensions (net.imglib2.Dimensions)3 Point (net.imglib2.Point)3 MixedTransformView (net.imglib2.view.MixedTransformView)3 Before (org.junit.Before)3 BinaryFunctionOp (net.imagej.ops.special.function.BinaryFunctionOp)2 UnaryFunctionOp (net.imagej.ops.special.function.UnaryFunctionOp)2 Interval (net.imglib2.Interval)2 ComplexFloatType (net.imglib2.type.numeric.complex.ComplexFloatType)2 ByteType (net.imglib2.type.numeric.integer.ByteType)2