@Test public void testSubtract() { double[] constants = new double[] {18.75}; GridCoverage sourceCoverage = SST.view(GEOPHYSICS); GridCoverage targetCoverage = (GridCoverage) processor.subtract(sourceCoverage, constants); 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 ("SubtractConst", ((OperationNode) targetImage).getOperationName()); final boolean medialib = TestData.isMediaLibAvailable(); for (int y=sourceRaster.getHeight(); --y>=0;) { for (int x=sourceRaster.getWidth(); --x>=0;) { final float s = sourceRaster.getSampleFloat(x, y, 0); final float t = targetRaster.getSampleFloat(x, y, 0); if (Float.isNaN(s)) { if (medialib) { assertTrue(Float.isNaN(t)); } } else { assertEquals(s - constants[0], t, 1E-3f); } } } if (SHOW) { show(targetCoverage); } }
public Coverage subtract(final Coverage source, final double[] constants) throws CoverageProcessingException { return doOperation("SubtractConst", source, "constants", constants); }
Operations { public Coverage subtract(final Coverage source, final double[] constants) throws CoverageProcessingException { return doOperation("SubtractConst", source, "constants", constants); } }
Operations { public Coverage subtract(final Coverage source, final double[] constants) throws CoverageProcessingException { return doOperation("SubtractConst", source, "constants", constants); } Operations(final RenderingHints hints); }
Operations { public Coverage subtract(final Coverage source, final double[] constants) throws CoverageProcessingException { return doOperation("SubtractConst", source, "constants", constants); } 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); GridCoverage recolor(final GridCoverage source, final ColorMap[] colorMaps); 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 scale(final GridCoverage source,
                              final double xScale, final double yScale,
                              final double xTrans, final double yTrans,
                              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); }
Operations { public Coverage subtract(final Coverage source, final double[] constants) throws CoverageProcessingException { return doOperation("SubtractConst", source, "constants", constants); } 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); GridCoverage recolor(final GridCoverage source, final ColorMap[] colorMaps); 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 scale(final GridCoverage source,
                              final double xScale, final double yScale,
                              final double xTrans, final double yTrans,
                              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; }