/** * 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 RealInterval & RealRandomAccessible<T>> T getTypeFromRealInterval(final F rai) { // create RealRandomAccess final RealRandomAccess<T> realRandomAccess = rai.realRandomAccess(); // place it at the first pixel for (int d = 0; d < rai.numDimensions(); ++d) realRandomAccess.setPosition(rai.realMin(d), d); return realRandomAccess.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 RealInterval & RealRandomAccessible<T>> T getTypeFromRealInterval(final F rai) { // create RealRandomAccess final RealRandomAccess<T> realRandomAccess = rai.realRandomAccess(); // place it at the first pixel rai.realMin(realRandomAccess); return realRandomAccess.get(); }