Skip to content
Snippets Groups Projects
Commit d8f93205 authored by Aurélien Bricier's avatar Aurélien Bricier
Browse files

ENH: added skip geom option to the reader

parent 9be31acb
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,9 @@ ExtendedFilenameToReaderOptions
m_Options.skipCarto.first = false;
m_Options.skipCarto.second = false;
m_Options.skipGeom.first = false;
m_Options.skipGeom.second = false;
m_Options.nbSetOptions = 0;
}
......@@ -89,9 +92,25 @@ ExtendedFilenameToReaderOptions
}
}
if (!map["skipgeom"].empty())
{
m_Options.skipGeom.first = true;
m_Options.nbSetOptions ++;
if ( map["skipgeom"] == "On"
|| map["skipgeom"] == "on"
|| map["skipgeom"] == "ON"
|| map["skipgeom"] == "true"
|| map["skipgeom"] == "True"
|| map["skipgeom"] == "1" )
{
m_Options.skipGeom.second = true;
}
}
if (m_Options.nbSetOptions < nbOpts)
{
itkWarningMacro("Some unknown reader options have been detected")
itkWarningMacro("Some unknown reader options have been detected");
}
}
......@@ -160,4 +179,17 @@ ExtendedFilenameToReaderOptions
return m_Options.skipCarto.second;
}
bool
ExtendedFilenameToReaderOptions
::SkipGeomIsSet () const
{
return m_Options.skipGeom.first;
}
bool
ExtendedFilenameToReaderOptions
::GetSkipGeom () const
{
return m_Options.skipGeom.second;
}
} // end namespace otb
......@@ -32,6 +32,7 @@ namespace otb
* - &sdataidx : sub-dataset index for composite files
* - &resol : resolution factor for jpeg200 files
* - &skipcarto : switch to skip the cartographic informations
* - &skipgeom : switch to skip the geometric informations
*
* \sa ImageFileReader
*/
......@@ -59,6 +60,7 @@ public:
std::pair< bool, unsigned int > subDatasetIndex;
std::pair< bool, unsigned int > resolutionFactor;
std::pair< bool, bool > skipCarto;
std::pair< bool, bool > skipGeom;
unsigned int nbSetOptions;
};
......@@ -75,6 +77,8 @@ public:
unsigned int GetResolutionFactor () const;
bool SkipCartoIsSet () const;
bool GetSkipCarto () const;
bool SkipGeomIsSet () const;
bool GetSkipGeom () const;
protected:
ExtendedFilenameToReaderOptions();
......
......@@ -471,8 +471,20 @@ ImageFileReader<TOutputImage>
}
//Copy MetaDataDictionary from instantiated reader to output image.
output->SetMetaDataDictionary(this->m_ImageIO->GetMetaDataDictionary());
this->SetMetaDataDictionary(this->m_ImageIO->GetMetaDataDictionary());
if (!m_FilenameHelper->GetSkipGeom())
{
output->SetMetaDataDictionary(this->m_ImageIO->GetMetaDataDictionary());
this->SetMetaDataDictionary(this->m_ImageIO->GetMetaDataDictionary());
}
else
{
itk::MetaDataDictionary dictLight;
std::string projRef;
itk::ExposeMetaData(dict, MetaDataKey::ProjectionRefKey, projRef);
itk::EncapsulateMetaData<std::string>(dictLight, MetaDataKey::ProjectionRefKey, projRef);
output->SetMetaDataDictionary(dictLight);
this->SetMetaDataDictionary(dictLight);
}
typedef typename TOutputImage::IndexType IndexType;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment