@Test public void testBandMerge() { ImageWorker iw = new ImageWorker(gray).retainBands(1); RenderedImage image = iw.bandMerge(4).getRenderedImage(); assertEquals(4, image.getTile(0, 0).getSampleModel().getNumBands()); assertNoData(image, null); }
public final ImageWorker bandMerge(int writeband) { ParameterBlock pb = new ParameterBlock(); PlanarImage sourceImage = PlanarImage.wrapRenderedImage(getRenderedImage()); int numBands = sourceImage.getSampleModel().getNumBands(); final RenderedImage firstBand = JAI.create("bandSelect", sourceImage, new int[] {0}); final int length = writeband - numBands; pb.addSource(sourceImage); for (int i = 0; i < length; i++) { pb.addSource(firstBand); } pb.set(new Range[] {nodata}, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } else if (nodata != null) { pb.set(((Number) nodata.getMin()).doubleValue(), 1); } } pb.set(roi, 3); sourceImage = JAI.create("bandmerge", pb); image = sourceImage; invalidateStatistics(); assert image.getSampleModel().getNumBands() == writeband; return this; }
ImageWorker { public final ImageWorker bandMerge(int writeband) { ParameterBlock pb = new ParameterBlock(); PlanarImage sourceImage = PlanarImage.wrapRenderedImage(getRenderedImage()); int numBands = sourceImage.getSampleModel().getNumBands(); final RenderedImage firstBand = JAI.create("bandSelect", sourceImage, new int[] {0}); final int length = writeband - numBands; pb.addSource(sourceImage); for (int i = 0; i < length; i++) { pb.addSource(firstBand); } pb.set(new Range[] {nodata}, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } else if (nodata != null) { pb.set(((Number) nodata.getMin()).doubleValue(), 1); } } pb.set(roi, 3); sourceImage = JAI.create("bandmerge", pb); image = sourceImage; invalidateStatistics(); assert image.getSampleModel().getNumBands() == writeband; return this; } }
ImageWorker { public final ImageWorker bandMerge(int writeband) { ParameterBlock pb = new ParameterBlock(); PlanarImage sourceImage = PlanarImage.wrapRenderedImage(getRenderedImage()); int numBands = sourceImage.getSampleModel().getNumBands(); final RenderedImage firstBand = JAI.create("bandSelect", sourceImage, new int[] {0}); final int length = writeband - numBands; pb.addSource(sourceImage); for (int i = 0; i < length; i++) { pb.addSource(firstBand); } pb.set(new Range[] {nodata}, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } else if (nodata != null) { pb.set(((Number) nodata.getMin()).doubleValue(), 1); } } pb.set(roi, 3); sourceImage = JAI.create("bandmerge", pb); image = sourceImage; invalidateStatistics(); assert image.getSampleModel().getNumBands() == writeband; return this; } ImageWorker();  ImageWorker(RenderingHints hints);  ImageWorker(final File input);  ImageWorker(final RenderedImage image); }
ImageWorker { public final ImageWorker bandMerge(int writeband) { ParameterBlock pb = new ParameterBlock(); PlanarImage sourceImage = PlanarImage.wrapRenderedImage(getRenderedImage()); int numBands = sourceImage.getSampleModel().getNumBands(); final RenderedImage firstBand = JAI.create("bandSelect", sourceImage, new int[] {0}); final int length = writeband - numBands; pb.addSource(sourceImage); for (int i = 0; i < length; i++) { pb.addSource(firstBand); } pb.set(new Range[] {nodata}, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } else if (nodata != null) { pb.set(((Number) nodata.getMin()).doubleValue(), 1); } } pb.set(roi, 3); sourceImage = JAI.create("bandmerge", pb); image = sourceImage; invalidateStatistics(); assert image.getSampleModel().getNumBands() == writeband; return this; } ImageWorker();  ImageWorker(RenderingHints hints);  ImageWorker(final File input);  ImageWorker(final RenderedImage image); static boolean isJaiExtEnabled(); int getXPeriod(); ImageWorker setXPeriod(int xPeriod); int getYPeriod(); ImageWorker setYPeriod(int yPeriod); Range extractNoDataProperty(final RenderedImage image); final ImageWorker setImage(final RenderedImage image); final void load(final String source, final int imageChoice, final boolean readMetadata); final RenderedImage getRenderedImage(); final BufferedImage getBufferedImage(); final PlanarImage getPlanarImage(); final RenderedOp getRenderedOperation(); ImageWorker nullOp(); final ROI getImageAsROI(); final ROI getROI(); final Range getNoData(); final double[] getDestinationNoData(); boolean isNoDataNeeded(); final ImageWorker setROI(final ROI roi); final ImageWorker setNoData(final Range nodata); final ImageWorker setBackground(final double[] background); final Object getRenderingHint(final RenderingHints.Key key); final ImageWorker setRenderingHint(final RenderingHints.Key key, final Object value); final ImageWorker setRenderingHints(final RenderingHints hints); final ImageWorker removeRenderingHints(); final ImageWorker removeRenderingHint(final RenderingHints.Key key); final RenderingHints getRenderingHints(); final ImageWorker tileCacheEnabled(final boolean status); final int getNumBands(); final int getTransparentPixel(); Histogram getHistogram(int[] numBins, double[] lowValues, double[] highValues); double[] getMean(); final double[] getMinimums(); final double[] getMaximums(); final boolean isBytes(); final boolean isBinary(); final boolean isIndexed(); final boolean isColorSpaceRGB(); final boolean isColorSpaceYCbCr(); final boolean isColorSpaceIHS(); final boolean isColorSpaceGRAYScale(); final boolean isTranslucent(); final ImageWorker rescaleToBytes(); final ImageWorker forceIndexColorModel(final boolean error); final ImageWorker forceBitmaskIndexColorModel(); final ImageWorker forceBitmaskIndexColorModel(
            int suggestedTransparent, final boolean errorDiffusion); final ImageWorker forceIndexColorModelForGIF(final boolean errorDiffusion); final ImageWorker forceComponentColorModel(); final ImageWorker forceComponentColorModel(
            boolean checkTransparent, boolean optimizeGray, boolean omitAlphaOnExpand); final ImageWorker removeIndexColorModel(); final ImageWorker forceComponentColorModel(boolean checkTransparent); final ImageWorker forceComponentColorModel(
            boolean checkTransparent, boolean optimizeGray); final ImageWorker forceColorSpaceRGB(); final ImageWorker forceColorSpaceYCbCr(); final ImageWorker forceColorSpaceIHS(); final ImageWorker bandMerge(int writeband); final ImageWorker addBand(RenderedImage image, boolean before); final ImageWorker addBand(
            RenderedImage image, boolean before, boolean addAlpha, Range nodata2); final ImageWorker addBands(RenderedImage[] bands, boolean addAlpha, Range[] nodata2); final ImageWorker addBands(
            RenderedImage[] bands,
            boolean addAlpha,
            Range[] nodata2,
            List<AffineTransform> transformationList); final ImageWorker forceColorSpaceGRAYScale(); final ImageWorker intensity(); final ImageWorker retainFirstBand(); final ImageWorker retainLastBand(); final ImageWorker retainBands(final int numBands); final ImageWorker retainBands(final int[] bands); final ImageWorker format(final int dataType); final ImageWorker binarize(); final ImageWorker binarize(double threshold); final ImageWorker binarize(final int value0, final int value1); final ImageWorker makeColorTransparent(final Color transparentColor); final ImageWorker invert(); final ImageWorker mask(RenderedImage mask, final boolean maskValue, int newValue); final ImageWorker addImage(final RenderedImage renderedImage); final ImageWorker multiplyConst(double[] inValues); final ImageWorker multiply(RenderedImage renderedImage); final ImageWorker xorConst(int[] values); final ImageWorker subtract(final RenderedImage renderedImage); final ImageWorker or(final RenderedImage renderedImage); final ImageWorker artifactsFilter(int threshold, int filterSize); ImageWorker addTransparencyToIndexColorModel(
            final RenderedImage alphaChannel, final boolean errorDiffusion); final ImageWorker addTransparencyToIndexColorModel(
            final RenderedImage alphaChannel,
            final boolean translucent,
            int transparent,
            final boolean errorDiffusion); final ImageWorker tile(); ImageWorker applyOpacity(float opacity); final ImageWorker write(final File output); final void writePNG(
            final Object destination,
            final String compression,
            final float compressionRate,
            final boolean nativeAcc,
            final boolean paletted); final ImageWorker writeGIF(
            final Object destination, final String compression, final float compressionRate); final void writeJPEG(
            final Object destination,
            final String compression,
            final float compressionRate,
            final boolean nativeAcc); final void writeTIFF(
            final Object destination,
            final String compression,
            final float compressionRate,
            final int tileSizeX,
            final int tileSizeY); ImageWorker affine(AffineTransform tx, Interpolation interpolation, double[] bgValues); ImageWorker crop(float x, float y, float width, float height); ImageWorker function(
            ImageFunction function,
            int w,
            int h,
            float xScale,
            float yScale,
            float xTrans,
            float yTrans); ImageWorker mosaic(
            RenderedImage[] images,
            MosaicType type,
            PlanarImage[] alphas,
            ROI[] rois,
            double[][] thresholds,
            Range[] nodata); ImageWorker border(
            int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender ext); ImageWorker translate(float xTrans, float yTrans, Interpolation interp); ImageWorker warp(Warp warp, Interpolation interp); ImageWorker scale(
            double xScale, double yScale, double xTrans, double yTrans, Interpolation interp); ImageWorker lookup(LookupTable table); ImageWorker colorIndex(ColorIndexer indexer); ImageWorker classify(ColorMapTransform domain1D, Integer bandIndex); ImageWorker piecewise(PiecewiseTransform1D transform, Integer bandIndex); ImageWorker rescale(double[] scale, double[] offset); ImageWorker bandCombine(double[][] coeff); ImageWorker rangeLookup(Object rangeLookup); ImageWorker prepareForRendering(); final ImageWorker show(); final void dispose(); static void main(String[] args); }
ImageWorker { public final ImageWorker bandMerge(int writeband) { ParameterBlock pb = new ParameterBlock(); PlanarImage sourceImage = PlanarImage.wrapRenderedImage(getRenderedImage()); int numBands = sourceImage.getSampleModel().getNumBands(); final RenderedImage firstBand = JAI.create("bandSelect", sourceImage, new int[] {0}); final int length = writeband - numBands; pb.addSource(sourceImage); for (int i = 0; i < length; i++) { pb.addSource(firstBand); } pb.set(new Range[] {nodata}, 0); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.set(background[0], 1); } else if (nodata != null) { pb.set(((Number) nodata.getMin()).doubleValue(), 1); } } pb.set(roi, 3); sourceImage = JAI.create("bandmerge", pb); image = sourceImage; invalidateStatistics(); assert image.getSampleModel().getNumBands() == writeband; return this; } ImageWorker();  ImageWorker(RenderingHints hints);  ImageWorker(final File input);  ImageWorker(final RenderedImage image); static boolean isJaiExtEnabled(); int getXPeriod(); ImageWorker setXPeriod(int xPeriod); int getYPeriod(); ImageWorker setYPeriod(int yPeriod); Range extractNoDataProperty(final RenderedImage image); final ImageWorker setImage(final RenderedImage image); final void load(final String source, final int imageChoice, final boolean readMetadata); final RenderedImage getRenderedImage(); final BufferedImage getBufferedImage(); final PlanarImage getPlanarImage(); final RenderedOp getRenderedOperation(); ImageWorker nullOp(); final ROI getImageAsROI(); final ROI getROI(); final Range getNoData(); final double[] getDestinationNoData(); boolean isNoDataNeeded(); final ImageWorker setROI(final ROI roi); final ImageWorker setNoData(final Range nodata); final ImageWorker setBackground(final double[] background); final Object getRenderingHint(final RenderingHints.Key key); final ImageWorker setRenderingHint(final RenderingHints.Key key, final Object value); final ImageWorker setRenderingHints(final RenderingHints hints); final ImageWorker removeRenderingHints(); final ImageWorker removeRenderingHint(final RenderingHints.Key key); final RenderingHints getRenderingHints(); final ImageWorker tileCacheEnabled(final boolean status); final int getNumBands(); final int getTransparentPixel(); Histogram getHistogram(int[] numBins, double[] lowValues, double[] highValues); double[] getMean(); final double[] getMinimums(); final double[] getMaximums(); final boolean isBytes(); final boolean isBinary(); final boolean isIndexed(); final boolean isColorSpaceRGB(); final boolean isColorSpaceYCbCr(); final boolean isColorSpaceIHS(); final boolean isColorSpaceGRAYScale(); final boolean isTranslucent(); final ImageWorker rescaleToBytes(); final ImageWorker forceIndexColorModel(final boolean error); final ImageWorker forceBitmaskIndexColorModel(); final ImageWorker forceBitmaskIndexColorModel(
            int suggestedTransparent, final boolean errorDiffusion); final ImageWorker forceIndexColorModelForGIF(final boolean errorDiffusion); final ImageWorker forceComponentColorModel(); final ImageWorker forceComponentColorModel(
            boolean checkTransparent, boolean optimizeGray, boolean omitAlphaOnExpand); final ImageWorker removeIndexColorModel(); final ImageWorker forceComponentColorModel(boolean checkTransparent); final ImageWorker forceComponentColorModel(
            boolean checkTransparent, boolean optimizeGray); final ImageWorker forceColorSpaceRGB(); final ImageWorker forceColorSpaceYCbCr(); final ImageWorker forceColorSpaceIHS(); final ImageWorker bandMerge(int writeband); final ImageWorker addBand(RenderedImage image, boolean before); final ImageWorker addBand(
            RenderedImage image, boolean before, boolean addAlpha, Range nodata2); final ImageWorker addBands(RenderedImage[] bands, boolean addAlpha, Range[] nodata2); final ImageWorker addBands(
            RenderedImage[] bands,
            boolean addAlpha,
            Range[] nodata2,
            List<AffineTransform> transformationList); final ImageWorker forceColorSpaceGRAYScale(); final ImageWorker intensity(); final ImageWorker retainFirstBand(); final ImageWorker retainLastBand(); final ImageWorker retainBands(final int numBands); final ImageWorker retainBands(final int[] bands); final ImageWorker format(final int dataType); final ImageWorker binarize(); final ImageWorker binarize(double threshold); final ImageWorker binarize(final int value0, final int value1); final ImageWorker makeColorTransparent(final Color transparentColor); final ImageWorker invert(); final ImageWorker mask(RenderedImage mask, final boolean maskValue, int newValue); final ImageWorker addImage(final RenderedImage renderedImage); final ImageWorker multiplyConst(double[] inValues); final ImageWorker multiply(RenderedImage renderedImage); final ImageWorker xorConst(int[] values); final ImageWorker subtract(final RenderedImage renderedImage); final ImageWorker or(final RenderedImage renderedImage); final ImageWorker artifactsFilter(int threshold, int filterSize); ImageWorker addTransparencyToIndexColorModel(
            final RenderedImage alphaChannel, final boolean errorDiffusion); final ImageWorker addTransparencyToIndexColorModel(
            final RenderedImage alphaChannel,
            final boolean translucent,
            int transparent,
            final boolean errorDiffusion); final ImageWorker tile(); ImageWorker applyOpacity(float opacity); final ImageWorker write(final File output); final void writePNG(
            final Object destination,
            final String compression,
            final float compressionRate,
            final boolean nativeAcc,
            final boolean paletted); final ImageWorker writeGIF(
            final Object destination, final String compression, final float compressionRate); final void writeJPEG(
            final Object destination,
            final String compression,
            final float compressionRate,
            final boolean nativeAcc); final void writeTIFF(
            final Object destination,
            final String compression,
            final float compressionRate,
            final int tileSizeX,
            final int tileSizeY); ImageWorker affine(AffineTransform tx, Interpolation interpolation, double[] bgValues); ImageWorker crop(float x, float y, float width, float height); ImageWorker function(
            ImageFunction function,
            int w,
            int h,
            float xScale,
            float yScale,
            float xTrans,
            float yTrans); ImageWorker mosaic(
            RenderedImage[] images,
            MosaicType type,
            PlanarImage[] alphas,
            ROI[] rois,
            double[][] thresholds,
            Range[] nodata); ImageWorker border(
            int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender ext); ImageWorker translate(float xTrans, float yTrans, Interpolation interp); ImageWorker warp(Warp warp, Interpolation interp); ImageWorker scale(
            double xScale, double yScale, double xTrans, double yTrans, Interpolation interp); ImageWorker lookup(LookupTable table); ImageWorker colorIndex(ColorIndexer indexer); ImageWorker classify(ColorMapTransform domain1D, Integer bandIndex); ImageWorker piecewise(PiecewiseTransform1D transform, Integer bandIndex); ImageWorker rescale(double[] scale, double[] offset); ImageWorker bandCombine(double[][] coeff); ImageWorker rangeLookup(Object rangeLookup); ImageWorker prepareForRendering(); final ImageWorker show(); final void dispose(); static void main(String[] args); static final String SCALE_NAME; static final String SCALE2_NAME; static final String SCALE_OP_NAME; static final String JAIEXT_ENABLED_KEY; static final String USE_JAI_SCALE2_KEY; static final boolean JAIEXT_ENABLED; static final boolean USE_JAI_SCALE2; static final String WARP_REDUCTION_ENABLED_KEY; static final Hints.Key TILING_ALLOWED; static final Hints.Key FORCE_MOSAIC_ROI_PROPERTY; static final Hints.Key PRESERVE_CHAINED_AFFINES; }