Package org.apache.sis.storage.geotiff
Class DataCube
java.lang.Object
org.apache.sis.storage.AbstractResource
org.apache.sis.storage.AbstractGridCoverageResource
org.apache.sis.internal.storage.TiledGridResource
org.apache.sis.storage.geotiff.DataCube
- All Implemented Interfaces:
ResourceOnFileSystem
,StoreResource
,DataSet
,GridCoverageResource
,Resource
- Direct Known Subclasses:
ImageFileDirectory
One or many GeoTIFF images packaged as a single resource.
This is typically a single two-dimensional image represented as a
ImageFileDirectory
.
But it can also be a stack of images organized in a n-dimensional data cube,
or a pyramid of images with their overviews used when low resolution images is requested.
Warning: do not implement Localized
,
as it may cause an infinite loop in listeners.getLocale()
call.
- Since:
- 1.1
- Version:
- 1.3
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.storage.TiledGridResource
TiledGridResource.Subset
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Reader
The GeoTIFF reader which contain thisDataCube
.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Returnstrue
if the image can be read with theDataSubset
base class, orfalse
if the more sophisticatedCompressedSubset
sub-class is needed.(package private) final String
filename()
Shortcut for a frequently requested information.final Path[]
Gets the paths to files used by this resource, or an empty array if unknown.(package private) abstract Compression
Returns the compression method, ornull
if unspecified.abstract Optional
<org.opengis.util.GenericName> Returns an human-readable identification of this coverage.(package private) abstract int
Returns the number of components per pixel in the image stored in GeoTIFF file.(package private) abstract long
Returns the total number of tiles.final DataStore
Returns the data store that produced this resource.(package private) abstract Predictor
Returns the mathematical operator that is applied to the image data before an encoding scheme is applied.protected final Object
Returns the object on which to perform all synchronizations for thread-safety.(package private) abstract Vector[]
Gets the stream position and the length in bytes of compressed tile arrays in the GeoTIFF file.(package private) abstract boolean
Returnstrue
ifInteger.reverseBytes(int)
should be invoked on each byte read.(package private) final StoreListeners
Access to the protectedlisteners()
field.final GridCoverage
read
(GridGeometry domain, int... ranges) Creates aGridCoverage
which will load pixel data in the given domain.Methods inherited from class org.apache.sis.internal.storage.TiledGridResource
getAtomSize, getColorModel, getDissociableBands, getFillValue, getLoadingStrategy, getSampleModel, getTileSize, preload, setLoadingStrategy
Methods inherited from class org.apache.sis.storage.AbstractGridCoverageResource
canNotRead, createMetadata, getEnvelope, logReadOperation
Methods inherited from class org.apache.sis.storage.AbstractResource
addListener, clearCache, getMetadata, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sis.storage.GridCoverageResource
getGridGeometry, getResolutions, getSampleDimensions, subset
Methods inherited from interface org.apache.sis.storage.Resource
addListener, getMetadata, removeListener
-
Field Details
-
reader
The GeoTIFF reader which contain thisDataCube
. Used for fetching information like the input channel and where to report warnings.
-
-
Constructor Details
-
DataCube
DataCube(Reader reader) Creates a new data cube.- Parameters:
reader
- information about the input stream to read, the metadata and the character encoding.
-
-
Method Details
-
getOriginator
Returns the data store that produced this resource.- Specified by:
getOriginator
in interfaceStoreResource
- Returns:
- the data store that created this resource.
-
getSynchronizationLock
Returns the object on which to perform all synchronizations for thread-safety.- Overrides:
getSynchronizationLock
in classAbstractResource
- Returns:
- the synchronization lock.
-
listeners
Access to the protectedlisteners()
field. -
filename
Shortcut for a frequently requested information. -
getIdentifier
Returns an human-readable identification of this coverage. The namespace should be the filename and the tip can be an image index, citation, or overview level.The returned value should never be empty. An empty value would be a failure to initialize overviews.
- Specified by:
getIdentifier
in interfaceResource
- Overrides:
getIdentifier
in classAbstractResource
- Returns:
- a persistent identifier unique within the data store, or absent if this resource has no such identifier.
- See Also:
-
getComponentFiles
Gets the paths to files used by this resource, or an empty array if unknown.- Specified by:
getComponentFiles
in interfaceResourceOnFileSystem
- Returns:
- files used by this resource. Should never be
null
.
-
getNumBands
abstract int getNumBands()Returns the number of components per pixel in the image stored in GeoTIFF file. This the same value than the one returned bygetSampleModel().getNumBands()
, and is also the size of the collection returned byGridCoverageResource.getSampleDimensions()
.- See Also:
-
getNumTiles
abstract long getNumTiles()Returns the total number of tiles. This is used for computing the stride between a band and the next band ininvalid reference
#tileOffsets
invalid reference
#tileByteCounts
-
getTileArrayInfo
Gets the stream position and the length in bytes of compressed tile arrays in the GeoTIFF file. Values in the returned vector arelong
primitive type.- Returns:
- stream position (relative to file beginning) and length of compressed tile arrays, in bytes.
-
isBitOrderReversed
abstract boolean isBitOrderReversed()Returnstrue
ifInteger.reverseBytes(int)
should be invoked on each byte read. This mode is very rare and should apply only to uncompressed image or CCITT 1D/2D compressions. -
getCompression
Returns the compression method, ornull
if unspecified. -
getPredictor
Returns the mathematical operator that is applied to the image data before an encoding scheme is applied. Should never be null; the default value isPredictor.NONE
. -
canReadDirect
Returnstrue
if the image can be read with theDataSubset
base class, orfalse
if the more sophisticatedCompressedSubset
sub-class is needed. ThereadSlice(…)
implementation inDataSubset
base class is more efficient but can be used only if all following conditions hold:- The sample model stores each band in its own bank (this condition is relaxed if there is no band subset and no subsampling on the x axis). The reason for this restriction is because otherwise, the space skipped between values to read may be of irregular sizes, or the number of values to read between spaces may be greater than 1.
- There is only one sample value per bank element (i.e. no multi-pixels packed in single elements).
CompressedSubset
subclass must be used even if there is no compression.- Throws:
DataStoreException
-
read
Creates aGridCoverage
which will load pixel data in the given domain.- Specified by:
read
in interfaceGridCoverageResource
- Parameters:
domain
- desired grid extent and resolution, ornull
for reading the whole domain.ranges
- 0-based index of sample dimensions to read, or an empty sequence for reading all ranges.- Returns:
- the grid coverage for the specified domain and ranges.
- Throws:
DataStoreException
- if an error occurred while reading the grid coverage data.
-