@Override public boolean validateIndex(int pixelIndex) { return raster.isPixelValid(pixelIndex) && (noDataIndex == 0 || (rgbSamples[pixelIndex * numColorComponents] & 0xff) != noDataIndex); } };
@Override public boolean validateIndex(int pixelIndex) { return raster.isPixelValid(pixelIndex); } };
@Override public boolean isSampleValid(int x, int y) { // todo - urgently need benchmarks. performance may be poor (nf 04.2010) // fixme - read flag directly from a validMaskTile:TileImpl (nf - 04.2010) return rasterDataNode.isPixelValid(x, y); }
@Override public boolean isSampleValid(int x, int y) { return rasterDataNode.isPixelValid(x, y); }
/** * Checks whether or not the pixel located at (x,y) is valid. * The method first test whether a pixel is valid by using the {@link #isPixelValid(int, int)} method, * and secondly, if the pixel is within the ROI (if any). * * @param x the X co-ordinate of the pixel location * @param y the Y co-ordinate of the pixel location * @param roi the ROI, if null the method returns {@link #isPixelValid(int, int)} * @return <code>true</code> if the pixel is valid * @throws ArrayIndexOutOfBoundsException if the co-ordinates are not in bounds * @see #isPixelValid(int, int) * @see #setNoDataValueUsed(boolean) * @see #setNoDataValue(double) * @see #setValidPixelExpression(String) */ public boolean isPixelValid(int x, int y, ROI roi) { return isPixelValid(x, y) && (roi == null || roi.contains(x, y)); }
/** * Checks whether or not the pixel located at (x,y) is valid. * A pixel is assumed to be valid either if {@link #getValidMaskImage() validMaskImage} is null or * or if the bit corresponding to (x,y) is set within the returned mask image. * * @param pixelIndex the linear pixel index in the range 0 to width * height - 1 * @return <code>true</code> if the pixel is valid * @throws ArrayIndexOutOfBoundsException if the co-ordinates are not in bounds * @see #isPixelValid(int, int, javax.media.jai.ROI) * @see #setNoDataValueUsed(boolean) * @see #setNoDataValue(double) * @see #setValidPixelExpression(String) * @since 4.1 */ public boolean isPixelValid(int pixelIndex) { if (!isValidMaskUsed()) { return true; } final int y = pixelIndex / getSceneRasterWidth(); final int x = pixelIndex - (y * getSceneRasterWidth()); return isPixelValid(x, y); }
if (isPixelValid(x, y)) { if (isFloatingPointType()) { return String.valueOf(getPixelFloat(x, y));
for (int x = 0; x < box.width; x++) { final int index = y * box.width + x; if (config.raster.isPixelValid(box.x + x, box.y + y) && (maskBuffer == null || maskBuffer[index] != 0)) { final float v = sampleBuffer[index];
protected static void setBandValues(Product product, String[] rasterNames, int x, int y, Number[] bandValues) { for (int i = 0; i < rasterNames.length; i++) { RasterDataNode raster = product.getRasterDataNode(rasterNames[i]); if (raster != null && product.containsPixel(x, y)) { if (pixelIsNotInBounds(raster, x, y) || !raster.isPixelValid(x, y)) { bandValues[i] = Double.NaN; } else if (raster.isFloatingPointType()) { bandValues[i] = (double) raster.getSampleFloat(x, y); } else { int temp = raster.getSampleInt(x, y); if (raster instanceof Mask) { bandValues[i] = temp == 0 ? 0 : 1; // normalize to 0 for false and 1 for true } else { if (raster.getDataType() == ProductData.TYPE_UINT32) { bandValues[i] = temp & 0xffffffffL; } else { bandValues[i] = temp; } } } } } }
for (int x = 0; x < imageRect.width; x++) { final int index = y * imageRect.height + x; if (raster.isPixelValid(x + imageRect.x, y + imageRect.y) && maskBuffer[index] != 0) { final double rasterValue = rasterValues[index]; sum += rasterValue;
for (int y = pixelY - windowBorder; y <= pixelY + windowBorder; y++) { if (product.containsPixel(x, y)) { if (!raster.isPixelValid(x, y) || (validData != null && validData.getSample(x, y, 0) == 0)) { bandValues[pixelIndex] = Float.NaN; } else if (raster.isFloatingPointType()) {
for (int i = 0; i < rgbSamples.length; i += numColorComponents) { pixelValid = !validMaskUsed || rasters[0].isPixelValid(pixelIndex) && rasters[1].isPixelValid(pixelIndex) && rasters[2].isPixelValid(pixelIndex); if (pixelValid) { if (numColorComponents == 4) {