public ConvertedRealRandomAccessible( final RealRandomAccessible< A > source, final Converter< ? super A, ? super B > converter, final B b ) { super( source ); this.converter = converter; this.converted = b.copy(); }
@Override public void setPosition( final long[] position ) { type.updateIndex( ( int ) position[ 0 ] ); this.position[ 0 ] = ( int ) position[ 0 ]; } }
@Override public void fwd() { if ( ++index > lastIndex ) { index = 0; ++sliceIndex; type.updateContainer( this ); } type.updateIndex( index ); }
/** * {@inheritDoc} */ @Override public final void fwd() { type.incIndex(); }
@Override public boolean hasNext() { return type.getIndex() < lastIndex; }
@Override public void decIndex( final int decrement ) { t.decIndex( decrement ); } }
public static < T extends NativeType< T >, A extends DoubleAccess > NativeTypeFactory< T, A > DOUBLE( final Function< NativeImg< T, ? extends A >, T > createLinkedType ) { return new NativeTypeFactory<>( PrimitiveType.DOUBLE, createLinkedType ); } }
@Override public void updateIndex( final int i ) { t.updateIndex( i ); }
@Override public void move( final long distance, final int d ) { type.incIndex( img.steps[ d ] * ( int ) distance ); position[ d ] += distance; }
@Override public int getIntPosition( final int dim ) { if ( dim == 0 ) return type.getIndex(); return 0; } }
/** * Moves one step backward in dimension 0 */ public void bckDim0() { type.decIndex(); --position[ 0 ]; }
@Override public void setPosition( final int[] position ) { type.updateIndex( position[ 0 ] ); this.position[ 0 ] = position[ 0 ]; }
@Override public void move( final int[] distance ) { position[ 0 ] += distance[ 0 ]; type.incIndex( distance[ 0 ] ); }
@Override public boolean hasNext() { return type.getIndex() < lastIndex; }
@Override public void bck( final int dim ) { --position[ 0 ]; type.decIndex(); }
@Override public void updateIndex( final int i ) { t.updateIndex( i ); }
@Override public void incIndex() { t.incIndex(); }
@Override public void localize( final int[] position ) { final int indexInSlice = type.getIndex(); final int dim0 = container.dimensions[ 0 ]; position[ 1 ] = indexInSlice / dim0; position[ 0 ] = indexInSlice - position[ 1 ] * dim0; }
/** * {@inheritDoc} */ @Override public final void jumpFwd( final long steps ) { type.incIndex( ( int ) steps ); }