@Override public Cursor<T> copyCursor() { return cursor.copyCursor(); }
@Override public Cursor<T> copyCursor() { return cursor.copyCursor(); }
@Override public Cursor< T > copyCursor() { return new IterableSubsetViewCursor< T >( cursor.copyCursor(), planeSize, planePos, numPlaneDims ); } }
@Override public Cursor<T> copyCursor() { return new PredicateCursor<T>( cursor.copyCursor(), predicate ); } }
@Override public LabelingConvertedCursor< I, T > copy() { return new LabelingConvertedCursor< I, T >( source.copyCursor(), type.generation, type.mapping ); } }
@Override public Cursor< T > copyCursor() { return new IterableSubsetViewCursor< T >( cursor.copyCursor(), planeSize, planePos, numPlaneDims ); } }
@Override public IFunction duplicate() throws Exception { return new CursorFunction(c.copyCursor()); }
@Override public SamplingCursor< T > copy() { return new SamplingCursor< T >( source.copyCursor(), target.copyRandomAccess() ); }
/** * Find the minimum value and its position in an {@link IterableInterval}. * * @param iterable * input interval. * @return a cursor positioned on the global minimum. If several minima with * the same value exist, the cursor is on the first one. */ public static < T extends Comparable< T > > Cursor< T > findMin( final IterableInterval< T > iterable ) { final Cursor< T > cursor = iterable.cursor(); cursor.fwd(); Cursor< T > min = cursor.copyCursor(); while ( cursor.hasNext() ) if ( cursor.next().compareTo( min.get() ) < 0 ) min = cursor.copyCursor(); return min; }
/** * Find the maximum value and its position in an {@link IterableInterval}. * * @param iterable * input interval. * @return a cursor positioned on the global maximum. If several maxima with * the same value exist, the cursor is on the first one. */ public static < T extends Comparable< T > > Cursor< T > findMax( final IterableInterval< T > iterable ) { final Cursor< T > cursor = iterable.cursor(); cursor.fwd(); Cursor< T > max = cursor.copyCursor(); while ( cursor.hasNext() ) if ( cursor.next().compareTo( max.get() ) > 0 ) max = cursor.copyCursor(); return max; } }
/** * Find the minimum value and its position in an {@link IterableInterval}. * * @param iterable * input interval. * @return a cursor positioned on the global minimum. If several minima with * the same value exist, the cursor is on the first one. */ public static < T extends Comparable< T > > Cursor< T > findMin( final IterableInterval< T > iterable ) { final Cursor< T > cursor = iterable.cursor(); cursor.fwd(); Cursor< T > min = cursor.copyCursor(); while ( cursor.hasNext() ) if ( cursor.next().compareTo( min.get() ) < 0 ) min = cursor.copyCursor(); return min; }
/** * Find the maximum value and its position in an {@link IterableInterval}. * * @param iterable * input interval. * @return a cursor positioned on the global maximum. If several maxima with * the same value exist, the cursor is on the first one. */ public static < T extends Comparable< T > > Cursor< T > findMax( final IterableInterval< T > iterable ) { final Cursor< T > cursor = iterable.cursor(); cursor.fwd(); Cursor< T > max = cursor.copyCursor(); while ( cursor.hasNext() ) if ( cursor.next().compareTo( max.get() ) > 0 ) max = cursor.copyCursor(); return max; } }
protected CellCursor( final CellCursor< T, C > cursor ) { super( cursor.numDimensions() ); this.type = cursor.type.duplicateTypeOnSameNativeImg(); this.cursorOnCells = cursor.cursorOnCells.copyCursor(); isNotLastCell = cursor.isNotLastCell; lastIndexInCell = cursor.lastIndexInCell; index = cursor.index; type.updateContainer( this ); type.updateIndex( index ); }
protected CellCursor( final CellCursor< T, C > cursor ) { super( cursor.numDimensions() ); this.type = cursor.type.duplicateTypeOnSameNativeImg(); this.cursorOnCells = cursor.cursorOnCells.copyCursor(); isNotLastCell = cursor.isNotLastCell; lastIndexInCell = cursor.lastIndexInCell; index = cursor.index; type.updateContainer( this ); type.updateIndex( index ); }
protected CellLocalizingCursor( final CellLocalizingCursor< T, C > cursor ) { super( cursor.numDimensions() ); this.type = cursor.type.duplicateTypeOnSameNativeImg(); this.cursorOnCells = cursor.cursorOnCells.copyCursor(); this.currentCellMin = cursor.currentCellMin; this.currentCellMax = cursor.currentCellMax; isNotLastCell = cursor.isNotLastCell; lastIndexInCell = cursor.lastIndexInCell; for ( int d = 0; d < n; ++d ) position[ d ] = cursor.position[ d ]; index = cursor.index; type.updateContainer( this ); type.updateIndex( index ); }
protected CellLocalizingCursor( final CellLocalizingCursor< T, C > cursor ) { super( cursor.numDimensions() ); this.type = cursor.type.duplicateTypeOnSameNativeImg(); this.cursorOnCells = cursor.cursorOnCells.copyCursor(); this.currentCellMin = cursor.currentCellMin; this.currentCellMax = cursor.currentCellMax; isNotLastCell = cursor.isNotLastCell; lastIndexInCell = cursor.lastIndexInCell; for ( int d = 0; d < n; ++d ) position[ d ] = cursor.position[ d ]; index = cursor.index; type.updateContainer( this ); type.updateIndex( index ); }
public void evaluate(Cursor<U> cursor, V output) { // need to make a copy of the cursor as we will change its position and // parent might hate that. (MAYBE I'M WRONG HERE). But any function that // evals another function needs its own cursor if (crs == null) { crs = cursor.copyCursor(); //position = new long[cursor.numDimensions()]; } //cursor.localize(position); // EXPENSIVE as setPosition() call from pure method //cursor.relocate(position); // NOPE - can't do this type of needed op crs.reset(); double sum = 0; long numElements = 0; while (crs.hasNext()) { sum += crs.next().getRealDouble(); numElements++; } if (numElements == 0) output.setZero(); else output.setReal(sum / numElements); }