public static RandomIter getRandomIterator( final PlanarImage src, int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender extender) { RandomIter iterSource; if (extender != null) { ImageWorker w = new ImageWorker(src).setRenderingHints(GeoTools.getDefaultHints()); RenderedOp op = w.border(leftPad, rightPad, topPad, bottomPad, extender).getRenderedOperation(); RandomIter it = RandomIterFactory.create(op, op.getBounds(), true, true); return new ExtendedRandomIter(it, op); } else { iterSource = RandomIterFactory.create(src, src.getBounds(), true, true); } return iterSource; }
Rectangle dstBounds = op.getBounds();
Rectangle targetBB = at.getBounds(); int tileWidth = at.getTileWidth(); int tileHeight = at.getTileHeight();
newHints, info.readParameters); roi = MaskOverviewProvider.scaleROI(roiRaster, coverageRaster.getBounds());
assert CRS.equalsIgnoreMetadata(targetCoverage.getCoordinateReferenceSystem(), targetCRS) : targetGG; assert targetCoverage.getGridGeometry().getGridRange2D().equals(targetImage.getBounds()) : targetGG; if (CoverageProcessor.LOGGER.isLoggable(LOGGING_LEVEL)) {
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
Rectangle dstBounds = op.getBounds();
float ty = pb.getFloatParameter(3); Rectangle dstBounds = op.getBounds(); PlanarImage roiImage = null;
@Test public void testCropImageROI() { // Parameterblock creation ParameterBlock pb = buildParameterBlock(source, false, false, false); ParameterBlock pbNew = buildParameterBlock(source, true, true, false); // Images creation RenderedOp cropped = JAI.create("crop", pb); RenderedOp jaiextCropped = JAI.create("Crop", pbNew); // Check if the presence of the ROI reduces the image bounds Rectangle boundOld = cropped.getBounds(); Rectangle boundNew = jaiextCropped.getBounds(); boolean contained = boundNew.getMinX() >= boundOld.getMinX() && boundNew.getMinY() >= boundOld.getMinY() && boundNew.getMaxX() <= boundOld.getMaxX() && boundNew.getMaxY() <= boundOld.getMaxY(); assertTrue(contained); // Display Image if (INTERACTIVE && TEST_SELECTOR == 1) { RenderedImageBrowser.showChain(jaiextCropped, false, true); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } }
/** * Returns a RandomIterator on the input image. Also it handles padding if present. * * @param src * @return */ protected RandomIter getRandomIterator(final PlanarImage src, int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender extender) { RandomIter iterSource; if (extended) { // use parameter block to allow mixing JAI and JAI-EXT ParameterBlock pb = new ParameterBlock(); pb.addSource(src); pb.add(leftPad); pb.add(rightPad); pb.add(topPad); pb.add(bottomPad); pb.add(extender); pb.add(noDataRange); pb.add(backgroundValues != null ? backgroundValues[0] : 0d); RenderedOp op = JAI.create("Border", pb, hints); iterSource = RandomIterFactory.create(op, op.getBounds(), TILE_CACHED, ARRAY_CALC); } else { iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); } return iterSource; } }
/** * Returns a RandomIterator on the input image. Also it handles padding if present. * * @param src * @return */ protected RandomIter getRandomIterator(final PlanarImage src, int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender extender) { RandomIter iterSource; if (extended) { // use parameter block to allow mixing JAI and JAI-EXT ParameterBlock pb = new ParameterBlock(); pb.addSource(src); pb.add(leftPad); pb.add(rightPad); pb.add(topPad); pb.add(bottomPad); pb.add(extender); pb.add(noDataRange); pb.add(backgroundValues != null ? backgroundValues[0] : 0d); RenderedOp op = JAI.create("Border", pb, hints); iterSource = RandomIterFactory.create(op, op.getBounds(), TILE_CACHED, ARRAY_CALC); } else { iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); } return iterSource; } }
Rectangle dstBounds = affineImgNear.getBounds();
if (roiExists) { PlanarImage roiIMG = roi.getAsImage(); roiIter = RandomIterFactory.create(roiIMG, finalimage.getBounds(), true, true); roiBounds = roi.getBounds();