Java Code Examples for net.imglib2.img.Img#copy()
The following examples show how to use
net.imglib2.img.Img#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIIAndIIInplace() { final Img<ByteType> first = generateByteArrayTestImg(true, 10, 10); final Img<ByteType> firstCopy = first.copy(); final Img<ByteType> second = generateByteArrayTestImg(false, 10, 10); for (final ByteType px : second) px.set((byte) 1); final Img<ByteType> secondCopy = second.copy(); final Img<ByteType> secondDiffDims = generateByteArrayTestImg(false, 10, 10, 2); sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class); final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces .binary(ops, MapIIAndIIInplace.class, firstCopy, second, sub); map.run(firstCopy, second, firstCopy); map.run(first, secondCopy, secondCopy); assertImgSubEquals(first, second, firstCopy); assertImgSubEquals(first, second, secondCopy); // Expect exception when in2 has different dimensions thrown.expect(IllegalArgumentException.class); ops.op(MapIIAndIIInplace.class, first, secondDiffDims, sub); }
Example 2
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIIAndIIInplaceParallel() { final Img<ByteType> first = generateByteArrayTestImg(true, 10, 10); final Img<ByteType> firstCopy = first.copy(); final Img<ByteType> second = generateByteArrayTestImg(false, 10, 10); for (final ByteType px : second) px.set((byte) 1); final Img<ByteType> secondCopy = second.copy(); final Img<ByteType> secondDiffDims = generateByteArrayTestImg(false, 10, 10, 2); 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); // Expect exception when in2 has different dimensions thrown.expect(IllegalArgumentException.class); ops.op(MapIIAndIIInplaceParallel.class, first, secondDiffDims, sub); }
Example 3
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@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); }
Example 4
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testIIInplaceParallel() { final Img<ByteType> arg = generateByteArrayTestImg(true, 10, 10); final Img<ByteType> argCopy = arg.copy(); sub = Inplaces.unary(ops, Ops.Math.Subtract.class, ByteType.class, new ByteType((byte) 1)); ops.run(MapIIInplaceParallel.class, argCopy, sub); assertImgSubOneEquals(arg, argCopy); }
Example 5
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testIterableInplace() { final Img<ByteType> arg = generateByteArrayTestImg(true, 10, 10); final Img<ByteType> argCopy = arg.copy(); sub = Inplaces.unary(ops, Ops.Math.Subtract.class, ByteType.class, new ByteType((byte) 1)); ops.run(MapIterableInplace.class, argCopy, sub); assertImgSubOneEquals(arg, argCopy); }
Example 6
Source File: MapTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testIIInplaceParallelCellImg() { final Img<ByteType> arg = generateByteTestCellImg(true, 40, 20); final Img<ByteType> argCopy = arg.copy(); sub = Inplaces.unary(ops, Ops.Math.Subtract.class, ByteType.class, new ByteType((byte) 1)); ops.run(MapIIInplaceParallel.class, argCopy, sub); assertImgSubOneEquals(arg, argCopy); }