예제 #1
0
  protected void computeSimple(final long startPos, final long loopSize) {
    final Cursor<S> cursorIn = image.createCursor();
    final Cursor<T> cursorOut = output.createCursor();

    // move to the starting position of the current thread
    cursorIn.fwd(startPos);
    cursorOut.fwd(startPos);

    // do as many pixels as wanted by this thread
    for (long j = 0; j < loopSize; ++j) {
      cursorIn.fwd();
      cursorOut.fwd();

      converter.convert(cursorIn.getType(), cursorOut.getType());
    }

    cursorIn.close();
    cursorOut.close();
  }
  protected <C extends Comparable<C> & Type<C>> C max(final Image<C> image) {

    C max = image.createType();

    // create a cursor for the image (the order does not matter)
    Cursor<C> cursor = image.createCursor();

    // initialize max with the first image value
    max.set(cursor.next());

    for (C type : cursor) {
      if (type.compareTo(max) > 0) max.set(type);
    }
    return max;
  }