Commit e0ffe205 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

MRG

parents fe7e1204 a7d7db1b
......@@ -768,7 +768,7 @@ IF(OTB_CPP_CHECK_SOURCE_FILE)
FIND_PROGRAM(OTB_CPP_CHECK_PROG "")
ENDIF(OTB_CPP_CHECK_SOURCE_FILE)
FUNCTION(OTB_ADD_EXECUTABLE name sources libraries)
MACRO(OTB_ADD_EXECUTABLE name sources libraries)
# MESSAGE(STATUS "name: ${name}")
# MESSAGE(STATUS "sources: ${sources}")
# MESSAGE(STATUS "libraries: ${libraries}")
......@@ -787,7 +787,7 @@ FUNCTION(OTB_ADD_EXECUTABLE name sources libraries)
VERBATIM )
ENDFOREACH(file)
ENDIF(OTB_CPP_CHECK_SOURCE_FILE)
ENDFUNCTION(OTB_ADD_EXECUTABLE)
ENDMACRO(OTB_ADD_EXECUTABLE)
#-----------------------------------------------------------------------------
......
......@@ -45,7 +45,7 @@ public:
ClosePathFunctor()
{};
~ClosePathFunctor() {};
virtual ~ClosePathFunctor() {};
inline OutputPathPointerType operator()(const TInput * input)
{
......@@ -74,4 +74,4 @@ public:
}
#endif
\ No newline at end of file
#endif
......@@ -175,4 +175,4 @@ LabelMapToVectorDataFilter<TLabelMap, TVectorData>
}
}// end namespace otb
#endif
\ No newline at end of file
#endif
......@@ -82,4 +82,4 @@ private:
#include "otbVectorDataSource.txx"
#endif
#endif // __otbVectorDataSource_h
\ No newline at end of file
#endif // __otbVectorDataSource_h
......@@ -54,97 +54,97 @@ public:
/** Get the radiometric bias from the ossim metadata */
VariableLengthVectorType GetPhysicalBias( const MetaDataDictionaryType & /*dict*/ ) const
VariableLengthVectorType GetPhysicalBias( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetPhysicalBias not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the radiometric gain from the ossim metadata */
VariableLengthVectorType GetPhysicalGain( const MetaDataDictionaryType & /*dict*/ ) const
VariableLengthVectorType GetPhysicalGain( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetPhysicalGain not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the solar irradiance from the ossim metadata */
VariableLengthVectorType GetSolarIrradiance( const MetaDataDictionaryType & /*dict*/ ) const
VariableLengthVectorType GetSolarIrradiance( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetSolarIrradiance not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging acquisition day from the ossim metadata */
int GetDay( const MetaDataDictionaryType & /*dict*/ ) const
int GetDay( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetDay not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging acquisition month from the ossim metadata */
int GetMonth( const MetaDataDictionaryType & /*dict*/ ) const
int GetMonth( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetMonth not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging acquisition year from the ossim metadata */
int GetYear( const MetaDataDictionaryType & /*dict*/ ) const
int GetYear( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetYear not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging acquisition hour from the ossim metadata */
int GetHour( const MetaDataDictionaryType & /*dict*/ ) const
int GetHour( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetHour not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging acquisition minute from the ossim metadata */
int GetMinute( const MetaDataDictionaryType & /*dict*/ ) const
int GetMinute( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetMinute not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging production day from the ossim metadata */
int GetProductionDay( const MetaDataDictionaryType & /*dict*/ ) const
int GetProductionDay( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetProductionDay not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging production month from the ossim metadata */
int GetProductionMonth( const MetaDataDictionaryType & /*dict*/ ) const
int GetProductionMonth( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetProductionMonth not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the imaging production year from the ossim metadata */
int GetProductionYear( const MetaDataDictionaryType & /*dict*/ ) const
int GetProductionYear( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetProductionYear not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the sat elevation from the ossim metadata */
double GetSatElevation( const MetaDataDictionaryType & /*dict*/ ) const
double GetSatElevation( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetSatElevation not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the sat azimuth from the ossim metadata */
double GetSatAzimuth( const MetaDataDictionaryType & /*dict*/ ) const
double GetSatAzimuth( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetSatElevation not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the first wavelength for the spectral band definition */
VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & /*dict*/ ) const
VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetFirstWavelengths not implemented in DefaultImageMetadataInterface, no captor type found");
};
/** Get the last wavelength for the spectral band definition */
VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & /*dict*/ ) const
VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & ) const
{
itkExceptionMacro("GetLastWavelengths not implemented in DefaultImageMetadataInterface, no captor type found");
};
bool CanRead( const MetaDataDictionaryType & /*dict*/ ) const
bool CanRead( const MetaDataDictionaryType & ) const
{
// This clas is the default one, it has to be able to call every metadata
return true;
......
......@@ -86,7 +86,7 @@ public:
OGRIOHelper():m_Kept(-1)
{};
~OGRIOHelper() {};
virtual ~OGRIOHelper() {};
private:
/** Number of layer in the Tree*/
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <typeinfo>
#include <cassert>
#include "otbMacro.h"
#include "otbTerraSarImageMetadataInterface.h"
#include "itkMetaDataObject.h"
#include "otbVectorDataKeywordlist.h"
namespace otb
{
TerraSarImageMetadataInterface
::TerraSarImageMetadataInterface()
{
}
std::string
TerraSarImageMetadataInterface::GetSensorID( const MetaDataDictionaryType & dict ) const
{
ImageKeywordlistType ImageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, ImageKeywordlist);
}
ossimKeywordlist kwl;
ImageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key= "sensor";
ossimString keywordString = kwl.find(key.c_str());
std::string output(keywordString.chars());
return output;
}
bool
TerraSarImageMetadataInterface::CanRead( const MetaDataDictionaryType & dict ) const
{
std::string sensorID = GetSensorID(dict);
std::cout<<"sensorID : "<<sensorID<<std::endl;
if (sensorID.find("TerraSar") != std::string::npos)
return true;
else
return false;
}
int
TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
/*
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.image_date";
separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if(keywordStrings.size() <= 2)
itkExceptionMacro(<<"Invalid Day");
ossimString day = keywordStrings[2];
return day.toInt();
*/
return 1;
}
int
TerraSarImageMetadataInterface::GetMonth( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
/*
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.image_date";
separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if(keywordStrings.size() <= 2)
itkExceptionMacro(<<"Invalid Month");
ossimString month = keywordStrings[1];
return month.toInt();
*/
return 1;
}
int
TerraSarImageMetadataInterface::GetYear( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
/*
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.image_date";
separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if( keywordStrings.size() <= 2 )
itkExceptionMacro("Invalid Year");
ossimString year = keywordStrings[0];
return year.toInt();
*/
return 1;
}
int
TerraSarImageMetadataInterface::GetHour( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
/*
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.image_date";
separatorList = "-T:";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if( keywordStrings.size() <= 2 )
itkExceptionMacro("Invalid Hour");
ossimString hour = keywordStrings[3];
return hour.toInt();
*/
return 1;
}
int
TerraSarImageMetadataInterface::GetMinute( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
/*
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.image_date";
separatorList = "-T:";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if( keywordStrings.size() <= 2 )
itkExceptionMacro("Invalid Minute");
ossimString minute = keywordStrings[4];
return minute.toInt();
*/
return 1;
}
int
TerraSarImageMetadataInterface::GetProductionDay( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.generation_time";
separatorList = "-T:";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if(keywordStrings.size() <= 2)
itkExceptionMacro(<<"Invalid Day");
ossimString day = keywordStrings[2];
return day.toInt();
}
int
TerraSarImageMetadataInterface::GetProductionMonth( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.generation_time";
separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if(keywordStrings.size() <= 2)
itkExceptionMacro(<<"Invalid Month");
ossimString month = keywordStrings[1];
return month.toInt();
}
int
TerraSarImageMetadataInterface::GetProductionYear( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::string key;
ossimString separatorList;
key = "support_data.generation_time";
separatorList = "-T";
ossimString keywordString = kwl.find(key.c_str());
std::vector<ossimString> keywordStrings = keywordString.split(separatorList);
if( keywordStrings.size() <= 2 )
itkExceptionMacro("Invalid Year");
ossimString year = keywordStrings[0];
return year.toInt();
}
} // end namespace otb
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbTerraSarImageMetadataInterface_h
#define __otbTerraSarImageMetadataInterface_h
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "itkObject.h"
#include "itkMetaDataDictionary.h"
#include "otbMetaDataKey.h"
#include "otbImageKeywordlist.h"
#include "itkImageBase.h"
#include <string>
namespace otb
{
/** \class TerraSarImageMetadataInterface
*
* \brief Creation of an "otb" TerraSarImageMetadataInterface that gets metadata.
*
*/
class ITK_EXPORT TerraSarImageMetadataInterface : public itk::Object
{
public:
typedef TerraSarImageMetadataInterface Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(ImageMetadataInterfaceBase, itk::Object);
typedef itk::ImageBase< 2 > ImageType;
typedef itk::MetaDataDictionary MetaDataDictionaryType;
typedef MetaDataKey::VectorType VectorType;
typedef MetaDataKey::VariableLengthVectorType VariableLengthVectorType;
typedef ImageKeywordlist ImageKeywordlistType;
/** Set the image used to get the metadata */
itkSetObjectMacro(Image,ImageType);
/** Get the sensor ID from the ossim metadata */
std::string GetSensorID(const MetaDataDictionaryType & dict ) const;
/** Get the imaging acquisition day from the ossim metadata */
int GetDay( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition month from the ossim metadata */
int GetMonth( const MetaDataDictionaryType & ) const;
/** Get the imaging acquisition year from the ossim metadata */
int GetYear( const MetaDataDictionaryType & ) const;