diff --git a/Code/IO/otbExtendedFilenameToReaderOptions.cxx b/Code/IO/otbExtendedFilenameToReaderOptions.cxx index 6a49917915921b50896a2559ccdad09d3a24764c..267da10db318e77559d1892c43cdf6b7a0f99906 100644 --- a/Code/IO/otbExtendedFilenameToReaderOptions.cxx +++ b/Code/IO/otbExtendedFilenameToReaderOptions.cxx @@ -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 diff --git a/Code/IO/otbExtendedFilenameToReaderOptions.h b/Code/IO/otbExtendedFilenameToReaderOptions.h index d0bfddd9edd5aa7fd1991cdf3d06060e5c24bef0..1a45f4cbfb79c0b5b0341417895da1d7da1e6170 100644 --- a/Code/IO/otbExtendedFilenameToReaderOptions.h +++ b/Code/IO/otbExtendedFilenameToReaderOptions.h @@ -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(); diff --git a/Code/IO/otbImageFileReader.txx b/Code/IO/otbImageFileReader.txx index c68ff256dd7ef60eca47325747c9fd2f499e114d..e2ebbd1d2298c215e8044c6b5e890f53c65c3c7d 100644 --- a/Code/IO/otbImageFileReader.txx +++ b/Code/IO/otbImageFileReader.txx @@ -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;