@Override public void sub( final T c ) { t.sub( c.t ); valid &= c.valid; }
@Override public void sub( final T c ) { t.sub( c.t ); valid &= c.valid; }
public final O eval() { this.scrap.set( this.a.eval() ); this.scrap.sub( this.b.eval() ); return this.scrap; }
public final O eval( final Localizable loc ) { this.scrap.set( this.a.eval( loc ) ); this.scrap.sub( this.b.eval( loc ) ); return this.scrap; } }
final private static < T extends RealType< T >> void computeSum( final long startX, final long startY, final long vX, final long vY, final RandomAccess< T > c2, final T sum ) { c2.setPosition( startX, 0 ); c2.setPosition( startY, 1 ); sum.set( c2.get() ); c2.move( vX, 0 ); sum.sub( c2.get() ); c2.move( vY, 1 ); sum.add( c2.get() ); c2.move( -vX, 0 ); sum.sub( c2.get() ); }
final private static <T extends RealType<T>> void computeSum( final long startX, final long startY, final long vX, final long vY, final RandomAccess< T > c2, final T sum ) { c2.setPosition( startX, 0 ); c2.setPosition( startY, 1 ); sum.set( c2.get() ); c2.move( vX, 0 ); sum.sub( c2.get() ); c2.move( vY, 1 ); sum.add( c2.get() ); c2.move( -vX, 0 ); sum.sub( c2.get() ); }
/** * * @param nBins The desired number of bins. * @param numDimensions The dimensions of the image region from which the histogram is computed. * @param min The minimum value, from which the first bin starts; all values under min will be added to the first bin. * @param max The maximum value, at which the last bin ends; all values over max will be added to the last bin. * @param op The type in which operations will be computed. */ public Histogram( final int nBins, final int numDimensions, final T min, final T max) { this.bins = new long[nBins]; this.maxPositions = new long[numDimensions]; this.minPositions = new long[numDimensions]; this.min = min; this.max = max; // this.range = min.createVariable(); this.range.set(max); this.range.sub(min); // final Dimensions dims = new FinalDimensions( nBins ); this.binValues = Util.getSuitableImgFactory( dims, min ).create( dims ); this.accessBinValues = this.binValues.randomAccess(); }
public static < T extends RealType< T > > void subtractProjection( final RandomAccessibleInterval< T > img, final RandomAccessibleInterval< T > proj, final int projDim ) { final int n0 = img.numDimensions(); final Cursor< T > cursor = Views.iterable( img ).localizingCursor(); final RandomAccess< T > ra = proj.randomAccess(); while ( cursor.hasNext() ) { final T type = cursor.next(); int dim = 0; for ( int d = 0; d < n0; ++d ) if ( d != projDim ) ra.setPosition( cursor.getLongPosition( d ), dim++ ); type.sub( ra.get() ); } }
protected void Subtract(RandomAccessibleInterval<T> a, RandomAccessibleInterval<T> input, RandomAccessibleInterval<T> output) { final Cursor<T> cursorA = Views.iterable(a).cursor(); final Cursor<T> cursorInput = Views.iterable(input).cursor(); final Cursor<T> cursorOutput = Views.iterable(output).cursor(); while (cursorA.hasNext()) { cursorA.fwd(); cursorInput.fwd(); cursorOutput.fwd(); cursorOutput.get().set(cursorA.get()); cursorOutput.get().sub(cursorInput.get()); } }