net.imglib2.img.basictypeaccess.array.ByteArray Java Examples
The following examples show how to use
net.imglib2.img.basictypeaccess.array.ByteArray.
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: IntegralImgTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImgLarge() { final long[] dims = new long[] { 3, 3 }; final byte[] array = new byte[9]; array[0] = (byte) 40; array[1] = (byte) 40; array[2] = (byte) 20; array[3] = (byte) 40; array[4] = (byte) 40; array[5] = (byte) 20; array[6] = (byte) 20; array[7] = (byte) 20; array[8] = (byte) 100; return ArrayImgs.bytes(array, dims); }
Example #2
Source File: IntegralCursorTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImg() { final long[] dims = new long[] { 3, 3 }; final byte[] array = new byte[9]; array[0] = (byte) 1; array[1] = (byte) 2; array[2] = (byte) 3; array[3] = (byte) 4; array[4] = (byte) 5; array[5] = (byte) 6; array[6] = (byte) 7; array[7] = (byte) 8; array[8] = (byte) 9; return ArrayImgs.bytes(array, dims); }
Example #3
Source File: SquareIntegralImgTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImg() { final long[] dims = new long[] { 3, 3 }; final byte[] array = new byte[9]; array[0] = (byte) 4; array[1] = (byte) 4; array[2] = (byte) 2; array[3] = (byte) 4; array[4] = (byte) 4; array[5] = (byte) 2; array[6] = (byte) 2; array[7] = (byte) 2; array[8] = (byte) 6; return ArrayImgs.bytes(array, dims); }
Example #4
Source File: LocalThresholdTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImgLarge() { final long[] dims = new long[] { 3, 3 }; final byte[] array = new byte[9]; array[0] = (byte) 40; array[1] = (byte) 40; array[2] = (byte) 20; array[3] = (byte) 40; array[4] = (byte) 40; array[5] = (byte) 20; array[6] = (byte) 20; array[7] = (byte) 20; array[8] = (byte) 100; return ArrayImgs.bytes(array, dims); }
Example #5
Source File: AbstractFeatureTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
/** * @param dim a long array with the desired dimensions of the image * @param constValue constant image value * @return an {@link Img} of {@link UnsignedByteType} filled with a constant * value. */ public Img<UnsignedByteType> getConstantUnsignedByteImg(final long[] dim, final int constValue) { final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes( dim); final UnsignedByteType type = img.firstElement(); if (constValue < type.getMinValue() || constValue >= type.getMaxValue()) { throw new IllegalArgumentException("Can't create image for constant [" + constValue + "]"); } final ArrayCursor<UnsignedByteType> cursor = img.cursor(); while (cursor.hasNext()) { cursor.next().set(constValue); } return img; }
Example #6
Source File: SliceTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
private void testXYZCropping(int t) { Img<ByteType> inSequence = ArrayImgs.bytes(20, 20, 21, t); ArrayImg<ByteType, ByteArray> outSequence = ArrayImgs.bytes(20, 20, 21, t); // fill array img with values (plane position = value in px); for (final Cursor<ByteType> cur = inSequence.cursor(); cur.hasNext();) { cur.fwd(); cur.get().set((byte) cur.getIntPosition(2)); } // selected interval XYZ final int[] xyAxis = new int[] { 0, 1, 2 }; ops.run(SliceRAI2RAI.class, outSequence, inSequence, new DummyOp(), xyAxis); for (final Cursor<ByteType> cur = outSequence.cursor(); cur.hasNext();) { cur.fwd(); assertEquals(cur.getIntPosition(2), cur.get().getRealDouble(), 0); } }
Example #7
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testSameSeed() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> inputImage = ArrayImgs.unsignedBytes( new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 2, 2 }; long seed = 0xdeadbeef; ShuffledView<UnsignedByteType> shuffled01 = new ShuffledView<>(inputImage, blockSize, seed); ShuffledView<UnsignedByteType> shuffled02 = new ShuffledView<>(inputImage, blockSize, seed); assertIterationsEqual(Views.iterable(shuffled01), Views.iterable( shuffled02)); }
Example #8
Source File: LinearIntensityMap.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public static void main( final String[] args ) { new ImageJ(); final double[] coefficients = new double[]{ 0, 2, 4, 8, 1, 1, 1, 1, 1, 10, 5, 1, 1, 1, 1, 1, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150 }; final LinearIntensityMap< DoubleType > transform = new LinearIntensityMap< DoubleType >( ArrayImgs.doubles( coefficients, 4, 4, 2 ) ); //final ImagePlus imp = new ImagePlus( "http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png" ); final ImagePlus imp1 = new ImagePlus( "http://fly.mpi-cbg.de/~saalfeld/Pictures/norway.jpg"); final ArrayImg< FloatType, FloatArray > image1 = ArrayImgs.floats( ( float[] )imp1.getProcessor().convertToFloatProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< UnsignedByteType, ByteArray > image2 = ArrayImgs.unsignedBytes( ( byte[] )imp1.getProcessor().convertToByteProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< UnsignedShortType, ShortArray > image3 = ArrayImgs.unsignedShorts( ( short[] )imp1.getProcessor().convertToShortProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< ARGBType, IntArray > image4 = ArrayImgs.argbs( ( int[] )imp1.getProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); ImageJFunctions.show( ArrayImgs.doubles( coefficients, 4, 4, 2 ) ); transform.run( image1 ); transform.run( image2 ); transform.run( image3 ); transform.run( image4 ); ImageJFunctions.show( image1 ); ImageJFunctions.show( image2 ); ImageJFunctions.show( image3 ); ImageJFunctions.show( image4 ); }
Example #9
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.MultiplyByte.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyByte.class, net.imagej.ops.math.ConstantToArrayImageP.MultiplyUnsignedByte.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyUnsignedByte.class }) public <B extends GenericByteType<B>> ArrayImg<B, ByteArray> multiply( final ArrayImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final ArrayImg<B, ByteArray> result = (ArrayImg<B, ByteArray>) ops().run( Ops.Math.Multiply.NAME, image, value); return result; }
Example #10
Source File: SCIFIOCellImgFactory.java From scifio with BSD 2-Clause "Simplified" License | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) private <A extends ArrayDataAccess<A>> SCIFIOCellLoader<T, A> createCellLoader(final NativeTypeFactory<T, A> typeFactory) { switch (typeFactory.getPrimitiveType()) { case BYTE: return new SCIFIOCellLoader(new ByteArrayLoader(reader, subregion), o -> new ByteArray((byte[]) o)); case CHAR: return new SCIFIOCellLoader(new CharArrayLoader(reader, subregion), o -> new CharArray((char[]) o)); case DOUBLE: return new SCIFIOCellLoader(new DoubleArrayLoader(reader, subregion), o -> new DoubleArray((double[]) o)); case FLOAT: return new SCIFIOCellLoader(new FloatArrayLoader(reader, subregion), o -> new FloatArray((float[]) o)); case INT: return new SCIFIOCellLoader(new IntArrayLoader(reader, subregion), o -> new IntArray((int[]) o)); case LONG: return new SCIFIOCellLoader(new LongArrayLoader(reader, subregion), o -> new LongArray((long[]) o)); case SHORT: return new SCIFIOCellLoader(new ShortArrayLoader(reader, subregion), o -> new ShortArray((short[]) o)); default: throw new IllegalArgumentException(); } }
Example #11
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<UnsignedByteType, ByteArray> generateUnsignedByteArrayTestImg( final boolean fill, final long... dims) { final byte[] array = new byte[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (byte) pseudoRandom(); } } return ArrayImgs.unsignedBytes(array, dims); }
Example #12
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<ByteType, ByteArray> generateByteArrayTestImg( final boolean fill, final long... dims) { final byte[] array = new byte[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (byte) pseudoRandom(); } } return ArrayImgs.bytes(array, dims); }
Example #13
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testAllShuffle() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> actualInputImage = ArrayImgs .unsignedBytes(new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 1, 1 }; long seed = 0xdeadbeef; ShuffledView<UnsignedByteType> shuffled = new ShuffledView<>( actualInputImage, blockSize, seed); ArrayImg<UnsignedByteType, ByteArray> expected = ArrayImgs.unsignedBytes( new byte[] { // 33, 19, 14, 36, 31, 32, // 34, 21, 17, 30, 35, 1, // 7, 28, 29, 20, 9, 12, // 5, 18, 27, 3, 8, 2, // 11, 25, 4, 24, 26, 6, // 23, 10, 13, 15, 22, 16 // }, 6, 6); assertIterationsEqual(expected, Views.iterable(shuffled)); }
Example #14
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testNonSquareBlocks2() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> actualInputImage = ArrayImgs .unsignedBytes(new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 3, 2 }; long seed = 0xdeadbeef; ShuffledView<UnsignedByteType> shuffled = new ShuffledView<>( actualInputImage, blockSize, seed); ArrayImg<UnsignedByteType, ByteArray> expected = ArrayImgs.unsignedBytes( new byte[] { // 25, 26, 27, 13, 14, 15, // 31, 32, 33, 19, 20, 21, // 1, 2, 3, 28, 29, 30, // 7, 8, 9, 34, 35, 36, // 4, 5, 6, 16, 17, 18, // 10, 11, 12, 22, 23, 24 // }, 6, 6); assertIterationsEqual(expected, Views.iterable(shuffled)); }
Example #15
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testNonSquareBlocks1() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> actualInputImage = ArrayImgs .unsignedBytes(new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 2, 3 }; long seed = 0xdeadbeef; ShuffledView<UnsignedByteType> shuffled = new ShuffledView<>( actualInputImage, blockSize, seed); ArrayImg<UnsignedByteType, ByteArray> expected = ArrayImgs.unsignedBytes( new byte[] { // 21, 22, 5, 6, 1, 2, // 27, 28, 11, 12, 7, 8, // 33, 34, 17, 18, 13, 14, // 23, 24, 3, 4, 19, 20, // 29, 30, 9, 10, 25, 26, // 35, 36, 15, 16, 31, 32 // }, 6, 6); assertIterationsEqual(expected, Views.iterable(shuffled)); }
Example #16
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public <T extends RealType<T>, U extends RealType<U>> void testDiffSeeds() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> inputImage = ArrayImgs.unsignedBytes( new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 2, 2 }; long seed1 = 0xdeadbeef; long seed2 = 0x22334455; ShuffledView<UnsignedByteType> shuffled1 = new ShuffledView<>(inputImage, blockSize, seed1); ArrayImg<UnsignedByteType, ByteArray> expected1 = ArrayImgs.unsignedBytes( new byte[] { // 27, 28, 3, 4, 15, 16, // 33, 34, 9, 10, 21, 22, // 5, 6, 17, 18, 13, 14, // 11, 12, 23, 24, 19, 20, // 1, 2, 29, 30, 25, 26, // 7, 8, 35, 36, 31, 32 // }, 6, 6); ShuffledView<UnsignedByteType> shuffled2 = new ShuffledView<>(inputImage, blockSize, seed2); ArrayImg<UnsignedByteType, ByteArray> expected2 = ArrayImgs.unsignedBytes( new byte[] { // 29, 30, 25, 26, 17, 18, // 35, 36, 31, 32, 23, 24, // 5, 6, 27, 28, 15, 16, // 11, 12, 33, 34, 21, 22, // 3, 4, 13, 14, 1, 2, // 9, 10, 19, 20, 7, 8 // }, 6, 6); assertIterationsEqual(expected1, Views.iterable(shuffled1)); assertIterationsEqual(expected2, Views.iterable(shuffled2)); }
Example #17
Source File: ShuffledViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testShuffleView() { // FIRST - create 6x6 image filled with known values ArrayImg<UnsignedByteType, ByteArray> actualInputImage = ArrayImgs .unsignedBytes(new byte[] { // 1, 2, 3, 4, 5, 6, // 7, 8, 9, 10, 11, 12, // 13, 14, 15, 16, 17, 18, // 19, 20, 21, 22, 23, 24, // 25, 26, 27, 28, 29, 30, // 31, 32, 33, 34, 35, 36 // }, 6, 6); int[] blockSize = { 2, 2 }; long seed = 0xdeadbeef; ShuffledView<UnsignedByteType> shuffled = new ShuffledView<>( actualInputImage, blockSize, seed); ArrayImg<UnsignedByteType, ByteArray> expected = ArrayImgs.unsignedBytes( new byte[] { // 27, 28, 3, 4, 15, 16, // 33, 34, 9, 10, 21, 22, // 5, 6, 17, 18, 13, 14, // 11, 12, 23, 24, 19, 20, // 1, 2, 29, 30, 25, 26, // 7, 8, 35, 36, 31, 32 // }, 6, 6); assertIterationsEqual(expected, Views.iterable(shuffled)); }
Example #18
Source File: AbstractFeatureTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
/** * @param dim dimensions of the image * @param radii of the ellipse * @param offset of the ellipse * @return an {@link Img} of {@link BitType} filled with a ellipse */ @SuppressWarnings({ "deprecation" }) public Img<UnsignedByteType> getEllipsedBitImage(final long[] dim, final double[] radii, final double[] offset) { // create empty bittype image with desired dimensions final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes( dim); // create ellipse final EllipseRegionOfInterest ellipse = new EllipseRegionOfInterest(); ellipse.setRadii(radii); // set origin in the center of image final double[] origin = new double[dim.length]; for (int i = 0; i < dim.length; i++) origin[i] = dim[i] / 2; ellipse.setOrigin(origin); // get iterable intervall and cursor of ellipse final IterableInterval<UnsignedByteType> ii = ellipse .getIterableIntervalOverROI(img); final Cursor<UnsignedByteType> cursor = ii.cursor(); // fill image with ellipse while (cursor.hasNext()) { cursor.next(); cursor.get().set(255); } return img; }
Example #19
Source File: AbstractFeatureTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
/** * @param dim a long array with the desired dimensions of the image * @return an {@link Img} of {@link UnsignedByteType} filled with random * values. */ public Img<UnsignedByteType> getRandomUnsignedByteImg(final long[] dim) { final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes( dim); final UnsignedByteType type = img.firstElement(); final ArrayCursor<UnsignedByteType> cursor = img.cursor(); while (cursor.hasNext()) { cursor.next().set(rand.nextInt((int) type.getMaxValue())); } return img; }
Example #20
Source File: LocalThresholdTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImgSmall() { final long[] dims = new long[] { 2, 2 }; final byte[] array = new byte[4]; array[0] = (byte) 10; array[1] = (byte) 20; array[2] = (byte) 30; array[3] = (byte) 40; return ArrayImgs.bytes(array, dims); }
Example #21
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.SubtractByte.class, net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedByte.class }) public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> subtract( final PlanarImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run( Ops.Math.Subtract.NAME, image, value); return result; }
Example #22
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.SubtractByte.class, net.imagej.ops.math.ConstantToArrayImage.SubtractByte.class, net.imagej.ops.math.ConstantToArrayImageP.SubtractUnsignedByte.class, net.imagej.ops.math.ConstantToArrayImage.SubtractUnsignedByte.class }) public <B extends GenericByteType<B>> ArrayImg<B, ByteArray> subtract( final ArrayImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final ArrayImg<B, ByteArray> result = (ArrayImg<B, ByteArray>) ops().run( Ops.Math.Subtract.NAME, image, value); return result; }
Example #23
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.MultiplyByte.class, net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedByte.class }) public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> multiply( final PlanarImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #24
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.AddByte.class, net.imagej.ops.math.ConstantToArrayImage.AddByte.class, net.imagej.ops.math.ConstantToArrayImageP.AddUnsignedByte.class, net.imagej.ops.math.ConstantToArrayImage.AddUnsignedByte.class }) public <B extends GenericByteType<B>> ArrayImg<B, ByteArray> add( final ArrayImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final ArrayImg<B, ByteArray> result = (ArrayImg<B, ByteArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #25
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideByte.class, net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedByte.class }) public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> divide( final PlanarImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #26
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideByte.class, net.imagej.ops.math.ConstantToArrayImage.DivideByte.class, net.imagej.ops.math.ConstantToArrayImageP.DivideUnsignedByte.class, net.imagej.ops.math.ConstantToArrayImage.DivideUnsignedByte.class }) public <B extends GenericByteType<B>> ArrayImg<B, ByteArray> divide( final ArrayImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final ArrayImg<B, ByteArray> result = (ArrayImg<B, ByteArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #27
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddByte.class, net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedByte.class }) public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> add( final PlanarImg<B, ByteArray> image, final byte value) { @SuppressWarnings("unchecked") final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #28
Source File: AddOpBenchmarkTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Test public void fTestAddConstantToByteArray() { new org.scijava.util.ByteArray(arrIn).stream().map(v -> v + 10).toArray(); }
Example #29
Source File: ByteArrayLoader.java From scifio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public ByteArray emptyArray(final int entities) { return new ByteArray(entities); }