@Override public void setPosition( final long[] position ) { type.updateIndex( ( int ) position[ 0 ] ); this.position[ 0 ] = ( int ) position[ 0 ]; } }
@Override public void updateIndex( final int i ) { t.updateIndex( i ); }
@Override public void setPosition( final int pos, final int dim ) { type.updateIndex( pos ); position[ 0 ] = pos; }
@Override public void setPosition( final int[] position ) { type.updateIndex( position[ 0 ] ); this.position[ 0 ] = position[ 0 ]; }
@Override public void updateIndex( final int i ) { t.updateIndex( i ); }
@Override public void setPosition( final int[] pos ) { int index = 0; for ( int d = 0; d < n; ++d ) { position[ d ] = pos[ d ]; index += pos[ d ] * img.steps[ d ]; } type.updateIndex( index ); }
@Override public void setPosition( final long[] pos ) { int index = 0; for ( int d = 0; d < n; ++d ) { final int p = ( int ) pos[ d ]; position[ d ] = p; index += p * img.steps[ d ]; } type.updateIndex( index ); }
@Override public void fwd() { if ( ++index > lastIndexInCell ) { moveToNextCell(); index = 0; } type.updateIndex( index ); }
@Override public void setPosition( final Localizable localizable ) { int index = 0; for ( int d = 0; d < n; ++d ) { position[ d ] = localizable.getIntPosition( d ); index += position[ d ] * img.steps[ d ]; } type.updateIndex( index ); }
@Override public void fwd() { if ( ++index > lastIndex ) { index = 0; ++sliceIndex; type.updateContainer( this ); } type.updateIndex( index ); }
@Override public void reset() { type.updateIndex( offset - 1 ); type.updateContainer( this ); }
@Override public void setPosition( final int pos, final int d ) { index += ( int ) ( pos - position[ d ] ) * currentCellSteps[ d ]; position[ d ] = pos; if ( pos < currentCellMin[ d ] || pos > currentCellMax[ d ] ) { randomAccessOnCells.setPosition( pos / cellDims[ d ], d ); updatePosition( position[ d ] < 0 || position[ d ] >= dimensions[ d ] ); } type.updateIndex( index ); }
@Override public void move( final int distance, final int d ) { index += distance * currentCellSteps[ d ]; position[ d ] += distance; if ( position[ d ] < currentCellMin[ d ] || position[ d ] > currentCellMax[ d ] ) { randomAccessOnCells.setPosition( position[ d ] / cellDims[ d ], d ); updatePosition( position[ d ] < 0 || position[ d ] >= dimensions[ d ] ); } type.updateIndex( index ); }
/** * {@inheritDoc} */ @Override public void reset() { type.updateIndex( offset - 1 ); IntervalIndexer.indexToPosition( offset, img.dim, position ); position[ 0 ]--; type.updateContainer( this ); } }
@Override public void fwd( final int d ) { index += currentCellSteps[ d ]; if ( ++position[ d ] > currentCellMax[ d ] ) { randomAccessOnCells.fwd( d ); updatePosition( position[ d ] >= dimensions[ d ] ); } type.updateIndex( index ); }
@Override public void move( final long distance, final int d ) { index += ( int ) distance * currentCellSteps[ d ]; position[ d ] += distance; if ( position[ d ] < currentCellMin[ d ] || position[ d ] > currentCellMax[ d ] ) { randomAccessOnCells.setPosition( position[ d ] / cellDims[ d ], d ); updatePosition( position[ d ] < 0 || position[ d ] >= dimensions[ d ] ); } type.updateIndex( index ); }
/** * {@inheritDoc} */ @Override public final void reset() { type.updateIndex( -1 ); updatePositionFromIndex( type.getIndex() ); }
protected PlanarCursor( final PlanarCursor< T > cursor ) { super( cursor.numDimensions() ); container = cursor.container; this.type = container.createLinkedType(); lastIndex = cursor.lastIndex; lastSliceIndex = cursor.lastSliceIndex; sliceIndex = cursor.sliceIndex; index = cursor.index; type.updateContainer( this ); type.updateIndex( index ); }
public ArrayRandomAccess( final ArrayImg< T, ? > container ) { super( container.numDimensions() ); this.img = container; this.type = container.createLinkedType(); for ( int d = 0; d < n; d++ ) position[ d ] = 0; type.updateContainer( this ); type.updateIndex( 0 ); }
protected PlanarRandomAccess( final PlanarRandomAccess< T > randomAccess ) { super( randomAccess.numDimensions() ); sliceSteps = randomAccess.sliceSteps; width = randomAccess.width; sliceIndex = randomAccess.sliceIndex; for ( int d = 0; d < n; ++d ) position[ d ] = randomAccess.position[ d ]; type = randomAccess.type.duplicateTypeOnSameNativeImg(); type.updateContainer( this ); type.updateIndex( randomAccess.type.getIndex() ); }