org.geotools.image.io.metadata
Class Band

java.lang.Object
  extended by org.geotools.image.io.metadata.MetadataAccessor
      extended by org.geotools.image.io.metadata.Band

public class Band
extends MetadataAccessor

A <SampleDimension> element in geographic metadata format.

Since:
2.4
Version:
$Id: Band.java 30996 2008-07-10 13:28:59Z cedricbr $
Author:
Martin Desruisseaux
See Also:
SampleDimension

Constructor Summary
protected Band(GeographicMetadata metadata, int bandIndex)
          Creates a parser for a band.
 
Method Summary
 java.lang.String getName()
          Returns the name for this band, or null if none.
 double[] getNoDataValues()
          Returns the fill values for this band, or null if none.
 double getOffset()
          Returns the offset from packed to geophysics values, or 0 if none.
 double getScale()
          Returns the scale factor from packed to geophysics values, or 1 if none.
 NumberRange getValidRange()
          Returns the range of valid values for this band.
 void setName(java.lang.String name)
          Sets the name for this band.
 void setNoDataValues(double[] fillValues)
          Sets the fill values for this band.
 void setOffset(double offset)
          Sets the offset for this band.
 void setPackedValues(double minValue, double maxValue, double[] fillValues, int dataType)
          Defines valid and fill packed values as a combinaison of setValidRange(minValue, maxValue) and {linkplain #setNoDataValues(double[]) setNoDataValues}(fillValues).
 void setScale(double scale)
          Sets the scale factor for this band.
 void setValidRange(double minValue, double maxValue)
          Sets the range of valid values.
 
Methods inherited from class org.geotools.image.io.metadata.MetadataAccessor
appendChild, childCount, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubles, getAttributeAsInteger, getAttributeAsIntegers, getAttributeAsString, getUserObject, getUserObject, selectChild, selectParent, setAttributeAsDate, setAttributeAsDouble, setAttributeAsDoubles, setAttributeAsInteger, setAttributeAsIntegers, setAttributeAsString, setUserObject, setWarningsEnabled, toString, trimFractionalPart, warningOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Band

protected Band(GeographicMetadata metadata,
               int bandIndex)
Creates a parser for a band. This constructor should not be invoked directly; use GeographicMetadata.getBand(int) instead.

Parameters:
metadata - The metadata which contains this band.
bandIndex - The band index for this instance.
Method Detail

getName

public java.lang.String getName()
Returns the name for this band, or null if none.


setName

public void setName(java.lang.String name)
Sets the name for this band.

Parameters:
name - The band name, or null if none.

getValidRange

public NumberRange getValidRange()
Returns the range of valid values for this band. The range use the Integer type if possible, or the Double type otherwise. Note that range minimum value, maximum value or both may be null if no "minValue" or "maxValue" attribute were found for the "SampleDimensions/SampleDimension" element.


setValidRange

public void setValidRange(double minValue,
                          double maxValue)
Sets the range of valid values. The values should be integers most of the time since they are packed values (often index in a color palette). But floating point values are allowed too.

If the minimal or maximal value may be unknown, consider invoking setPackedValues(minValue, maxValue, …) instead. The later can infers default bounds according a given data type.

Parameters:
minValue - The minimal valid packed value, or Double.NEGATIVE_INFINITY if none.
maxValue - The maximal valid packed value, or Double.POSITIVE_INFINITY if none.
See Also:
setPackedValues(double, double, double[], int)

getNoDataValues

public double[] getNoDataValues()
Returns the fill values for this band, or null if none.


setNoDataValues

public void setNoDataValues(double[] fillValues)
Sets the fill values for this band. This method formats all fill values as integers if possible, or all values as floating points otherwise. We apply a "all or nothing" rule for consistency.

Parameters:
fillValues - The packed values used for missing data, or null if none.
See Also:
setPackedValues(double, double, double[], int)

setPackedValues

public void setPackedValues(double minValue,
                            double maxValue,
                            double[] fillValues,
                            int dataType)
Defines valid and fill packed values as a combinaison of setValidRange(minValue, maxValue) and {linkplain #setNoDataValues(double[]) setNoDataValues}(fillValues).

If the minimal or maximal value is infinite and the data type is an integer type, then this method replaces the infinite values by default bounds inferred from the data type and the fill values.

Parameters:
minValue - The minimal valid packed value, or Double.NEGATIVE_INFINITY if unknown.
maxValue - The maximal valid packed value, or Double.POSITIVE_INFINITY if unknown.
fillValues - The packed values used for missing data, or null if none.
dataType - The raw data type as one of DataBuffer constants, or DataBuffer.TYPE_UNDEFINED if unknown.
See Also:
setValidRange(double, double), setNoDataValues(double[])

getScale

public double getScale()
Returns the scale factor from packed to geophysics values, or 1 if none.


setScale

public void setScale(double scale)
Sets the scale factor for this band.

Parameters:
scale - The scale from packed to geophysics values, or 1 if none.

getOffset

public double getOffset()
Returns the offset from packed to geophysics values, or 0 if none.


setOffset

public void setOffset(double offset)
Sets the offset for this band.

Parameters:
offset - The offset from packed to geophysics values, or 0 if none.


Copyright © 1996-2010 Geotools. All Rights Reserved.