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 ReaderThe GeoTIFF reader which contain thisDataCube.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanReturnstrueif the image can be read with theDataSubsetbase class, orfalseif the more sophisticatedCompressedSubsetsub-class is needed.(package private) final Stringfilename()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 CompressionReturns the compression method, ornullif unspecified.abstract Optional<org.opengis.util.GenericName>Returns an human-readable identification of this coverage.(package private) abstract intReturns the number of components per pixel in the image stored in GeoTIFF file.(package private) abstract longReturns the total number of tiles.final DataStoreReturns the data store that produced this resource.(package private) abstract PredictorReturns the mathematical operator that is applied to the image data before an encoding scheme is applied.protected final ObjectReturns 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 booleanReturnstrueifInteger.reverseBytes(int)should be invoked on each byte read.(package private) final StoreListenersAccess to the protectedlisteners()field.final GridCoverageread(GridGeometry domain, int... ranges) Creates aGridCoveragewhich 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, setLoadingStrategyMethods inherited from class org.apache.sis.storage.AbstractGridCoverageResource
canNotRead, createMetadata, getEnvelope, logReadOperationMethods inherited from class org.apache.sis.storage.AbstractResource
addListener, clearCache, getMetadata, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sis.storage.GridCoverageResource
getGridGeometry, getResolutions, getSampleDimensions, subsetMethods 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:
getOriginatorin interfaceStoreResource- Returns:
- the data store that created this resource.
-
getSynchronizationLock
Returns the object on which to perform all synchronizations for thread-safety.- Overrides:
getSynchronizationLockin 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:
getIdentifierin interfaceResource- Overrides:
getIdentifierin 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:
getComponentFilesin 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(). -
getNumTiles
abstract long getNumTiles()Returns the total number of tiles. This is used for computing the stride between a band and the next band in#tileOffsetsand#tileByteCountsvectors. -
getTileArrayInfo
Gets the stream position and the length in bytes of compressed tile arrays in the GeoTIFF file. Values in the returned vector arelongprimitive type.- Returns:
- stream position (relative to file beginning) and length of compressed tile arrays, in bytes.
-
isBitOrderReversed
abstract boolean isBitOrderReversed()ReturnstrueifInteger.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, ornullif 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
Returnstrueif the image can be read with theDataSubsetbase class, orfalseif the more sophisticatedCompressedSubsetsub-class is needed. ThereadSlice(…)implementation inDataSubsetbase 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).
CompressedSubsetsubclass must be used even if there is no compression.- Throws:
DataStoreException
-
read
Creates aGridCoveragewhich will load pixel data in the given domain.- Specified by:
readin interfaceGridCoverageResource- Parameters:
domain- desired grid extent and resolution, ornullfor 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.
-