Search in sources :

Example 31 with ArrayImgFactory

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

the class AddDimensionViewTest method addDimensionMinMaxTest.

@Test
public void addDimensionMinMaxTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    int max = 20;
    int min = 0;
    IntervalView<DoubleType> il2 = Views.addDimension(img, min, max);
    IntervalView<DoubleType> opr = ops.transform().addDimensionView(img, min, max);
    assertEquals(il2.numDimensions(), opr.numDimensions(), 0.0);
    for (int i = 0; i < il2.numDimensions(); i++) {
        assertEquals(il2.dimension(i), opr.dimension(i), 0.0);
    }
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 32 with ArrayImgFactory

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

the class CollapseNumericViewTest method defaultCollapseNumericTest.

@Test
public void defaultCollapseNumericTest() {
    Img<NativeARGBDoubleType> img = new ArrayImgFactory<NativeARGBDoubleType>().create(new int[] { 10, 10 }, new NativeARGBDoubleType());
    CompositeIntervalView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> il2 = Views.collapseNumeric((RandomAccessibleInterval<NativeARGBDoubleType>) img);
    CompositeIntervalView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> opr = ops.transform().collapseNumericView((RandomAccessibleInterval<NativeARGBDoubleType>) img);
    assertEquals(il2.numDimensions(), opr.numDimensions());
    CompositeView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> il2_2 = Views.collapseNumeric((RandomAccessible<NativeARGBDoubleType>) img, 1);
    CompositeView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> opr_2 = ops.transform().collapseNumericView((RandomAccessible<NativeARGBDoubleType>) img, 1);
    assertEquals(il2_2.numDimensions(), opr_2.numDimensions());
}
Also used : NumericComposite(net.imglib2.view.composite.NumericComposite) NativeARGBDoubleType(net.imglib2.type.numeric.NativeARGBDoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 33 with ArrayImgFactory

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

the class CollapseRealViewTest method defaultCollapseRealTest.

@Test
public void defaultCollapseRealTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    CompositeIntervalView<DoubleType, RealComposite<DoubleType>> il2 = Views.collapseReal((RandomAccessibleInterval<DoubleType>) img);
    CompositeIntervalView<DoubleType, RealComposite<DoubleType>> opr = ops.transform().collapseRealView((RandomAccessibleInterval<DoubleType>) img);
    assertEquals(il2.numDimensions(), opr.numDimensions());
    CompositeView<DoubleType, RealComposite<DoubleType>> il2_2 = Views.collapseReal((RandomAccessible<DoubleType>) img, 1);
    CompositeView<DoubleType, RealComposite<DoubleType>> opr_2 = ops.transform().collapseRealView((RandomAccessible<DoubleType>) img, 1);
    assertEquals(il2_2.numDimensions(), opr_2.numDimensions());
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) RealComposite(net.imglib2.view.composite.RealComposite) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 34 with ArrayImgFactory

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

the class CollapseViewTest method collapseRATest.

@Test
public void collapseRATest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());
    CompositeView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views.collapse((RandomAccessible<DoubleType>) img);
    CompositeView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform().collapseView((RandomAccessible<DoubleType>) 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 35 with ArrayImgFactory

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

the class CollapseViewTest method collapseRAITest.

@Test
public void collapseRAITest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());
    CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views.collapse((RandomAccessibleInterval<DoubleType>) img);
    CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform().collapseView((RandomAccessibleInterval<DoubleType>) img);
    assertEquals(il2.numDimensions(), opr.numDimensions());
}
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