net.imglib2.img.basictypeaccess.array.IntArray Java Examples
The following examples show how to use
net.imglib2.img.basictypeaccess.array.IntArray.
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: ConsensusWarpFieldBuilder.java From render with GNU General Public License v2.0 | 6 votes |
private int[] buildModelIndexGrid() { final int[] targetCellIndexes = new int[getNumberOfCells()]; final ArrayImg<ARGBType, IntArray> target = ArrayImgs.argbs(targetCellIndexes, columnCount, rowCount); final KDTree<ARGBType> kdTree = new KDTree<>(consensusSetIndexSamples); final NearestNeighborSearch<ARGBType> nnSearchSamples = new NearestNeighborSearchOnKDTree<>(kdTree); final Cursor<ARGBType> targetCursor = target.localizingCursor(); Sampler<ARGBType> sampler; ARGBType sampleItem; ARGBType targetItem; while (targetCursor.hasNext()) { targetCursor.fwd(); nnSearchSamples.search(targetCursor); sampler = nnSearchSamples.getSampler(); sampleItem = sampler.get(); targetItem = targetCursor.get(); targetItem.set(sampleItem); } return targetCellIndexes; }
Example #2
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.MultiplyInt.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyInt.class, net.imagej.ops.math.ConstantToArrayImageP.MultiplyUnsignedInt.class, net.imagej.ops.math.ConstantToArrayImage.MultiplyUnsignedInt.class }) public <I extends GenericIntType<I>> ArrayImg<I, IntArray> multiply( final ArrayImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final ArrayImg<I, IntArray> result = (ArrayImg<I, IntArray>) ops().run( Ops.Math.Multiply.NAME, image, value); return result; }
Example #3
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddInt.class, net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedInt.class }) public <I extends GenericIntType<I>> PlanarImg<I, IntArray> add( final PlanarImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #4
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideInt.class, net.imagej.ops.math.ConstantToArrayImage.DivideInt.class, net.imagej.ops.math.ConstantToArrayImageP.DivideUnsignedInt.class, net.imagej.ops.math.ConstantToArrayImage.DivideUnsignedInt.class }) public <I extends GenericIntType<I>> ArrayImg<I, IntArray> divide( final ArrayImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final ArrayImg<I, IntArray> result = (ArrayImg<I, IntArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #5
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideInt.class, net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedInt.class }) public <I extends GenericIntType<I>> PlanarImg<I, IntArray> divide( final PlanarImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run( Ops.Math.Divide.NAME, image, value); return result; }
Example #6
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.AddInt.class, net.imagej.ops.math.ConstantToArrayImage.AddInt.class, net.imagej.ops.math.ConstantToArrayImageP.AddUnsignedInt.class, net.imagej.ops.math.ConstantToArrayImage.AddUnsignedInt.class }) public <I extends GenericIntType<I>> ArrayImg<I, IntArray> add( final ArrayImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final ArrayImg<I, IntArray> result = (ArrayImg<I, IntArray>) ops().run( Ops.Math.Add.NAME, image, value); return result; }
Example #7
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.MultiplyInt.class, net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedInt.class }) public <I extends GenericIntType<I>> PlanarImg<I, IntArray> multiply( final PlanarImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run( Ops.Math.Multiply.NAME, image, value); return result; }
Example #8
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.SubtractInt.class, net.imagej.ops.math.ConstantToArrayImage.SubtractInt.class, net.imagej.ops.math.ConstantToArrayImageP.SubtractUnsignedInt.class, net.imagej.ops.math.ConstantToArrayImage.SubtractUnsignedInt.class }) public <I extends GenericIntType<I>> ArrayImg<I, IntArray> subtract( final ArrayImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final ArrayImg<I, IntArray> result = (ArrayImg<I, IntArray>) ops().run( Ops.Math.Subtract.NAME, image, value); return result; }
Example #9
Source File: MathNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.SubtractInt.class, net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedInt.class }) public <I extends GenericIntType<I>> PlanarImg<I, IntArray> subtract( final PlanarImg<I, IntArray> image, final int value) { @SuppressWarnings("unchecked") final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run( Ops.Math.Subtract.NAME, image, value); return result; }
Example #10
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<IntType, IntArray> generateIntArrayTestImg(final boolean fill, final long... dims) { final int[] array = new int[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (int) pseudoRandom() / (int) Integer.MAX_VALUE; } } return ArrayImgs.ints(array, dims); }
Example #11
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<UnsignedIntType, IntArray> generateUnsignedIntArrayTestImg( final boolean fill, final long... dims) { final int[] array = new int[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (int) pseudoRandom() / (int) Integer.MAX_VALUE; } } return ArrayImgs.unsignedInts(array, dims); }
Example #12
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 #13
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 #14
Source File: BufferExposingWritableImage.java From paintera with GNU General Public License v2.0 | 4 votes |
public ArrayImg<ARGBType, IntAccess> asArrayImg() { return ArrayImgs.argbs(new IntArray(store), (long) getWidth(), (long) getHeight()); }
Example #15
Source File: IntArrayLoader.java From scifio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public IntArray emptyArray(final int entities) { return new IntArray(entities); }