public int getRasterHeight() { return raster.getSceneRasterHeight(); }
private static boolean pixelIsNotInBounds(RasterDataNode raster, int x, int y) { int height = raster.getSceneRasterHeight(); int width = raster.getSceneRasterWidth(); return x < 0 || x >= width || y < 0 || y >= height; } }
public int getStatisticsLevel(RasterDataNode raster, int levelCount) { final long imageSize = (long) raster.getSceneRasterWidth() * raster.getSceneRasterHeight(); final int statisticsLevel; if (imageSize <= DefaultMultiLevelModel.DEFAULT_MAX_LEVEL_PIXEL_COUNT) { statisticsLevel = 0; } else { statisticsLevel = levelCount - 1; } return statisticsLevel; }
private boolean isPixelWithinImageBounds(int x, int y) { return x >= 0 && y >= 0 && x < getSceneRasterWidth() && y < getSceneRasterHeight(); }
private static Dimension getFinalImageSize(RasterDataNode raster) { int width; int height; double ratio = raster.getSceneRasterWidth() / (double) raster.getSceneRasterHeight(); if (ratio >= 1.0) { width = Math.min(1280, raster.getSceneRasterWidth()); height = (int) Math.round(width / ratio); } else { height = Math.min(1280, raster.getSceneRasterHeight()); width = (int) Math.round(height * ratio); } return new Dimension(width, height); } }
public ConvolutionFilterBand(String name, RasterDataNode source, Kernel kernel, int iterationCount) { super(name, source.getGeophysicalDataType() == ProductData.TYPE_FLOAT64 ? ProductData.TYPE_FLOAT64 : ProductData.TYPE_FLOAT32, source.getSceneRasterWidth(), source.getSceneRasterHeight(), source); this.kernel = kernel; this.iterationCount = iterationCount; }
public byte[] quantizeRasterData(final double newMin, final double newMax, final double gamma, ProgressMonitor pm) throws IOException { final byte[] colorIndexes = new byte[getSceneRasterWidth() * getSceneRasterHeight()]; quantizeRasterData(newMin, newMax, gamma, colorIndexes, 0, 1, pm); return colorIndexes; }
/** * Creates raster data that is compatible to this dataset's data type. The data buffer returned contains exactly * <code>getBandOutputRasterWidth()*getBandOutputRasterHeight()</code> elements of a compatible data type. * * @return raster data compatible with this product raster * @see #createCompatibleRasterData */ public ProductData createCompatibleSceneRasterData() { return createCompatibleRasterData(getSceneRasterWidth(), getSceneRasterHeight()); }
/** * @deprecated since BEAM 5 because it creates a {@code DefaultMultiLevelModel}, which is not the desired behaviour in many cases */ @Deprecated public static BandImageMultiLevelSource create(RasterDataNode[] rasterDataNodes, AffineTransform i2mTransform, ProgressMonitor pm) { return create(rasterDataNodes, i2mTransform, DefaultMultiLevelModel.getLevelCount(rasterDataNodes[0].getSceneRasterWidth(), rasterDataNodes[0].getSceneRasterHeight()), pm); }
double[] getNextValue() { final double[] value = new double[rdn.length]; final int x; final int y; if (xValue == null) { x = random.nextInt(rdn[0].getSceneRasterWidth()); y = random.nextInt(rdn[0].getSceneRasterHeight()); } else { final int randomIndex = random.nextInt(roiMemberCount); x = xValue[randomIndex]; y = yValue[randomIndex]; } final Rectangle rectangle = new Rectangle(x, y, 1, 1); for (int i = 0; i < rdn.length; i++) { final Tile sourceTile = operator.getSourceTile(rdn[i], rectangle); value[i] = sourceTile.getSampleDouble(x, y); } return value; } }
/** * Creates a rectangular boundary expressed in pixel positions for the given source rectangle. If the source * <code>rect</code> is 100 x 50 pixels and <code>step</code> is 10 the returned array will countain exactly 2 * 10 * + 2 * (5 - 2) = 26 pixel positions. * <p/> * <p>This method is used for an intermediate step when determining a raster boundary expressed in geographical * co-ordinates. * * @param raster the raster * @param rect the source rectangle * @param step the mean distance from one pixel position to the other in the returned array * * @return the rectangular boundary */ public static PixelPos[] createPixelBoundary(RasterDataNode raster, Rectangle rect, int step) { if (rect == null) { rect = new Rectangle(0, 0, raster.getSceneRasterWidth(), raster.getSceneRasterHeight()); } return createRectBoundary(rect, step); }
private static void checkRegion(final int offsetX, final int offsetY, final int width, final int height, final Term[] terms) { for (final Term term : terms) { final RasterDataSymbol[] refRasterDataSymbols = BandArithmetic.getRefRasterDataSymbols(term); for (RasterDataSymbol refRasterDataSymbol : refRasterDataSymbols) { final RasterDataNode raster = refRasterDataSymbol.getRaster(); final int rasterWidth = raster.getSceneRasterWidth(); final int rasterHeight = raster.getSceneRasterHeight(); if (rasterWidth < (offsetX + width) || rasterHeight < (offsetY + height)) { throw new IllegalArgumentException("out of bounds."); } } } }
private Orthorectifier createOrthorectifier(final RasterDataNode sourceBand) { return new Orthorectifier2(sourceBand.getSceneRasterWidth(), sourceBand.getSceneRasterHeight(), sourceBand.getPointing(), elevationModel, 25); }
protected AbstractNetcdfMultiLevelImage(RasterDataNode rasterDataNode) { super(ImageManager.createSingleBandedImageLayout(rasterDataNode), null, null); this.rasterDataNode = rasterDataNode; int width = rasterDataNode.getSceneRasterWidth(); int height = rasterDataNode.getSceneRasterHeight(); levelCount = DefaultMultiLevelModel.getLevelCount(width, height); this.levelImages = new RenderedImage[levelCount]; }
protected RasterDataNodeOpImage(RasterDataNode rasterDataNode, ResolutionLevel level) { super(ImageManager.getDataBufferType(rasterDataNode.getDataType()), rasterDataNode.getSceneRasterWidth(), rasterDataNode.getSceneRasterHeight(), getPreferredTileSize(rasterDataNode), null, level); this.rasterDataNode = rasterDataNode; }
public static ImageLayout createSingleBandedImageLayout(RasterDataNode rasterDataNode, int dataBufferType) { int width = rasterDataNode.getSceneRasterWidth(); int height = rasterDataNode.getSceneRasterHeight(); Dimension tileSize = getPreferredTileSize(rasterDataNode.getProduct()); return createSingleBandedImageLayout(dataBufferType, width, height, tileSize.width, tileSize.height); }
/** * @deprecated since BEAM 5 because it creates a {@code DefaultMultiLevelModel}, which is not the desired behaviour in many cases */ @Deprecated private static BandImageMultiLevelSource create(RasterDataNode[] rasterDataNodes, AffineTransform i2mTransform, int levelCount, ProgressMonitor pm) { Assert.notNull(rasterDataNodes); Assert.argument(rasterDataNodes.length > 0); final int w = rasterDataNodes[0].getSceneRasterWidth(); final int h = rasterDataNodes[0].getSceneRasterHeight(); MultiLevelModel model = new DefaultMultiLevelModel(levelCount, i2mTransform, w, h); return create(rasterDataNodes, model, pm); }
/** * Creates a GeneralFilterBand. * * @param name the name of the band. * @param source the source which shall be filtered. * @param opType the predefined operation type. * @param structuringElement the structuring element (as used by morphological filters) */ public GeneralFilterBand(String name, RasterDataNode source, OpType opType, Kernel structuringElement, int iterationCount) { super(name, source.getGeophysicalDataType() == ProductData.TYPE_FLOAT64 ? ProductData.TYPE_FLOAT64 : ProductData.TYPE_FLOAT32, source.getSceneRasterWidth(), source.getSceneRasterHeight(), source); Assert.notNull(opType, "opType"); Assert.notNull(structuringElement, "structuringElement"); this.opType = opType; this.structuringElement = structuringElement; this.iterationCount = iterationCount; }
ArrayDataProvider(RasterDataNode lonBand, RasterDataNode latBand, PlanarImage maskImage) { width = lonBand.getSceneRasterWidth(); int height = lonBand.getSceneRasterHeight(); MultiLevelImage lonImage = ImageManager.createMaskedGeophysicalImage(lonBand, Float.NaN); lonData = lonImage.getData().getSamples(0, 0, width, height, 0, (float[]) null); MultiLevelImage latImage = ImageManager.createMaskedGeophysicalImage(latBand, Float.NaN); latData = latImage.getData().getSamples(0, 0, width, height, 0, (float[]) null); if (maskImage != null) { final int[] maskValues = maskImage.getData().getSamples(0, 0, width, height, 0, (int[]) null); for (int i = 0; i < maskValues.length; i++) { if (maskValues[i] == 0) { lonData[i] = Float.NaN; latData[i] = Float.NaN; } } } }
@Override protected void computeProductData(ProductData productData, Rectangle destRect) throws IOException { final int sourceWidth = getRasterDataNode().getSceneRasterWidth(); final int sourceHeight = getRasterDataNode().getSceneRasterHeight(); final int targetWidth = destRect.width; final int targetHeight = destRect.height; final int sourceX0 = getSourceX(destRect.x); final int sourceY0 = getSourceY(destRect.y); final int[] sourceXs = getSourceCoords(sourceWidth, targetWidth); final int[] sourceYs = getSourceCoords(sourceHeight, targetHeight); int elemIndex = 0; for (int j = 0; j < targetHeight; j++) { final int sourceY = sourceY0 + sourceYs[j]; for (int i = 0; i < targetWidth; i++) { productData.setElemDoubleAt(elemIndex, computeSample(sourceX0 + sourceXs[i], sourceY)); elemIndex++; } } }