/** * @param img - the input {@link Image} * @return - the sum of all pixels using {@link RealSum} */ final public static double sumImage( final Iterable<FloatType> img ) { final RealSum sum = new RealSum(); for ( final FloatType t : img ) sum.add( t.get() ); return sum.getSum(); }
@Override public Void call() throws Exception { final int id = ai.getAndIncrement(); final RealSum sum = new RealSum(); final Cursor< T > c = img.cursor(); c.jumpFwd( portion.getStartPosition() ); for ( long j = 0; j < portion.getLoopSize(); ++j ) sum.add( c.next().getRealDouble() ); sums[ id ] = sum; return null; } });