final double[] padNaNs = new double[numBands]; Arrays.fill(padNaNs, Double.NaN); final WritableRectIter iterator = RectIterFactory.createWritable(tiled, gridBounds); if (!iterator.finishedLines()) try {
public RectIter create(RenderedImage image, Rectangle bounds) { if (image == null) { throw new IllegalArgumentException("image must not be null"); } if (!(image instanceof WritableRenderedImage)) { throw new IllegalArgumentException("image must be a WritableRenderedImage"); } if (bounds == null || bounds.isEmpty()) { return null; } return RectIterFactory.createWritable((WritableRenderedImage) image, bounds); }
/** * Creates a {@code WritableRectIter} for the specified source and destination rasters. * The given rectangle must be in the bounds of both rasters (this will not be verified). * * @param src The source raster. * @param dst The destination raster. * @param bounds The region of the rasters to iterate over. * @return An iterator that read sample from {@code src} and write sample to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination rasters are not the same. * * @since 3.00 */ public static WritableRectIter create(Raster src, WritableRaster dst, Rectangle bounds) { WritableRectIter iter = RectIterFactory.createWritable(dst, bounds); if (src != dst) { iter = new TransfertRectIter(RectIterFactory.create(src, bounds), iter); } return iter; }
/** * Creates a {@code WritableRectIter} for the specified source and destination images. * The given rectangle must be in the bounds of both images (this will not be verified). * * @param src The source image. * @param dst The destination image. * @param bounds The region of the images to iterate over. * @return An iterator that read samples from {@code src} and write samples to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination images are not the same. * * @since 3.00 */ public static WritableRectIter create(RenderedImage src, WritableRenderedImage dst, Rectangle bounds) { if (dst instanceof BufferedImage) { /* * BufferedImage are always backed by a single raster. Consequently we are better to * delegate the work to create(RenderedImage, WritableRaster, Rectangle), which will * detects if the source uses the same raster than the destination. */ return create(src, ((BufferedImage) dst).getRaster(), bounds); } WritableRectIter iter = RectIterFactory.createWritable(dst, bounds); if (src != dst) { iter = new TransfertRectIter(RectIterFactory.create(src, bounds), iter); } return iter; }
WritableRectIter iterator = RectIterFactory.createWritable(dest, destRect); if (true) {
/** * Creates a {@code WritableRectIter} for the specified source image and destination raster. * The given rectangle must be in the bounds of both arguments (this will not be verified). * * @param src The source image. * @param dst The destination raster. * @param bounds The region of the image or raster to iterate over. * @return An iterator that read samples from {@code src} and write samples to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination rasters are not the same. * * @since 3.00 */ public static WritableRectIter create(RenderedImage src, WritableRaster dst, Rectangle bounds) { final Raster tile = uniqueTile(src, bounds); if (tile == dst) { return create(tile, dst, bounds); } return new TransfertRectIter(RectIterFactory.create(src, bounds), RectIterFactory.createWritable(dst, bounds)); }
WritableRectIter iterator = RectIterFactory.createWritable(dest, destRect); if (true) {
public void createRipplesImage(WritableRenderedImage destImg) { // image dimensions final int width = destImg.getWidth(); final int height = destImg.getHeight(); // first pixel coordinates int x = destImg.getMinX(); int y = destImg.getMinY(); // center pixel coordinates final int xc = x + destImg.getWidth() / 2; final int yc = y + destImg.getHeight() / 2; // constant term double C = Math.PI * 8; WritableRectIter iter = RectIterFactory.createWritable(destImg, null); do { double dy = ((double) (y - yc)) / yc; do { double dx = ((double) (x - xc)) / xc; double d = Math.sqrt(dx * dx + dy * dy); iter.setSample(Math.sin(d * C)); x++ ; } while (!iter.nextPixelDone()); x = destImg.getMinX(); y++; iter.startPixels(); } while (!iter.nextLineDone()); } // docs-end-method
public void run() { WritableRectIter writer = RectIterFactory.createWritable(oi, rect); writer.startLines(); int y = rect.y; while (!writer.finishedLines()) { writer.startPixels(); int x = rect.x; while (!writer.finishedPixels()) { final Coordinate realPos = trans.gridToWorldCoordinate(x, y); final double retVal = interpolator.getValue(realPos); writer.setSample(0, retVal); updateStatistics(retVal); writer.nextPixel(); x++; } writer.nextLine(); y++; } } }
public void run() { WritableRectIter writer = RectIterFactory.createWritable(oi, rect); writer.startLines(); int y = rect.y; while (!writer.finishedLines()) { writer.startPixels(); int x = rect.x; while (!writer.finishedPixels()) { final Coordinate realPos = trans.gridToWorldCoordinate(x, y); final double retVal = interpolator.getValue(realPos); writer.setSample(0, retVal); updateStatistics(retVal); writer.nextPixel(); x++; } writer.nextLine(); y++; } } }
public GridCoverage2D execute(GridCoverage2D inputGc) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitTPI(writer, pos); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("TPI", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitRoughness(writer, pos); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("Roughness", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitAspect(writer, pos); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("Aspect", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc, double azimuth, double altitude, double zFactor) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitHillShade(writer, pos, azimuth, altitude, zFactor); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("Aspect", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitTRI(writer, pos); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("TRI", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc, SlopeType slopeType, double zFactor) { this.initSurface(inputGc); DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitSlope(writer, pos, slopeType, zFactor); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("Slope", outputImage); }
public GridCoverage2D execute(GridCoverage2D inputGc, double zFactor) { this.initSurface(inputGc); xL2 = CellSizeX * CellSizeX; x2L = 2.0 * CellSizeX; yL2 = CellSizeY * CellSizeY; y2L = 2.0 * CellSizeY; DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); WritableRectIter writer = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); GridCoordinates2D pos = new GridCoordinates2D(); int y = bounds.y; writer.startLines(); while (!writer.finishedLines()) { int x = bounds.x; writer.startPixels(); while (!writer.finishedPixels()) { pos.setLocation(x, y); visitCurvature(writer, pos, zFactor); writer.nextPixel(); x++; } writer.nextLine(); y++; } return createGridCoverage("Curvature", outputImage); }
WritableRectIter writerIter = RectIterFactory.createWritable(outputImage, outputImage.getBounds());
public GridCoverage2D execute(GridCoverage2D inputGc, double[] fuzzyValues) { DiskMemImage outputImage = this.createDiskMemImage(inputGc, RasterPixelType.FLOAT); PlanarImage inputImage = (PlanarImage) inputGc.getRenderedImage(); final double inputNoData = RasterHelper.getNoDataValue(inputGc); this.NoData = RasterHelper.getDefaultNoDataValue(PixelType); RectIter inputIter = RectIterFactory.create(inputImage, inputImage.getBounds()); WritableRectIter writerIter = RectIterFactory.createWritable(outputImage, outputImage.getBounds()); inputIter.startLines(); writerIter.startLines(); while (!inputIter.finishedLines() && !writerIter.finishedLines()) { inputIter.startPixels(); writerIter.startPixels(); while (!inputIter.finishedPixels() && !writerIter.finishedPixels()) { final double inputVal = inputIter.getSampleDouble(0); if (SSUtils.compareDouble(inputNoData, inputVal)) { writerIter.setSample(0, NoData); } else { double fuzzyValue = getFuzzyValue(inputVal, fuzzyValues) * maxRange; writerIter.setSample(0, fuzzyValue); updateStatistics(inputVal); } inputIter.nextPixel(); writerIter.nextPixel(); } inputIter.nextLine(); writerIter.nextLine(); } return createGridCoverage("Fuzzy", outputImage); }
WritableRectIter writerIter = RectIterFactory.createWritable(outputImage, outputImage.getBounds());