本文整理了Java中javax.media.jai.iterator.RandomIter.getSampleDouble
方法的一些代码示例,展示了RandomIter.getSampleDouble
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomIter.getSampleDouble
方法的具体详情如下:
包路径:javax.media.jai.iterator.RandomIter
类名称:RandomIter
方法名:getSampleDouble
暂无
代码示例来源:origin: geotools/geotools
public double getSampleDouble(int x, int y, int b) {
return delegate.getSampleDouble(x, y, b);
}
代码示例来源:origin: geotools/geotools
double value = iter.getSampleDouble(x, y, 0);
if (!Double.isNaN(value)) {
代码示例来源:origin: geotools/geotools
for (int i = 0; i < dataWindowRows; i++) {
for (int j = 0; j < dataWindowCols; j++) {
double value = iterator.getSampleDouble(j, i, 0);
代码示例来源:origin: geotools/geotools
int col = (tileX * tileWidth) + tcol;
if ((col >= minX) && (col <= maxX)) {
double value = iter.getSampleDouble(col, row, 0);
if (!bitSet.get(col - minX, row - minY)
&& !Double.isNaN(value)) {
代码示例来源:origin: org.integratedmodelling/klab-engine
public double getDouble(int x, int y) {
return itera.getSampleDouble(x, y, 0);
}
代码示例来源:origin: org.integratedmodelling/klab-engine
@Override
public Object getValue(int contextIndex) {
int[] xy = _grid.getXYOffsets(contextIndex);
return _itera.getSampleDouble(xy[0], xy[1], 0);
}
代码示例来源:origin: org.jaitools/jt-utils
/**
* Fills the region connected to the specified start pixel.
* A pixel belongs to this region if there is a path between it and the starting
* pixel which passes only through pixels of value {@code v} within the range
* {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}.
*
* @param x start pixel x coordinate
*
* @param y start pixel y coordinate
*
* @param fillValue the value to write to the destination image for this region
*
* @return a new {@linkplain FillResult}
*/
public FillResult fill(int x, int y, int fillValue) {
return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand));
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
/**
* Fills the region connected to the specified start pixel.
* A pixel belongs to this region if there is a path between it and the starting
* pixel which passes only through pixels of value {@code v} within the range
* {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}.
*
* @param x start pixel x coordinate
*
* @param y start pixel y coordinate
*
* @param fillValue the value to write to the destination image for this region
*
* @return a new {@linkplain FillResult}
*/
public FillResult fill(int x, int y, int fillValue) {
return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand));
}
代码示例来源:origin: org.jaitools/jt-utils
/**
* Fills the region connected to the specified start pixel and lying within
* {@code radius} pixels of the start pixel.
* <p>
* A pixel belongs to this region if there is a path between it and the starting
* pixel which passes only through pixels of value {@code v} within the range
* {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}.
*
* @param x start pixel x coordinate
*
* @param y start pixel y coordinate
*
* @param fillValue the value to write to the destination image for this region
*
* @param radius maximum distance (pixels) that a candidate pixel can be from
* the start pixel
*
* @return a new {@linkplain FillResult}
*/
public FillResult fillRadius(int x, int y, int fillValue, double radius) {
return fillRadius(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand), radius);
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
/**
* Fills the region connected to the specified start pixel and lying within
* {@code radius} pixels of the start pixel.
* <p>
* A pixel belongs to this region if there is a path between it and the starting
* pixel which passes only through pixels of value {@code v} within the range
* {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}.
*
* @param x start pixel x coordinate
*
* @param y start pixel y coordinate
*
* @param fillValue the value to write to the destination image for this region
*
* @param radius maximum distance (pixels) that a candidate pixel can be from
* the start pixel
*
* @return a new {@linkplain FillResult}
*/
public FillResult fillRadius(int x, int y, int fillValue, double radius) {
return fillRadius(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand), radius);
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
double val = srcIter.getSampleDouble(x, y, srcBand);
return CompareOp.acompare(Math.abs(val - refValue), tolerance) <= 0;
代码示例来源:origin: geotools/geotools
for (int j = 0; j < kheight; j++) {
for (int i = 0; i < kwidth; i++) {
samples[j][i] = iter.getSampleDouble(xint + i, yint + j, b);
代码示例来源:origin: org.integratedmodelling/klab-engine
public static int countNodata(GridCoverage2D layer, IDirectObservation context) throws KlabException {
SpaceExtent ext = (SpaceExtent) context.getScale().getSpace();
if (ext.getGrid() == null) {
throw new KlabValidationException("cannot return a raster layer from a non-grid extent");
}
Grid grid = ext.getGrid();
RenderedImage image = layer.getRenderedImage();
RandomIter itera = RandomIterFactory.create(image, null);
int nodata = 0;
for (int i = 0; i < grid.getCellCount(); i++) {
int[] xy = grid.getXYOffsets(i);
double d = itera.getSampleDouble(xy[0], xy[1], 0);
if (Double.isNaN(d)) {
nodata ++;
}
}
return nodata;
}
代码示例来源:origin: geosolutions-it/jai-ext
/** Method for testing the selected input RandomIter on a Double image */
public void testRandomIterDouble(RenderedImage img, double[] valueArray, boolean cachedTiles,
boolean arrayCalculation) {
RandomIter iter = RandomIterFactory.create(img, null, cachedTiles, arrayCalculation);
double[] array = new double[3];
// Store of the image data calculated
for (int i = 0; i < indexArray.length; i++) {
int x = indexArray[i][0];
int y = indexArray[i][1];
double valueExpected = iter.getSampleDouble(x, y, 0);
assertEquals(valueExpected, valueArray[i], DELTA);
double valueExpectedArray = iter.getPixel(x, y, array)[0];
assertEquals(valueExpectedArray, valueArray[i], DELTA);
}
}
代码示例来源:origin: org.integratedmodelling/klab-engine
double value = itera.getSampleDouble(xy[0], xy[1], 0);
States.set(ret, transformation == null ? value : transformation.apply(value), i);
代码示例来源:origin: geosolutions-it/jai-ext
private void assertCopy(RenderedImage src, RenderedOp op, int dataType) {
// check it's a copy with the expected values
assertEquals(src.getMinX(), op.getMinX());
assertEquals(src.getWidth(), op.getWidth());
assertEquals(src.getMinY(), op.getMinY());
assertEquals(src.getHeight(), op.getHeight());
assertEquals(dataType, op.getSampleModel().getDataType());
RandomIter srcIter = RandomIterFactory.create(src, null);
RandomIter opIter = RandomIterFactory.create(op, null);
for(int y = src.getMinY(); y < src.getMinY() + src.getHeight(); y++) {
for(int x = src.getMinX(); x < src.getMinX() + src.getWidth(); x++) {
double expected = srcIter.getSampleDouble(x, y, 0);
double actual = opIter.getSampleDouble(x, y, 0);
assertEquals(expected, actual, 0d);
}
}
}
代码示例来源:origin: org.integratedmodelling/klab-engine
public static IGridMask rasterizeShapes(Collection<ShapeValue> shapes, IGrid grid, int value) throws KlabException {
if (grid.getXCells() * grid.getYCells() < 16) {
return new DummyActivationLayer(grid);
}
RasterActivationLayer ret = (RasterActivationLayer) createMask(grid);
GridCoverage2D coverage = null;
ret.deactivate();
FeatureRasterizer rasterizer = new FeatureRasterizer(grid, 0.0f, null, null);
coverage = rasterizer.rasterize(shapes, value);
/*
* turn coverage into mask
*/
RenderedImage image = coverage.getRenderedImage();
RandomIter itera = RandomIterFactory.create(image, null);
for (int i = 0; i < grid.getCellCount(); i++) {
int[] xy = grid.getXYOffsets(i);
if (itera.getSampleDouble(xy[0], xy[1], 0) > 0.0) {
ret.activate(xy[0], xy[1]);
}
}
return ret;
}
代码示例来源:origin: org.integratedmodelling/klab-engine
/**
* Get a static state built from the passed layer. Do not add to a context.
*
* @param layer
* @param observable
* @param context
* @param label
* @return state
* @throws KlabException
*/
public static IState coverageToState(GridCoverage2D layer, IObservableSemantics observable, IContext context, String label, Function<Double, Double> transformation )
throws KlabException {
SpaceExtent ext = (SpaceExtent) context.getSubject().getScale().getSpace();
if (ext.getGrid() == null) {
throw new KlabValidationException("cannot return a raster layer from a non-grid extent");
}
Grid grid = ext.getGrid();
RenderedImage image = layer.getRenderedImage();
RandomIter itera = RandomIterFactory.create(image, null);
IState ret = States.createStatic(observable, context.getSubject().getScale(), context);
for (int i = 0; i < grid.getCellCount(); i++) {
int[] xy = grid.getXYOffsets(i);
double value = itera.getSampleDouble(xy[0], xy[1], 0);
States.set(ret, transformation == null ? value : transformation.apply(value), i);
}
ret.getMetadata().put(NS.DISPLAY_LABEL_PROPERTY, label);
return ret;
}
代码示例来源:origin: org.integratedmodelling/klab-engine
private static IGridMask rasterizeShape(ShapeValue shape, IGrid grid, int value) throws KlabException {
if (grid.getXCells() * grid.getYCells() < 16) {
return new DummyActivationLayer(grid);
}
RasterActivationLayer ret = (RasterActivationLayer) createMask(grid);
GridCoverage2D coverage = null;
ret.deactivate();
FeatureRasterizer rasterizer = new FeatureRasterizer(grid, 0.0f, null, null);
coverage = rasterizer.rasterize(shape, value);
/*
* turn coverage into mask
*/
RenderedImage image = coverage.getRenderedImage();
RandomIter itera = RandomIterFactory.create(image, null);
for (int i = 0; i < grid.getCellCount(); i++) {
int[] xy = grid.getXYOffsets(i);
if (itera.getSampleDouble(xy[0], xy[1], 0) > 0.0) {
ret.activate(xy[0], xy[1]);
}
}
return ret;
}
代码示例来源:origin: geosolutions-it/jai-ext
@Test
public void testSum() {
RenderedImage src1 = buildTestImage(10, 10);
RenderedImage src2 = buildTestImage(10, 10);
RenderedOp op = JiffleDescriptor.create(new RenderedImage[] {src1, src2}, new String[] {"a", "b"}, "res",
"res = a + b;", null, DataBuffer.TYPE_INT, null, null, null);
// check same size and expected
assertEquals(src1.getMinX(), op.getMinX());
assertEquals(src1.getWidth(), op.getWidth());
assertEquals(src1.getMinY(), op.getMinY());
assertEquals(src1.getHeight(), op.getHeight());
assertEquals(DataBuffer.TYPE_INT, op.getSampleModel().getDataType());
RandomIter srcIter = RandomIterFactory.create(src1, null);
RandomIter opIter = RandomIterFactory.create(op, null);
for(int y = src1.getMinY(); y < src1.getMinY() + src1.getHeight(); y++) {
for(int x = src1.getMinX(); x < src1.getMinX() + src1.getWidth(); x++) {
double expected = srcIter.getSampleDouble(x, y, 0) * 2;
double actual = opIter.getSampleDouble(x, y, 0);
assertEquals(expected, actual, 0d);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!