/** * Gets an instance of T from the {@link RandomAccessibleInterval} by querying the value at the * min coordinate * * @param <T> - the T * @param rai - the {@link RandomAccessibleInterval} * @return - an instance of T */ public static final <T, F extends Interval & RandomAccessible<T>> T getTypeFromInterval( final F rai) { // create RandomAccess final RandomAccess<T> randomAccess = rai.randomAccess(); // place it at the first pixel for (int d = 0; d < rai.numDimensions(); ++d) randomAccess.setPosition(rai.min(d), d); return randomAccess.get(); }
/** * Gets an instance of T from the {@link RandomAccessibleInterval} by querying the value at the * min coordinate * * @param <T> - the T * @param rai - the {@link RandomAccessibleInterval} * @return - an instance of T */ public static final <T, F extends Interval & RandomAccessible<T>> T getTypeFromInterval( final F rai) { // create RandomAccess final RandomAccess<T> randomAccess = rai.randomAccess(); // place it at the first pixel rai.min(randomAccess); return randomAccess.get(); }