/** Sets the iterator to the leftmost pixel of its bounding rectangle. */ public void startPixels() { src.startPixels(); dst.startPixels(); }
@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()); } }
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); } }
if (!iterator.nextLineDone()) iterator.startPixels();
int j = 0; do { iter.startPixels(); final boolean[] nodLine = hasNoData ? gaps[j] : null; final double[] row = samples[j++];
int j = 0; do { iter.startPixels(); final boolean[] nodLine = hasNoData ? gaps[j] : null; final float[] row = samples[j++];
/** * Sets the iterator to the leftmost pixel of its bounding rectangle. */ public void startPixels() { iterator.startPixels(); }
int j = 0; do { iter.startPixels(); final boolean[] nodLine = hasNoData ? gaps[j] : null; final int[] row = samples[j++];
/** * Sets the iterator to the leftmost pixel of its bounding rectangle. */ public void startPixels() { src.startPixels(); dst.startPixels(); }
/** * Sets the iterator to the leftmost pixel of its bounding rectangle. */ public void startPixels() { src.startPixels(); dst.startPixels(); }
/** * Sets the iterator to the leftmost pixel of its bounding rectangle. */ @Override public void startPixels() { src.startPixels(); dst.startPixels(); }
private void extractValues() { coordinates.clear(); int column = bounds.x; int row = bounds.y + currentRow; readIter.startPixels(); while (!readIter.finishedPixels()) { double sampleValue = readIter.getSampleDouble(bandIndex); if (retainNoData) { Coordinate coord = trans.gridToWorldCoordinate(column, row); coord.z = sampleValue; coordinates.add(coord); } else { if (!SSUtils.compareDouble(noData, sampleValue)) { Coordinate coord = trans.gridToWorldCoordinate(column, row); coord.z = sampleValue; coordinates.add(coord); } } column++; readIter.nextPixel(); } currentRow++; readIter.nextLine(); }
private void extractValues() { coordinates.clear(); int column = bounds.x; int row = bounds.y + currentRow; readIter.startPixels(); while (!readIter.finishedPixels()) { double sampleValue = readIter.getSampleDouble(bandIndex); if (retainNoData) { Coordinate coord = trans.gridToWorldCoordinate(column, row); coord.z = sampleValue; coordinates.add(coord); } else { if (!SSUtils.compareDouble(noData, sampleValue)) { Coordinate coord = trans.gridToWorldCoordinate(column, row); coord.z = sampleValue; coordinates.add(coord); } } column++; readIter.nextPixel(); } currentRow++; readIter.nextLine(); }
/** * Sets the delegate iterator position. If {@code newPos} is outside * the target image bounds, the delegate iterator does not move. */ protected void setDelegatePosition() { if (isInsideDelegateBounds()) { int dy = mainPos.y - delegatePos.y; if (dy < 0) { delegateIter.startLines(); delegatePos.y = delegateBounds.y; dy = mainPos.y - delegateBounds.y; } while (dy > 0) { delegateIter.nextLineDone(); delegatePos.y++ ; dy--; } int dx = mainPos.x - delegatePos.x; if (dx < 0) { delegateIter.startPixels(); delegatePos.x = delegateBounds.x; dx = mainPos.x - delegateBounds.x; } while (dx > 0) { delegateIter.nextPixelDone(); delegatePos.x++ ; dx--; } } }
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]; }
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(); } }
protected void assertImage(RenderedImage srcImg, RenderedImage destImg, Evaluator evaluator) { RectIter destIter = RectIterFactory.create(destImg, null); if (srcImg != null) { RectIter srcIter = RectIterFactory.create(srcImg, null); do { do { assertEquals(evaluator.eval(srcIter.getSampleDouble()), destIter.getSampleDouble(), TOL); destIter.nextPixelDone(); } while (!srcIter.nextPixelDone()); srcIter.startPixels(); destIter.startPixels(); destIter.nextLineDone(); } while (!srcIter.nextLineDone()); } else { do { do { assertEquals(evaluator.eval(0), destIter.getSampleDouble(), TOL); } while (!destIter.nextPixelDone()); destIter.startPixels(); } while (!destIter.nextLineDone()); } }
private void assertResult(RenderedImage resultImage, String script) throws Exception { JiffleBuilder builder = new JiffleBuilder(); builder.script(script).dest("dest", WIDTH, WIDTH).run(); RenderedImage referenceImage = builder.getImage("dest"); RectIter resultIter = RectIterFactory.create(resultImage, null); RectIter referenceIter = RectIterFactory.create(referenceImage, null); do { do { assertEquals(resultIter.getSample(), referenceIter.getSample()); resultIter.nextPixelDone(); } while (!referenceIter.nextPixelDone()); resultIter.startPixels(); resultIter.nextLineDone(); referenceIter.startPixels(); } while (!referenceIter.nextLineDone()); } }
iter.nextPixel(); iter.startPixels(); iter.nextLine();
/** * Ensures that all sample values in every bands are either inside the given range, * or {@link Double#NaN}. * * @param minimum The lower bound of the range, inclusive. * @param maximum The upper bound of the range, inclusive. * @param image The image to test. * * @since 3.19 */ public static void assertSampleValuesInRange(final double minimum, final double maximum, final RenderedImage image) { final RectIter it = RectIterFactory.create(image, null); if (!it.finishedLines()) do { if (!it.finishedPixels()) do { if (!it.finishedBands()) do { final double value = it.getSampleDouble(); assertBetween("Sample value", minimum, maximum, value); } while (!it.nextBandDone()); it.startBands(); } while (!it.nextPixelDone()); it.startPixels(); } while (!it.nextLineDone()); }