Commit 2ae42cdd authored by Guillaume Pasero's avatar Guillaume Pasero

REFAC: remove deprecated replacement method for itk::MetaDataDictionary::Erase

parent 279d6e9d
......@@ -78,11 +78,6 @@ private:
ChangeInformationImageFilter(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
/** Removes a field from a metadata dictionary
* After ITK 4.6, an Erase() method has been added to
* itk::MetaDataDictionary, so this function could be tagged as deprecated */
bool RemoveKeyFromDictionary(itk::MetaDataDictionary & dict, const std::string & key);
/** List of metadata keys to change */
std::set<std::string> m_ChangedKeys;
......
......@@ -81,7 +81,7 @@ ChangeInformationImageFilter<TInputImage>
if (value == ITK_NULLPTR)
{
// Remove meta-data from dictionary
this->RemoveKeyFromDictionary(dict,key);
dict.Erase(key);
}
else
{
......@@ -113,41 +113,11 @@ ChangeInformationImageFilter<TInputImage>
else
{
// Remove metadata from output dictionary
this->RemoveKeyFromDictionary(outputDict,*it);
outputDict.Erase(*it);
}
}
}
template< typename TInputImage >
bool
ChangeInformationImageFilter<TInputImage>
::RemoveKeyFromDictionary(itk::MetaDataDictionary & dict, const std::string & key)
{
std::vector<std::string> keyList = dict.GetKeys();
std::vector<std::string>::iterator pos = keyList.begin();
while (pos != keyList.end())
{
if (key.compare(*pos) == 0)
{
break;
}
++pos;
}
if (pos != keyList.end())
{
itk::MetaDataDictionary copyDict;
keyList.erase(pos);
pos = keyList.begin();
for ( ; pos != keyList.end();++pos)
{
copyDict.Set(*pos, const_cast<itk::MetaDataObjectBase*>(dict.Get(*pos)));
}
dict = copyDict;
return true;
}
return false;
}
} // End of namespace OTB
#endif
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