@SuppressWarnings("PMD.SystemPrintln") public static void printImage(RenderedImage renderedImage) { RectIter rectIter = RectIterFactory.create(renderedImage, null); do { do { double value = rectIter.getSampleDouble(); System.out.print(value + " "); } while (!rectIter.nextPixelDone()); rectIter.startPixels(); } while (!rectIter.nextLineDone()); } }
if (iterator.finishedPixels()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); if (iterator.finishedLines()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); iterator.getPixel(temp); for (double d : temp) { if (iterator.nextPixelDone()) { if (!iterator.nextLineDone()) iterator.startPixels();
public RasterAsPointFeatureIterator(final RasterAsPointFeatureCollection fc) { // checks Utilities.ensureNonNull("fc", fc); // get elements this.fc = fc; this.fb = new SimpleFeatureBuilder(fc.getSchema()); this.size = fc.size; // create an iterator that only goes forward, it is the fastest one iterator = RectIterFactory.create(fc.gc2d.getRenderedImage(), null); // // start the iterator // iterator.startLines(); if (iterator.finishedLines()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); } iterator.startPixels(); if (iterator.finishedPixels()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); } // appo temp = new double[fc.numBands]; // grid convergence angle manager if (fc.gridConvergenceAngleCorrectionNeeded) { sourceCRSPosition = new DirectPosition2D(); targetCRSPosition = new DirectPosition2D(fc.targetCRS); } }
public void visit(GridCoverage2D inputCoverage, Integer bandIndex) { reset(); PlanarImage inputImage = (PlanarImage) inputCoverage.getRenderedImage(); RectIter readIter = RectIterFactory.create(inputImage, inputImage.getBounds()); readIter.startLines(); while (!readIter.finishedLines()) { readIter.startPixels(); while (!readIter.finishedPixels()) { double sampleValue = readIter.getSampleDouble(bandIndex); visit(Double.valueOf(sampleValue)); readIter.nextPixel(); } readIter.nextLine(); } }
final WritableRectIter iTarget = RectIterFactory.createWritable(dest, destRect); int band = 0; iSrc0 .startBands(); iSrc1 .startBands(); iTarget.startBands(); if (!iTarget.finishedBands() && !iSrc0 .finishedBands() && !iSrc1 .finishedBands()) final double offset = offsets[Math.min(band, offsets.length-1)]; do { iSrc0 .startLines(); iSrc1 .startLines(); iTarget.startLines(); if (!iTarget.finishedLines() && !iSrc0 .finishedLines() && !iSrc1 .finishedLines()) iSrc0 .startPixels(); iSrc1 .startPixels(); iTarget.startPixels(); if (!iTarget.finishedPixels() && !iSrc0 .finishedPixels() && !iSrc1 .finishedPixels()) iTarget.setSample(iSrc0.getSampleDouble() * scale0 + iSrc1.getSampleDouble() * scale1 + offset); } while (!iSrc0.nextPixelDone() && !iSrc1.nextPixelDone() &&
final RectIter e = RectIterFactory.create(expected, null); final RectIter a = RectIterFactory.create(actual, null); if (!e.finishedLines()) do { assertFalse(a.finishedLines()); if (!e.finishedPixels()) do { assertFalse(a.finishedPixels()); if (!e.finishedBands()) do { assertFalse(a.finishedBands()); final float pe = e.getSampleFloat(); final float pa = a.getSampleFloat(); assertEquals(pe, pa, SAMPLE_TOLERANCE); a.nextBand(); } while (!e.nextBandDone()); assertTrue(a.finishedBands()); a.nextPixel(); a.startBands(); e.startBands(); } while (!e.nextPixelDone()); assertTrue(a.finishedPixels()); a.nextLine(); a.startPixels(); e.startPixels(); } while (!e.nextLineDone()); assertTrue(a.finishedLines());
raster, PlanarImage.wrapRenderedImage(raster).getBounds()); iterator.startLines(); while (!iterator.finishedLines()) { iterator.startPixels(); while (!iterator.finishedPixels()) { switch (dataType) { case DataBuffer.TYPE_BYTE: case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: iterator.getPixel(valuesI); for (int i = 0; i < numBands; i++) { case DataBuffer.TYPE_DOUBLE: case DataBuffer.TYPE_FLOAT: iterator.getPixel(valuesD); for (int i = 0; i < numBands; i++) { iterator.nextPixel(); iterator.nextLine(); chars("\n");
assertEquals(expectedVal.byteValue(), (byte) destIter.getSample()); break; case DataBuffer.TYPE_SHORT: assertEquals(expectedVal.shortValue(), (short) destIter.getSample()); break; case DataBuffer.TYPE_INT: assertEquals(expectedVal.intValue(), destIter.getSample()); break; case DataBuffer.TYPE_FLOAT: assertEquals(expectedVal.floatValue(), destIter.getSampleFloat(), TOLERANCE); break; case DataBuffer.TYPE_DOUBLE: assertEquals(expectedVal.doubleValue(), destIter.getSampleDouble(), TOLERANCE); break; srcIter.nextPixelDone(); x++; } while (!destIter.nextPixelDone()); srcIter.nextLineDone(); srcIter.startPixels(); destIter.startPixels(); y++; x = 0; } while (!destIter.nextLineDone());
final int[] buffer = new int[numBands]; do { mit.startPixels(); iter.startPixels(); if (!iter.finishedPixels()) { do { final int m = mit.getSample(); mit.nextPixel(); if (m != 0) { } while (!iter.nextPixelDone()); mit.nextLine(); } while (!iter.nextLineDone());
/** Returns the specified sample of the current pixel as a double. */ public double getSampleDouble(int b) { return src.getSampleDouble(b); }
case DataBuffer.TYPE_DOUBLE: if (inside) { value = new Double(delegateIter.getSampleDouble(band)); } else { value = outsideValue_Double; value = new Float(delegateIter.getSampleFloat(band)); } else { value = outsideValue_Float; value = Integer.valueOf(delegateIter.getSample(band)); } else { value = outsideValue_Integer;
/** Sets the iterator to the leftmost pixel of its bounding rectangle. */ public void startPixels() { src.startPixels(); dst.startPixels(); }
/** Sets the iterator to the first line of its bounding rectangle. */ public void startLines() { src.startLines(); dst.startLines(); }
/** Returns the specified sample of the current pixel as an integer. */ public int getSample(int b) { return src.getSample(b); }
/** Returns {@code true} if the bottom row of the bounding rectangle has been passed. */ public boolean finishedLines() { boolean check = src.finishedLines(); if (check == dst.finishedLines()) { return check; } throw new RasterFormatException(ERROR); }
/** Returns {@code true} if the right edge of the bounding rectangle has been passed. */ public boolean finishedPixels() { boolean check = src.finishedPixels(); if (check == dst.finishedPixels()) { return check; } throw new RasterFormatException(ERROR); }
/** Sets the iterator to the next pixel in the image (that is, move rightward). */ public boolean nextPixelDone() { boolean check = src.nextPixelDone(); if (check == dst.nextPixelDone()) { return check; } throw new RasterFormatException(ERROR); }
/** * Sets the iterator to the next line in the image, and returns {@code true} if the bottom row * of the bounding rectangle has been passed. */ public boolean nextLineDone() { boolean check = src.nextLineDone(); if (check == dst.nextLineDone()) { return check; } throw new RasterFormatException(ERROR); }
/** * Sets the iterator to the next line in the image. */ public boolean nextLineDone() { if (iterator.nextLineDone()) { return true; } iterator.jumpLines(dy); return false; }
/** * Sets the iterator to the next pixel in the image. */ public boolean nextPixelDone() { if (iterator.nextPixelDone()) { return true; } iterator.jumpPixels(dx); return false; }