Commit c9d53c5b authored by Cédric Traizet's avatar Cédric Traizet

ENH: adds ImageMetadata::GetAsVector for numeric keys

parent b8367b7e
......@@ -302,6 +302,9 @@ public:
/** Setter for numeric keys on each band*/
using ImageMetadataBase::Add;
void Add(const MDNum&, const MetaDataKey::VariableLengthVectorType);
/** Getter for numeric keys on each band*/
itk::VariableLengthVector<double> GetAsVector(const MDNum & key) const;
};
extern OTBMetadata_EXPORT std::ostream& operator<<(std::ostream& os, const otb::ImageMetadataBase& imd);
......
......@@ -631,6 +631,20 @@ void ImageMetadata::Add(const MDNum& key, const MetaDataKey::VariableLengthVecto
}
}
itk::VariableLengthVector<double> ImageMetadata::GetAsVector(const MDNum& key) const
{
itk::VariableLengthVector<double> output(Bands.size());
int i = 0;
for (const auto & band : Bands)
{
output[i] = band[key];
i++;
}
return output;
}
// printing
std::ostream& operator<<(std::ostream& os, const otb::ImageMetadataBase& imd)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment