byte[] rgb = new byte[w * h * 3]; float[] Y = raster.getSamples(0, 0, w, h, 0, (float[]) null); float[] Cb = raster.getSamples(0, 0, w, h, 1, (float[]) null); float[] Cr = raster.getSamples(0, 0, w, h, 2, (float[]) null); float[] K = raster.getSamples(0, 0, w, h, 3, (float[]) null);
int[] gray = null, alpha = null; for (int y = 0; y < im.getHeight(); y++) { gray = srcRaster.getSamples(0, y, w, 1, 0, gray); alpha = srcRaster.getSamples(0, y, w, 1, 1, alpha);
pixels = raster.getSamples(0, y, width, 1, c, pixels);
@Override protected void fetch(final int x, final int y) { for (int c = 0; c < componentCount; c++) { srcRaster.getSamples(x, y, length, 1, c, data[c]); if (null != inputFilter) inputFilter.filter(x, y, c, data[c], length); } }
@Override protected void fetch(final int x, final int y) { for (int c = 0; c < componentCount; c++) { srcRaster.getSamples(x, y, length, 1, c, data[c]); if (null != inputFilter) inputFilter.filter(x, y, c, data[c], length); } }
private static void outputRealImage(final RenderedImage I, final int startIdx, final int endIdx) { final Raster data = I.getData(); final double[] real = data.getSamples(0, 0, I.getWidth(), I.getHeight(), 0, (double[]) null); for (int i = startIdx; i <= endIdx; i++) { System.out.print(real[i] + ","); } System.out.println(); }
@Override protected void fetch(final int x, final int y) { for (int c = 0; c < componentCount; c++) { srcRaster.getSamples(x, y, length, 1, c, data[c]); if (null != inputFilter) inputFilter.filter(x, y, c, data[c], length); } }
private static void outputComplexImage(final PlanarImage image) { final int w = image.getWidth(); final int h = image.getHeight(); final Raster dftData = image.getData(); final double[] real = dftData.getSamples(0, 0, w, h, 0, (double[]) null); final double[] imag = dftData.getSamples(0, 0, w, h, 1, (double[]) null); System.out.println("Real part:"); for (double v : real) { System.out.print(v + ", "); } System.out.println(); System.out.println("Imaginary part:"); for (double v : imag) { System.out.print(v + ", "); } System.out.println(); }
private void writeObject(ObjectOutputStream oos) throws IOException { RenderedImage ri = this.grid.getRenderedImage(); serializedRaster = ri.getData().getSamples(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight(), BAND, (int[])null); LOGGER.log(Level.FINEST, "Writing Grid, internal gridCoverage={0}", this.grid); oos.defaultWriteObject(); }
public GridImageElement(Lookup lkp) { gridDataObject = lkp.lookup(GridDataObject.class); assert gridDataObject != null; setLayout(new BorderLayout()); grid = gridDataObject.getLookup().lookup(Grid.class); RenderedImage ri = grid.getRenderedImage(); serializedRaster = ri.getData().getSamples(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight(), Grid.BAND, (int[]) null); initComponents(); }
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; } } } }
public static void copyBand(Raster src, int srcBand, WritableRaster dst, int dstBand) { Rectangle srcR = new Rectangle(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight()); Rectangle dstR = new Rectangle(dst.getMinX(), dst.getMinY(), dst.getWidth(), dst.getHeight()); Rectangle cpR = srcR.intersection(dstR); int [] samples = null; for (int y=cpR.y; y< cpR.y+cpR.height; y++) { samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples); dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples); } } }
public static void copyBand(Raster src, int srcBand, WritableRaster dst, int dstBand) { Rectangle srcR = new Rectangle(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight()); Rectangle dstR = new Rectangle(dst.getMinX(), dst.getMinY(), dst.getWidth(), dst.getHeight()); Rectangle cpR = srcR.intersection(dstR); int [] samples = null; for (int y=cpR.y; y< cpR.y+cpR.height; y++) { samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples); dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples); } } }
public static void copyBand(Raster src, int srcBand, WritableRaster dst, int dstBand) { Rectangle srcR = new Rectangle(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight()); Rectangle dstR = new Rectangle(dst.getMinX(), dst.getMinY(), dst.getWidth(), dst.getHeight()); Rectangle cpR = srcR.intersection(dstR); int [] samples = null; for (int y = cpR.y; y < cpR.y + cpR.height; y++) { samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples); dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples); } } }
public static void copyBand(Raster src, int srcBand, WritableRaster dst, int dstBand) { Rectangle srcR = new Rectangle(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight()); Rectangle dstR = new Rectangle(dst.getMinX(), dst.getMinY(), dst.getWidth(), dst.getHeight()); Rectangle cpR = srcR.intersection(dstR); int [] samples = null; for (int y=cpR.y; y< cpR.y+cpR.height; y++) { samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples); dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples); } } }
public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) { int dy = dR.y -sR.y; int dx = dR.x -sR.x; sR = sR.intersection(src.getBounds()); dR = dR.intersection(dst.getBounds()); int width, height; if (dR.width < sR.width) width = dR.width; else width = sR.width; if (dR.height < sR.height) height = dR.height; else height = sR.height; int x = sR.x+dx; int [] samples = null; for (int y=sR.y; y< sR.y+height; y++) { samples = src.getSamples(sR.x, y, width, 1, sBand, samples); dst.setSamples(x, y+dy, width, 1, dBand, samples); } }
public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) { int dy = dR.y -sR.y; int dx = dR.x -sR.x; sR = sR.intersection(src.getBounds()); dR = dR.intersection(dst.getBounds()); int width, height; if (dR.width < sR.width) width = dR.width; else width = sR.width; if (dR.height < sR.height) height = dR.height; else height = sR.height; int x = sR.x+dx; int [] samples = null; for (int y=sR.y; y< sR.y+height; y++) { samples = src.getSamples(sR.x, y, width, 1, sBand, samples); dst.setSamples(x, y+dy, width, 1, dBand, samples); } }
public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) { int dy = dR.y - sR.y; int dx = dR.x - sR.x; sR = sR.intersection(src.getBounds()); dR = dR.intersection(dst.getBounds()); int width, height; if (dR.width < sR.width) width = dR.width; else width = sR.width; if (dR.height < sR.height) height = dR.height; else height = sR.height; int x = sR.x + dx; int[] samples = null; for (int y = sR.y; y < sR.y + height; y++) { samples = src.getSamples(sR.x, y, width, 1, sBand, samples); dst.setSamples(x, y + dy, width, 1, dBand, samples); } }
public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) { int dy = dR.y -sR.y; int dx = dR.x -sR.x; sR = sR.intersection(src.getBounds()); dR = dR.intersection(dst.getBounds()); int width, height; if (dR.width < sR.width) width = dR.width; else width = sR.width; if (dR.height < sR.height) height = dR.height; else height = sR.height; int x = sR.x+dx; int [] samples = null; for (int y=sR.y; y< sR.y+height; y++) { samples = src.getSamples(sR.x, y, width, 1, sBand, samples); dst.setSamples(x, y+dy, width, 1, dBand, samples); } }
public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) { int dy = dR.y - sR.y; int dx = dR.x - sR.x; sR = sR.intersection(src.getBounds()); dR = dR.intersection(dst.getBounds()); int width, height; if (dR.width < sR.width) width = dR.width; else width = sR.width; if (dR.height < sR.height) height = dR.height; else height = sR.height; int x = sR.x + dx; int[] samples = null; for (int y = sR.y; y < sR.y + height; y++) { samples = src.getSamples(sR.x, y, width, 1, sBand, samples); dst.setSamples(x, y + dy, width, 1, dBand, samples); } }