示例#1
0
  /**
   * 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();
  }
示例#2
0
文件: Util.java 项目: imglib/imglib2
  /**
   * 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();
  }