net.imglib2.img.basictypeaccess.array.LongArray Java Examples
The following examples show how to use
net.imglib2.img.basictypeaccess.array.LongArray.
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: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
public ArrayImg<UnsignedVariableBitLengthType, LongArray> generateUnsignedVariableBitLengthTypeArrayTestImg(final boolean fill, final int nbits, final long... dims) { final long[] array = new long[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (long) (((pseudoRandom() / Integer.MAX_VALUE)) % (Math.pow(2, nbits))) ; } } final LongArray l = new LongArray(array); return ArrayImgs.unsignedVariableBitLengths(l, nbits, dims); }
Example #2
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.MultiplyLong.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyLong.class, net.imagej.ops.math.ConstantToArrayImageP.MultiplyUnsignedLong.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyUnsignedLong.class }) public <N extends NativeType<N>> ArrayImg<N, LongArray> multiply( final ArrayImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run( Ops.Math.Multiply.NAME, image, value); return result; }
Example #3
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 #4
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<UnsignedLongType, LongArray> generateUnsignedLongArrayTestImg( final boolean fill, final long... dims) { final long[] array = new long[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (long) (pseudoRandom() / Integer.MAX_VALUE); } } return ArrayImgs.unsignedLongs(array, dims); }
Example #5
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<LongType, LongArray> generateLongArrayTestImg( final boolean fill, final long... dims) { final long[] array = new long[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (long) (pseudoRandom() / Integer.MAX_VALUE); } } return ArrayImgs.longs(array, dims); }
Example #6
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<Unsigned128BitType, LongArray> generateUnsigned128BitArrayTestImg(final boolean fill, final long... dims) { ArrayImg<Unsigned128BitType, LongArray> bits = ArrayImgs.unsigned128Bits( dims); if (fill) { MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece); for (Unsigned128BitType b : bits) { BigInteger big = BigInteger.valueOf(betterRNG.nextLong()); b.set(big); } } return bits; }
Example #7
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<Unsigned12BitType, LongArray> generateUnsigned12BitArrayTestImg(final boolean fill, final long... dims) { ArrayImg<Unsigned12BitType, LongArray> bits = ArrayImgs.unsigned12Bits( dims); if (fill) { MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece); for (Unsigned12BitType b : bits) { b.set(betterRNG.nextLong()); } } return bits; }
Example #8
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<Unsigned4BitType, LongArray> generateUnsigned4BitArrayTestImg( final boolean fill, final long... dims) { ArrayImg<Unsigned4BitType, LongArray> bits = ArrayImgs.unsigned4Bits(dims); if (fill) { MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece); for (Unsigned4BitType b : bits) { b.set(betterRNG.nextLong()); } } return bits; }
Example #9
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<Unsigned2BitType, LongArray> generateUnsigned2BitArrayTestImg( final boolean fill, final long... dims) { ArrayImg<Unsigned2BitType, LongArray> bits = ArrayImgs.unsigned2Bits(dims); if (fill) { MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece); for (Unsigned2BitType b : bits) { b.set(betterRNG.nextLong()); } } return bits; }
Example #10
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<BitType, LongArray> generateBitArrayTestImg( final boolean fill, final long... dims) { ArrayImg<BitType, LongArray> bits = ArrayImgs.bits(dims); if (fill) { MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece); for (BitType b : bits) { b.set(betterRNG.nextBoolean()); } } return bits; }
Example #11
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.SubtractLong.class, net.imagej.ops.math.ConstantToArrayImage.SubtractLong.class, net.imagej.ops.math.ConstantToArrayImageP.SubtractUnsignedLong.class, net.imagej.ops.math.ConstantToArrayImage.SubtractUnsignedLong.class }) public <N extends NativeType<N>> ArrayImg<N, LongArray> subtract( final ArrayImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run( Ops.Math.Subtract.NAME, image, value); return result; }
Example #12
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.MultiplyLong.class, net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedLong.class }) public <N extends NativeType<N>> PlanarImg<N, LongArray> multiply( final PlanarImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run( Ops.Math.Multiply.NAME, image, value); return result; }
Example #13
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.AddLong.class, net.imagej.ops.math.ConstantToArrayImage.AddLong.class, net.imagej.ops.math.ConstantToArrayImageP.AddUnsignedLong.class, net.imagej.ops.math.ConstantToArrayImage.AddUnsignedLong.class }) public <N extends NativeType<N>> ArrayImg<N, LongArray> add( final ArrayImg<LongType, LongArray> image, final long value) { @SuppressWarnings("unchecked") final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #14
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideLong.class, net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedLong.class }) public <N extends NativeType<N>> PlanarImg<N, LongArray> divide( final PlanarImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #15
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideLong.class, net.imagej.ops.math.ConstantToArrayImage.DivideLong.class, net.imagej.ops.math.ConstantToArrayImageP.DivideUnsignedLong.class, net.imagej.ops.math.ConstantToArrayImage.DivideUnsignedLong.class }) public <N extends NativeType<N>> ArrayImg<N, LongArray> divide( final ArrayImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #16
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddLong.class, net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedLong.class }) public <N extends NativeType<N>> PlanarImg<N, LongArray> add( final PlanarImg<N, LongArray> image, final long value) { @SuppressWarnings("unchecked") final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #17
Source File: AccessedBlocksRandomAccessible.java From paintera with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) { final long[] dimensions = {10, 7}; final int[] blockSize = {5, 3}; final ArrayImg<LongType, LongArray> dummy = ArrayImgs.longs(dimensions); final AccessedBlocksRandomAccessible<LongType> tracker = new AccessedBlocksRandomAccessible<>( dummy, new CellGrid(dimensions, blockSize) ); System.out.println(Arrays.toString(tracker.listBlocks())); final RandomAccess<LongType> ra = tracker.randomAccess(); System.out.println(Arrays.toString(tracker.listBlocks())); ra.get(); System.out.println(Arrays.toString(tracker.listBlocks())); ra.move(4, 0); ra.get(); System.out.println(Arrays.toString(tracker.listBlocks())); ra.fwd(0); ra.get(); System.out.println(Arrays.toString(tracker.listBlocks())); ra.move(6, 1); ra.get(); System.out.println(Arrays.toString(tracker.listBlocks())); }
Example #18
Source File: LongArrayLoader.java From scifio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public LongArray emptyArray(final int entities) { return new LongArray(entities); }