Update Remove OSSIM authored by Julien Osman's avatar Julien Osman
...@@ -42,6 +42,79 @@ Benefits: ...@@ -42,6 +42,79 @@ Benefits:
## Presentation of the new architecture ## Presentation of the new architecture
### The new ImageMetadata object
To replace OSSIM's MetadataDictionary, a new *ImageMetadata* object is
introduced. It inherits from *ImageMetadataBase*.
```mermaid
classDiagram
class ImageMetadataBase
ImageMetadataBase : - NumericKeys
ImageMetadataBase : - StringKeys
ImageMetadataBase : - LUT1DKeys
ImageMetadataBase : - LUT2DKeys
ImageMetadataBase : - TimeKeys
ImageMetadataBase : - GeometryKeys
ImageMetadataBase : - ExtraKeys
ImageMetadataBase : - [] operator(key)
ImageMetadataBase : - Add(key, value)
ImageMetadataBase : - Remove(key)
ImageMetadataBase : - Has(key)
ImageMetadataBase : - ToKeywordList(kwl)
ImageMetadataBase : - FromKeywordList(kwl)
ImageMetadataBase : - Fuse(imd)
class ImageMetadata
ImageMetadata : - Bands
ImageMetadata : - slice(start, end)
ImageMetadata : - append(imd)
ImageMetadata : - compact()
ImageMetadata : - Merge(imd)
ImageMetadata : - AppendToKeywordLists(kwlv)
ImageMetadata : - AppendToBandKeywordLists(kwlv)
ImageMetadata : - FromKeywordLists(kwlv)
ImageMetadataBase <|-- ImageMetadata
ImageMetadata "1" *-- "0..*" ImageMetadataBase
```
*ImageMetadataBase* encapsulates seven std::map to store seven
different kind of metadata:
- Numeric metadata for the metadata that can be stored as a double
- String metadata for the metadata that can be stored as a std::string
- LUT 1D metadata the metadata that can be stored as a one
dimension table
- LUT 2D metadata for the metadata that can be stored as two
dimensions table
- Time metadata for the metadata that can be stored as a *time* object
- Geometry metadata for the metadata that represent a model
- Extra metadata for non generic metadata stored as std::string
The keys of the maps are described in the file otbMetaDataKey. This
file also defines the *time* object.
The *ImageMetadataBase* class also provides 4 methods:
- the *[] operator* for a read-only access the metadata from the key
- the *Add* method to set a metadata value
- the *Remove* method to delete a metadata value
- the *Has* method to test if a key has a value
The *ImageMetadata* class is used to store the metadata. It contains a
std::vector *Bands* that contains one *ImageMetadataBase* for each
band of the product. The metadata that are common to all the bands are
stored in the *ImageMetadata* object itself. It also provides some
useful methods:
- the *slice* method to access the metadata of a range of bands
- the *append* method to concatenate two *ImageMetadata* objects
- the *compact* method to put to the top level the metadata that are
common to all the bands
- the *Merge* method to merge with another *ImageMetadata*
### Metadata parsing ### Metadata parsing
Here is a new workflow to replace the current function Here is a new workflow to replace the current function
...@@ -54,7 +127,7 @@ Here is a new workflow to replace the current function ...@@ -54,7 +127,7 @@ Here is a new workflow to replace the current function
a (in-memory) XML tree. This tree is given to a a (in-memory) XML tree. This tree is given to a
ImageMetadataInterface (IMI) that will look for needed ImageMetadataInterface (IMI) that will look for needed
information. The parsing is be done by different classes, information. The parsing is be done by different classes,
ddepending on the file format. They can all derive from the base depending on the file format. They can all derive from the base
class MetadataSupplierInterface. The three suppliers are: class MetadataSupplierInterface. The three suppliers are:
* GDALImageIO will use GDALDataset::GetMetadata() to extract * GDALImageIO will use GDALDataset::GetMetadata() to extract
'key=value' pairs and format them into a XML tree. 'key=value' pairs and format them into a XML tree.
...@@ -62,7 +135,7 @@ Here is a new workflow to replace the current function ...@@ -62,7 +135,7 @@ Here is a new workflow to replace the current function
("ReadXMLToList" method from the "GDALMDReaderBase" class) to ("ReadXMLToList" method from the "GDALMDReaderBase" class) to
convert the XML file into a GDAL ListString, which is a convert the XML file into a GDAL ListString, which is a
succession of 'key=value' pairs. succession of 'key=value' pairs.
* TextMetadataSupplier trys to parse 'key=value' pairs. * TextMetadataSupplier tries to parse 'key=value' pairs.
Those classes all implement the method *GetMetadataValue* which Those classes all implement the method *GetMetadataValue* which
returns the value of the metadata from a given key. The base class returns the value of the metadata from a given key. The base class
...@@ -72,9 +145,9 @@ Here is a new workflow to replace the current function ...@@ -72,9 +145,9 @@ Here is a new workflow to replace the current function
1. The GDAL input/output capabilities are encapsulated in the 1. The GDAL input/output capabilities are encapsulated in the
GDALImageIO class, which derivates from ImageIO. This class is in GDALImageIO class, which derivates from ImageIO. This class is in
charge of fetching the metadata from the product (supplier charge of fetching the metadata from the product (supplier
capabilities hinerited from the class MetadataSupplierInterface), capabilities inherited from the class MetadataSupplierInterface),
and of writting the metadata to the product (storage capabilities and of writing the metadata to the product (storage capabilities
hinerited from the class MetadataStorageInterface). inherited from the class MetadataStorageInterface).
1. We use a classic IMIFactory to find if a given IMI (associated to a 1. We use a classic IMIFactory to find if a given IMI (associated to a
given sensor) can parse the metadata of a product. The IMI's given sensor) can parse the metadata of a product. The IMI's
... ...
......