Package org.jaitools.imageutils

Examples of org.jaitools.imageutils.ROIGeometry


      // just make it slower to determine the point in polygon relationship
      Geometry simplifiedGeometry = DouglasPeuckerSimplifier.simplify(
              rasterSpaceGeometry, 1);
 
      // build a shape using a fast point in polygon wrapper
    return new ROIGeometry(simplifiedGeometry);
  }
View Full Code Here


               
                at.setToTranslation(-0.5, -0.5);
                simplifiedGeometry.apply(at);
               
                // build a shape using a fast point in polygon wrapper
                ROI roi = new ROIGeometry(simplifiedGeometry, false);

                // run the stats via JAI
                Statistic[] reqStatsArr = new Statistic[] { Statistic.MAX, Statistic.MIN,
                        Statistic.RANGE, Statistic.MEAN, Statistic.SDEV, Statistic.SUM };
                final ZonalStatsOpImage zsOp = new ZonalStatsOpImage(
View Full Code Here

                                                sourceThreshold,
                                                (hasAlpha || doInputTransparency) ? new PlanarImage[] { in.alphaChannel }: new PlanarImage[] { null },
                                                new ROI[] { in.roi },
                                                request.isBlend() ? MosaicDescriptor.MOSAIC_TYPE_BLEND: MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
                                                localHints);
                                roi=roi.add(new ROIGeometry(JTS.toGeometry(new ReferencedEnvelope(rasterBounds, null))));
                                if (footprintBehavior!=FootprintBehavior.None) {
                                    // Adding globalRoi to the output
                                    RenderedOp rop = (RenderedOp) mosaic;
                                    rop.setProperty("ROI", in.roi);
                                }
View Full Code Here

            // ROI
            //
            // we need to add its roi in order to avoid problems with the mosaics sources overlapping
            final Rectangle bounds = PlanarImage.wrapRenderedImage(granule).getBounds();
            Geometry mask = JTS.toGeometry(new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()));
            ROI imageROI = new ROIGeometry(mask);           
            if (footprintBehavior.handleFootprints()){

               
                // get the real footprint
                final ROI footprint = result.getFootprint();
                if (footprint != null) {
                    if (imageROI.contains(footprint.getBounds2D().getBounds())) {
                        imageROI = footprint;
                    } else {
                        imageROI = imageROI.intersect(footprint);
                    }
                }
               
                // ARTIFACTS FILTERING
                if (defaultArtifactsFilterThreshold != Integer.MIN_VALUE && result.isDoFiltering()){
View Full Code Here

        finalRaster2Model.concatenate(decimationScaleTranform);
     
            // adjust roi
            if (useFootprint) {

                ROIGeometry transformed;
                try {
                    transformed = roiProvider.getTransformedROI(finalRaster2Model.createInverse());
                    if (transformed.getAsGeometry().isEmpty()) {
                        // inset might have killed the geometry fully
                        return null;
                    }

                    PlanarImage pi = PlanarImage.wrapRenderedImage(raster);
                    if(!transformed.intersects(pi.getBounds())) {
                        return null;
                    }
                    pi.setProperty("ROI", transformed);
                    raster = pi;
View Full Code Here

        block.setParameter("noData", nodata);

        // Setting ROI
        if (parameters.parameter(GEOMETRY).getValue() != null) {
            // Creation of a ROI geometry object from the Geometry
            ROI roi = new ROIGeometry(JTS.transform((Geometry) parameters.parameter(GEOMETRY)
                    .getValue(), crsToGRID));
            // Addition of the ROI to the ParameterBlock
            block.setParameter("roi", roi);
        }
View Full Code Here

        // Ensure equal images inside ROI. This requires cropping the images
       
        // World to grid transform for mapping the ROI in the Raster apsce
        MathTransform2D tr = coverage1.getGridGeometry().getCRSToGrid2D(PixelOrientation.UPPER_LEFT);
        // ROI object inthe Raster Space
        ROI roi = new ROIGeometry(JTS.transform(geo, tr));
        // This ROI is a Rectangle so we can get its bounds
        Rectangle roiBounds = roi.getBounds();
        // Crop the source image with the ROI Bounds
        RenderedImage cropSrc = CropDescriptor.create(srcImg1, (float)roiBounds.x,
            (float)roiBounds.y, (float)roiBounds.width, (float)roiBounds.height, null);
       
        // Coverage Crop for the final coverages
View Full Code Here

    private void ensureNoDataOutside(GridCoverage2D coverage, Geometry geom)
            throws MismatchedDimensionException, TransformException {
        // World to Grid transform used to project the Geometry to the RasterSpace
        MathTransform w2g = coverage.getGridGeometry().getCRSToGrid2D(PixelOrientation.UPPER_LEFT);
        // ROI in raster space
        ROI roi = new ROIGeometry(JTS.transform(geom, w2g));
        // Approximate bounds by expanding them by one (coordinates are taken with a 0.5 offset)
        Rectangle rect = roi.getBounds();
        rect.grow(1, 1);
        // No data value to use
        double nodata = CoverageUtilities.getBackgroundValues(coverage)[0];

        // Cycle on the image Bounds in order to search if No Data are present
View Full Code Here

            return null;
        }
        if (at == null) {
            at = new AffineTransform();
        }
        ROIGeometry roiGeometry = roiCache.get(at);
        if (roiGeometry == null) {
            Geometry rescaled;
            AffineTransformation geometryAT = new AffineTransformation(at.getScaleX(), at.getShearX(), at
                    .getTranslateX(), at.getShearY(), at.getScaleY(), at.getTranslateY());
            if (inset > 0) {
View Full Code Here

            final Geometry geom = getGeometry(roi);
            // is it a rectangle?
            if (geom != null && geom.equalsExact(geom.getEnvelope())) {
                GeometryClipper clipper = new GeometryClipper(geom.getEnvelopeInternal());
                Geometry intersect = clipper.clip(getAsGeometry(), true);
                return new ROIGeometry(intersect);
   
            } else {
                return super.intersect(roi);
            }
        }
View Full Code Here

TOP

Related Classes of org.jaitools.imageutils.ROIGeometry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.