randomAccess.setPosition( zindex, 2 ); final File filePath = new File( imageIndexFile.getParentFile(), filename ); final ImagePlus imp = new ImagePlus( filePath.getAbsolutePath() ); randomAccess.setPosition( offset[ 0 ] + cursor.getLongPosition( 0 ), 0 ); randomAccess.setPosition( offset[ 1 ] + cursor.getLongPosition( 1 ), 1 ); randomAccess.get().set( cursor.get() );
randomAccessLeft.setPositionDim0( 0 ); randomAccessLeft.get().add( copy ); randomAccessLeft.setPositionDim0( -1 ); randomAccessLeft.fwdDim0(); randomAccessLeft.get().add( tmp ); randomAccessLeft.setPositionDim0( n ); randomAccessRight.setPositionDim0( n + kernelSizeMinus1 ); randomAccessLeft.get().add( tmp ); randomAccessRight.get().add( tmp ); randomAccessLeft.fwdDim0(); randomAccessRight.bckDim0(); randomAccessLeft.get().add( tmp ); randomAccessRight.get().add( tmp ); randomAccessLeft.fwdDim0(); randomAccessLeft.get().add( tmp ); randomAccessLeft.setPositionDim0( i - kernelSize ); randomAccessLeft.fwdDim0();
protected ArrayRandomAccess( final ArrayRandomAccess< T > randomAccess ) { super( randomAccess.numDimensions() ); this.img = randomAccess.img; this.type = img.createLinkedType(); int index = 0; for ( int d = 0; d < n; d++ ) { position[ d ] = randomAccess.position[ d ]; index += position[ d ] * img.steps[ d ]; } type.updateContainer( this ); type.updateIndex( index ); }
for ( int d = 0; d < r.numDimensions(); ++d ) r.setPosition( PermutationTransformTest.lut[ b.getIntPosition( d ) ], d ); // manually Assert.assertEquals( r.get().get(), b.get().get() ); Assert.assertEquals( b.get().get(), v.get().get() ); r.setPosition( i ); Assert.assertEquals( r.get().get(), i.get().get() );
final int[] xyInt = new int[] { x, y }; final long[] xyLong = new long[] { x, y }; ra.setPosition( xyInt ); Assert.assertEquals( bckVal, bckLong[ d ] ); Assert.assertEquals( fwdVal, raFwd.getIntPosition( d ) ); Assert.assertEquals( bckVal, raBck.getIntPosition( d ) ); r.setPosition( t ); r.setPosition( this.lut[ t.getIntPosition( this.d ) ], this.d ); Assert.assertEquals( r.get().get(), t.get().get() ); Assert.assertEquals( t.get().get(), v.get().get() ); r.setPosition( i ); Assert.assertEquals( r.get().get(), i.get().get() );
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(); }
for ( int i = 0; i < nspots; i++ ) ra.setPosition( ran.nextInt( ( int ) img.dimension( 0 ) ), 0 ); ra.setPosition( ran.nextInt( ( int ) img.dimension( 1 ) ), 1 ); ra.get().set( 5000 );
randomAccessLeft.setPositionDim0( 0 ); randomAccessLeft.get().add( copy ); randomAccessLeft.setPositionDim0( -1 ); randomAccessLeft.fwdDim0(); randomAccessLeft.get().add( tmp ); randomAccessLeft.setPositionDim0( n ); randomAccessRight.setPositionDim0( n + kernelSizeMinus1 ); randomAccessLeft.get().add( tmp ); randomAccessRight.get().add( tmp ); randomAccessLeft.fwdDim0(); randomAccessRight.bckDim0(); randomAccessLeft.get().add( tmp ); randomAccessRight.get().add( tmp ); randomAccessLeft.fwdDim0(); randomAccessLeft.get().add( tmp ); randomAccessLeft.setPositionDim0( i - kernelSize ); randomAccessLeft.fwdDim0();
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(); }
protected ArrayRandomAccess( final ArrayRandomAccess< T > randomAccess ) { super( randomAccess.numDimensions() ); this.img = randomAccess.img; this.type = img.createLinkedType(); int index = 0; for ( int d = 0; d < n; d++ ) { position[ d ] = randomAccess.position[ d ]; index += position[ d ] * img.steps[ d ]; } type.updateContainer( this ); type.updateIndex( index ); }
for ( int i = 0; i < nspots; i++ ) ra.setPosition( ran.nextInt( ( int ) img.dimension( 0 ) ), 0 ); ra.setPosition( ran.nextInt( ( int ) img.dimension( 1 ) ), 1 ); ra.get().set( 5000 );
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(); }
for ( int i = 0; i < nspots; i++ ) ra.setPosition( ran.nextInt( ( int ) img.dimension( 0 ) ), 0 ); ra.setPosition( ran.nextInt( ( int ) img.dimension( 1 ) ), 1 ); ra.get().set( 5000 );
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(); }
for ( int i = 0; i < nspots; i++ ) ra.setPosition( ran.nextInt( ( int ) img.dimension( 0 ) ), 0 ); ra.setPosition( ran.nextInt( ( int ) img.dimension( 1 ) ), 1 ); ra.get().set( 5000 );
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 ); } }
ra.setPosition( ran.nextInt( ( int ) img.dimension( d ) ), d ); ra.get().set( 5000 );
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 ); } }
ra.setPosition( ran.nextInt( ( int ) img.dimension( d ) ), d ); ra.get().set( 5000 );