/** * Retrieves an array of tie point data interpolated to the product with and height as float array. If the given * array is <code>null</code> a new one was created and returned. * * @param x the x coordinate of the array to be read * @param y the y coordinate of the array to be read * @param w the width of the array to be read * @param h the height of the array to be read * @param pixels the integer array to be filled with data * * @throws IllegalArgumentException if the length of the given array is less than <code>w*h</code>. */ @Override public int[] readPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm) throws IOException { return getPixels(x, y, w, h, pixels, pm); }
/** * Retrieves an array of tie point data interpolated to the product with and height as float array. If the given * array is <code>null</code> a new one was created and returned. * * * @param x the x coordinate of the array to be read * @param y the y coordinate of the array to be read * @param w the width of the array to be read * @param h the height of the array to be read * @param pixels the float array to be filled with data * @param pm a monitor to inform the user about progress * * @throws IllegalArgumentException if the length of the given array is less than <code>w*h</code>. */ @Override public float[] readPixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm) throws IOException { return getPixels(x, y, w, h, pixels, pm); }
/** * Retrieves an array of tie point data interpolated to the product with and height as double array. If the given * array is <code>null</code> a new one was created and returned. * * @param x the x coordinate of the array to be read * @param y the y coordinate of the array to be read * @param w the width of the array to be read * @param h the height of the array to be read * @param pixels the double array to be filled with data * @param pm a monitor to inform the user about progress * * @throws IllegalArgumentException if the length of the given array is less than <code>w*h</code>. */ @Override public double[] readPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm) throws IOException { return getPixels(x, y, w, h, pixels, pm); }
/** * Retrieves an array of tie point data interpolated to the product with and height as double array. If the given * array is <code>null</code> a new one was created and returned. * * @param x the x coordinate of the array to be read * @param y the y coordinate of the array to be read * @param w the width of the array to be read * @param h the height of the array to be read * @param pixels the double array to be filled with data * * @throws IllegalArgumentException if the length of the given array is less than <code>w*h</code>. */ @Override public double[] getPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm) { pixels = ensureMinLengthArray(pixels, w * h); float[] fpixels = getPixels(x, y, w, h, (float[]) null, pm); for (int i = 0; i < fpixels.length; i++) { pixels[i] = fpixels[i]; } return pixels; }
/** * Retrieves an array of tie point data interpolated to the product with and height as integer array. If the given * array is <code>null</code> a new one was created and returned. * * @param x the x coordinate of the array to be read * @param y the y coordinate of the array to be read * @param w the width of the array to be read * @param h the height of the array to be read * @param pixels the integer array to be filled with data * @param pm a monitor to inform the user about progress * * @throws IllegalArgumentException if the length of the given array is less than <code>w*h</code>. */ @Override public int[] getPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm) { pixels = ensureMinLengthArray(pixels, w * h); float[] fpixels = getPixels(x, y, w, h, (float[]) null, pm); for (int i = 0; i < fpixels.length; i++) { pixels[i] = Math.round(fpixels[i]); } return pixels; }
/** * Gets a raster data holding this tie-point's interpolated pixel data for an entire product scene. <p/> * <p/> * In opposite to the <code>getRasterData</code> method, this method returns raster data that has at least * <code>getBandOutputRasterWidth()*getBandOutputRasterHeight()</code> elements of the given data type to store * the scene's pixels. * * @return raster data covering the pixels for a complete scene * * @see #getRasterData * @see #getRasterWidth * @see #getRasterHeight * @see #getSceneRasterWidth * @see #getSceneRasterHeight */ @Override public ProductData getSceneRasterData() { int width = getSceneRasterWidth(); int height = getSceneRasterHeight(); ProductData data = createCompatibleRasterData(width, height); final float[] elems = (float[]) data.getElems(); // getPixels will interpolate between tie points getPixels(0, 0, width, height, elems, ProgressMonitor.NULL); return data; }
tmpStripeFloats = stripeGc.getLatGrid().getPixels(region.x, newScanlineOffset, region.width, copyH, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLatFloats, 0, copyH*region.width); tmpStripeFloats = stripeGc.getLonGrid().getPixels(region.x, newScanlineOffset, region.width, copyH, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLonFloats, 0, copyH*region.width); tmpStripeFloats = stripeGc.getLatGrid().getPixels(region.x, 0, region.width, _scanlineHeight, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLatFloats, (firstY-region.y)*region.width, _scanlineHeight*region.width); tmpStripeFloats = stripeGc.getLonGrid().getPixels(region.x, 0, region.width, _scanlineHeight, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLonFloats, (firstY-region.y)*region.width, _scanlineHeight*region.width); if(lastH > 0) { TiePointGeoCoding stripeGc = (TiePointGeoCoding) _gcList.get(gcIndex); tmpStripeFloats = stripeGc.getLatGrid().getPixels(region.x, 0, region.width, lastH, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLatFloats, (firstY-region.y)*region.width, lastH*region.width); tmpStripeFloats = stripeGc.getLonGrid().getPixels(region.x, 0, region.width, lastH, tmpStripeFloats); System.arraycopy(tmpStripeFloats, 0, newLonFloats, (firstY-region.y)*region.width, lastH*region.width);
assertEquals(2f, rline1[1], 1e-6f); assertEquals(3f, rline1[2], 1e-6f); float[] gline1 = grid.getPixels(0, 0, 3, 1, (float[]) null, ProgressMonitor.NULL); for (int i = 0; i < gline1.length; i++) { assertEquals(rline1[i], gline1[i], 1e-6f); assertEquals(3f, rline2[1], 1e-6f); assertEquals(4f, rline2[2], 1e-6f); float[] gline2 = grid.getPixels(0, 1, 3, 1, (float[]) null, ProgressMonitor.NULL); for (int i = 0; i < gline2.length; i++) { assertEquals(rline2[i], gline2[i], 1e-6f); assertEquals(3f, rline1[1], 1e-6f); assertEquals(4f, rline1[2], 1e-6f); gline1 = grid.getPixels(0, 0, 3, 1, (float[]) null, ProgressMonitor.NULL); for (int i = 0; i < gline1.length; i++) { assertEquals(rline1[i], gline1[i], 1e-6f); assertEquals(4f, rline2[1], 1e-6f); assertEquals(5f, rline2[2], 1e-6f); gline2 = grid.getPixels(0, 1, 3, 1, (float[]) null, ProgressMonitor.NULL); for (int i = 0; i < gline2.length; i++) { assertEquals(rline2[i], gline2[i], 1e-6f);