/** * Retains unconditionally the last band of {@linkplain #image}. All other bands (if any) are * discarded without any further processing. * * <p>It is worth to point out that we use the true number of bands rather than the number of * color components. This means that if we apply this method on a colormapped image we get back * the image itself untouched since it originally contains 1 band although the color components * are 3 or 4 as per the attached colormap. * * @return this {@link ImageWorker}. * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainLastBand() { final int band = getNumBands() - 1; if (band != 0) { retainBands(new int[] {band}); } // All post conditions for this method contract. assert getNumBands() == 1; return this; }
/** * Retains inconditionnaly the first band of {@linkplain #image}. All other bands (if any) are * discarted without any further processing. * * @return this {@link ImageWorker}. * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainFirstBand() { retainBands(1); // All post conditions for this method contract. assert getNumBands() == 1; return this; }
Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "numBands", numBands)); if (getNumBands() > numBands) { final int[] bands = new int[numBands]; for (int i = 0; i < bands.length; i++) { assert getNumBands() <= numBands; return this;
if (getNumBands() != 1) { tileCacheEnabled(false); intensity();
/** * Retains inconditionnaly the last band of {@linkplain #image}. All other * bands (if any) are discarted without any further processing. * * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainLastBand() { retainBands(new int[] {getNumBands() - 1}); // All post conditions for this method contract. assert getNumBands() == 1; return this; }
/** * Retains unconditionally the last band of {@linkplain #image}. All other * bands (if any) are discarded without any further processing. * * <p> * It is worth to point out that we use the true number of bands rather than * the number of color components. This means that if we apply this method on * a colormapped image we get back the image itself untouched since it originally * contains 1 band although the color components are 3 or 4 as per the attached colormap. * * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainLastBand() { final int band = getNumBands() - 1; if (band != 0) { retainBands(new int[] {band}); } // All post conditions for this method contract. assert getNumBands() == 1; return this; }
.forceComponentColorModel(); final int numbands = worker.getNumBands();
/** * Retains inconditionnaly the first band of {@linkplain #image}. All other * bands (if any) are discarted without any further processing. * * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainFirstBand() { retainBands(1); // All post conditions for this method contract. assert getNumBands() == 1; return this; }
/** * Retains inconditionnaly the first band of {@linkplain #image}. All other * bands (if any) are discarted without any further processing. * * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainBands * @see BandSelectDescriptor */ public final ImageWorker retainFirstBand() { retainBands(1); // All post conditions for this method contract. assert getNumBands() == 1; return this; }
if (getNumBands() % 2 == 0) retainBands(getNumBands() - 1); forceColorSpaceRGB(); final RenderingHints hints = getRenderingHints();
assert getNumBands() == 1; return this;
.forceComponentColorModel(); final int numbands = worker.getNumBands();
/** * Retains inconditionnaly the first {@code numBands} of {@linkplain #image}. * All other bands (if any) are discarted without any further processing. * This method does nothing if the current {@linkplain #image} does not have * a greater amount of bands than {@code numBands}. * * @param numBands * the number of bands to retain. * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainFirstBand * @see BandSelectDescriptor */ public final ImageWorker retainBands(final int numBands) { if (numBands <= 0) { throw new IndexOutOfBoundsException(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "numBands", numBands)); } if (getNumBands() > numBands) { final int[] bands = new int[numBands]; for (int i=0; i<bands.length; i++) { bands[i] = i; } image = BandSelectDescriptor.create(image, bands, getRenderingHints()); } // All post conditions for this method contract. assert getNumBands() <= numBands; return this; }
/** * Retains inconditionnaly the first {@code numBands} of {@linkplain #image}. * All other bands (if any) are discarted without any further processing. * This method does nothing if the current {@linkplain #image} does not have * a greater amount of bands than {@code numBands}. * * @param numBands * the number of bands to retain. * @return this {@link ImageWorker}. * * @see #getNumBands * @see #retainFirstBand * @see BandSelectDescriptor */ public final ImageWorker retainBands(final int numBands) { if (numBands <= 0) { throw new IndexOutOfBoundsException(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "numBands", new Integer(numBands))); } if (getNumBands() > numBands) { final int[] bands = new int[numBands]; for (int i=0; i<bands.length; i++) { bands[i] = i; } image = BandSelectDescriptor.create(image, bands, getRenderingHints()); } // All post conditions for this method contract. assert getNumBands() <= numBands; return this; }
StatsType[] stats = new StatsType[] {StatsType.MEAN}; int numBands = getNumBands(); int[] bands = new int[numBands]; for (int i = 0; i < numBands; i++) {
StatsType[] stats = new StatsType[] {StatsType.EXTREMA}; int numBands = getNumBands(); int[] bands = new int[numBands]; for (int i = 0; i < numBands; i++) {
if (w.getNumBands() == 2) { w.retainBands(1);
int numBands = getNumBands(); final RenderingHints hints = getRenderingHints();
StatsType[] stats = new StatsType[] {StatsType.HISTOGRAM}; int numBands = getNumBands(); int[] bands = new int[numBands]; for (int i = 0; i < numBands; i++) {
if (getNumBands() != 1) { tileCacheEnabled(false); intensity();