Commit 0aa4f8ce authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

ENH:add getter by key to imagekeywordlist

parent 97b37baa
......@@ -52,7 +52,7 @@ public:
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(AttributesMapOpeningLabelMapFilter,AttributeOpeningLabelMapFilter);
itkTypeMacro(AttributesMapOpeningLabelMapFilter,itk::AttributeOpeningLabelMapFilter);
/** Set the name of the attribute to perform opening on */
void SetAttributeName(const char * name)
......
......@@ -45,7 +45,22 @@ operator=(const Self& p)
m_Keywordlist = p.m_Keywordlist;
}
const ossimString &
ImageKeywordlist::
GetMetadataByKey(const ossimString & key) const
{
// Search for the key in the output map
KeywordlistMap::const_iterator it = m_Keywordlist.find(key);
// If the key can not be found, throw an exception
if(it == m_Keywordlist.end())
{
itkExceptionMacro(<<"Keywordlist has no output with key "<<key);
}
// Then if everything is ok, return the ossinString
return it->second;
}
void
ImageKeywordlist::
convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const
......
......@@ -44,11 +44,20 @@ public:
/** Standard class typedefs. */
typedef ImageKeywordlist Self;
virtual const char *GetNameOfClass() const
{return "ImageKeywordlist";}
//virtual const char *GetNameOfClass() const
//{return "ImageKeywordlist";}
typedef std::map<ossimString, ossimString> KeywordlistMap;
/** Run-time type information (and related methods). */
itkTypeMacro(ImageKeywordlist, ImageKeywordlist);
/** Get the internal map container */
const KeywordlistMap & GetKeywordlist() const
{
return m_Keywordlist;
}
void SetKeywordlist(const ossimKeywordlist& kwl)
{
m_Keywordlist = kwl.getMap();
......@@ -63,7 +72,10 @@ public:
{
return m_Keywordlist.size();
}
/** Get the Data object descriptor corresponding to the given key */
const ossimString & GetMetadataByKey(const ossimString & key) const;
virtual void convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const;
virtual void Print(std::ostream& os, itk::Indent indent=0) const;
......
......@@ -303,11 +303,6 @@ ImageLayer<TImage,TOutputImage>
oss << otbGetTextMacro("Location unknown") << std::endl;
}
}
itk::MetaDataDictionary dict = m_Image->GetMetaDataDictionary();
ImageMetadataInterfaceBase::Pointer lImageMetadataInterface = ImageMetadataInterfaceFactory::CreateIMI(dict);
oss << otbGetTextMacro("X spacing ") << lImageMetadataInterface->GetXPixelSpacing(dict) << std::endl;
oss << otbGetTextMacro("Y spacing ") << lImageMetadataInterface->GetYPixelSpacing(dict) << std::endl;
return oss.str();
}
......
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