public MosaicMultiLevelSource(Band sourceBand, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int levels, AffineTransform transform) { super(new DefaultMultiLevelModel(levels, transform, imageWidth, imageHeight)); this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tileWidth = tileWidth; this.tileHeight = tileHeight; this.sourceBand = sourceBand; this.logger = Logger.getLogger(MosaicMultiLevelSource.class.getName()); }
/** * @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); }
@Override public Layer createLayer(LayerContext ctx, PropertySet configuration) { final File file = (File) configuration.getValue(PROPERTY_NAME_IMAGE_FILE); final AffineTransform transform = (AffineTransform) configuration.getValue(PROPERTY_NAME_WORLD_TRANSFORM); RenderedImage image = FileLoadDescriptor.create(file.getPath(), null, true, null); final Rectangle2D modelBounds = DefaultMultiLevelModel.getModelBounds(transform, image); final DefaultMultiLevelModel model = new DefaultMultiLevelModel(1, transform, modelBounds); final MultiLevelSource multiLevelSource = new DefaultMultiLevelSource(image, model); return new ImageLayer(this, multiLevelSource, configuration); }
private void testGetLevelImageBounds(int expectedSize, int size, int level, DefaultMultiLevelModel model) { Rectangle expected = new Rectangle(0, 0, expectedSize, expectedSize); ResolutionLevel resolutionLevel = new ResolutionLevel(level, model.getScale(level)); ImageLayout imageLayout = ImageManager.createSingleBandedImageLayout(DataBuffer.TYPE_USHORT, size, size, null, resolutionLevel); assertEquals("at resolution level " + level + ":", expected, new Rectangle(imageLayout.getMinX(null), imageLayout.getMinY(null), imageLayout.getWidth(null), imageLayout.getHeight(null)) ); }
public MosaicMultiLevelSource(Band[][] sourceBands, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int numTilesX, int numTilesY, int levels, int dataType, AffineTransform transform) { super(new DefaultMultiLevelModel(levels, //Product.findImageToModelTransform(geoCoding), transform, imageWidth, imageHeight)); this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tileWidth = tileWidth; this.tileHeight = tileHeight; this.numXTiles = numTilesX; this.numYTiles = numTilesY; this.sourceBands = sourceBands; this.dataType = dataType; logger = Logger.getLogger(MosaicMultiLevelSource.class.getName()); }
@Override public Layer createLayer(LayerContext ctx, PropertySet configuration) { final File file = (File) configuration.getValue(PROPERTY_NAME_IMAGE_FILE); final AffineTransform transform = (AffineTransform) configuration.getValue(PROPERTY_NAME_WORLD_TRANSFORM); RenderedImage image = FileLoadDescriptor.create(file.getPath(), null, true, null); final Rectangle2D modelBounds = DefaultMultiLevelModel.getModelBounds(transform, image); final DefaultMultiLevelModel model = new DefaultMultiLevelModel(1, transform, modelBounds); final MultiLevelSource multiLevelSource = new DefaultMultiLevelSource(image, model); return new ImageLayer(this, multiLevelSource, configuration); }
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]; }
public MosaicMultiLevelSource(Band[][] sourceBands, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int numTilesX, int numTilesY, int levels, int dataType, AffineTransform transform) { super(new DefaultMultiLevelModel(levels, //Product.findImageToModelTransform(geoCoding), transform, imageWidth, imageHeight)); this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tileWidth = tileWidth; this.tileHeight = tileHeight; this.numXTiles = numTilesX; this.numYTiles = numTilesY; this.sourceBands = sourceBands; this.dataType = dataType; logger = Logger.getLogger(MosaicMultiLevelSource.class.getName()); }
AffineTransform i2mTransform = Product.findImageToModelTransform(raster.getGeoCoding()); i2mTransform.scale((double) sceneWidth / image.getWidth(), (double) sceneHeight / image.getHeight()); final Rectangle2D bounds = DefaultMultiLevelModel.getModelBounds(i2mTransform, image); final DefaultMultiLevelModel multiLevelModel = new DefaultMultiLevelModel(1, i2mTransform, bounds); multiLevelSource = new DefaultMultiLevelSource(image, multiLevelModel); } catch (Exception e) {
public MosaicMultiLevelSource(Map<Band, String> sourceBand, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int levels, TileComponent tileComponent, AffineTransform transform) { super(new DefaultMultiLevelModel(levels, transform, imageWidth, imageHeight)); this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tileWidth = tileWidth; this.tileHeight = tileHeight; List<Band> bands = new ArrayList<>(); List<String> tiles = new ArrayList<>(); for(Map.Entry<Band, String>entry: sourceBand.entrySet()) { bands.add(entry.getKey()); tiles.add(entry.getValue()); } this.sourceBand = bands.toArray(new Band[bands.size()]); this.tilesNames = tiles.toArray(new String[tiles.size()]); this.tileComponent = tileComponent; this.logger = Logger.getLogger(MosaicMultiLevelSource.class.getName()); }
AffineTransform i2mTransform = ImageManager.getImageToModelTransform(raster.getGeoCoding()); i2mTransform.scale((double) sceneWidth / image.getWidth(), (double) sceneHeight / image.getHeight()); final Rectangle2D bounds = DefaultMultiLevelModel.getModelBounds(i2mTransform, image); final DefaultMultiLevelModel multiLevelModel = new DefaultMultiLevelModel(1, i2mTransform, bounds); multiLevelSource = new DefaultMultiLevelSource(image, multiLevelModel); } catch (Exception e) {
public S2MosaicMultiLevelSource(Band[] sourceBands, double originX, double originY, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int levels, GeoCoding geoCoding, String mosaicType) { super(new DefaultMultiLevelModel(levels, Product.findImageToModelTransform(geoCoding), imageWidth, imageHeight)); this.originX = originX; this.originY = originY; this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tileWidth = tileWidth; this.tileHeight = tileHeight; this.sourceBands = sourceBands; this.mosaicType = mosaicType; this.tileImages = new HashMap<>(); for (int i = 0; i < levels; i++) { this.tileImages.put(i, Collections.synchronizedList(new ArrayList<>())); } this.logger = Logger.getLogger(S2MosaicMultiLevelSource.class.getName()); }
public static TiledFileMultiLevelSource create(File imageDir) throws IOException { Assert.notNull(imageDir); final Properties imageProperties = new Properties(); imageProperties.load(new FileReader(new File(imageDir, "image.properties"))); int levelCount = Integer.parseInt(imageProperties.getProperty("numLevels")); int sourceWidth = Integer.parseInt(imageProperties.getProperty("width")); int sourceHeight = Integer.parseInt(imageProperties.getProperty("height")); final String s = imageProperties.getProperty("i2mTransform"); AffineTransform i2mTransform = new AffineTransform(); if (s != null) { try { double[] matrix = StringUtils.toDoubleArray(s, ","); if (matrix.length == 6) { i2mTransform = new AffineTransform(matrix); } } catch (IllegalArgumentException e) { // may be thrown by StringUtils.toDoubleArray(), use identity instead } } final MultiLevelModel model = new DefaultMultiLevelModel(levelCount, i2mTransform, sourceWidth, sourceHeight); return new TiledFileMultiLevelSource(model, imageDir, imageProperties); }
AbstractL1bSceneMultiLevelSource(L1bSceneDescription sceneDescription, AffineTransform imageToModelTransform, int numResolutions) { super(new DefaultMultiLevelModel(numResolutions, imageToModelTransform, sceneDescription.getSceneRectangle().width, sceneDescription.getSceneRectangle().height)); this.sceneDescription = sceneDescription; } }
AbstractL1cSceneMultiLevelSource(S2OrthoSceneLayout sceneDescription, S2SpatialResolution bandResolution, AffineTransform imageToModelTransform, int numResolutions) { super(new DefaultMultiLevelModel(numResolutions, imageToModelTransform, sceneDescription.getSceneDimension(bandResolution).width, sceneDescription.getSceneDimension(bandResolution).height)); this.sceneDescription = sceneDescription; } }
int tileWidth, int tileHeight, int numTilesX, int numTilesY, int levels, int dataType, GeoCoding geoCoding) { super(new DefaultMultiLevelModel(levels, Product.findImageToModelTransform(geoCoding), imageWidth, imageHeight));
GDALMultiLevelSource(Path sourceFile, int bandIndex, int numBands, int imageWidth, int imageHeight, int tileWidth, int tileHeight, int levels, int dataBufferType, GeoCoding geoCoding) { super(new DefaultMultiLevelModel(levels, Product.findImageToModelTransform(geoCoding), imageWidth, imageHeight)); this.sourceFile = sourceFile; this.dataBufferType = dataBufferType; this.bandIndex = bandIndex; int numTilesX = imageWidth / tileWidth; if (imageWidth % tileWidth != 0) { numTilesX++; } int numTilesY = imageHeight / tileHeight; if (imageHeight % tileHeight != 0) { numTilesY++; } this.tileLayout = new TileLayout(imageWidth, imageHeight, tileWidth, tileHeight, numTilesX, numTilesY, levels); this.tileLayout.numBands = numBands; this.tileManager = new TileImageDisposer(); }
public static MultiLevelImage createMultiLevelImage(float[] data, int width, int height, AffineTransform affineTransform) { //create a planarImage with the data PlanarImage planarImage = createFloatPlanarImage(data, width, height); //create multi-level model DefaultMultiLevelModel multiLevelModel = new DefaultMultiLevelModel(affineTransform, width, height); //create multi-level source DefaultMultiLevelSource multiLevelSource= new DefaultMultiLevelSource(planarImage, multiLevelModel, Interpolation.getInstance(Interpolation.INTERP_NEAREST)); //create multi-level image MultiLevelImage multiLevelImage = new DefaultMultiLevelImage(multiLevelSource); return multiLevelImage; }
/** * @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); }
DefaultMultiLevelModel model = new DefaultMultiLevelModel(levelCount, new AffineTransform(), new Rectangle(image0.getWidth(), image0.getHeight())); MultiLevelSource multiLevelSource = new DefaultMultiLevelSource(image0, model, interpolation);