@Override public ArrayRandomAccess< T > randomAccess( final Interval interval ) { return randomAccess(); }
@Override public ArrayRandomAccess< T > randomAccess( final Interval interval ) { return randomAccess(); }
@Override public AbstractConvertedRandomAccess< DoubleType, DoubleType > randomAccess() { return new AbstractConvertedRandomAccess< DoubleType, DoubleType >( data.randomAccess() ) { DoubleType t = new DoubleType(); @Override public DoubleType get() { t.set( this.source.get() ); t.mul( this.source.getDoublePosition( this.source.numDimensions() - 1 ) ); return t; } @Override public AbstractConvertedRandomAccess< DoubleType, DoubleType > copy() { return null; } }; }
private ConvolverNativeType( final double[] kernel, final RandomAccess< T > in, final RandomAccess< T > out, final int d, final long lineLength, final T type ) { this.kernel = kernel; this.in = in; this.out = out; this.d = d; k = kernel.length; k1 = k - 1; k1k1 = k1 + k1; linelen = lineLength; final int buflen = 2 * k - 1; final ArrayImg< T, ? > buf = new ArrayImgFactory< T >().create( new long[] { buflen }, type ); b1 = buf.randomAccess().get(); b2 = buf.randomAccess().get(); tmp = type.createVariable(); }
private ConvolverNativeType( final double[] kernel, final RandomAccess< T > in, final RandomAccess< T > out, final int d, final long lineLength, final T type ) { this.kernel = kernel; this.in = in; this.out = out; this.d = d; k = kernel.length; k1 = k - 1; k1k1 = k1 + k1; linelen = lineLength; final int buflen = 2 * k - 1; final ArrayImg< T, ? > buf = new ArrayImgFactory<>( type ).create( buflen ); b1 = buf.randomAccess().get(); b2 = buf.randomAccess().get(); tmp = type.createVariable(); }
private ConvolverNativeTypeBuffered( final double[] kernel, final RandomAccess< T > in, final RandomAccess< T > out, final int d, final long lineLength, final T type ) { this.kernel = kernel; this.in = in; this.out = out; this.d = d; k = kernel.length; k1 = k - 1; k1k1 = k1 + k1; buflen = ( int ) lineLength + 2 * k1k1; final ArrayImg< T, ? > buf = new ArrayImgFactory<>( type ).create( buflen ); b1 = buf.randomAccess().get(); tmp = type.createVariable(); }
private ConvolverNativeTypeBuffered( final double[] kernel, final RandomAccess< T > in, final RandomAccess< T > out, final int d, final long lineLength, final T type ) { this.kernel = kernel; this.in = in; this.out = out; this.d = d; k = kernel.length; k1 = k - 1; k1k1 = k1 + k1; buflen = ( int ) lineLength + 2 * k1k1; final ArrayImg< T, ? > buf = new ArrayImgFactory< T >().create( new long[] { buflen }, type ); b1 = buf.randomAccess().get(); tmp = type.createVariable(); }
public ConvolverNativeType( final Kernel1D kernel, final RandomAccess< ? extends T > in, final RandomAccess< ? extends T > out, final int d, final long lineLength ) { // NB: This constructor is used in ConvolverFactories. It needs to be public and have this exact signature. this.in = in; this.out = out; this.d = d; this.kernel = kernel.fullKernel().clone(); k1k = this.kernel.length; k1k1 = k1k - 1; linelen = lineLength; final T type = out.get(); final ArrayImg< T, ? > buf = new ArrayImgFactory<>( type ).create( k1k + 1 ); b1 = buf.randomAccess().get(); b2 = buf.randomAccess().get(); b1.updateIndex( k1k ); b1.setZero(); }
final RandomAccess<BitType> ra = img.randomAccess(); final byte[] buffer = new byte[in.readInt()]; in.read(buffer);
final BitType t = new BitType(img); img.setLinkedType(t); final RandomAccess<BitType> ra = img.randomAccess(); final byte[] buffer = new byte[in.readInt()]; in.read(buffer);
/** * Fill intImg (a CellContainer with 40x40x40 cells) with data using flat * array iteration order. */ public void fillImage() { final int[] pos = new int[ dimensions.length ]; final RandomAccess< IntType > a = intImg.randomAccess(); final int[] idim = new int[ dimensions.length ]; for ( int d = 0; d < dimensions.length; ++d ) idim[ d ] = ( int ) dimensions[ d ]; for ( int i = 0; i < numValues; ++i ) { IntervalIndexer.indexToPosition( i, idim, pos ); a.setPosition( pos ); a.get().set( intData[ i ] ); } }
final ArrayRandomAccess< UnsignedShortType > ra = img.randomAccess(); final Random ran = new Random(); for ( int i = 0; i < nspots; i++ )
final ArrayRandomAccess< UnsignedShortType > ra = img.randomAccess(); final Random ran = new Random(); for ( int i = 0; i < nspots; i++ )
final ArrayRandomAccess< UnsignedShortType > ra = img.randomAccess(); final Random ran = new Random(); for ( int i = 0; i < nspots; i++ )
final ArrayRandomAccess< UnsignedShortType > ra = img.randomAccess(); final Random ran = new Random(); for ( int i = 0; i < nspots; i++ )
public static void testEquality( final ArrayImg< ? extends RealType< ? >, ? > img, final float[] array ) { Assert.assertEquals( array.length, Intervals.numElements( img ) ); final ArrayRandomAccess< ? extends RealType< ? > > access = img.randomAccess(); for ( int i = 0; i < array.length; ++i ) { IntervalIndexer.indexToPosition( i, img, access ); Assert.assertEquals( array[ i ], access.get().getRealDouble(), 0.0 ); } }
public static void testEquality( final ArrayImg< ? extends RealType< ? >, ? > img, final double[] array ) { Assert.assertEquals( array.length, Intervals.numElements( img ) ); final ArrayRandomAccess< ? extends RealType< ? > > access = img.randomAccess(); for ( int i = 0; i < array.length; ++i ) { IntervalIndexer.indexToPosition( i, img, access ); Assert.assertEquals( array[ i ], access.get().getRealDouble(), 0.0 ); } }
@Before public void createSourceData() { dimensions = new long[] { 23, 31, 11, 7, 3 }; intervalFast = new FinalInterval( new long[] { dimensions[ 0 ], dimensions[ 1 ], 5, 1, 1 } ); intervalFastPart = new FinalInterval( new long[] { dimensions[ 0 ], 2, 3, 1, 1 } ); intervalShifted = new FinalInterval( new long[] { 0, 0, 3, 5, 1 }, new long[] { dimensions[ 0 ] - 1, dimensions[ 1 ] - 1, 4, 5, 1 } ); numValues = 1; for ( int d = 0; d < dimensions.length; ++d ) numValues *= dimensions[ d ]; intData = new int[ numValues ]; intDataSum = 0; Random random = new Random( 0 ); for ( int i = 0; i < numValues; ++i ) { intData[ i ] = random.nextInt(); intDataSum += intData[ i ]; } img = new ArrayImgFactory<>( new IntType() ).create( dimensions ); long[] pos = new long[ dimensions.length ]; RandomAccess< IntType > a = img.randomAccess(); for ( int i = 0; i < numValues; ++i ) { IntervalIndexer.indexToPosition( i, dimensions, pos ); a.setPosition( pos ); a.get().set( intData[ i ] ); } }
@SuppressWarnings( "unchecked" ) public void setUp() { dimensions = new long[] { 207, 103, 1021 }; array1 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory<>( new IntType() ).create( dimensions ); array2 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory<>( new IntType() ).create( dimensions ); cell = ( CellImg< IntType, IntArray > ) new CellImgFactory<>( new IntType() ).create( dimensions ); // fill intData with random values numValues = 1; for ( int d = 0; d < dimensions.length; ++d ) numValues *= dimensions[ d ]; intData = new int[ numValues ]; final Random random = new Random( 0 ); for ( int i = 0; i < numValues; ++i ) intData[ i ] = random.nextInt(); // copy intData to array1 final long[] pos = new long[ dimensions.length ]; final RandomAccess< IntType > a = array1.randomAccess(); for ( int i = 0; i < numValues; ++i ) { IntervalIndexer.indexToPosition( i, dimensions, pos ); a.setPosition( pos ); a.get().set( intData[ i ] ); } }
@SuppressWarnings( "unchecked" ) @Before public void setUp() { dimensions = new long[] { 207, 103 }; array1 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory<>( new IntType() ).create( dimensions ); array2 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory<>( new IntType() ).create( dimensions ); cell = ( CellImg< IntType, IntArray > ) new CellImgFactory<>( new IntType() ).create( dimensions ); // fill intData with random values numValues = 1; for ( int d = 0; d < dimensions.length; ++d ) numValues *= dimensions[ d ]; intData = new int[ numValues ]; final Random random = new Random( 0 ); for ( int i = 0; i < numValues; ++i ) intData[ i ] = random.nextInt(); // copy intData to array1 final long[] pos = new long[ dimensions.length ]; final RandomAccess< IntType > a = array1.randomAccess(); for ( int i = 0; i < numValues; ++i ) { IntervalIndexer.indexToPosition( i, dimensions, pos ); a.setPosition( pos ); a.get().set( intData[ i ] ); } }