private WritableSampleImpl(int index, Tile tile, Point location) { this.index = index; this.node = tile.getRasterDataNode(); this.dataType = this.node.getGeophysicalDataType(); this.tile = tile; this.location = location; }
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; }
private static MultiLevelImage replaceNoDataValueByNaN(final RasterDataNode rasterDataNode, final MultiLevelImage srcImage, final double noDataValue, final Number newValue) { final MultiLevelModel multiLevelModel = getMultiLevelModel(rasterDataNode); final int targetDataType = ImageManager.getDataBufferType(rasterDataNode.getGeophysicalDataType()); return new DefaultMultiLevelImage(new AbstractMultiLevelSource(multiLevelModel) { @Override public RenderedImage createImage(int sourceLevel) { return new ReplaceValueOpImage(srcImage, noDataValue, newValue, targetDataType); } }); }
/** * 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; }
public static void defineRasterDataNodes(ProfileWriteContext ctx, RasterDataNode[] rasterDataNodes) throws IOException { final NFileWriteable ncFile = ctx.getNetcdfFileWriteable(); final String dimensions = ncFile.getDimensions(); for (RasterDataNode rasterDataNode : rasterDataNodes) { String variableName = ReaderUtils.getVariableName(rasterDataNode); int dataType; if (rasterDataNode.isLog10Scaled()) { dataType = rasterDataNode.getGeophysicalDataType(); } else { dataType = rasterDataNode.getDataType(); } DataType netcdfDataType = DataTypeUtils.getNetcdfDataType(dataType); java.awt.Dimension tileSize = ImageManager.getPreferredTileSize(rasterDataNode.getProduct()); final NVariable variable = ncFile.addVariable(variableName, netcdfDataType, tileSize, dimensions); writeCfBandAttributes(rasterDataNode, variable); } }
private boolean addDataToReferredRasterDataSymbols(Rectangle destRect, Term term) { for (final RasterDataSymbol symbol : BandArithmetic.getRefRasterDataSymbols(term)) { final RenderedImage sourceImage; final int dataType; final RasterDataNode rasterDataNode = symbol.getRaster(); if (symbol.getSource() == RasterDataSymbol.GEOPHYSICAL) { sourceImage = ImageManager.getInstance().getGeophysicalImage(rasterDataNode, getLevel()); dataType = rasterDataNode.getGeophysicalDataType(); } else { sourceImage = ImageManager.getInstance().getSourceImage(rasterDataNode, getLevel()); dataType = rasterDataNode.getDataType(); } final Raster sourceRaster = sourceImage.getData(destRect); if (sourceRaster instanceof NoDataRaster) { return false; } DataBuffer dataBuffer = sourceRaster.getDataBuffer(); if (dataBuffer.getSize() != destRect.width * destRect.height) { final WritableRaster writableRaster = sourceRaster.createCompatibleWritableRaster(destRect); sourceImage.copyData(writableRaster); dataBuffer = writableRaster.getDataBuffer(); } symbol.setData(ProductData.createInstance(dataType, ImageUtils.getPrimitiveArray(dataBuffer))); } return true; }
MultiLevelImage sourceImage; if (sourceRaster.isScalingApplied()) { targetDataType = sourceRaster.getGeophysicalDataType(); sourceImage = sourceRaster.getGeophysicalImage(); } else {