if (layout.getSampleModel(null).getDataType() != this.layout.getSampleModel(null).getDataType()) { throw new IllegalArgumentException( "The coverage dataType should be the same for all coverages");
GridCoverage2DReader reader = SingleGridCoverage2DReader.wrap(delegate, name); ImageLayout layout = reader.getImageLayout(); int numBands = layout.getSampleModel(null).getNumBands(); Number[] bandValues = new Number[numBands]; // all zeroes Arrays.fill(bandValues, Double.valueOf(0));
+ format.getName()); SampleModel sm = imageLayout.getSampleModel(null); if (cm == null) { throw new Exception(
try { layout = delegate.getImageLayout(referenceName); SampleModel originalSampleModel = layout.getSampleModel(null); SampleModel sampleModel = RasterFactory.createBandedSampleModel(
if (layout == null || layout.getSampleModel(null) == null) { LOGGER.log(Level.FINE, "Cannot determine the reader bands, reading them all"); return params; SampleModel sampleModel = layout.getSampleModel(null);
sm = layout.getSampleModel(null);
private WarpSourceCoordinatesOpImage(Warp warp, ImageLayout layout, Map configuration) { super(layout, configuration, layout.getSampleModel(null), layout.getMinX(null), layout.getMinY(null), layout.getWidth(null), layout.getHeight(null)); this.warp = warp; int compatibleTag = RasterAccessor.findCompatibleTag(null, layout.getSampleModel(null)); rasterFormatTag = new RasterFormatTag(layout.getSampleModel(null), compatibleTag); OperatorContext.setTileCache(this); }
private WarpSourceCoordinatesOpImage(Warp warp, ImageLayout layout, Map configuration) { super(layout, configuration, layout.getSampleModel(null), layout.getMinX(null), layout.getMinY(null), layout.getWidth(null), layout.getHeight(null)); this.warp = warp; int compatibleTag = RasterAccessor.findCompatibleTag(null, layout.getSampleModel(null)); rasterFormatTag = new RasterFormatTag(layout.getSampleModel(null), compatibleTag); OperatorContext.setTileCache(this); }
public Properties getAsProperties(Properties defaultProperties) { final Properties properties = new Properties(defaultProperties); properties.setProperty("dataType", imageLayout.getSampleModel(null).getDataType() + ""); properties.setProperty("minX", imageLayout.getMinX(null) + ""); properties.setProperty("minY", imageLayout.getMinY(null) + ""); properties.setProperty("width", imageLayout.getWidth(null) + ""); properties.setProperty("height", imageLayout.getHeight(null) + ""); properties.setProperty("tileGridXOffset", imageLayout.getTileGridXOffset(null) + ""); properties.setProperty("tileGridYOffset", imageLayout.getTileGridYOffset(null) + ""); properties.setProperty("tileWidth", imageLayout.getTileWidth(null) + ""); properties.setProperty("tileHeight", imageLayout.getTileHeight(null) + ""); properties.setProperty("tileFormat", tileFormat); return properties; } }
/** Helper function for creating a suitable sample model for the final image */ private static SampleModel sampleModelHelper(int numBands, ImageLayout layout) { SampleModel sampleModel; if (layout != null && layout.isValid(ImageLayout.SAMPLE_MODEL_MASK)) { sampleModel = layout.getSampleModel(null); if (sampleModel.getNumBands() != numBands) { throw new RuntimeException(JaiI18N.getString("ImageFunctionRIF0")); } } else { // Create a SampleModel. // Use a dummy width and height, OpImage will fix them sampleModel = RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, 1, 1, numBands); } return sampleModel; }
SampleModel sm; if (layout != null) { sm = layout.getSampleModel(source); } else { sm = source.getSampleModel();
private OperatorImage(Band targetBand, OperatorContext operatorContext, ImageLayout imageLayout) { super(imageLayout, operatorContext.getRenderingHints(), imageLayout.getSampleModel(null), imageLayout.getMinX(null), imageLayout.getMinY(null), imageLayout.getWidth(null), imageLayout.getHeight(null)); this.targetBand = targetBand; this.operatorContext = operatorContext; OperatorContext.setTileCache(this); }
private SingleBandedOpImage(ImageLayout layout, int sourceWidth, int sourceHeight, Map configuration, ResolutionLevel level) { super(layout, configuration, layout.getSampleModel(null), layout.getMinX(null), layout.getMinY(null), layout.getWidth(null), layout.getHeight(null)); levelImageSupport = new LevelImageSupport(sourceWidth, sourceHeight, level); if (getTileCache() == null) { setTileCache(JAI.getDefaultInstance().getTileCache()); } }
private TiledFileOpImage(ImageHeader imageHeader, Map configuration, VirtualDir imageDir) throws IOException { super(imageHeader.getImageLayout(), configuration, imageHeader.getImageLayout().getSampleModel(null), imageHeader.getImageLayout().getMinX(null), imageHeader.getImageLayout().getMinY(null), imageHeader.getImageLayout().getWidth(null), imageHeader.getImageLayout().getHeight(null)); this.imageDir = imageDir; this.imageHeader = imageHeader; if (this.imageHeader.getTileFormat().equalsIgnoreCase("raw.zip")) { inputStreamFactory = new RawZipImageInputStreamFactory(); } else if (this.imageHeader.getTileFormat().equalsIgnoreCase("raw")) { inputStreamFactory = new RawImageInputStreamFactory(); } else if (this.imageHeader.getTileFormat().equalsIgnoreCase("zip")) { inputStreamFactory = new ZipInputStreamFactory(); } if (getTileCache() == null) { setTileCache(JAI.getDefaultInstance().getTileCache()); } }
private static ImageLayout layoutHelper(RenderedImage source, ImageLayout il, Map config) { ImageLayout layout = (il == null) ? new ImageLayout() : (ImageLayout) il.clone(); SampleModel sm = layout.getSampleModel(source); if (!ImageUtil.isBinary(sm)) { sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, layout.getTileWidth(source), layout.getTileHeight(source), 1); layout.setSampleModel(sm); } ColorModel cm = layout.getColorModel(null); if (cm == null || !JDKWorkarounds.areCompatibleDataModels(sm, cm)) { layout.setColorModel(ImageUtil.getCompatibleColorModel(sm, config)); } return layout; }
private static ImageLayout layoutHelper(RenderedImage source, ImageLayout il, Map config) { ImageLayout layout = (il == null) ? new ImageLayout() : (ImageLayout) il.clone(); SampleModel sm = layout.getSampleModel(source); if (!ImageUtil.isBinary(sm)) { sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, layout.getTileWidth(source), layout.getTileHeight(source), 1); layout.setSampleModel(sm); } ColorModel cm = layout.getColorModel(null); if (cm == null || !JDKWorkarounds.areCompatibleDataModels(sm, cm)) { layout.setColorModel(ImageUtil.getCompatibleColorModel(sm, config)); } return layout; }
SampleModel sm = layout.getSampleModel(null); if (sm == null) { final SampleModel dataSampleModel = dataImage.getSampleModel();
public void testLoadFloatImage() throws IOException { final ImageHeader imageHeader = ImageHeader.load( new InputStreamReader(ImageHeaderTest.class.getResourceAsStream("float-image.properties")), null, null); assertEquals("raw", imageHeader.getTileFormat()); final ImageLayout imageLayout = imageHeader.getImageLayout(); assertNotNull(imageLayout); assertEquals(1, imageLayout.getMinX(null)); assertEquals(-1, imageLayout.getMinY(null)); assertEquals(1280, imageLayout.getWidth(null)); assertEquals(1024, imageLayout.getHeight(null)); assertEquals(0, imageLayout.getTileGridXOffset(null)); assertEquals(6, imageLayout.getTileGridYOffset(null)); assertEquals(512, imageLayout.getTileWidth(null)); assertEquals(256, imageLayout.getTileHeight(null)); assertNull(imageLayout.getColorModel(null)); assertNotNull(imageLayout.getSampleModel(null)); assertEquals(512, imageLayout.getSampleModel(null).getWidth()); assertEquals(256, imageLayout.getSampleModel(null).getHeight()); assertEquals(1, imageLayout.getSampleModel(null).getNumBands()); assertEquals(4, imageLayout.getSampleModel(null).getDataType()); assertEquals(32, imageLayout.getSampleModel(null).getSampleSize()[0]); }
public void testLoadBitImage() throws IOException { final ImageHeader imageHeader = ImageHeader.load( new InputStreamReader(ImageHeaderTest.class.getResourceAsStream("bit-image.properties")), null, null); assertEquals("raw", imageHeader.getTileFormat()); final ImageLayout imageLayout = imageHeader.getImageLayout(); assertNotNull(imageLayout); assertEquals(1, imageLayout.getMinX(null)); assertEquals(-1, imageLayout.getMinY(null)); assertEquals(1280, imageLayout.getWidth(null)); assertEquals(1024, imageLayout.getHeight(null)); assertEquals(0, imageLayout.getTileGridXOffset(null)); assertEquals(6, imageLayout.getTileGridYOffset(null)); assertEquals(512, imageLayout.getTileWidth(null)); assertEquals(256, imageLayout.getTileHeight(null)); assertNull(imageLayout.getColorModel(null)); assertNotNull(imageLayout.getSampleModel(null)); assertEquals(512, imageLayout.getSampleModel(null).getWidth()); assertEquals(256, imageLayout.getSampleModel(null).getHeight()); assertEquals(1, imageLayout.getSampleModel(null).getNumBands()); assertEquals(0, imageLayout.getSampleModel(null).getDataType()); assertEquals(1, imageLayout.getSampleModel(null).getSampleSize()[0]); }
SampleModel sampleModel = layout.getSampleModel(null); assertEquals (2, sampleModel.getNumBands()); ColorModel colorModel = layout.getColorModel(null);