Skip to content
Snippets Groups Projects
Commit 93c23635 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

MRG

parents 94734243 940052d6
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
=========================================================================*/ =========================================================================*/
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning ( disable : 4786 ) #pragma warning ( disable : 4786 )
#endif #endif
...@@ -70,7 +69,7 @@ TerraSarImageMetadataInterface::CanRead( const MetaDataDictionaryType & dict ) c ...@@ -70,7 +69,7 @@ TerraSarImageMetadataInterface::CanRead( const MetaDataDictionaryType & dict ) c
else else
return false; return false;
} }
int int
TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) const TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) const
...@@ -94,20 +93,20 @@ TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) co ...@@ -94,20 +93,20 @@ TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) co
ossimString separatorList; ossimString separatorList;
key = "support_data.image_date"; key = "support_data.image_date";
separatorList = "-T"; separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str()); ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList); std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if(keywordStrings.size() <= 2) if(keywordStrings.size() <= 2)
itkExceptionMacro(<<"Invalid Day"); itkExceptionMacro(<<"Invalid Day");
ossimString day = keywordStrings[2]; ossimString day = keywordStrings[2];
return day.toInt(); return day.toInt();
*/ */
return 1; return 1;
} }
int int
...@@ -132,8 +131,8 @@ TerraSarImageMetadataInterface::GetMonth( const MetaDataDictionaryType & dict ) ...@@ -132,8 +131,8 @@ TerraSarImageMetadataInterface::GetMonth( const MetaDataDictionaryType & dict )
ossimString separatorList; ossimString separatorList;
key = "support_data.image_date"; key = "support_data.image_date";
separatorList = "-T"; separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str()); ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList); std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
...@@ -141,7 +140,7 @@ TerraSarImageMetadataInterface::GetMonth( const MetaDataDictionaryType & dict ) ...@@ -141,7 +140,7 @@ TerraSarImageMetadataInterface::GetMonth( const MetaDataDictionaryType & dict )
itkExceptionMacro(<<"Invalid Month"); itkExceptionMacro(<<"Invalid Month");
ossimString month = keywordStrings[1]; ossimString month = keywordStrings[1];
return month.toInt(); return month.toInt();
*/ */
return 1; return 1;
...@@ -262,7 +261,7 @@ TerraSarImageMetadataInterface::GetProductionDay( const MetaDataDictionaryType & ...@@ -262,7 +261,7 @@ TerraSarImageMetadataInterface::GetProductionDay( const MetaDataDictionaryType &
{ {
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image"); itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
} }
ImageKeywordlistType imageKeywordlist; ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
...@@ -296,7 +295,7 @@ TerraSarImageMetadataInterface::GetProductionMonth( const MetaDataDictionaryType ...@@ -296,7 +295,7 @@ TerraSarImageMetadataInterface::GetProductionMonth( const MetaDataDictionaryType
{ {
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image"); itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
} }
ImageKeywordlistType imageKeywordlist; ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
...@@ -331,7 +330,7 @@ TerraSarImageMetadataInterface::GetProductionYear( const MetaDataDictionaryType ...@@ -331,7 +330,7 @@ TerraSarImageMetadataInterface::GetProductionYear( const MetaDataDictionaryType
{ {
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image"); itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
} }
ImageKeywordlistType imageKeywordlist; ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
#ifndef __otbTerraSarImageMetadataInterface_h #ifndef __otbTerraSarImageMetadataInterface_h
#define __otbTerraSarImageMetadataInterface_h #define __otbTerraSarImageMetadataInterface_h
...@@ -46,13 +47,13 @@ public: ...@@ -46,13 +47,13 @@ public:
typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer; typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */ /** Method for creation through the object factory. */
itkNewMacro(Self); itkNewMacro(Self);
/** Run-time type information (and related methods). */ /** Run-time type information (and related methods). */
itkTypeMacro(TerraSarImageMetadataInterface, itk::Object); itkTypeMacro(TerraSarImageMetadataInterface, itk::Object);
typedef itk::ImageBase< 2 > ImageType; typedef itk::ImageBase< 2 > ImageType;
typedef itk::MetaDataDictionary MetaDataDictionaryType; typedef itk::MetaDataDictionary MetaDataDictionaryType;
typedef MetaDataKey::VectorType VectorType; typedef MetaDataKey::VectorType VectorType;
...@@ -67,35 +68,35 @@ public: ...@@ -67,35 +68,35 @@ public:
/** Get the imaging acquisition day from the ossim metadata */ /** Get the imaging acquisition day from the ossim metadata */
int GetDay( const MetaDataDictionaryType & ) const; int GetDay( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition month from the ossim metadata */ /** Get the imaging acquisition month from the ossim metadata */
int GetMonth( const MetaDataDictionaryType & ) const; int GetMonth( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition year from the ossim metadata */ /** Get the imaging acquisition year from the ossim metadata */
int GetYear( const MetaDataDictionaryType & ) const; int GetYear( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition hour from the ossim metadata */ /** Get the imaging acquisition hour from the ossim metadata */
int GetHour( const MetaDataDictionaryType & ) const; int GetHour( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition minute from the ossim metadata */ /** Get the imaging acquisition minute from the ossim metadata */
int GetMinute( const MetaDataDictionaryType & ) const; int GetMinute( const MetaDataDictionaryType & ) const;
/** Get the imaging production day from the ossim metadata */ /** Get the imaging production day from the ossim metadata */
int GetProductionDay( const MetaDataDictionaryType & ) const; int GetProductionDay( const MetaDataDictionaryType & ) const;
/** Get the imaging production month from the ossim metadata */ /** Get the imaging production month from the ossim metadata */
int GetProductionMonth( const MetaDataDictionaryType & ) const; int GetProductionMonth( const MetaDataDictionaryType & ) const;
/** Get the imaging production year from the ossim metadata */ /** Get the imaging production year from the ossim metadata */
int GetProductionYear( const MetaDataDictionaryType & ) const; int GetProductionYear( const MetaDataDictionaryType & ) const;
bool CanRead( const MetaDataDictionaryType & ) const; bool CanRead( const MetaDataDictionaryType & ) const;
protected: protected:
TerraSarImageMetadataInterface(); TerraSarImageMetadataInterface();
virtual ~TerraSarImageMetadataInterface() {}; virtual ~TerraSarImageMetadataInterface() {};
private: private:
TerraSarImageMetadataInterface(const Self&); //purposely not implemented TerraSarImageMetadataInterface(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
See OTBCopyright.txt for details. See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
...@@ -33,16 +33,16 @@ int otbTerraSarImageMetadataInterface (int argc, char* argv[]) ...@@ -33,16 +33,16 @@ int otbTerraSarImageMetadataInterface (int argc, char* argv[])
// Verify the number of parameters in the command line // Verify the number of parameters in the command line
const char * inputFilename = argv[1]; const char * inputFilename = argv[1];
const char * outputFilename = argv[2]; const char * outputFilename = argv[2];
typedef otb::VectorImage< double, 2 > InputImageType; typedef otb::VectorImage< double, 2 > InputImageType;
typedef otb::ImageFileReader< InputImageType > ImageReaderType; typedef otb::ImageFileReader< InputImageType > ImageReaderType;
ImageReaderType::Pointer reader = ImageReaderType::New(); ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName( inputFilename ); reader->SetFileName( inputFilename );
reader->UpdateOutputInformation(); reader->UpdateOutputInformation();
otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New(); otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New();
std::ofstream file; std::ofstream file;
file.open(outputFilename); file.open(outputFilename);
file<<"GetSensorID: "<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; file<<"GetSensorID: "<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment