pb.set(roi, 4); pb.set(nodata, 5); if (isNoDataNeeded()) { double destinationNoData = nodata != null
/** Warps the underlying using the provided Warp object. */ public ImageWorker colorIndex(ColorIndexer indexer) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(indexer, 0); pb.set(roi, 1); pb.set(nodata, 2); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background, 3); } } image = JAI.create("ColorIndexer", pb, getRenderingHints()); return this; }
/** Apply a rescale operation on the underlying image. */ public ImageWorker bandCombine(double[][] coeff) { // ParameterBlock definition ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); pb.set(coeff, 0); pb.set(roi, 1); pb.set(nodata, 2); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 3); } } image = JAI.create("BandCombine", pb, getRenderingHints()); return this; }
/** Apply a rescale operation on the underlying image. */ public ImageWorker rescale(double[] scale, double[] offset) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(scale, 0); // The per-band constants to multiply by. pb.set(offset, 1); // The per-band offsets to be added. pb.set(roi, 2); // ROI pb.set(nodata, 3); // NoData range if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 5); // destination No Data value } } image = JAI.create("Rescale", pb, getRenderingHints()); return this; }
/** Forces the provided {@link ColorModel} via the JAI ColorConvert operation. */ private void forceColorModel(final ColorModel cm) { final ImageLayout2 il = new ImageLayout2(image); il.setColorModel(cm); il.setSampleModel(cm.createCompatibleSampleModel(image.getWidth(), image.getHeight())); final RenderingHints oldRi = this.getRenderingHints(); final RenderingHints newRi = (RenderingHints) oldRi.clone(); newRi.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il)); setRenderingHints(newRi); // Setting the parameter blocks ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); pb.set(cm, 0); pb.set(roi, 1); pb.set(nodata, 2); if (isNoDataNeeded()) { if (background != null && background.length > 0) { // Elaborating the final NoData value if (background.length != cm.getNumColorComponents()) { throw new IllegalArgumentException("Wrong DestinationNoData value defined"); } pb.set(background, 3); } } image = JAI.create("ColorConvert", pb, getRenderingHints()); // restore RI this.setRenderingHints(oldRi); // invalidate stats invalidateStatistics(); }
if (isNoDataNeeded()) { if (background != null && background.length > 0) { double dest = background[0];
.add(roi) .add(nodata); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.add((float) background[0]);
public ImageWorker border( int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender ext) { ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(leftPad); pb.add(rightPad); pb.add(topPad); pb.add(bottomPad); pb.add(ext); pb.add(nodata); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.add(background); } } image = JAI.create("Border", pb, getRenderingHints()); return this; }
/** Performs Lookup on the underlying image */ public ImageWorker lookup(LookupTable table) { // ParameterBlock definition ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); pb.set(table, 0); pb.set(roi, 2); // Convert the NoData if (nodata != null) { nodata = RangeFactory.convert(nodata, image.getSampleModel().getDataType()); } pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } } image = JAI.create("Lookup", pb, getRenderingHints()); return this; }
pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1);
pb.set(roi, 2); // ROI pb.set(nodata, 3); // NoData range if (isNoDataNeeded() && !Double.isNaN(destNodata)) { pb.set(destNodata, 5);
/** Apply a Raster classification on the underlying image. */ public ImageWorker classify(ColorMapTransform domain1D, Integer bandIndex) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(domain1D, 0); pb.set(bandIndex, 1); pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (domain1D.hasGaps()) { // We must set the new NoData value setNoData( RangeFactory.create( domain1D.getDefaultValue(), domain1D.getDefaultValue())); } } image = JAI.create("RasterClassifier", pb, getRenderingHints()); return this; }
/** Apply a Generic Piecewise operation on the underlying image. */ public ImageWorker piecewise(PiecewiseTransform1D transform, Integer bandIndex) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(transform, 0); pb.set(bandIndex, 1); pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (transform.hasGaps()) { // We must set the new NoData value setNoData( RangeFactory.create( transform.getDefaultValue(), transform.getDefaultValue())); } } image = JAI.create("GenericPiecewise", pb, getRenderingHints()); return this; }
/** * Inverts the pixel values of the {@linkplain #image}. * * @see InvertDescriptor */ public final ImageWorker invert() { // ParameterBlock creation ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); if (JAIExt.isJAIExtOperation(ALGEBRIC_OP_NAME)) { pb.set(AlgebraDescriptor.Operator.INVERT, 0); pb.set(roi, 1); pb.set(nodata, 2); if (isNoDataNeeded()) { if (background != null && background.length > 0) { double dest = background[0]; pb.set(dest, 3); } } image = JAI.create(ALGEBRIC_OP_NAME, pb, getRenderingHints()); } else { image = JAI.create("Invert", pb, getRenderingHints()); } invalidateStatistics(); return this; }
pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); }, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { double dest = background[0]; pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1);
if (isNoDataNeeded() || nodata2 != null) { if (background != null && background.length > 0) { double dest = background[0];
if (isNoDataNeeded()) { if (background != null && background.length > 0) {
pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { int dest = (int) background[0]; pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (background != null && background.length > 0) { int dest = (int) background[0];
pb.set(roi, 1); pb.set(nodata, 2); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 3);
pb.set(roi, 5); pb.set(nodata, 7); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background, 8);