Operations { public Coverage gradientMagnitude(final Coverage source) throws CoverageProcessingException { return doOperation("GradientMagnitude", source); } Operations(final RenderingHints hints); Coverage add(final Coverage source, final double[] constants); Coverage add(final Coverage source0, final Coverage source1); Coverage multiply(final Coverage source0, final Coverage source1); Coverage subtract(final Coverage source, final double[] constants); Coverage subtractFrom(final Coverage source, final double[] constants); Coverage multiply(final Coverage source, final double[] constants); Coverage divideBy(final Coverage source, final double[] constants); Coverage rescale(final Coverage source, final double[] constants, final double[] offsets); Coverage invert(final Coverage source); Coverage absolute(final Coverage source); Coverage log(final Coverage source); Coverage exp(final Coverage source); Coverage extrema(final Coverage source); GridCoverage nodataFilter(final GridCoverage source); GridCoverage nodataFilter(final GridCoverage source,
                                     final int padding,
                                     final int validityThreshold); GridCoverage interpolate(final GridCoverage source, final String type); GridCoverage interpolate(final GridCoverage source, final Interpolation type); GridCoverage interpolate(final GridCoverage source, final Interpolation[] types); Coverage selectSampleDimension(final Coverage source, final int[] sampleDimensions); Coverage resample(final Coverage source, final CoordinateReferenceSystem crs); Coverage resample(final GridCoverage  source,
                             final Envelope      envelope,
                             final Interpolation interpolationType); Coverage resample(final GridCoverage  source,
                             final CoordinateReferenceSystem crs,
                             final GridGeometry  gridGeometry,
                             final Interpolation interpolationType); Coverage resample(final GridCoverage  source,
                             final CoordinateReferenceSystem crs,
                             final GridGeometry  gridGeometry,
                             final Interpolation interpolationType,
                             final double[] backgroundValues); Coverage crop(final Coverage Source, final Envelope envelope); GridCoverage scale(final GridCoverage source,
                              final double xScale, final double yScale,
                              final double xTrans, final double yTrans); GridCoverage warp(final GridCoverage source,
                              final Warp warp); GridCoverage affine(final GridCoverage source,
                              final AffineTransform transform,
                              final Interpolation interpolation,
                              final double[] noDataValues); GridCoverage scale(final GridCoverage source,
                              final double xScale, final double yScale,
                              final double xTrans, final double yTrans,
                              final Interpolation interpolation); GridCoverage warp(final GridCoverage source,
                              final Warp warp,
                              final Interpolation interpolation); GridCoverage subsampleAverage(final GridCoverage   source,
                                         final double         scaleX,
                                         final double         scaleY); GridCoverage filteredSubsample(final GridCoverage source); GridCoverage filteredSubsample(final GridCoverage source,
                                          final int          scaleX,
                                          final int          scaleY,
                                          final float[]      qsFilter); GridCoverage filteredSubsample(final GridCoverage source,
                                          final int scaleX, final int scaleY,
                                          final float[] qsFilter,
                                          final Interpolation interpolation); Coverage gradientMagnitude(final Coverage source); Coverage gradientMagnitude(final Coverage source,
                                      final KernelJAI mask1, final KernelJAI mask2); static final Operations DEFAULT; }
@Test public void testGradientMagnitude() { GridCoverage sourceCoverage = SST.view(GEOPHYSICS); GridCoverage targetCoverage = (GridCoverage) processor.gradientMagnitude(sourceCoverage); RenderedImage sourceImage = sourceCoverage.getRenderableImage(0,1).createDefaultRendering(); RenderedImage targetImage = targetCoverage.getRenderableImage(0,1).createDefaultRendering(); Raster sourceRaster = sourceImage.getData(); Raster targetRaster = targetImage.getData(); assertNotSame(sourceCoverage, targetCoverage); assertNotSame(sourceImage, targetImage); assertNotSame(sourceRaster, targetRaster); assertSame (sourceCoverage.getCoordinateReferenceSystem(), targetCoverage.getCoordinateReferenceSystem()); assertEquals (sourceCoverage.getEnvelope(), targetCoverage.getEnvelope()); assertEquals (sourceCoverage.getGridGeometry(), targetCoverage.getGridGeometry()); assertEquals (sourceRaster .getMinX(), targetRaster .getMinX()); assertEquals (sourceRaster .getMinY(), targetRaster .getMinY()); assertEquals (sourceRaster .getWidth(), targetRaster .getWidth()); assertEquals (sourceRaster .getHeight(), targetRaster .getHeight()); assertEquals (0, sourceRaster.getMinX()); assertEquals (0, sourceRaster.getMinY()); assertEquals ("GradientMagnitude", ((OperationNode) targetImage).getOperationName()); assertEquals(3.95f, targetRaster.getSampleFloat(304, 310, 0), 1E-2f); assertEquals(1.88f, targetRaster.getSampleFloat(262, 357, 0), 1E-2f); if (SHOW) { show(targetCoverage); } }