Package javax.media.jai

Examples of javax.media.jai.ROIShape


      assertEquals(bins[1][255],5612);
     
      assertEquals(bins[0][0]+bins[1][0]+bins[2][0]+bins[0][20]+bins[1][20]+bins[2][20]+bins[0][180]+bins[0][200]+bins[2][200]+bins[1][255], 100*100*3);
     
      // Image filtering
      ROI roi = new ROIShape(new Rectangle(14, 11, 75, 75));
      double [] backgroundValues = new double[]{0.0d, 0.0d, 0.0d};
      RenderedImage filtered = ArtifactsFilterDescriptor.create(image, roi, backgroundValues, 30, 3, null);
      histogramOp = HistogramDescriptor.create(filtered, null, Integer.valueOf(1), Integer.valueOf(1), new int[]{256}, null, null, null);
      histogram = (Histogram) histogramOp.getProperty("histogram");
     
View Full Code Here


        // If a ROI is present, then only the part contained inside the current tile bounds is taken.
        if (hasROI) {
            Rectangle rect = new Rectangle(destRect);
            // The tile dimension is extended for avoiding border errors
            rect.grow(TILE_EXTENDER, TILE_EXTENDER);
            roiTile = roi.intersect(new ROIShape(rect));
        }

        if (!hasROI || !roiTile.getBounds().isEmpty()) {
            // Loop on the image raster
            switch (destType) {
View Full Code Here

        // If a ROI is present, then only the part contained inside the current tile bounds is taken.
        if (hasROI) {
            Rectangle rect = new Rectangle(destRect);
            // The tile dimension is extended for avoiding border errors
            rect.grow(TILE_EXTENDER, TILE_EXTENDER);
            roiTile = roi.intersect(new ROIShape(rect));
        }

        if (!hasROI || !roiTile.getBounds().isEmpty()) {
            // Loop on the image raster
            switch (destType) {
View Full Code Here

        // Destination No Data
        destNoData = 100;

        // ROI
        roiData = new ROIShape(new Rectangle(0, 0, ROI_WIDTH, ROI_HEIGHT));
    }
View Full Code Here

                     src.getHeight());
            }

            // If necessary, clip the ROI to the effective source bounds.
            if(!srcBounds.contains(srcROI.getBounds())) {
                srcROI = srcROI.intersect(new ROIShape(srcBounds));
            }

            // Retrieve the Warp object.
            Warp warp = (Warp)pb.getObjectParameter(0);

            // Setting constant image to be warped as a ROI
            Rectangle dstBounds = op.getBounds();
           
            // Setting layout of the constant image
            ImageLayout2 layout = new ImageLayout2();
            int minx = (int) srcBounds.getMinX();
            int miny = (int) srcBounds.getMinY();
            int w = (int) srcBounds.getWidth();
            int h = (int) srcBounds.getHeight();
            layout.setMinX(minx);
            layout.setMinY(miny);
            layout.setWidth(w);
            layout.setHeight(h);
            RenderingHints hints = op.getRenderingHints();
            hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
           
            final PlanarImage constantImage = ConstantDescriptor.create(new Float(w), new Float(h), new Byte[]{(byte)255}, hints);
           
            PlanarImage roiImage = null;
           
            // Make sure to specify tileCache, tileScheduler, tileRecyclier, by cloning hints.
            RenderingHints warpingHints = op.getRenderingHints();
            warpingHints.remove(JAI.KEY_IMAGE_LAYOUT);
           
            // Creating warped roi by the same way (Warp, Interpolation, source ROI) we warped the
            // input image.
            final ParameterBlock paramBlk = new ParameterBlock();
            paramBlk.addSource(constantImage);
            paramBlk.add(warp);
            paramBlk.add(interp);
            paramBlk.add(null);
            paramBlk.add(srcROI);

            // force in the image layout, this way we get exactly the same
            // as the affine we're eliminating
            Hints localHints = new Hints(op.getRenderingHints());
            localHints.remove(JAI.KEY_IMAGE_LAYOUT);
            ImageLayout il = new ImageLayout();
            il.setMinX(dstBounds.x);
            il.setMinY(dstBounds.y);
            il.setWidth(dstBounds.width);
            il.setHeight(dstBounds.height);
            localHints.put(JAI.KEY_IMAGE_LAYOUT, il);
            roiImage = JAI.create("Warp", paramBlk, localHints);
            ROI dstROI = new ROI(roiImage, 1);

            // If necessary, clip the warped ROI to the destination bounds.
            if(!dstBounds.contains(dstROI.getBounds())) {
                dstROI = dstROI.intersect(new ROIShape(dstBounds));
            }

            // Return the warped and possibly clipped ROI.
            return dstROI;
        }
View Full Code Here

            source.getCoordinateReferenceSystem2D())
            .intersects((Envelope) new ReferencedEnvelope(envelope))) {
          final java.awt.Polygon shapePolygon = convertPolygon(
              roiInput, worldToGridTransform);

          block.setParameter("roi", new ROIShape(shapePolygon));
        }
      }
      return block;
    } catch (Exception e) {
      // //
View Full Code Here

                    for (int i = 0; i < numGeometries; i++) {
                        Geometry geometryN = geometry.getGeometryN(i);
                        java.awt.Polygon awtPolygon = toAWTPolygon((Polygon) geometryN,
                                worldToGridTransform);
                        if (roi == null) {
                            roi = new ROIShape(awtPolygon);
                        } else {
                            ROI newRoi = new ROIShape(awtPolygon);
                            roi.add(newRoi);
                        }
                    }

                    final Statistic[] statistis = statisticsSet.toArray(new Statistic[statisticsSet
View Full Code Here

          // prepare the params for the mosaic
                    final ROI[] roiarr;
                    try {
                        if(cropROI != null) {
                            final Shape cropRoiLS2 = new LiteShape2(cropROI, ProjectiveTransform.create(sourceWorldToGridTransform), null, false);
                            final ROIShape cropRS = new ROIShape(cropRoiLS2);
                            roiarr = new ROI[]{cropRS};
                        } else {
                            final ROIShape roi = new ROIShape(rasterSpaceROI);
                            roiarr = new ROI[]{roi};
                        }
                    } catch (FactoryException ex) {
            throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP), ex);
                    }
View Full Code Here

        // Setting of the ROI associated to each GridCoverage
        // We need to add its roi in order to avoid problems with the mosaics sources overlapping
        ROI[] rois = new ROI[numSources];
        // Cycle on each coverage in order to add the associated ROI
        for (int i = 0; i < numSources; i++) {
            rois[i] = new ROIShape(PlanarImage.wrapRenderedImage(rasters[i]).getBounds());
        }
        block.setParameter("sourceROI", rois);

        // Setting of the Mosaic type as Overlay
        block.setParameter("mosaicType", MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
View Full Code Here

        }
       
        //
        // If we need to add a collar use mosaic or if we need to blend/apply a bkg color
        if(!(imageBounds.contains(mapRasterArea) || imageBounds.equals(mapRasterArea))||transparencyType!=Transparency.OPAQUE) {
            ROI[] rois = new ROI[] { new ROIShape(imageBounds) };

            // build the transparency thresholds
            double[][] thresholds = new double[][] { { ColorUtilities.getThreshold(image
                    .getSampleModel().getDataType()) } };
            // apply the mosaic
View Full Code Here

TOP

Related Classes of javax.media.jai.ROIShape

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.