From 83f69c3213d75d32072b5bb66ab2fa55bbdda291 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Tue, 24 Nov 2009 16:20:20 +0100 Subject: [PATCH] ENH : add test for TSARX image metadata --- Code/IO/otbTerraSarImageMetadataInterface.cxx | 2 + Code/IO/otbTerraSarImageMetadataInterface.h | 21 ++++++++++ Testing/Code/IO/CMakeLists.txt | 13 +++++++ Testing/Code/IO/otbIOTests17.cxx | 1 + .../IO/otbTerraSarImageMetadataInterface.cxx | 2 + .../otbTerraSarImageMetadataInterfaceNew.cxx | 38 +++++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx diff --git a/Code/IO/otbTerraSarImageMetadataInterface.cxx b/Code/IO/otbTerraSarImageMetadataInterface.cxx index b5e3f6c88c..995f06ca47 100644 --- a/Code/IO/otbTerraSarImageMetadataInterface.cxx +++ b/Code/IO/otbTerraSarImageMetadataInterface.cxx @@ -52,6 +52,8 @@ TerraSarImageMetadataInterface::GetSensorID( const MetaDataDictionaryType & dict ossimKeywordlist kwl; ImageKeywordlist.convertToOSSIMKeywordlist(kwl); std::cout<<kwl<<std::endl; + std::cout<<"##########################################################"<<std::endl; + std::string key= "sensor"; ossimString keywordString = kwl.find(key.c_str()); std::string output(keywordString.chars()); diff --git a/Code/IO/otbTerraSarImageMetadataInterface.h b/Code/IO/otbTerraSarImageMetadataInterface.h index fa521aca79..0ca5ec2ae7 100644 --- a/Code/IO/otbTerraSarImageMetadataInterface.h +++ b/Code/IO/otbTerraSarImageMetadataInterface.h @@ -63,6 +63,27 @@ public: /** Set the image used to get the metadata */ itkSetObjectMacro(Image,ImageType); + /** Get the radiometric bias from the ossim metadata */ + VariableLengthVectorType GetPhysicalBias( const MetaDataDictionaryType & ) const + { + VariableLengthVectorType toto; + return toto; + }; + + /** Get the radiometric gain from the ossim metadata */ + VariableLengthVectorType GetPhysicalGain( const MetaDataDictionaryType & ) const + { + VariableLengthVectorType toto; + return toto; + }; + + /** Get the solar irradiance from the ossim metadata */ + VariableLengthVectorType GetSolarIrradiance( const MetaDataDictionaryType & ) const + { + VariableLengthVectorType toto; + return toto; + }; + /** Get the sensor ID from the ossim metadata */ std::string GetSensorID(const MetaDataDictionaryType & dict ) const; diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 7715ca8d09..ea165bcb38 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -1952,6 +1952,10 @@ ADD_TEST(ioTuQuickBirdImageMetadataInterfaceNew ${IO_TESTS17} otbQuickBirdImageMetadataInterfaceNew ) +ADD_TEST(ioTuTerraSarImageMetadataInterfaceNew ${IO_TESTS17} + otbTerraSarImageMetadataInterfaceNew +) + IF(OTB_DATA_USE_LARGEINPUT) ADD_TEST(ioTvImageMetadataInterfaceQBTest ${IO_TESTS17} --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvImageMetadataInterfaceQB.txt @@ -1988,6 +1992,14 @@ ADD_TEST(ioTvImageMetadataInterfaceSPOTTest ${IO_TESTS17} ${LARGEDATA}/SPOT5/TEHERAN/IMAGERY.TIF ${TEMP}/ioTvImageMetadataInterfaceSPOT.txt ) + +ADD_TEST(ioTvImageMetadataInterfaceTerraSarTest ${IO_TESTS17} + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvImageMetadataInterfaceTerraSarTest.txt + ${TEMP}/ioTvImageMetadataInterfaceTerraSarTest.txt + otbImageMetadataInterfaceTest + ${LARGEDATA}/TERRASARX/2007-12-15_Toronto_SSC/TSX1_SAR__SSC______SL_S_SRA_20071215T112105_20071215T112107/IMAGEDATA/IMAGE_HH_SRA_spot_074.cos + ${TEMP}/ioTvImageMetadataInterfaceTerraSarTest.txt +) ENDIF(OTB_DATA_USE_LARGEINPUT) ADD_TEST(ioTvImageMetadataInterfaceTest ${IO_TESTS17} @@ -2318,6 +2330,7 @@ otbPointSetFileReader2.cxx otbSpotImageMetadataInterfaceNew.cxx otbQuickBirdImageMetadataInterfaceNew.cxx otbIkonosImageMetadataInterfaceNew.cxx +otbTerraSarImageMetadataInterfaceNew.cxx otbImageMetadataInterfaceTest.cxx otbImageMetadataInterfaceTest2.cxx ) diff --git a/Testing/Code/IO/otbIOTests17.cxx b/Testing/Code/IO/otbIOTests17.cxx index ce4f010b3d..b9d0f8e03b 100644 --- a/Testing/Code/IO/otbIOTests17.cxx +++ b/Testing/Code/IO/otbIOTests17.cxx @@ -34,6 +34,7 @@ REGISTER_TEST(otbPointSetFileReader2); REGISTER_TEST(otbSpotImageMetadataInterfaceNew); REGISTER_TEST(otbIkonosImageMetadataInterfaceNew); REGISTER_TEST(otbQuickBirdImageMetadataInterfaceNew); +REGISTER_TEST(otbTerraSarImageMetadataInterfaceNew); REGISTER_TEST(otbImageMetadataInterfaceTest); REGISTER_TEST(otbImageMetadataInterfaceTest2); } diff --git a/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx b/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx index 346af06676..7fa5790e5e 100644 --- a/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx +++ b/Testing/Code/IO/otbTerraSarImageMetadataInterface.cxx @@ -43,6 +43,8 @@ int otbTerraSarImageMetadataInterface (int argc, char* argv[]) otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New(); + reader->GetOutput()->GetMetaDataDictionary().Print(std::cout); + std::ofstream file; file.open(outputFilename); file<<"GetSensorID: "<<lImageMetadata->GetSensorID(reader->GetOutput()->GetMetaDataDictionary())<<std::endl; diff --git a/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx b/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx new file mode 100644 index 0000000000..b49f7c25cb --- /dev/null +++ b/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx @@ -0,0 +1,38 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "itkExceptionObject.h" + +#include <fstream> +#include <iostream> +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbTerraSarImageMetadataInterface.h" + +int otbTerraSarImageMetadataInterfaceNew (int argc, char* argv[]) +{ + + otb::TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New(); + + return EXIT_SUCCESS; + +} -- GitLab