Beispiel #1
0
 int[] getImgAsInts(final Img<IntType> img) {
   final RandomAccess<IntType> a = img.randomAccess();
   final int N = (int) img.size();
   final int[] data = new int[N];
   final long[] dim = new long[img.numDimensions()];
   final long[] pos = new long[img.numDimensions()];
   img.dimensions(dim);
   for (int i = 0; i < N; ++i) {
     IntervalIndexer.indexToPosition(i, dim, pos);
     a.setPosition(pos);
     data[i] = a.get().get();
   }
   return data;
 }
Beispiel #2
0
  /** Makes sure input is okay and creates output image */
  @Override
  public boolean checkInput() {
    final Img inputImage = dataset.getImgPlus(); // TODO - raw type required
    // here

    inputDimensions = new long[inputImage.numDimensions()];

    inputImage.dimensions(inputDimensions);

    final long[] outputDimensions = flipper.calcOutputDimensions(inputDimensions);

    outputImage = inputImage.factory().create(outputDimensions, inputImage.firstElement());

    return true;
  }