コード例 #1
0
ファイル: Util.java プロジェクト: keithschulze/imglib
  /**
   * 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
  public GenericGaussianConvolution(
      final F input,
      final ImgFactory<T> outputFactory,
      final OutOfBoundsFactory<T, F> outOfBoundsFactory1,
      final OutOfBoundsFactory<T, Img<T>> outOfBoundsFactory2,
      final double[] sigma) {
    this.input = input;
    this.outputFactory = outputFactory;
    this.convolved = outputFactory.create(input, input.firstElement().createVariable());
    this.sigma = sigma;
    this.processingTime = -1;
    setNumThreads();

    this.outOfBoundsFactory1 = outOfBoundsFactory1;
    this.outOfBoundsFactory2 = outOfBoundsFactory2;
    this.numDimensions = input.numDimensions();

    this.kernel = new double[numDimensions][];

    for (int d = 0; d < numDimensions; ++d)
      this.kernel[d] = Util.createGaussianKernel1DDouble(sigma[d], true);
  }