use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class CollapseViewTest method defaultCollapseTest.
@Test
public void defaultCollapseTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views.collapse(img);
CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform().collapseView(img);
assertEquals(il2.numDimensions(), opr.numDimensions());
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class ExtendRandomViewTest method extendRandomTest.
@Test
public void extendRandomTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
OutOfBounds<DoubleType> il2 = Views.extendRandom(img, 0, 0).randomAccess();
OutOfBounds<DoubleType> opr = ops.transform().extendRandomView(img, 0, 0).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);
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class ExtendValueViewTest method extendValueTest.
@Test
public void extendValueTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
OutOfBounds<DoubleType> il2 = Views.extendValue(img, new DoubleType(0)).randomAccess();
OutOfBounds<DoubleType> opr = ops.transform().extendValueView(img, new DoubleType(0)).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);
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class CachedOpEnvironmentTest method testOptionalParameter.
@Test
public void testOptionalParameter() {
UnaryFunctionOp<DoubleType, Object> f = Functions.unary(env, OptionalParameterOp.class, Object.class, DoubleType.class);
Object result = f.calculate(new DoubleType());
UnaryFunctionOp<DoubleType, Object> f2 = Functions.unary(env, OptionalParameterOp.class, Object.class, DoubleType.class);
Object sameResult = f2.calculate(new DoubleType());
assertSame(result, sameResult);
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class CreateImgTest method testImageFactory.
@Test
public void testImageFactory() {
final Dimensions dim = new FinalDimensions(10, 10, 10);
@SuppressWarnings("unchecked") final Img<DoubleType> arrayImg = (Img<DoubleType>) ops.run(CreateImgFromDimsAndType.class, dim, new DoubleType(), new ArrayImgFactory<DoubleType>());
final Class<?> arrayFactoryClass = arrayImg.factory().getClass();
assertEquals("Image Factory: ", ArrayImgFactory.class, arrayFactoryClass);
@SuppressWarnings("unchecked") final Img<DoubleType> cellImg = (Img<DoubleType>) ops.run(CreateImgFromDimsAndType.class, dim, new DoubleType(), new CellImgFactory<DoubleType>());
final Class<?> cellFactoryClass = cellImg.factory().getClass();
assertEquals("Image Factory: ", CellImgFactory.class, cellFactoryClass);
}
Aggregations