/** * Construct an image map, as the result of the Categorize operation * * @param raster * input raster * @param style * raster style, that contains channel mappings (if applicable) * @return a buffered image with the processed data */ public BufferedImage evaluateRaster( AbstractRaster raster, RasterStyling style ) { BufferedImage img = null; int col = -1, row = -1; RasterData data = raster.getAsSimpleRaster().getRasterData(); RasterDataUtility converter = new RasterDataUtility( raster, style.channelSelection ); img = new BufferedImage( data.getColumns(), data.getRows(), BufferedImage.TYPE_INT_ARGB ); LOG.trace( "Created image with H={}, L={}", img.getHeight(), img.getWidth() ); for ( row = 0; row < img.getHeight(); row++ ) { for ( col = 0; col < img.getWidth(); col++ ) { Color c = lookup2( converter.get( col, row ) ); img.setRGB( col, row, c.getRGB() ); } } return img; }
/** * Construct an image map, as the result of the Interpolate operation * * @param raster * input raster * @param style * raster style, containing channel mappings (if applicable) * @return a buffered image with the processed data */ public BufferedImage evaluateRaster( AbstractRaster raster, RasterStyling style ) { BufferedImage img = null; int col = -1, row = -1; int rgb = 0; RasterData data = raster.getAsSimpleRaster().getRasterData(); RasterDataUtility rawData = new RasterDataUtility( raster ); img = new BufferedImage( data.getColumns(), data.getRows(), BufferedImage.TYPE_INT_ARGB ); LOG.debug( "Created image with H={}, L={}", img.getHeight(), img.getWidth() ); for ( row = 0; row < img.getHeight(); row++ ) for ( col = 0; col < img.getWidth(); col++ ) { float val = rawData.get( col, row ); rgb = lookup2Color( val ).getRGB(); img.setRGB( col, row, rgb ); } return img; }
RasterDataUtility data = new RasterDataUtility( raster, style.channelSelection ); RasterData shadeData = RasterDataFactory.createRasterData( cols - 2, rows - 2, DataType.BYTE, false ); RasterGeoReference ref = raster.getRasterReference();
/** * Performs contrast enhancement on all bands of a raster and returns the modified raster. * * @param raster * initial raster * @param contrastEnhancement * @return the enhanced raster */ private AbstractRaster performContrastEnhancement( AbstractRaster raster, ContrastEnhancement contrastEnhancement ) { if ( contrastEnhancement == null ) return raster; LOG.trace( "Enhancing contrast for overall raster..." ); RasterData data = raster.getAsSimpleRaster().getRasterData(), newData = data; RasterDataUtility rasutil = new RasterDataUtility( raster ); rasutil.setContrastEnhancement( contrastEnhancement ); rasutil.precomputeContrastEnhancements( -1, contrastEnhancement ); for ( int band = 0; band < data.getBands(); band++ ) newData = setEnhancedChannelData( newData, rasutil, band, band, contrastEnhancement ); AbstractRaster newRaster = new SimpleRaster( newData, raster.getEnvelope(), raster.getRasterReference(), null ); return newRaster; }
int redIndex = idx[0], greenIndex = idx[1]; int blueIndex = idx[2], grayIndex = idx[3]; RasterDataUtility rasutil = new RasterDataUtility( raster, channels ); RasterData newData = simpleRaster.getRasterData(); BandType[] bandTypes = null;