use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class JoinTest method testJoin2Inplaces.
@Test
public void testJoin2Inplaces() {
final Op op = ops.op(DefaultJoin2Inplaces.class, in, inplaceOp, inplaceOp);
op.run();
// test
final Cursor<ByteType> c = in.cursor();
while (c.hasNext()) {
assertEquals(2, c.next().get());
}
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class ConditionalTest method testDefault.
@Test
public void testDefault() {
final ByteType out = new ByteType((byte) 10);
final ByteType defaultVal = new ByteType((byte) 100);
assertEquals(10, ((ByteType) ops.run(Default.class, out, new BoolType(true), defaultVal)).get());
assertEquals(100, ((ByteType) ops.run(Default.class, out, new BoolType(false), defaultVal)).get());
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class ConditionalTest method testIf.
@Test
public void testIf() {
final ByteType ifTrueVal = new ByteType((byte) 10);
final ByteType ifFalseVal = new ByteType((byte) 100);
assertEquals(10, ((ByteType) ops.run(If.class, new BoolType(true), ifTrueVal, ifFalseVal)).get());
assertEquals(100, ((ByteType) ops.run(If.class, new BoolType(false), ifTrueVal, ifFalseVal)).get());
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class MapTest method testII.
@Test
public void testII() {
final Img<ByteType> in = generateByteArrayTestImg(true, 10, 10);
final Op nullary = Computers.nullary(ops, Ops.Math.Zero.class, ByteType.class);
ops.run(MapNullaryII.class, in, nullary);
for (final ByteType ps : in) assertEquals(ps.get(), 0);
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class MapTest method testIIAndIIInplaceParallelCellImg.
@Test
public void testIIAndIIInplaceParallelCellImg() {
final Img<ByteType> first = generateByteTestCellImg(true, 40, 20);
final Img<ByteType> firstCopy = first.copy();
final Img<ByteType> second = generateByteTestCellImg(false, 40, 20);
for (final ByteType px : second) px.set((byte) 1);
final Img<ByteType> secondCopy = second.copy();
sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class);
final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces.binary(ops, MapIIAndIIInplaceParallel.class, firstCopy, second, sub);
map.run(firstCopy, second, firstCopy);
map.run(first, secondCopy, secondCopy);
assertImgSubEquals(first, second, firstCopy);
assertImgSubEquals(first, second, secondCopy);
}
Aggregations