Commit e93ad46e authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

Merge branch 'gd-projection' into develop

parents d5da1141 c5c47480
......@@ -2,7 +2,7 @@ otb_module_test()
set(OTBOSSIMAdaptersTests
otbOSSIMAdaptersTestDriver.cxx
otbImageKeywordlist.cxx
otbTestImageKeywordlist.cxx
otbOssimJpegFileRessourceLeakTest.cxx
otbMapProjectionAdapterTest.cxx
otbOssimElevManagerTest2.cxx
......@@ -19,226 +19,106 @@ otb_module_target_label(otbOSSIMAdaptersTestDriver)
# Tests Declaration
otb_add_test(NAME ioTvImageKeywordlistSPOT5 COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistSpot5.txt
${TEMP}/ioTvImageKeywordlistSpot5.txt
${BASELINE_FILES}/ioTvImageKeywordlistSpot5.txt
${TEMP}/ioTvImageKeywordlistSpot5_saveState_loadState.txt
--ignore-lines-with 3 support_data.metadata_file meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF}
${TEMP}/ioTvImageKeywordlistSpot5.txt
${TEMP}/ioTvImageKeywordlistSpot5_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistTerraSarX_Upsala COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX_Upsala.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Upsala.txt
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX_Upsala.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Upsala_saveState_loadState.txt
--ignore-lines-with 1 product_xml_filename
otbImageKeywordlist
LARGEINPUT{TERRASARX/UPSALA_GLACIER/TSX1_SAR__MGD/TSX1_SAR__MGD.xml}
${TEMP}/ioTvImageKeywordlistTerraSarX_Upsala.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Upsala_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistRadarSat1_SARDEGNA_vdf COMMAND otbOSSIMAdaptersTestDriver
--compare-n-ascii ${EPSILON_6} 2
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_vdf.txt
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_vdf_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{RADARSAT1/SARDEGNA/scene01/dat_01.001}
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_vdf.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_vdf_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistRadarSat1_SARDEGNA COMMAND otbOSSIMAdaptersTestDriver
--compare-n-ascii ${EPSILON_6} 2
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{RADARSAT1/SARDEGNA/scene01/dat_01.001}
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_SARDEGNA_saveState_loadState.txt
)
otb_add_test(NAME ioTuImageKeywordlistTerraSarX_PANGKALANBUUNUsingXmlFile COMMAND otbOSSIMAdaptersTestDriver
otbImageKeywordlist
LARGEINPUT{TERRASARX/PANGKALANBUUN/TSX1_SAR__SSC______SM_D_SRA_20080313T221955_20080313T222003.xml}
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistTerraSarX_Toronto COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX_Toronto.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Toronto.txt
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX_Toronto.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Toronto_saveState_loadState.txt
--ignore-lines-with 1 product_xml_filename
otbImageKeywordlist
LARGEINPUT{TERRASARX/TORONTO/TSX1_SAR__SSC/TSX1_SAR__SSC.xml}
${TEMP}/ioTvImageKeywordlistTerraSarX_Toronto.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Toronto_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistErs COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistErs.txt
${TEMP}/ioTvImageKeywordlistErs.txt
${BASELINE_FILES}/ioTvImageKeywordlistErs.txt
${TEMP}/ioTvImageKeywordlistErs_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{SAR_ERS2_SLCI_SCENE1/DAT_01.001}
${TEMP}/ioTvImageKeywordlistErs.txt
${TEMP}/ioTvImageKeywordlistErs_saveState_loadState.txt
)
otb_add_test(NAME ioTuImageKeywordlistTerraSarX_PANGKALANBUUNUsingHHFile COMMAND otbOSSIMAdaptersTestDriver
otbImageKeywordlist
LARGEINPUT{TERRASARX/PANGKALANBUUN/IMAGEDATA/IMAGE_HH_SRA_stripFar_008.cos}
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistTerraSarX COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX.txt
${TEMP}/ioTvImageKeywordlistTerraSarX.txt
${BASELINE_FILES}/ioTvImageKeywordlistTerraSarX.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_saveState_loadState.txt
--ignore-lines-with 1 product_xml_filename
otbImageKeywordlist
LARGEINPUT{TERRASARX/dims/TSX-1.SAR.L1B/TSX1_SAR__SSC/TSX1_SAR__SSC.xml}
${TEMP}/ioTvImageKeywordlistTerraSarX.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistRadarSat1_GOMA_vdf COMMAND otbOSSIMAdaptersTestDriver
--compare-n-ascii ${EPSILON_6} 2
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_vdf.txt
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_vdf_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{RADARSAT1/GOMA/SCENE01/VDF_DAT.001}
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_vdf.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_vdf_saveState_loadState.txt
)
otb_add_test(NAME ioTvImageKeywordlistRadarSat2 COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat2.txt
${TEMP}/ioTvImageKeywordlistRadarSat2.txt
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat2.txt
${TEMP}/ioTvImageKeywordlistRadarSat2_saveState_loadState.txt
--ignore-lines-with 1 product_xml_filename
otbImageKeywordlist
LARGEINPUT{RADARSAT2/ALTONA/Fine_Quad-Pol_Dataset/PK6621_DK406_FQ9_20080405_124900_HH_VV_HV_VH_SLC_Altona/product.xml}
${TEMP}/ioTvImageKeywordlistRadarSat2.txt
${TEMP}/ioTvImageKeywordlistRadarSat2_saveState_loadState.txt
)
#KEYWORDLIST : OPTICAL SENSORS
set(NAME_TESTS
"pleiades-1"
"ikonos-1"
"rapideye-1"
"quickbird-1"
"spot6-1"
"worldview2-1"
"spot5-1"
"geoeye1-1"
)
otb_add_test(NAME ioTvImageKeywordlistRapidEye COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistRapidEye.txt
${TEMP}/ioTvImageKeywordlistRapidEye.txt
${BASELINE_FILES}/ioTvImageKeywordlistRapidEye.txt
${TEMP}/ioTvImageKeywordlistRapidEye_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf}
${TEMP}/ioTvImageKeywordlistRapidEye.txt
${TEMP}/ioTvImageKeywordlistRapidEye_saveState_loadState.txt
)
set(IMG
LARGEINPUT{PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R1C1.JP2}
LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif}
LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf}
LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
LARGEINPUT{SPOT6/600143101-Primary-Bundle-JP2-LOSSLESS/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/IMG_SPOT6_MS_201212071020271_SEN_600143101_R1C1.JP2}
LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF}
LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF}
LARGEINPUT{GEOEYE/MARCILLOLES/po_350134_bgrn_0000001.tif}
)
otb_add_test(NAME ioTuImageKeywordlistTerraSarX_PANGKALANBUUNUsingVVFile COMMAND otbOSSIMAdaptersTestDriver
otbImageKeywordlist
LARGEINPUT{TERRASARX/PANGKALANBUUN/IMAGEDATA/IMAGE_VV_SRA_stripFar_008.cos}
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun.txt
${TEMP}/ioTvImageKeywordlistTerraSarX_Pangkalanbuun_saveState_loadState.txt
)
set(NEEDEDKW
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #PLEIADES
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #IKONOS
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #RAPIDEYE
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #QB
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #SPOT6
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #WORLDVIEW2
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #SPOT5
"line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff support_data.physical_gain support_data.physical_bias support_data.solar_irradiance support_data.image_date support_data.elevation_angle" #geoeye1
)
otb_add_test(NAME ioTvImageKeywordlistFORMOSAT2 COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistFORMOSAT2.txt
${TEMP}/ioTvImageKeywordlistFORMOSAT2.txt
${BASELINE_FILES}/ioTvImageKeywordlistFORMOSAT2.txt
${TEMP}/ioTvImageKeywordlistFORMOSAT2_saveState_loadState.txt
--ignore-lines-with 3 support_data.metadata_file meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF}
${TEMP}/ioTvImageKeywordlistFORMOSAT2.txt
${TEMP}/ioTvImageKeywordlistFORMOSAT2_saveState_loadState.txt
)
set(TOLS
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #PLEIADES
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #IKONOS
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #RAPIDEYE
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #QB
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #SPOT6
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #WORLDVIEW2
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #SPOT5
"1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6" #geoeye1
)
otb_add_test(NAME ioTvImageKeywordlistAlosPalsar COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistAlosPalsar.txt
${TEMP}/ioTvImageKeywordlistAlosPalsar.txt
${BASELINE_FILES}/ioTvImageKeywordlistAlosPalsar.txt
${TEMP}/ioTvImageKeywordlistAlosPalsar_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{PALSAR/200801280007/l1data/VOL-ALPSRP037120700-H1.1__A}
${TEMP}/ioTvImageKeywordlistAlosPalsar.txt
${TEMP}/ioTvImageKeywordlistAlosPalsar_saveState_loadState.txt
)
set(TESTNB 0 )
foreach( file ${NAME_TESTS} )
list(GET IMG ${TESTNB} current_img )
list(GET NEEDEDKW ${TESTNB} current_neededkw )
list(GET TOLS ${TESTNB} current_tols )
list(GET NAME_TESTS ${TESTNB} current_name )
math(EXPR TESTNB "${TESTNB} + 1")
otb_add_test(NAME ioTvTestImageKeywordlist_${current_name} COMMAND otbOSSIMAdaptersTestDriver
otbTestImageKeywordlist
${current_img}
${current_neededkw}
${current_tols}
${current_name}.geom
0 # 1 : Check all keywords (ignore argv[2] and argv[3]) / 0 : Only check the needed keywords
)
endforeach()
#KEYWORDLIST : RADAR SENSORS
set(NAME_TESTS
"radarsat2-1"
"terrasarx-1"
"sentinel1-1"
"envisat-asar-1"
"radarsat1-1"
"ers2-1"
)
otb_add_test(NAME ioTvImageKeywordlistEnvisatAsar COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistEnvisatAsar.txt
${TEMP}/ioTvImageKeywordlistEnvisatAsar.txt
${BASELINE_FILES}/ioTvImageKeywordlistEnvisatAsar.txt
${TEMP}/ioTvImageKeywordlistEnvisatAsar_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{ENVISAT_ASAR_SCENE01/ASA_APS_1PNDPA20030821_7713.N1}
${TEMP}/ioTvImageKeywordlistEnvisatAsar.txt
${TEMP}/ioTvImageKeywordlistEnvisatAsar_saveState_loadState.txt
)
set(IMG
LARGEINPUT{RADARSAT2/ALTONA/Fine_Quad-Pol_Dataset/PK6621_DK406_FQ9_20080405_124900_HH_VV_HV_VH_SLC_Altona/imagery_VH.tif}
LARGEINPUT{TERRASARX/2008-03-21_GrandCanyon_SSC/TSX1_SAR__SSC______SM_S_SRA_20080321T133220_20080321T133228/IMAGEDATA/IMAGE_HH_SRA_strip_011.cos}
LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff}
LARGEINPUT{ENVISAT_ASAR_SCENE01/ASA_APS_1PNDPA20030821_7713.N1}
LARGEINPUT{RADARSAT1/SARDEGNA/scene01/dat_01.001}
LARGEINPUT{SAR_ERS2_SLCI_SCENE1/DAT_01.001}
)
otb_add_test(NAME ioTvImageKeywordlistRadarSat1_GOMA COMMAND otbOSSIMAdaptersTestDriver
--compare-n-ascii ${EPSILON_6} 2
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${BASELINE_FILES}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_saveState_loadState.txt
otbImageKeywordlist
LARGEINPUT{RADARSAT1/GOMA/SCENE01/DAT_01.001}
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA.txt
${TEMP}/ioTvImageKeywordlistRadarSat1_GOMA_saveState_loadState.txt
)
set(TESTNB 0 )
foreach( file ${NAME_TESTS} )
list(GET IMG ${TESTNB} current_img )
list(GET NAME_TESTS ${TESTNB} current_name )
math(EXPR TESTNB "${TESTNB} + 1")
otb_add_test(NAME ioTvImageKeywordlistIkonos COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistIkonos.txt
${TEMP}/ioTvImageKeywordlistIkonos.txt
${BASELINE_FILES}/ioTvImageKeywordlistIkonos.txt
${TEMP}/ioTvImageKeywordlistIkonos_saveState_loadState.txt
--ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_pan_0000000.tif}
${TEMP}/ioTvImageKeywordlistIkonos.txt
${TEMP}/ioTvImageKeywordlistIkonos_saveState_loadState.txt
)
otb_add_test(NAME ioTvTestImageKeywordlist_${current_name} COMMAND otbOSSIMAdaptersTestDriver
otbTestImageKeywordlist
${current_img}
"Foo"
"Foo"
${current_name}.geom
1 # 1 : Check all keywords (ignore argv[2] and argv[3]) / 0 : Only check the needed keywords
)
endforeach()
otb_add_test(NAME ioTvImageKeywordlistQuickbird COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlistQuickbird.txt
${TEMP}/ioTvImageKeywordlistQuickbird.txt
${BASELINE_FILES}/ioTvImageKeywordlistQuickbird.txt
${TEMP}/ioTvImageKeywordlistQuickbird_saveState_loadState.txt
--ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
${TEMP}/ioTvImageKeywordlistQuickbird.txt
${TEMP}/ioTvImageKeywordlistQuickbird_saveState_loadState.txt
)
otb_add_test(NAME ioTvOssimJpegFileRessourceLeak COMMAND otbOSSIMAdaptersTestDriver
otbOssimJpegFileRessourceLeakTest
......@@ -598,53 +478,3 @@ otb_add_test(NAME uaTvRPCSolverAdapterValidationTest COMMAND otbOSSIMAdaptersTes
${INPUTDATA}/DEM/egm96.grd
)
if(OTB_DATA_USE_LARGEINPUT)
set( GenericTestPHR_TESTNB 0)
foreach( current_file ${GenericTestPHR_DATA_INPUTS} )
list(GET GenericTestPHR_DATA_TYPES ${GenericTestPHR_TESTNB} current_type )
math(EXPR GenericTestPHR_TESTNB "${GenericTestPHR_TESTNB} + 1")
# Get and manipulate ImageKeywordlist
otb_add_test(NAME ioTvImageKeywordlist_${current_type} COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt
${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt
--ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
${current_file}
${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt
)
endforeach()
set( GenericTestSPOT6_TESTNB 0)
foreach( current_file ${GenericTestSPOT6_DATA_INPUTS} )
list(GET GenericTestSPOT6_DATA_TYPES ${GenericTestSPOT6_TESTNB} current_type )
math(EXPR GenericTestSPOT6_TESTNB "${GenericTestSPOT6_TESTNB} + 1")
# Get and manipulate ImageKeywordlist
otb_add_test(NAME ioTvImageKeywordlist_${current_type} COMMAND otbOSSIMAdaptersTestDriver
--ignore-order --compare-n-ascii ${NOTOL} 2
${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt
${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt
--ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y
otbImageKeywordlist
${current_file}
${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt
${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt
)
endforeach()
endif()
/*=========================================================================
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.
=========================================================================*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include "otbMacro.h"
#include "otbImageKeywordlist.h"
#include "ossim/base/ossimKeywordlist.h"
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "ossim/projection/ossimProjection.h"
#include "ossim/projection/ossimProjectionFactoryRegistry.h"
#include "ossim/base/ossimFilename.h"
#pragma GCC diagnostic pop
#else
#include "ossim/projection/ossimProjection.h"
#include "ossim/projection/ossimProjectionFactoryRegistry.h"
#include "ossim/base/ossimFilename.h"
#endif
#include "ossim/ossimPluginProjectionFactory.h"
int otbImageKeywordlist(int argc, char* argv[])
{
if (argc != 4)
{
std::cout << argv[0] << " <input filename> <output filename> <output filename2>" << std::endl;
return EXIT_FAILURE;
}
char * filename = argv[1];
char * outFilename = argv[2];
char * outFilename2 = argv[3];
std::ofstream file;
file.open(outFilename);
file << std::setprecision(15);
std::ofstream file2;
file2.open(outFilename2);
file2 << std::setprecision(15);
bool hasMetaData = false;
ossimKeywordlist geom_kwl, geom_kwl2, geom_kwl3;
/** Don't use FactoryRegistry because of its default factory that can conflict
* with plugins factor (cf. TSX .tif image read as QB)*/
// test ossim plugin factory
ossimProjection * projection = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(
ossimFilename(filename), 0);
// if ossim plugins factory failed, then test ossim factory
if (!projection)
{
projection = ossimProjectionFactoryRegistry::instance()->createProjection(ossimFilename(filename), 0);
if (!projection)
{
itkGenericExceptionMacro(<< "OSSIM Instanciate projection FAILED ! ");
return EXIT_FAILURE;
}
}
hasMetaData = projection->saveState(geom_kwl);
if (!hasMetaData)
{
std::cerr << "ERROR: projection saveState return with a false flag !" << std::endl;
return EXIT_FAILURE;
}
otb::ImageKeywordlist otb_kwl;
otb_kwl.SetKeywordlist(geom_kwl);
otb_kwl.convertToOSSIMKeywordlist(geom_kwl2);
hasMetaData = projection->loadState(geom_kwl2);
if (!hasMetaData)
{
std::cerr << "ERROR: projection loadState return with a false flag !" << std::endl;
return EXIT_FAILURE;
}
hasMetaData = projection->saveState(geom_kwl3);
if (!hasMetaData)
{
std::cerr << "ERROR: projection saveState return with a false flag !" << std::endl;
return EXIT_FAILURE;
}
otb::ImageKeywordlist otb_kwl2;
otb_kwl2.SetKeywordlist(geom_kwl3);
file << "*** KEYWORD LIST ***\n";
file << otb_kwl;
file2 << "*** KEYWORD LIST ***\n";
file2 << otb_kwl2;
/** Search keyword in meter_per_pixel to truncate precision */
ossimString s;
double valueX, valueY;
otb_kwl.convertToOSSIMKeywordlist(geom_kwl2);
file << std::fixed << std::setprecision(5);
file2 << std::fixed << std::setprecision(5);
s = geom_kwl2.find("meters_per_pixel_x");
if (s != "")
{
valueX = s.toDouble();
file << "truncate_meter_per_pixel_x " << valueX << std::endl;
}
s = geom_kwl2.find("meters_per_pixel_y");
if (s != "")
{
valueY = s.toDouble();
file << "truncate_meter_per_pixel_y " << valueY << std::endl;
}
otb_kwl2.convertToOSSIMKeywordlist(geom_kwl3);
s = geom_kwl3.find("meters_per_pixel_x");
if (s != "")
{
valueX = s.toDouble();
file2 << "truncate_meter_per_pixel_x " << valueX << std::endl;
}
s = geom_kwl3.find("meters_per_pixel_y");
if (s != "")
{
valueY = s.toDouble();
file2 << "truncate_meter_per_pixel_y " << valueY << std::endl;
}
file.close();
file2.close();
return EXIT_SUCCESS;
}
#include "otbTestMain.h"
void RegisterTests()
{
REGISTER_TEST(otbImageKeywordlist);
REGISTER_TEST(otbTestImageKeywordlist);
REGISTER_TEST(otbOssimJpegFileRessourceLeakTest);
REGISTER_TEST(otbMapProjectionAdapterTest);
REGISTER_TEST(otbOssimElevManagerTest2);
......
/*=========================================================================
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.
=========================================================================*/
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include <otbImageKeywordlist.h>
#include <iostream>
#include <sstream>
#include <iterator>
double convertStringToDouble(const std::string& s)
{
std::istringstream i(s);
double x;
if (!(i >> x))
return 0;
return x;
}
int otbTestImageKeywordlist(int argc, char* argv[])
{
if (argc != 6)
{
std::cout << argv[0]
<< " <input img filename> <input needed keyword list> <input list of tols for each needed kw> "
<<" <output kw list filename> <bool test all kw>" << std::endl;
return EXIT_FAILURE;
}
const unsigned int Dimension = 2;
typedef double InputPixelType;
typedef otb::VectorImage<InputPixelType, Dimension> InputImageType;
typedef otb::ImageFileReader<InputImageType> ReaderType;