Refine search
+ format.getName()); final int numBands = sm.getNumBands(); sampleDimensions = new GridSampleDimension[numBands]; TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) throw new IOException( "Unrecognized sample dimension type for band number " + (i + 1)); sampleDimensions[i] = new GridSampleDimension(colorInterpretation.name());
final SampleDimensionType sourceType = TypeMap.getSampleDimensionType(model, 0); SampleDimensionType targetType = null; if (hints != null) { NumberRange targetRange = TypeMap.getRange(targetType); Category[] categories = new Category[1]; final Color[] c = colors != null ? colors[b] : null; categories[0] = new Category(n, c, targetRange, true); dst[b] = new GridSampleDimension(name, categories, units);
one = Long.valueOf(1L); lower = unique(pool, lower); upper = unique(pool, upper); one = unique(pool, one); assert lower.longValue() == min; assert upper.longValue() == max; assert MAP[ordinal] == null : code; MAP[ordinal] = this; assert code.equals(getSampleDimensionType(range)) : code;
final ColorModel cm = image.getColorModel(); final int numBands = request.getBands() == null ? sm.getNumBands() : request.getBands().length; colorInterpretation = TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) { throw new IOException("Unrecognized sample dimension type"); bandName = colorInterpretation.name(); if (colorInterpretation == ColorInterpretation.UNDEFINED || bandNames.contains( final SampleDimensionType st = TypeMap.getSampleDimensionType(sm, i);
/** * Constructs a sample dimension with a set of categories from an other sample dimension. * * @param band The originating sample dimension. * @param image The image to be wrapped by {@link GridCoverage}. * @param bandNumber The band number. */ private RenderedSampleDimension( final GridSampleDimension band, final RenderedImage image, final int bandNumber) { super(band); final SampleModel model = image.getSampleModel(); this.band = bandNumber; this.numBands = model.getNumBands(); this.type = TypeMap.getSampleDimensionType(model, bandNumber); }
public HistogramConfig(final SampleModel sampleModel) { final int numBands = sampleModel.getNumBands(); highValues = new double[numBands]; lowValues = new double[numBands]; numBins = new int[numBands]; for (int b = 0; b < numBands; b++) { final NumberRange range = TypeMap.getRange(TypeMap.getSampleDimensionType(sampleModel, b)); int bins; double min = range.getMinimum(true); double max = range.getMaximum(true); if (Double.isInfinite(min) || Double.isInfinite(max) || Double.isNaN(min) || Double.isNaN(max)) { // in this case there is no reasonable default, just use a range // of 0 to 1 as a placeholder min = 0; max = 1; bins = MAX_DEFAULT_NUM_BINS; } else { bins = (int) Math.min(MAX_DEFAULT_NUM_BINS, (max - min) + 1); } lowValues[b] = min; highValues[b] = max; numBins[b] = bins; } }
final SampleDimensionType sourceType = TypeMap.getSampleDimensionType(model, 0); final boolean sourceIsFloat = TypeMap.isFloatingPoint(sourceType); final boolean targetIsFloat = TypeMap.isFloatingPoint(targetType); NumberRange targetRange = TypeMap.getRange(targetType); Category[] categories = new Category[1]; final boolean needScaling; if (!TypeMap.isSigned(targetType)) { categories = new Category[2]; categories[1] = Category.NODATA; targetRange = TypeMap.getPositiveRange(targetType); needScaling = !targetRange.contains(TypeMap.getRange(sourceType)); dst[b] = new GridSampleDimension(name[b], categories, null);
final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, 0); if(colorInterpretation==null) throw new IOException("Unrecognized sample dimension type"); final GridSampleDimension band = new GridSampleDimension( coverageName, new Category[] { nan }, uom).geophysics(true); final Map<String, Double> properties = new HashMap<String, Double>(); properties.put("GC_NODATA", new Double(inNoData));
final ColorInterpretation colorInterpretation = TypeMap.getColorInterpretation(cm, 0); if (colorInterpretation == null) throw new IOException("Unrecognized sample dimension type"); new GridSampleDimension(coverageName, new Category[] {nan}, uom); final Map<String, Object> properties = new HashMap<String, Object>(); CoverageUtilities.setNoDataProperty(properties, new Double(inNoData));
/** * Returns the color interpretation of the sample dimension. A sample dimension can be an index * into a color palette or be a color model component. If the sample dimension is not assigned a * color interpretation the value is {@link ColorInterpretation#UNDEFINED}. */ public ColorInterpretation getColorInterpretation() { // The 'Grid2DSampleDimension' class overrides this method // with better values for 'band' and 'numBands' constants. final int band = 0; final int numBands = 1; return TypeMap.getColorInterpretation(getColorModel(band, numBands), band); }
/** Returns the color interpretation of the sample dimension. */ @Override public ColorInterpretation getColorInterpretation() { return TypeMap.getColorInterpretation(getColorModel(), band); }
list(description, type, color, palette, categories, nodata, minimum, maximum, unit), scale, offset); type = TypeMap.getSampleDimensionType(minimum, maximum); final Number value = TypeMap.wrapSample(padValue, type, false); if (name == null) { name = value.toString(); Number min = TypeMap.wrapSample(lower, type, false); Number max = TypeMap.wrapSample(upper - 1, type, false); final Class<? extends Number> classe; if (min.equals(max)) { Number min = TypeMap.wrapSample(minimum, type, false); Number max = TypeMap.wrapSample(maximum, type, false); final Class<? extends Number> classe = ClassChanger.getWidestClass(min, max); min = ClassChanger.cast(min, classe); if (ColorInterpretation.PALETTE_INDEX.equals(color) || ColorInterpretation.GRAY_INDEX.equals(color)) { return list(cl, unit);
/** * Returns a code value indicating grid value data type. This will also indicate the number of * bits for the data type. * * @return A code value indicating grid value data type. */ @SuppressWarnings("unchecked") public SampleDimensionType getSampleDimensionType() { final NumberRange range = getRange(); if (range == null) { return SampleDimensionType.REAL_32BITS; } return TypeMap.getSampleDimensionType(range); }
/** * Returns the smallest sample dimension type capable to hold the specified range of values. An * heuristic approach is used for non-integer values. * * @param min The lower value, inclusive. * @param max The upper value, <strong>inclusive</strong> as well. * @return The smallest sample dimension type for the specified range. */ public static SampleDimensionType getSampleDimensionType(double min, double max) { final long lgMin = (long) min; if (lgMin == min) { final long lgMax = (long) max; if (lgMax == max) { return getSampleDimensionType(lgMin, lgMax); } } min = Math.abs(min); max = Math.abs(max); if (Math.min(min, max) >= Float.MIN_VALUE && Math.max(min, max) <= Float.MAX_VALUE) { return REAL_32BITS; } return REAL_64BITS; }
private void handleSampleDimensionType(SampleDimensionType sdType) { // old data dirs upgrading will have this empty if (sdType == null) { // pick the one with the largest domain and be done with it sdType = SampleDimensionType.REAL_64BITS; } final NumberRange<? extends Number> indicativeRange = TypeMap.getRange(sdType); setRange(indicativeRange); }
final DataBuffer dataBuffer = rasterTile.getDataBuffer(); final Persistable tileMetadata = rasterTile.getMetadata(); final SampleModel sm = sampleModel.createCompatibleSampleModel(tileSize, tileSize); final int numBands = sm.getNumBands(); final BufferedImage image = new BufferedImage(colorModel, raster, alphaPremultiplied, null); if (cm != null) { colorInterpretation = TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) { throw new IOException("Unrecognized sample dimension type"); bandName = colorInterpretation.name(); if ((colorInterpretation == ColorInterpretation.UNDEFINED) || bandNames.contains(bandName)) { final SampleDimensionType st = TypeMap.getSampleDimensionType(sm, i);
/** * Constructs a sample dimension with a set of categories from an other sample dimension. * * @param band The originating sample dimension. * @param image The image to be wrapped by {@link GridCoverage}. * @param bandNumber The band number. */ private RenderedSampleDimension(final GridSampleDimension band, final RenderedImage image, final int bandNumber) { super(band); final SampleModel model = image.getSampleModel(); this.band = bandNumber; this.numBands = model.getNumBands(); this.type = TypeMap.getSampleDimensionType(model, bandNumber); }
final SampleDimensionType sourceType = TypeMap.getSampleDimensionType(model, 0); final boolean sourceIsFloat = TypeMap.isFloatingPoint(sourceType); SampleDimensionType targetType = null; if (hints != null) { final boolean targetIsFloat = TypeMap.isFloatingPoint(targetType); NumberRange targetRange = TypeMap.getRange(targetType); Category[] categories = new Category[1]; final boolean needScaling; if (!TypeMap.isSigned(targetType)) { categories = new Category[2]; categories[1] = Category.NODATA; targetRange = TypeMap.getPositiveRange(targetType); needScaling = !targetRange.contains(TypeMap.getRange(sourceType)); NumberRange sourceRange = TypeMap.getRange(sourceType); for (int b=0; b<numBands; b++) { final Color[] c = colors!=null ? colors[b] : null; categories[0] = new Category(n, c, targetRange, LinearTransform1D.IDENTITY); dst[b] = new GridSampleDimension(categories, units).geophysics(true);
/** * Returns the color interpretation of the sample dimension. * A sample dimension can be an index into a color palette or be a color model * component. If the sample dimension is not assigned a color interpretation * the value is {@link ColorInterpretation#UNDEFINED}. * */ public ColorInterpretation getColorInterpretation() { // The 'Grid2DSampleDimension' class overrides this method // with better values for 'band' and 'numBands' constants. final int band = 0; final int numBands = 1; return TypeMap.getColorInterpretation(getColorModel(band, numBands), band); }
/** * Returns the color interpretation of the sample dimension. */ @Override public ColorInterpretation getColorInterpretation() { return TypeMap.getColorInterpretation(getColorModel(), band); }