diff --git a/.travis.yml b/.travis.yml index 3df9c1ffd778520cc151e4867abeb71809bf9781..57e2a46096cd5394605d34555e99f75278249c4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,15 @@ dist: trusty compiler: - clang +addons: + apt: + packages: + - libboost-all-dev + cache: ccache branches: only: - nightly - + script: Utilities/Maintenance/TravisBuild.sh diff --git a/CMake/FindGBenchmark.cmake b/CMake/FindGBenchmark.cmake new file mode 100644 index 0000000000000000000000000000000000000000..55cef2de0a413e56ea107bc8ab52751686eb848b --- /dev/null +++ b/CMake/FindGBenchmark.cmake @@ -0,0 +1,29 @@ +# Find the Google Benchmark library +# Defines: +# GBENCHMARK_INCLUDE_DIR - gbenchmark include directory +# GBENCHMARK_LIBRARY - gbenchmark library file +# GBENCHMARK_FOUND - TRUE if gbenchmark is found + +if (GBENCHMARK_INCLUDE_DIR) + #check cache + set(GBENCHMARK_FIND_QUIETLY TRUE) +endif () + +if (NOT GBENCHMARK_INCLUDE_DIR) + find_path(GBENCHMARK_INCLUDE_DIR NAMES benchmark.h PATH_SUFFIXES benchmark) + set(GBENCHMARK_INCLUDE_DIR ${GBENCHMARK_INCLUDE_DIR}/benchmark CACHE PATH "Google.benchmark include direcory") +endif () + +mark_as_advanced(GBENCHMARK_INCLUDE_DIR) + +find_library(GBENCHMARK_LIBRARY NAMES benchmark) +mark_as_advanced(GBENCHMARK_LIBRARY) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GBENCHMARK + REQUIRED_VARS GBENCHMARK_LIBRARY GBENCHMARK_INCLUDE_DIR + ) +#VERSION_VAR GBENCHMARK_VERSION_STRING + +set(GBENCHMARK_LIBRARIES ${GBENCHMARK_LIBRARY}) +set(GBENCHMARK_INCLUDE_DIRS ${GBENCHMARK_INCLUDE_DIR}) diff --git a/CMake/FindGLEW.cmake b/CMake/FindGLEW.cmake index acd7c2b8e848df4cf9b772331a192445d36efde0..8de4220c0495feb032563df75142777c70c716e3 100644 --- a/CMake/FindGLEW.cmake +++ b/CMake/FindGLEW.cmake @@ -9,7 +9,7 @@ # IF (WIN32) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h $ENV{PROGRAMFILES}/GLEW/include ${GLEW_ROOT_DIR}/include DOC "The directory where GL/glew.h resides") @@ -23,7 +23,7 @@ IF (WIN32) ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib DOC "The GLEW library") ELSE (WIN32) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h /usr/include /usr/local/include /sw/include @@ -46,10 +46,12 @@ ELSE (WIN32) ENDIF (WIN32) SET(GLEW_FOUND "NO") -IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) +IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) SET(GLEW_LIBRARIES ${GLEW_LIBRARY}) SET(GLEW_FOUND "YES") -ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) +ENDIF () INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW + REQUIRED_VARS GLEW_LIBRARY GLEW_INCLUDE_DIR + VERSION_VAR GLEW_VERSION_STRING) diff --git a/CMake/OTBModuleExternal.cmake b/CMake/OTBModuleExternal.cmake index 9e70c3fffc67d4c15b5b966d6ec28236f71ca167..e4be6d5463259844cd204ca596ada696245f6b93 100644 --- a/CMake/OTBModuleExternal.cmake +++ b/CMake/OTBModuleExternal.cmake @@ -48,11 +48,11 @@ if(NOT OTB_INSTALL_PACKAGE_DIR) endif() # Use OTB's flags. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_REQUIRED_CXX_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") +set(CMAKE_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") +set(CMAKE_MODULE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}") option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ${OTB_BUILD_SHARED}) # Add the OTB_MODULES_DIR to the CMAKE_MODULE_PATH and then use the binary diff --git a/CMake/OTBModuleHeaderTest.cmake b/CMake/OTBModuleHeaderTest.cmake index d122d0912c4f42541cf1ccac7467707809a0fc3a..c381f0d7bfa6347878d2465f1cabc5ef54366865 100644 --- a/CMake/OTBModuleHeaderTest.cmake +++ b/CMake/OTBModuleHeaderTest.cmake @@ -99,7 +99,7 @@ macro( otb_module_headertest _name ) get_filename_component( _test_name ${_header_test_src} NAME_WE ) add_custom_command( OUTPUT ${_header_test_src} - COMMAND ${PYTHON_EXECUTABLE} ${OTB_SOURCE_DIR}/Utilities/Maintenance/BuildHeaderTest.py + COMMAND ${PYTHON_EXECUTABLE} ${OTB_CMAKE_DIR}/../Utilities/Maintenance/BuildHeaderTest.py ${_name} ${${_name}_SOURCE_DIR} ${${_name}_BINARY_DIR} diff --git a/CMake/OTBModuleTest.cmake b/CMake/OTBModuleTest.cmake index 0adb42dd9d2ba8c1279e2e651ab46bcba6fb9e2f..0b1acf7c3f5d7084231b89f0d83ef2080c5c626d 100644 --- a/CMake/OTBModuleTest.cmake +++ b/CMake/OTBModuleTest.cmake @@ -198,3 +198,23 @@ endfunction() function(otb_memcheck_ignore) set_property(GLOBAL APPEND PROPERTY CTEST_CUSTOM_MEMCHECK_IGNORE ${ARGN}) endfunction() + +#----------------------------------------------------------------------------- +# Function otb_add_test_mpi to run mpi tests +function(otb_add_test_mpi) + set( _OPTIONS_ARGS ) + set( _ONE_VALUE_ARGS NAME NBPROCS COMMAND) + set( _MULTI_VALUE_ARGS ) + cmake_parse_arguments( TEST_MPI "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) + + # Test nb procs + if( NOT TEST_MPI_NBPROCS ) + set(TEST_MPI_NBPROCS 2) + endif() + # Test command line + foreach(arg IN LISTS TEST_MPI_UNPARSED_ARGUMENTS) + list(APPEND ARGS ${arg}) + endforeach() + set (test_parameters -np ${TEST_MPI_NBPROCS} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TEST_MPI_COMMAND} ${ARGS}) + otb_add_test(NAME ${TEST_MPI_NAME} COMMAND ${MPIEXEC} ${test_parameters}) +endfunction() diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake index c44cb79482ee4c602d2dce33d9a62250eda26a9b..67ca7f4884d0e03d30b4cc0e4bab7c210f5d9102 100644 --- a/CMake/OTBSetStandardCompilerFlags.cmake +++ b/CMake/OTBSetStandardCompilerFlags.cmake @@ -307,8 +307,8 @@ check_compiler_warning_flags(C_WARNING_FLAGS CXX_WARNING_FLAGS) # Append OTB warnings to the CMake flags. # We do not set them in OTB_REQUIRED FLAGS because all project which # use OTB don't require these flags . -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_WARNING_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_FLAGS}") +set(CMAKE_C_FLAGS "${C_WARNING_FLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${CXX_WARNING_FLAGS} ${CMAKE_CXX_FLAGS}") #----------------------------------------------------------------------------- #Check the set of platform flags the compiler supports diff --git a/CMake/SourceStatus.cmake b/CMake/SourceStatus.cmake index 46a951a1f9a6f7d1d102c345c7bf0d51dada9cc2..3e176df83b8a9b0b0400e4fa5373b0cdba4dbcb6 100644 --- a/CMake/SourceStatus.cmake +++ b/CMake/SourceStatus.cmake @@ -1,71 +1,65 @@ -if(EXISTS "${PROJECT_SOURCE_DIR}/.hg") -find_package(Mercurial) -if(Mercurial_FOUND) - message(STATUS "Repository status :") - Mercurial_WC_IDENTIFY(${PROJECT_SOURCE_DIR} OTB) - message(STATUS " Mercurial version is ${Mercurial_VERSION_HG}") - message(STATUS " Repository revision is ${OTB_WC_REVISION}") - set(OTB_WC_REVISION ${OTB_WC_REVISION} CACHE STRING "Repository version" FORCE) - mark_as_advanced(OTB_WC_REVISION) - if(OTB_WC_STATUS) - message(STATUS " Local file modifications:") - string(REPLACE "\n" "\n-- " OTB_WC_STATUS_PRETTYPRINT " ${OTB_WC_STATUS}") - message(STATUS "${OTB_WC_STATUS_PRETTYPRINT}") - else() - message(STATUS " No files modified locally") +function(repository_status root_repo_dir result_var1) + if(NOT EXISTS "${root_repo_dir}/.git") + return() endif() - string(REGEX REPLACE "\n" ";" OTB_WC_STATUS "${OTB_WC_STATUS}") - set(OTB_WC_STATUS ${OTB_WC_STATUS} CACHE STRING "Repository status" FORCE) - mark_as_advanced(OTB_WC_STATUS) -endif() -endif() -if(EXISTS "${PROJECT_SOURCE_DIR}/.git") find_package(Git) - if(GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE OTB_WC_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) - execute_process(COMMAND ${GIT_EXECUTABLE} status -s - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE OTB_WC_STATUS - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) - message(STATUS "Repository status :") - message(STATUS " Repository revision is ${OTB_WC_REVISION}") - if(OTB_WC_STATUS) - message(STATUS " Local file modifications:") - string(REPLACE "\n" "\n-- " OTB_WC_STATUS_PRETTYPRINT " ${OTB_WC_STATUS}") - message(STATUS "${OTB_WC_STATUS_PRETTYPRINT}") - else() - message(STATUS " No files modified locally") - endif() + if(NOT GIT_FOUND) + message(STATUS "git not found. Make sure git can be found in your PATH. (source status will not be reported)") + set(${result_var1}) + return() endif() -endif() -if(OTB_DATA_ROOT) - if(EXISTS "${OTB_DATA_ROOT}/.hg") - if(NOT Mercurial_FOUND) - find_package(Mercurial) - endif() - if(Mercurial_FOUND) - Mercurial_WC_IDENTIFY(${OTB_DATA_ROOT} OTB_DATA) - set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE) - mark_as_advanced(OTB_DATA_WC_REVISION) - endif() + execute_process(COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url + WORKING_DIRECTORY ${root_repo_dir} + OUTPUT_VARIABLE git_remote_origin_url + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + if(git_remote_origin_url) + get_filename_component(dir_name ${git_remote_origin_url} NAME) + else() + get_filename_component(dir_name ${root_repo_dir} NAME) + endif() + + execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H --oneline + WORKING_DIRECTORY ${root_repo_dir} + OUTPUT_VARIABLE last_commit_id + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + #git symbolic-ref --short -q HEAD does not work on older git version + #rather than checking for git version. it is better to not use that + #option and employ cmake stuff to do the work + execute_process(COMMAND ${GIT_EXECUTABLE} symbolic-ref -q HEAD + WORKING_DIRECTORY ${root_repo_dir} + OUTPUT_VARIABLE git_symbolic_ref_output + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + set(branch_name) + if(git_symbolic_ref_output) + get_filename_component(branch_name ${git_symbolic_ref_output} NAME) endif() - - if(EXISTS "${OTB_DATA_ROOT}/.git") - if(NOT GIT_FOUND) - find_package(Git) - endif() - if(GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H - WORKING_DIRECTORY ${OTB_DATA_ROOT} - OUTPUT_VARIABLE OTB_DATA_WC_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) - set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE) - mark_as_advanced(OTB_DATA_WC_REVISION) - endif() + + set(return_msg "${dir_name} repository info: \n") + set(return_msg "${return_msg} git log -1 --oneline = [${last_commit_id}] \n") + set(return_msg "${return_msg} git symbolic-ref -q HEAD = ${branch_name}") + set(${result_var1} ${return_msg} PARENT_SCOPE) + + #print other information inside function call + execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H + WORKING_DIRECTORY ${root_repo_dir} + OUTPUT_VARIABLE OTB_WC_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + execute_process(COMMAND ${GIT_EXECUTABLE} status -s + WORKING_DIRECTORY ${root_repo_dir} + OUTPUT_VARIABLE OTB_WC_STATUS + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + message(STATUS "Repository status (${dir_name}) :") + message(STATUS " Repository revision is ${OTB_WC_REVISION}") + if(OTB_WC_STATUS) + message(STATUS " Local file modifications (${dir_name}) :") + string(REPLACE "\n" "\n-- " OTB_WC_STATUS_PRETTYPRINT " ${OTB_WC_STATUS}") + message(STATUS "${OTB_WC_STATUS_PRETTYPRINT}") + else() + message(STATUS " No files modified locally (${dir_name})") endif() -endif() + +endfunction() diff --git a/CMake/UseOTB.cmake b/CMake/UseOTB.cmake index ed0da34b1a13b6949ca910bc51c6993c952c1e39..5a891e450f5c925715a561f14df2a1e29cf5bef4 100644 --- a/CMake/UseOTB.cmake +++ b/CMake/UseOTB.cmake @@ -4,12 +4,11 @@ # obtained from OTBConfig.cmake. # Add compiler flags needed to use OTB. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_REQUIRED_CXX_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") - +set(CMAKE_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") +set(CMAKE_MODULE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}") # Add include directories needed to use OTB. include_directories(${OTB_INCLUDE_DIRS}) diff --git a/CMake/cmake_uninstall.cmake.in b/CMake/cmake_uninstall.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..fed0791c2f768fa4cad229ac626e991f2488ec83 --- /dev/null +++ b/CMake/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") + return() +endif() + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + execute_process(COMMAND + "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE out_var + RESULT_VARIABLE res_var + ) + if(NOT "${res_var}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif() + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach(file) diff --git a/CMake/otbTestNullPtr.cpp b/CMake/otbTestNullPtr.cpp index c46836eff42b14fef79db615217ef2c4cb9d265e..8abf4a6cae5a8d0a61d726a2e3fc91c08c2e5a42 100644 --- a/CMake/otbTestNullPtr.cpp +++ b/CMake/otbTestNullPtr.cpp @@ -1,6 +1,6 @@ int main(int argc, char *argv[]) { - int *p = nullptr; + int *p = ITK_NULLPTR; return 0; } diff --git a/CMakeLists.txt b/CMakeLists.txt index aeb3e6ed2e0443ac0fc49fbd183673c3c8d25aa8..4b3f52b1dfad6c7b38078a6fe657b8b65963185e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,4 @@ -if(WIN32) - cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) -else() - cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) -endif() +cmake_minimum_required(VERSION 2.8.11) foreach(p CMP0025 # CMake 3.0 @@ -68,15 +64,31 @@ include(OTBModuleMacros) include(OTBModuleRemote) include(OTBModuleTest) +repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE) + +#----------------------------------------------------------------------------- +# Configure the default OTB_DATA_ROOT for the location of OTB Data. +find_path(OTB_DATA_ROOT + NAMES README-OTB-Data + HINTS $ENV{OTB_DATA_ROOT} ${OTB_SOURCE_DIR}/../OTB-Data +) +mark_as_advanced(OTB_DATA_ROOT) + +if(OTB_DATA_ROOT) + repository_status(${OTB_DATA_ROOT} OTB_DATA_GIT_STATUS_MESSAGE) +endif() + set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL}) #----------------------------------------------------------------------------- # OTB version number. set(OTB_VERSION_MAJOR "5") -set(OTB_VERSION_MINOR "5") +set(OTB_VERSION_MINOR "7") set(OTB_VERSION_PATCH "0") set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") +string(TIMESTAMP OTB_BUILD_TIMESTAMP) + if(NOT OTB_INSTALL_RUNTIME_DIR) set(OTB_INSTALL_RUNTIME_DIR bin) endif() @@ -165,11 +177,11 @@ include(OTBSetStandardCompilerFlags) # TODO check if we need this #include(otbTestFriendTemplatedFunction) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_REQUIRED_CXX_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") +set(CMAKE_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") +set(CMAKE_MODULE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}") # detect some C++11 keywords include(OTBCheckCpp11Keywords) @@ -204,14 +216,6 @@ option(BUILD_EXAMPLES "Build the Examples directory." OFF) #---------------------------------------------------------------------------- set(OTB_TEST_OUTPUT_DIR "${OTB_BINARY_DIR}/Testing/Temporary") -#----------------------------------------------------------------------------- -# Configure the default OTB_DATA_ROOT for the location of OTB Data. -find_path(OTB_DATA_ROOT - NAMES README-OTB-Data - HINTS $ENV{OTB_DATA_ROOT} ${OTB_SOURCE_DIR}/../OTB-Data -) -mark_as_advanced(OTB_DATA_ROOT) - option(OTB_DATA_USE_LARGEINPUT "Use Large inputs images test." OFF) mark_as_advanced(OTB_DATA_USE_LARGEINPUT) if(OTB_DATA_USE_LARGEINPUT) @@ -331,6 +335,10 @@ install(FILES ${OTB_FIND_PACKAGE_SCRIPTS} DESTINATION ${OTB_INSTALL_PACKAGE_DIR} # install(FILES "LICENSE" "NOTICE" "README.txt" DESTINATION ${OTB_INSTALL_DOC_DIR} COMPONENT Runtime) install(FILES "LICENSE" DESTINATION ${OTB_INSTALL_DOC_DIR} COMPONENT Runtime) +# Configure and install VERSION file +configure_file(VERSION VERSION @ONLY) +install(FILES ${OTB_BINARY_DIR}/VERSION DESTINATION ${OTB_INSTALL_DOC_DIR} COMPONENT Runtime) + if(BUILD_TESTING) add_subdirectory(Utilities/InstallTest) endif() @@ -347,6 +355,8 @@ endif() # Provide an option for generating documentation. add_subdirectory(Utilities/Doxygen) +add_subdirectory(Utilities/Completion) + #---------------------------------------------------------------------- # Provide a target to generate the SuperBuild archive (only for Unix) if(UNIX) @@ -362,69 +372,151 @@ endif() # Create target to download data from the OTBData group. This must come after # all tests have been added that reference the group, so we put it last. +# uninstall target +configure_file( + "${CMAKE_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in" + "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + +add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake) + +#macro to put a fixed space between key, value in summary +macro(get_white_spaces var res) + string(LENGTH "${var}" len) + math(EXPR required_spaces "23 - ${len}") + set(${res}) + foreach(loop_var RANGE ${required_spaces}) + set(${res} "${${res}} ") + endforeach() +endmacro() + +message("\n======================= Begin of OTB cmake summary =======================\n") + +if(OTB_GIT_STATUS_MESSAGE) + message( ${OTB_GIT_STATUS_MESSAGE}) +endif() +if(OTB_DATA_GIT_STATUS_MESSAGE) + message( ${OTB_DATA_GIT_STATUS_MESSAGE}) +endif() + +set(option_list ${OTB_MODULE_ACTIVATION_OPTION_LIST}) +list(SORT option_list) + +foreach(otb_option + CMAKE_SOURCE_DIR + CMAKE_BINARY_DIR + CMAKE_INSTALL_PREFIX + CMAKE_COMMAND + CMAKE_C_COMPILER + CMAKE_CXX_COMPILER + CMAKE_MAKE_PROGRAM + CMAKE_GENERATOR + CMAKE_BUILD_TYPE + CMAKE_C_FLAGS + CMAKE_CXX_FLAGS + ${option_list} + OTB_WRAP_PYTHON + OTB_WRAP_JAVA + OTB_DATA_ROOT + ) + get_white_spaces("${otb_option}" spaces) + message("${otb_option} ${spaces} = ${${otb_option}}") +endforeach() + +# set(modules_list_for_summary "${OTB_MODULES_ENABLED}") +# list(SORT modules_list_for_summary) +# string(REPLACE ";" " " modules_list_for_summary "${modules_list_for_summary}") +# message("OTB_MODULES_ENABLED = ${modules_list_for_summary}") +# unset(modules_list_for_summary) + +list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_OPENCV" "OTB_USE_QT4") +foreach(item ${option_list}) + if(NOT ${item}) + list(REMOVE_ITEM option_list "${item}" ) + endif() +endforeach() + +#To report non-optional dependencies inside summary +list(APPEND option_list Boost) +list(APPEND option_list GDAL) +list(APPEND option_list GEOTIFF) +list(APPEND option_list ITK) +list(APPEND option_list OSSIM) +list(APPEND option_list TINYXML) + +#RK +#Q: Why these two guys here? we already have option_list +#A: Because cmake case sensitivity with variables. +if(OTB_USE_OPENCV) + list(APPEND option_list OpenCV) +endif() + +if(OTB_USE_QT4) + list(APPEND option_list QT) +endif() +#sort again! +list(SORT option_list) + +foreach(dep ${option_list}) + + string(REGEX REPLACE "OTB_USE_" "" dep ${dep}) + + unset(var1_key) + unset(var2_key) + unset(var3_key) + + unset(var1_val) + unset(var2_val) + unset(var3_val) + + set(var1_key "${dep}") + if(${dep}_VERSION_STRING) + set(var1_val ${${dep}_VERSION_STRING}) + endif() + if(NOT var1_val) + if(${dep}_VERSION) + set(var1_val ${${dep}_VERSION}) + endif() + endif() + + if(DEFINED ${dep}_DIR) + set(var2_key ${dep}_DIR) + set(var2_val ${${dep}_DIR}) + else() + if(${dep}_INCLUDE_DIR) + set(var2_key ${dep}_INCLUDE_DIR) + set(var2_val ${${dep}_INCLUDE_DIR}) + elseif(${dep}_INCLUDE_DIRS) + set(var2_key ${dep}_INCLUDE_DIRS) + set(var2_val ${${dep}_INCLUDE_DIRS}) + endif() + if(${dep}_LIBRARY) + set(var3_key ${dep}_LIBRARY) + set(var3_val ${${dep}_LIBRARY}) + elseif(${dep}_LIBRARIES) + set(var3_key ${dep}_LIBRARIES) + set(var3_val ${${dep}_LIBRARIES}) + endif() + endif() + + get_white_spaces("${var1_key}" insert_spaces1) + get_white_spaces("${var2_key}" insert_spaces2) + get_white_spaces("${var3_key}" insert_spaces3) + + message("${var1_key} ${insert_spaces1} = ${var1_val}") + if(var2_val) + message("${var2_key} ${insert_spaces2} = ${var2_val}") + endif() + if(var3_val) + message("${var3_key} ${insert_spaces3} = ${var3_val}") + endif() + +endforeach() + +message("\nCMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator\n") + +message("======================= End of OTB cmake summary =======================") -# 04-apr-2016. point OTB. -# create a single package with OTB + Monteverdi + Mapla. -# The below loop is commented out since generation of single -# package happens in monteverdi project. - -# if(WIN32 AND CMAKE_CROSSCOMPILING) -# if(DEFINED MXE_TARGET_DIR) - -# set(pefiles) - -# message(STATUS "MXE_TARGET_DIR = ${MXE_TARGET_DIR}") - -# if(MXE_TARGET_DIR MATCHES "i686") -# set(mxearch x86) -# set(archive_name ${CMAKE_PROJECT_NAME}-${OTB_VERSION_STRING}-win32) -# elseif(MXE_TARGET_DIR MATCHES "x86_64") -# set(mxearch x64) -# set(archive_name ${CMAKE_PROJECT_NAME}-${OTB_VERSION_STRING}-win64) -# endif() - -# execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_INSTALL_PREFIX}/${archive_name}") - -# get_filename_component(mxeroot ${MXE_TARGET_DIR} PATH) -# get_filename_component(mxeroot ${mxeroot} PATH) - -# file(WRITE "${CMAKE_BINARY_DIR}/_mingw/CMakeLists.txt" -# "cmake_minimum_required(VERSION 2.6) -# include(CMakeParseArguments) -# set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\") -# include(${CMAKE_SOURCE_DIR}/CMake/MinGWPackage.cmake) -# package_mingw( -# ARCH \"${mxearch}\" -# MXEROOT \"${mxeroot}\" -# PREFIX_DIR \"${archive_name}\" -# PEFILES \"${pefiles}\" -# WITH_OTBGUI 1 -# SEARCHDIRS \"\")") - -# add_custom_target(configure-mingw -# COMMAND ${CMAKE_COMMAND} -# "${CMAKE_BINARY_DIR}/_mingw" -# WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/_mingw") - -# add_custom_target(prepare-mingw -# COMMAND ${CMAKE_COMMAND} -# "--build" "${CMAKE_BINARY_DIR}/_mingw" "--target" "install" -# WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/_mingw" -# DEPENDS configure-mingw) - -# find_program(ZIP_EXECUTABLE zip) - -# if(ZIP_EXECUTABLE) -# add_custom_target(packages -# COMMAND ${ZIP_EXECUTABLE} "-r" "${CMAKE_BINARY_DIR}/${archive_name}.zip" "${archive_name}" -# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" -# DEPENDS prepare-mingw) -# else() -# message(FATAL_ERROR "Cannot find zip executable. Please add it to your path") -# endif() - -# # else(DEFINED MXE_TARGET_DIR) -# # message(WARNING "MXE_TARGET_DIR must be defined and contains location of mxe root directory") -# endif(DEFINED MXE_TARGET_DIR) - -# endif(WIN32 AND CMAKE_CROSSCOMPILING) +#don't need this one anymore. so unset it. +unset(option_list) diff --git a/Copyright/OpenMPICopyright.txt b/Copyright/OpenMPICopyright.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5b6a433c762f3363e357da123052218bacb11e --- /dev/null +++ b/Copyright/OpenMPICopyright.txt @@ -0,0 +1,89 @@ +Most files in this release are marked with the copyrights of the +organizations who have edited them. The copyrights below are in no +particular order and generally reflect members of the Open MPI core +team who have contributed code to this release. The copyrights for +code used under license from other parties are included in the +corresponding files. + +Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + University Research and Technology + Corporation. All rights reserved. +Copyright (c) 2004-2010 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, + University of Stuttgart. All rights reserved. +Copyright (c) 2004-2008 The Regents of the University of California. + All rights reserved. +Copyright (c) 2006-2010 Los Alamos National Security, LLC. All rights + reserved. +Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved. +Copyright (c) 2006-2011 Sandia National Laboratories. All rights reserved. +Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. +Copyright (c) 2006-2010 The University of Houston. All rights reserved. +Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. +Copyright (c) 2007-2008 UT-Battelle, LLC. All rights reserved. +Copyright (c) 2007-2010 IBM Corporation. All rights reserved. +Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing + Centre, Federal Republic of Germany +Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany +Copyright (c) 2007 Evergrid, Inc. All rights reserved. +Copyright (c) 2008 Chelsio, Inc. All rights reserved. +Copyright (c) 2008-2009 Institut National de Recherche en + Informatique. All rights reserved. +Copyright (c) 2007 Lawrence Livermore National Security, LLC. + All rights reserved. +Copyright (c) 2007-2009 Mellanox Technologies. All rights reserved. +Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. +Copyright (c) 2008-2010 Oak Ridge National Labs. All rights reserved. +Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2009 Bull SAS. All rights reserved. +Copyright (c) 2010 ARM ltd. All rights reserved. +Copyright (c) 2010-2011 Alex Brick . All rights reserved. +Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights + reserved. +Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Copyright/SPTWCopyright.txt b/Copyright/SPTWCopyright.txt new file mode 100644 index 0000000000000000000000000000000000000000..7279739f41afa40b3386b51654187222af511982 --- /dev/null +++ b/Copyright/SPTWCopyright.txt @@ -0,0 +1,3 @@ +This software is in the public domain, furnished "as is", without +technical support, and with no warranty, express or implied, as to its +usefulness for any purpose. diff --git a/Documentation/SoftwareGuide/CMakeLists.txt b/Documentation/SoftwareGuide/CMakeLists.txt index 352b58a5da3b8b5d9a97615af7e247505374393a..ed99e1f254df155908206465d2ff54c496d6dcb9 100644 --- a/Documentation/SoftwareGuide/CMakeLists.txt +++ b/Documentation/SoftwareGuide/CMakeLists.txt @@ -52,6 +52,7 @@ IF( NOT OTB_SOURCE_DIR ) MESSAGE(FATAL_ERROR "OTB source directory is not set. Please add OTB_SOURCE_DIR to your cmake cache.") ENDIF( NOT OTB_SOURCE_DIR ) +set(OTB_VERSION_STRING_FULL "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") #OPTION(GENERATE_MONTEVERDI_DOC "Generate Monteverdi user guide as well" OFF) @@ -81,7 +82,7 @@ ENDIF( BUILD_FIGURES ) # Find ImageMagick tools # This is used to convert image formats # -INCLUDE (${CMAKE_ROOT}/Modules/FindImageMagick.cmake) +find_program(IMAGEMAGICK_CONVERT_EXECUTABLE convert) IF(NOT IMAGEMAGICK_CONVERT_EXECUTABLE) MESSAGE(FATAL_ERROR "ImageMagick convert utility was not found. Please pass to advanced mode and provide its full path") ENDIF(NOT IMAGEMAGICK_CONVERT_EXECUTABLE) diff --git a/Documentation/SoftwareGuide/Latex/FAQ.tex b/Documentation/SoftwareGuide/Latex/FAQ.tex index ddd606bd8f9b683e6f4a18a689df14bbfd7b81a1..278d521f46f45550c587a41790aa65710e892d1e 100644 --- a/Documentation/SoftwareGuide/Latex/FAQ.tex +++ b/Documentation/SoftwareGuide/Latex/FAQ.tex @@ -165,8 +165,6 @@ The recommended procedure is to get this recent source and build GDAL from sourc --with-rename-internal-libgeotiff-symbol=yes \end{verbatim} -See section~\ref{sec:gdal} of Software Guide for more information on this issue. - \subsubsection{Errors when compiling internal libkml} The internal version of libkml cannot be compiled when using an external build of ITK. See \url{http://bugs.orfeo-toolbox.org/view.php?id=879} for more details. @@ -244,7 +242,7 @@ include it in the next release. You can also run the nightly tests so we have a wider range of platforms to detect bugs earlier. Look at section \ref{sec:runningTheTests}. -You can also find more information about how to contribute at \url{http://orfeo-toolbox.org/otb/contribute.html} +You can also find more information about how to contribute at \url{https://www.orfeo-toolbox.org/community} \subsection{What are the benefits of contributing to OTB?} @@ -330,7 +328,7 @@ OTB's version numbers have 3 digits. The first one is for major versions, the second one is for minor versions and the last one is for bugfixes. -The first version was 1.0.0 in July 2006.The current one is 5.5.0. +The first version was 1.0.0 in July 2006.The current one is \otbversion. \subsubsection{What is a major version?} A major version of the library implies the addition of high-level diff --git a/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex index 1084cf6a4fa4394c8e12be3b29015f1d38979d48..64e0e50685fee1f90acf8a61585267cd6a88c537 100644 --- a/Documentation/SoftwareGuide/Latex/Installation.tex +++ b/Documentation/SoftwareGuide/Latex/Installation.tex @@ -8,11 +8,11 @@ There are two ways to install OTB library on your system: installing from a bina You can find information about the installation of binary packages for OTB and Monteverdi in the OTB-Cookbook. This chapter covers compilation of OTB library from source. -OTB has been developed and tested across different combinations of operating systems, compilers, and hardware platforms including MS-Windows, Linux on Intel-compatible hardware and Mac OSX. It is known to work with the following compilers in 32/64 bit: +OTB has been developed and tested across different combinations of operating systems, compilers, and hardware platforms including Windows, Linux and Mac OSX. It is known to work with the following compilers in 32/64 bit: \begin{itemize} -\item Visual Studio 2010 and higher compiler on MS-Windows -\item GCC 4.1 and higher on Unix/Linux systems -\item Clang on MacOSX (10.8 and higher) systems +\item Visual Studio 2015 on Windows +\item GCC 4.x on GNU/Linux +\item AppleClang on MacOSX (10.8 or higher) \end{itemize} \index{CMake} @@ -47,8 +47,7 @@ configuration. This is the easiest way to start. \end{itemize} As shown in figure \ref{fig:CMakeGUI}, CMake has a different interfaces according to your system. -Refer to section~\ref{sec:compiling-linux} for Linux build instructions, -\ref{sec:compiling-macosx} for Mac~OS~X, +Refer to section~\ref{sec:compiling-linux} for Linux and Mac~OS~X build instructions and \ref{sec:compiling-windows} for Windows. \begin{figure}[tpb] @@ -224,15 +223,28 @@ because the SuperBuild will install some targets during the compilation step. Therefore this directory will be used even if you don't use make install target. In fact there is no make install target for the SuperBuild. -During the configuration step, the SuperBuild will detect any existing dependencies installed as systems libraries. -Whether to use them can be controlled via the \texttt{USE\_SYSTEM\_\textit{XXX}} (see -table~\ref{tab:installation-cmake-variables}). +By default, SuperBuild will not use any of libraries installed on system. All \texttt{USE\_SYSTEM\_\textit{XXX}} are +are set to FALSE. This is our recommended way of using SuperBuild. You are however free to use a system library +if you want!. You must be very much aware of dependencies of those libraries you use from system. For example, +if libjpeg is not used from superbuild using \texttt{USE\_SYSTEM\_JPEG=TRUE} then you should not use zlib from superbuild +because zlib is a dependency of libjpeg. Here SuperBuild will not automagically set \texttt{USE\_SYSTEM\_ZLIB=FALSE}. +You must do it yourself. The example of libjpeg - zlib dependency chain is so simple. +Imagine the same case for GDAL which depends on zlib, libjpeg, libtiff(with big tiff support), geotiff, +sqlite, curl, geos, libkml, openjpeg. This is one of the reasons we recommend to use SuperBuild exclusively or not. + +All dependencies are configured and built in a way that help us to get an efficient build OTB. +So we enable geotiff (with proj4 support), openjpeg, geos in GDAL build. + +It is also important to note that SuperBuild is tested daily on all three platforms that makes us clear that +there is no issue with new changes in OTB and its dependencies. It simply works! + +(see table~\ref{tab:installation-cmake-variables}). SuperBuild downloads dependencies into the \texttt{DOWNLOAD\_LOCATION} directory, which will be \texttt{$\sim$/OTB/build/Downloads} in our example. Dependencies can be downloaded manually into this directory before the compilation step. This can be usefull if you wish to bypass a proxy, intend to compile OTB without an internet conection, or other network -constraint. You can find a complete bundle with all dependencies sources on the Orfeo ToolBox website (pick the 'SuperBuild-archives' corresponding to the OTB version you want to build) : +constraint. You can find an archive with sources of all our dependencies on the Orfeo ToolBox website (pick the 'SuperBuild-archives' corresponding to the OTB version you want to build) : \begin{center} \url{https://www.orfeo-toolbox.org/packages} \end{center} diff --git a/Documentation/SoftwareGuide/Latex/OTB-FAQ.tex b/Documentation/SoftwareGuide/Latex/OTB-FAQ.tex index 911295413600429ccba2774cb98b78d42809c5e5..3d73953883cecb9ed89565744d0380fb5bc38972 100644 --- a/Documentation/SoftwareGuide/Latex/OTB-FAQ.tex +++ b/Documentation/SoftwareGuide/Latex/OTB-FAQ.tex @@ -44,7 +44,7 @@ \title{ORFEO Toolbox (OTB) Frequently Asked Questions (FAQ).\\ Updated - for OTB-5.5.0} + for OTB-\otbversion} \author{OTB Development Team} diff --git a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex index 2f04e4eb69b388a6ee384bf6117488d72406b8be..4affc164b8cb456285dee6d1d72fde9db4f223f6 100644 --- a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex +++ b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex @@ -133,7 +133,7 @@ colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue}, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{The ORFEO Tool Box Software Guide\\ Updated - for OTB-5.5.0} + for OTB-\otbversion} \author{OTB Development Team} diff --git a/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex b/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex index 7eeabe01b3e130fe52878e03ae5f54d70f13224c..1768c03ffa62fa38cc4c80ab62c944d4b7d92e0c 100644 --- a/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex +++ b/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex @@ -150,7 +150,7 @@ name of the files to write, but they also encapsulate the corresponding writers. \section{Compile your application} In order to compile your application you must call the macro \code{OTB\_CREATE\_APPLICATION} in the \emph{CMakelists.txt} file. -This macro generates the lib \emph{otbapp\_XXX.so}, in (OTB\_BINARY\_DIR), where \emph{XXX} refers to the class name. Don't forget to enable application building (see. \ref{sec:ConfiguringOTBwithVTK} section). +This macro generates the lib \emph{otbapp\_XXX.so}, in (OTB\_BINARY\_DIR/lib/otb/applications), where \emph{XXX} refers to the class name. \section{Execute your application} diff --git a/Documentation/SoftwareGuide/SoftwareGuideConfiguration.tex.in b/Documentation/SoftwareGuide/SoftwareGuideConfiguration.tex.in index 83c69b6fcd6cb796b10dbd1a83f88bbc3426e82d..02868b264c65bf63aac1c3cb7c802772b1e72efc 100644 --- a/Documentation/SoftwareGuide/SoftwareGuideConfiguration.tex.in +++ b/Documentation/SoftwareGuide/SoftwareGuideConfiguration.tex.in @@ -21,3 +21,5 @@ % Define command for the standard comment introducing classes with similar functionalities \newcommand{\relatedClasses}{ \textbf{The following classes provide similar functionality:}} + +\newcommand{\otbversion}{@OTB_VERSION_STRING_FULL@} diff --git a/Examples/Application/ApplicationExample.cxx b/Examples/Application/ApplicationExample.cxx index c01c061b4c09df82f14c49f454925995bb2ff3da..f70561a8292cfaa74d0d880d5de9b79f29c70b5d 100644 --- a/Examples/Application/ApplicationExample.cxx +++ b/Examples/Application/ApplicationExample.cxx @@ -97,7 +97,7 @@ private: // \code{DoInit()} method contains class information and description, parameter set up, and example values. // Software Guide : EndLatex - void DoInit() + void DoInit() ITK_OVERRIDE { // Software Guide : BeginLatex @@ -228,7 +228,7 @@ private: // gives a complete description of this method. // Software Guide : EndLatex // Software Guide :BeginCodeSnippet - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } // Software Guide : EndCodeSnippet @@ -238,7 +238,7 @@ private: // gives a complete description of this method. // Software Guide : EndLatex // Software Guide :BeginCodeSnippet - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx b/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx index 778497ba4d09134556feae6694867b4b4193cc61..b65c16e86638f2141a55fd68512e505d76aea852 100644 --- a/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx +++ b/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx @@ -138,7 +138,7 @@ public: protected: MyChangeDetectorImageFilter() {} - virtual ~MyChangeDetectorImageFilter() {} + ~MyChangeDetectorImageFilter() ITK_OVERRIDE {} private: MyChangeDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Examples/Filtering/CompositeFilterExample.cxx b/Examples/Filtering/CompositeFilterExample.cxx index 9b76116102e987b7edbe0443caa3eb3bd352fb7b..0f855c307924095f965097c47cb4ea4f9f924ed7 100644 --- a/Examples/Filtering/CompositeFilterExample.cxx +++ b/Examples/Filtering/CompositeFilterExample.cxx @@ -93,7 +93,7 @@ public: itkTypeMacro(CompositeExampleImageFilter, itk::ImageToImageFilter); /** Display */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; // Software Guide : BeginLatex // @@ -132,7 +132,7 @@ protected: RescalerType; // Software Guide : EndCodeSnippet - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Examples/Filtering/GeometriesChangeSpatialReference.cxx b/Examples/Filtering/GeometriesChangeSpatialReference.cxx index 46d869c51026508269dab32bd59ac16371010fa8..0253b8a5160bf925f8bf089e282e667d1da49863 100644 --- a/Examples/Filtering/GeometriesChangeSpatialReference.cxx +++ b/Examples/Filtering/GeometriesChangeSpatialReference.cxx @@ -62,7 +62,7 @@ private: otb::ogr::UniqueGeometryPtr ReprojectTransformationFunctor::operator()(OGRGeometry const* in) const { - otb::ogr::UniqueGeometryPtr out(in ? in->clone() : 0); + otb::ogr::UniqueGeometryPtr out(in ? in->clone() : ITK_NULLPTR); if (out) { const OGRErr err = out->transform(m_reprojector.get()); @@ -99,11 +99,11 @@ protected: /** Default constructor. */ MyReprojectionFilter(){ } /** Destructor. */ - virtual ~MyReprojectionFilter(){ } + ~MyReprojectionFilter() ITK_OVERRIDE{ } private: - virtual OGRSpatialReference* DoDefineNewLayerSpatialReference(otb::ogr::Layer const& itkNotUsed(source)) const + OGRSpatialReference* DoDefineNewLayerSpatialReference(otb::ogr::Layer const& itkNotUsed(source)) const ITK_OVERRIDE { return m_osr.get(); } @@ -204,7 +204,7 @@ int main (int argc, char **argv) otb::ogr::DataSource::Pointer output = options.workingInplace ? input - : options.outputIsStdout ? 0 + : options.outputIsStdout ? ITK_NULLPTR : otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << options.inputFile << "\n"; if (output) @@ -231,7 +231,7 @@ int main (int argc, char **argv) } else { - filter->UpdateOutputData(0); + filter->UpdateOutputData(ITK_NULLPTR); assert(filter->GetOutput() && "output not set"); filter->GetOutput()->Print(std::cout, 0); } diff --git a/Examples/Filtering/GeometriesFilter.cxx b/Examples/Filtering/GeometriesFilter.cxx index 8150eceb979ff948ef7ea480913c0a887f387d94..35faff8aff18699e5cde37e1b95abe03e776348d 100644 --- a/Examples/Filtering/GeometriesFilter.cxx +++ b/Examples/Filtering/GeometriesFilter.cxx @@ -32,7 +32,7 @@ struct SwapXYFunctor typedef OGRGeometry TransformedElementType; otb::ogr::UniqueGeometryPtr operator()(OGRGeometry const* in) const { - otb::ogr::UniqueGeometryPtr out(in ? in->clone() : 0); + otb::ogr::UniqueGeometryPtr out(in ? in->clone() : ITK_NULLPTR); if (out) { #if GDAL_VERSION_NUM >= 1900 @@ -71,7 +71,7 @@ int main (int argc, char **argv) otb::ogr::DataSource::Pointer output = workingInplace ? input - : outputIsStdout ? 0 + : outputIsStdout ? ITK_NULLPTR : otb::ogr::DataSource::New( outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << inputFile << "\n"; if (output) @@ -94,7 +94,7 @@ int main (int argc, char **argv) } else { - filter->UpdateOutputData(0); + filter->UpdateOutputData(ITK_NULLPTR); assert(filter->GetOutput() && "output not set"); filter->GetOutput()->Print(std::cout, 0); } diff --git a/Examples/IO/OGRWrappersExample.cxx b/Examples/IO/OGRWrappersExample.cxx index 23afc27e91695939586b279e3ce22b21686a3916..d7e3f0d7c37c3aec18b3e8cdd0af69a7cf571459 100644 --- a/Examples/IO/OGRWrappersExample.cxx +++ b/Examples/IO/OGRWrappersExample.cxx @@ -106,7 +106,7 @@ int main(int argc, char * argv[]) otb::ogr::DataSource::Pointer destination = otb::ogr::DataSource::New( argv[2], otb::ogr::DataSource::Modes::Update_LayerCreateOnly); otb::ogr::Layer destLayer = destination->CreateLayer( - argv[2], 0, wkbMultiPolygon); + argv[2], ITK_NULLPTR, wkbMultiPolygon); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff --git a/Examples/Learning/SEMModelEstimatorExample.cxx b/Examples/Learning/SEMModelEstimatorExample.cxx index 86f3e58f967d80e4c73031f65bd4ad32af0b87e6..cbe329d52fb8da24025e915274e0ab85c33e5764 100644 --- a/Examples/Learning/SEMModelEstimatorExample.cxx +++ b/Examples/Learning/SEMModelEstimatorExample.cxx @@ -100,7 +100,7 @@ int main(int argc, char * argv[]) // Software Guide : EndCodeSnippet char * fileNameIn = argv[1]; - char * fileNameImgInit = NULL; + char * fileNameImgInit = ITK_NULLPTR; char * fileNameOut = argv[2]; int numberOfClasses = atoi(argv[3]); int numberOfIteration = atoi(argv[4]); @@ -146,7 +146,7 @@ int main(int argc, char * argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - if (fileNameImgInit != NULL) + if (fileNameImgInit != ITK_NULLPTR) { typedef otb::ImageFileReader<OutputImageType> ImgInitReaderType; ImgInitReaderType::Pointer segReader = ImgInitReaderType::New(); diff --git a/Examples/Learning/SOMExample.cxx b/Examples/Learning/SOMExample.cxx index 3f56132f43b30be9ecbaeb790f6f1f38b8e8f6ae..aa867d4433c3097573a2f61fc9466d64064a50fc 100644 --- a/Examples/Learning/SOMExample.cxx +++ b/Examples/Learning/SOMExample.cxx @@ -406,7 +406,7 @@ int main(int itkNotUsed(argc), char* argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - if (actMapFileName != NULL) + if (actMapFileName != ITK_NULLPTR) { ActivationWriterType::Pointer actWriter = ActivationWriterType::New(); actWriter->SetFileName(actMapFileName); diff --git a/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx b/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx index 158b00793886987108562d268f61af633b048742..346c40aa5e6b92f979cc2cc841dae1991aede968 100644 --- a/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx +++ b/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx @@ -101,6 +101,8 @@ int main(int argc, char* argv[]) InputListSampleType::Pointer InputListSample = InputListSampleType::New(); TargetListSampleType::Pointer TargetListSample = TargetListSampleType::New(); + + InputListSample->SetMeasurementVectorSize(nbSampleComponents); // Software Guide : EndCodeSnippet diff --git a/Examples/Projections/OrthoRectificationExample.cxx b/Examples/Projections/OrthoRectificationExample.cxx index 2acfc9caf0d1b7cb4c46a72afe556e3d3e84fcae..2a529cf77a643ec371d336a7bfda8e6fdbf2454f 100644 --- a/Examples/Projections/OrthoRectificationExample.cxx +++ b/Examples/Projections/OrthoRectificationExample.cxx @@ -152,8 +152,8 @@ int main(int argc, char* argv[]) orthoRectifFilter->SetDisplacementFieldSpacing(gridSpacing); ImageType::PointType origin; - origin[0] = strtod(argv[5], NULL); - origin[1] = strtod(argv[6], NULL); + origin[0] = strtod(argv[5], ITK_NULLPTR); + origin[1] = strtod(argv[6], ITK_NULLPTR); orthoRectifFilter->SetOutputOrigin(origin); // Software Guide : EndCodeSnippet diff --git a/Examples/Projections/SensorModelExample.cxx b/Examples/Projections/SensorModelExample.cxx index b162762e692b9c20bbb32b17085ff19d64ed4de2..2b6b9fc8e0d86bb77d4af1d637ffdb5682c68145 100644 --- a/Examples/Projections/SensorModelExample.cxx +++ b/Examples/Projections/SensorModelExample.cxx @@ -184,8 +184,8 @@ int main(int argc, char* argv[]) spacing[1] = -0.00001; ImageType::PointType origin; - origin[0] = strtod(argv[3], NULL); //longitude - origin[1] = strtod(argv[4], NULL); //latitude + origin[0] = strtod(argv[3], ITK_NULLPTR); //longitude + origin[1] = strtod(argv[4], ITK_NULLPTR); //latitude ImageType::RegionType region; diff --git a/Examples/Registration/ImageRegistration1.cxx b/Examples/Registration/ImageRegistration1.cxx index ded1c98470a1211b559e03b2e0a27ce0ae969fb9..c59cd82f48905e61f91978b301dfd4f7edf8fa7b 100644 --- a/Examples/Registration/ImageRegistration1.cxx +++ b/Examples/Registration/ImageRegistration1.cxx @@ -78,12 +78,12 @@ public: typedef itk::RegularStepGradientDescentOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) + void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE { Execute((const itk::Object *) caller, event); } - void Execute(const itk::Object * object, const itk::EventObject& event) + void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE { OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object); diff --git a/Examples/Registration/ImageRegistration2.cxx b/Examples/Registration/ImageRegistration2.cxx index 250249c120623413597d9ee3c8b4faa497571908..766080cee37dc6cb6ce111e71b3ef94bc9dfe5e5 100644 --- a/Examples/Registration/ImageRegistration2.cxx +++ b/Examples/Registration/ImageRegistration2.cxx @@ -97,12 +97,12 @@ public: typedef itk::GradientDescentOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) + void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE { Execute((const itk::Object *) caller, event); } - void Execute(const itk::Object * object, const itk::EventObject& event) + void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE { OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object); diff --git a/Examples/Registration/ImageRegistration5.cxx b/Examples/Registration/ImageRegistration5.cxx index 99ceedad4602b09a96b2fde80d24c66a12beecc9..9785393c561de895350d40ec7bb1155c12b3e635 100644 --- a/Examples/Registration/ImageRegistration5.cxx +++ b/Examples/Registration/ImageRegistration5.cxx @@ -92,12 +92,12 @@ public: typedef itk::RegularStepGradientDescentOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) + void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE { Execute((const itk::Object *) caller, event); } - void Execute(const itk::Object * object, const itk::EventObject& event) + void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE { OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object); diff --git a/Examples/Registration/ImageRegistration9.cxx b/Examples/Registration/ImageRegistration9.cxx index 5e1cd81eb7d2c6d520138612ef7216a9b6266ca9..5ba052f92ef5fa19636201e8216ecb8e60445d00 100644 --- a/Examples/Registration/ImageRegistration9.cxx +++ b/Examples/Registration/ImageRegistration9.cxx @@ -87,12 +87,12 @@ public: typedef itk::RegularStepGradientDescentOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) + void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE { Execute((const itk::Object *) caller, event); } - void Execute(const itk::Object * object, const itk::EventObject& event) + void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE { OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object); diff --git a/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx b/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx index 38c27e81336d53c44fa8c6fc124f15aeb73dbd0e..b972fd7b4ebb8d15083317b005c27794eec19179 100644 --- a/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx +++ b/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx @@ -130,12 +130,12 @@ public: protected: ImageUniqueValuesCalculator() { - m_Image = NULL; + m_Image = ITK_NULLPTR; } - virtual ~ImageUniqueValuesCalculator() + ~ImageUniqueValuesCalculator() ITK_OVERRIDE { } - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Image: " << m_Image.GetPointer() << std::endl; @@ -449,9 +449,9 @@ public: protected: TernaryFunctorImageFilterWithNBands() {} - virtual ~TernaryFunctorImageFilterWithNBands() {} + ~TernaryFunctorImageFilterWithNBands() ITK_OVERRIDE {} - void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); this->GetOutput()->SetNumberOfComponentsPerPixel( m_NumberOfOutputBands ); @@ -469,7 +469,7 @@ private: int main(int argc, char *argv[]) { - char *cmifname = NULL; + char *cmifname = ITK_NULLPTR; if (argc != 10) { if (argc == 11) // cloud mask filename optional parameter @@ -804,7 +804,7 @@ int main(int argc, char *argv[]) miReader->UpdateOutputInformation(); MaskImageType::Pointer maskImage = miReader->GetOutput(); - if (cmifname != NULL) + if (cmifname != ITK_NULLPTR) { MaskReaderType::Pointer cmiReader = MaskReaderType::New(); diff --git a/Examples/Tutorials/OrthoFusion.cxx b/Examples/Tutorials/OrthoFusion.cxx index 46209ceaed8ccbfae0238396830c910d16aaf01e..a1ae3c6354bee480462c303f0e65d70bab9c11e0 100644 --- a/Examples/Tutorials/OrthoFusion.cxx +++ b/Examples/Tutorials/OrthoFusion.cxx @@ -139,8 +139,8 @@ int main(int argc, char* argv[]) spacing[1] = atof(argv[11]); ImageType::PointType origin; - origin[0] = strtod(argv[6], NULL); - origin[1] = strtod(argv[7], NULL); + origin[0] = strtod(argv[6], ITK_NULLPTR); + origin[1] = strtod(argv[7], ITK_NULLPTR); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff --git a/Modules/Adapters/BoostAdapters/include/otbBoostDox.h b/Modules/Adapters/BoostAdapters/include/otbBoostDox.h index d019018f2b11dfa2b43cf1390c5e902833f1ab81..368507c105beefc7fab7716098f00272b6f0ee40 100644 --- a/Modules/Adapters/BoostAdapters/include/otbBoostDox.h +++ b/Modules/Adapters/BoostAdapters/include/otbBoostDox.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoostDox_h -#define __otbBoostDox_h +#ifndef otbBoostDox_h +#define otbBoostDox_h /**\defgroup boost Boost alike helpers * \ingroup Thematic @@ -27,4 +27,4 @@ namespace boost { } //@} -#endif // __otbBoostDox_h +#endif // otbBoostDox_h diff --git a/Modules/Adapters/BoostAdapters/include/otbJoinContainer.h b/Modules/Adapters/BoostAdapters/include/otbJoinContainer.h index fd315afa9d265cb03fc23fee7d467519417a2505..e08ad8d5d1751b0dd09c478c57d5fb72fc255b38 100644 --- a/Modules/Adapters/BoostAdapters/include/otbJoinContainer.h +++ b/Modules/Adapters/BoostAdapters/include/otbJoinContainer.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJoinContainer_h -#define __otbJoinContainer_h +#ifndef otbJoinContainer_h +#define otbJoinContainer_h // #include <iosfwd> #include <string> @@ -61,4 +61,4 @@ std::ostream & Join(std::ostream &os, TRange const& range, std::string const& se // #include "otbJoinContainer.txx" #endif -#endif // __otbJoinContainer_h +#endif // otbJoinContainer_h diff --git a/Modules/Adapters/BoostAdapters/include/otbStringUtils.h b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h index 57e0d32568f2e8c64b4cfc19273d9eaa7ce9bdd1..309afa50485ae30ebd1bdaf036177a1f23ec5ce8 100644 --- a/Modules/Adapters/BoostAdapters/include/otbStringUtils.h +++ b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h @@ -27,6 +27,7 @@ #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" #include <boost/lexical_cast.hpp> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/predicate.hpp> diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h index b81ffce98cf8bdfd3e4013c3a6396afc0bf1487d..e3b5ad2c41ca7fe6f285087f6d02b420738f0ea6 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCurlHelper_h -#define __otbCurlHelper_h +#ifndef otbCurlHelper_h +#define otbCurlHelper_h #include "otbCurlHelperInterface.h" @@ -45,19 +45,19 @@ public: itkTypeMacro(CurlHelper, CurlHelperInterface); itkNewMacro(Self); - bool TestUrlAvailability(const std::string& url) const; + bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE; bool IsCurlReturnHttpError(const std::string& url) const; - int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const; + int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE; - int RetrieveFile(const std::string& urlString, std::string filename) const; + int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE; - int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const; + int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE; int RetrieveFileMulti(const std::vector<std::string>& listURLs, const std::vector<std::string>& listFiles, - int maxConnect) const; + int maxConnect) const ITK_OVERRIDE; itkGetMacro(Timeout,long int); @@ -68,7 +68,7 @@ protected: m_Browser("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) " "Gecko/20071127 Firefox/2.0.0.11"), m_Timeout(10) {} - virtual ~CurlHelper() {} + ~CurlHelper() ITK_OVERRIDE {} private: CurlHelper(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h index fb8f07b18c3453a57ef67496563d9418a978cce9..127eb5386aca4bce8bfc4f0f2e645bc3ba97c73a 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCurlHelperInterface_h -#define __otbCurlHelperInterface_h +#ifndef otbCurlHelperInterface_h +#define otbCurlHelperInterface_h #include <iosfwd> #include "itkObject.h" @@ -62,7 +62,7 @@ public: protected: CurlHelperInterface() {} - virtual ~CurlHelperInterface() {} + ~CurlHelperInterface() ITK_OVERRIDE {} private: CurlHelperInterface(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h index da7da9eea36b2befb83dbba1b030459d2b2b103e..95bca476b94b31dd528526d1388c6316e5d6dc13 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCurlHelperStub_h -#define __otbCurlHelperStub_h +#ifndef otbCurlHelperStub_h +#define otbCurlHelperStub_h #include "otbCurlHelperInterface.h" @@ -44,20 +44,20 @@ public: itkNewMacro(Self); - bool TestUrlAvailability(const std::string& url) const; + bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE; - int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const; + int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE; - int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const; + int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE; - int RetrieveFile(const std::string& urlString, std::string filename) const; + int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE; int RetrieveFileMulti(const std::vector<std::string>& listURLs, const std::vector<std::string>& listFiles, - int maxConnect) const; + int maxConnect) const ITK_OVERRIDE; protected: CurlHelperStub() {} - virtual ~CurlHelperStub() {} + ~CurlHelperStub() ITK_OVERRIDE {} private: CurlHelperStub(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx index a44b6b2857b24184c2c8f834b33ea762857c7925..fad48c272fbef04e23f34025165b829a676f0ae4 100644 --- a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx +++ b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx @@ -91,7 +91,7 @@ protected: } } - virtual ~CurlResource() + ~CurlResource() ITK_OVERRIDE { curl_easy_cleanup(m_Curl); } @@ -137,7 +137,7 @@ protected: } } - virtual ~CurlMultiResource() + ~CurlMultiResource() ITK_OVERRIDE { curl_multi_cleanup(m_Curl); } @@ -175,7 +175,7 @@ public: { m_File = fopen(infname, "wb"); - if (m_File == NULL) + if (m_File == ITK_NULLPTR) { itkExceptionMacro(<<" otbCurlHelper::FileResource : failed to open the file ."<< infname); } @@ -184,7 +184,7 @@ public: protected: CurlFileDescriptorResource(){} - virtual ~CurlFileDescriptorResource() + ~CurlFileDescriptorResource() ITK_OVERRIDE { fclose(m_File); } @@ -316,7 +316,6 @@ int CurlHelper::RetrieveFile(const std::ostringstream& urlStream, std::string fi int CurlHelper::RetrieveFile(const std::string& urlString, std::string filename) const { #ifdef OTB_USE_CURL - otbMsgDevMacro(<< "Retrieving: " << urlString); CURLcode res = CURLE_OK; @@ -326,13 +325,19 @@ int CurlHelper::RetrieveFile(const std::string& urlString, std::string filename) output_file->OpenFile(filename.c_str()); char url[256]; - strcpy(url, urlString.c_str()); + int len = static_cast<int>(urlString.size()); + strncpy( url, urlString.c_str(), len + 1 ); + + otbMsgDevMacro(<< "Retrieving ( CurlHelper::RetrieveFile ): " << url ); CurlHandleError::ProcessCURLcode(curl_easy_setopt(curlResource->GetCurlResource(), CURLOPT_URL, url)); // Set timeout CurlHandleError::ProcessCURLcode(curl_easy_setopt(curlResource->GetCurlResource(), CURLOPT_TIMEOUT, m_Timeout)); + CurlHandleError::ProcessCURLcode(curl_easy_setopt(curlResource->GetCurlResource(), CURLOPT_FRESH_CONNECT, 1)); + CurlHandleError::ProcessCURLcode(curl_easy_setopt(curlResource->GetCurlResource(), CURLOPT_NOSIGNAL, 1)); + // Use our writing static function to avoid file descriptor // pointer crash on windows CurlHandleError::ProcessCURLcode(curl_easy_setopt(curlResource->GetCurlResource(), CURLOPT_WRITEFUNCTION, diff --git a/Modules/Adapters/CurlAdapters/test/CMakeLists.txt b/Modules/Adapters/CurlAdapters/test/CMakeLists.txt index cfd45b32fd2ff33c1942b96cca41492a0c0abaf2..6388f71ed37dfd339629de116fea55d43327799e 100644 --- a/Modules/Adapters/CurlAdapters/test/CMakeLists.txt +++ b/Modules/Adapters/CurlAdapters/test/CMakeLists.txt @@ -9,16 +9,7 @@ add_executable(otbCurlAdaptersTestDriver ${OTBCurlAdaptersTests}) target_link_libraries(otbCurlAdaptersTestDriver ${OTBCurlAdapters-Test_LIBRARIES}) otb_module_target_label(otbCurlAdaptersTestDriver) -# Tests Declaration - -otb_add_test(NAME tsTvDataIsNightlyRevision COMMAND otbCurlAdaptersTestDriver - otbIsNightlyRevision - ${OTB_DATA_WC_REVISION} - https://git.orfeo-toolbox.org/otb-data.git/commit/refs/heads/nightly ) -set_property(TEST tsTvDataIsNightlyRevision PROPERTY RESOURCE_LOCK web_access) - -otb_add_test(NAME tsTvIsNightlyRevision COMMAND otbCurlAdaptersTestDriver - otbIsNightlyRevision - ${OTB_WC_REVISION} - https://git.orfeo-toolbox.org/otb.git/commit/refs/heads/nightly ) -set_property(TEST tsTvIsNightlyRevision PROPERTY RESOURCE_LOCK web_access) +# Is*Revision tests are removed. see JIRA OTB-1052 +#the building of testdriver otbCurlAdaptersTestDriver is kept just +#for the sake of linking libcurl with OTB to ensure curl (superbuild/system) +#is fine for usage with OTB diff --git a/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h b/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h index d30d3687b0f481d18803151c7133ac72d1d99c33..348287dc6b96827db383b25be1cc95060a35c31a 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h +++ b/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbGdalDataTypeBridge_h -#define __otbGdalDataTypeBridge_h +#ifndef otbGdalDataTypeBridge_h +#define otbGdalDataTypeBridge_h #include <typeinfo> #include "gdal.h" diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h index 921f4de97e2749b8e95cfb1b6476bdf1422b9822..9a438174e5aaf82c5f8cfae67d550d3ae16388bf 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometriesSet_h -#define __otbGeometriesSet_h +#ifndef otbGeometriesSet_h +#define otbGeometriesSet_h #include <boost/variant.hpp> // #include "otbOGRLayerWrapper.h" @@ -156,10 +156,10 @@ protected: GeometriesSet(ogr::Layer layer); /** Destructor. */ - virtual ~GeometriesSet(); + ~GeometriesSet() ITK_OVERRIDE; /** Prints self to stream. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType; AnyGeometriesSetType m_GeometriesSet; @@ -172,4 +172,4 @@ private: // #include "otbGeometriesSet.txx" #endif -#endif // __otbGeometriesSet_h +#endif // otbGeometriesSet_h diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h index aa1da8c42e9b794930c464c21ed1b33a68ff7bd1..8d782b1dcd78eaaff59792bb3b49af8656f426e4 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometriesSource_h -#define __otbGeometriesSource_h +#ifndef otbGeometriesSource_h +#define otbGeometriesSource_h #include <boost/noncopyable.hpp> #include "itkProcessObject.h" @@ -114,7 +114,7 @@ public: * initializing them. * \post <tt>GetOutput() != NULL</tt> */ - virtual void PrepareOutputs(); + void PrepareOutputs() ITK_OVERRIDE; protected: /** Default constructor. @@ -124,7 +124,7 @@ protected: /** Destructor. * Does nothing. */ - virtual ~GeometriesSource(); + ~GeometriesSource() ITK_OVERRIDE; /** Ensures that the output geometries are allocated before processing. * If the output hasn't been set, at this point, the default output geometries @@ -135,4 +135,4 @@ protected: }; } // end namespace otb -#endif // __otbGeometriesSource_h +#endif // otbGeometriesSource_h diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h index f5b9de54a347a66dc4fc795c389dd7a68bfe6a7f..90b37c80ca671ff22d92a533e8a6221fc34fedf9 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometriesToGeometriesFilter_h -#define __otbGeometriesToGeometriesFilter_h +#ifndef otbGeometriesToGeometriesFilter_h +#define otbGeometriesToGeometriesFilter_h /**\ingroup GeometriesFilters * \file otbGeometriesToGeometriesFilter.h @@ -86,13 +86,13 @@ protected: /** Destructor. * Does nothing. */ - virtual ~GeometriesToGeometriesFilter(); + ~GeometriesToGeometriesFilter() ITK_OVERRIDE; /** Processes the input to fill the output. * This is the main processing function. It either works \em in-place or by * \em copying the transformed input \c Feature s into the output. */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: /** \e In-place processing function. @@ -358,7 +358,7 @@ protected: /** Default constructor. */ DefaultGeometriesToGeometriesFilter(); /** Destructor. */ - virtual ~DefaultGeometriesToGeometriesFilter(); + ~DefaultGeometriesToGeometriesFilter() ITK_OVERRIDE; /** * Hook that actually filters an OGR \c Layer. @@ -370,7 +370,7 @@ protected: * \note When <tt>source == destination</tt>, it means this is an \em in-place * filter. */ - virtual void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const; + void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const ITK_OVERRIDE; /** * Hook used to define the fields of the new layer. * \param[in] source source \c Layer -- for reference @@ -379,7 +379,7 @@ protected: * Just forwards the fields definition to the \c FieldTransformationPolicy * inherited from the \c TransformationFunctorDispatcherType. */ - virtual void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const + void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const ITK_OVERRIDE { this->DefineFields(source, dest); } @@ -391,4 +391,4 @@ protected: #include "otbGeometriesToGeometriesFilter.txx" #endif -#endif // __otbGeometriesToGeometriesFilter_h +#endif // otbGeometriesToGeometriesFilter_h diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.txx b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.txx index cfbacea9db8c2ffdc502e561caea6fad3f39ace1..972ad250b05c7797d4ff7a90fa30028a42f71a48 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.txx +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.txx @@ -15,10 +15,13 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbGeometriesToGeometriesFilter_txx +#define otbGeometriesToGeometriesFilter_txx /*===========================================================================*/ /*===============================[ Includes ]================================*/ /*===========================================================================*/ +#include "otbGeometriesToGeometriesFilter.h" /*===========================================================================*/ /*==================[ DefaultGeometriesToGeometriesFilter ]==================*/ @@ -111,3 +114,5 @@ void otb::TransformationFunctorDispatcher<TransformationFunctor,OGRGeometry,Fiel inout.SetFeature(feat); } } + +#endif diff --git a/Modules/Adapters/GdalAdapters/include/otbImageReference.h b/Modules/Adapters/GdalAdapters/include/otbImageReference.h index c9dc8af300deb96af31239279bdd0f4c71666218..8212dccd3163591e3035ec0305f79ffd2da98c98 100644 --- a/Modules/Adapters/GdalAdapters/include/otbImageReference.h +++ b/Modules/Adapters/GdalAdapters/include/otbImageReference.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageReference_h -#define __otbImageReference_h +#ifndef otbImageReference_h +#define otbImageReference_h #include "itkPoint.h" @@ -173,4 +173,4 @@ private: // #include "otbImageReference.txx" #endif -#endif // __otbImageReference_h +#endif // otbImageReference_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGR.h b/Modules/Adapters/GdalAdapters/include/otbOGR.h index b92578e42f0614537fd969d973bc2362e313796e..c24fe24118d8c9977e1ee3287fdacce6f9bb5d68 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGR.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGR.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGR_h -#define __otbOGR_h +#ifndef otbOGR_h +#define otbOGR_h namespace otb { /**\defgroup gGeometry Geometry @@ -43,4 +43,4 @@ namespace otb { */ -#endif // __otbOGR_h +#endif // otbOGR_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h index a16eabcbc564e708ac5e23ba9a16e5fd26d38c1d..c1c9cee5f3729dffcf854e1cba42abf29e45ab5d 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbOGRDataSourceWrapper_h -#define __otbOGRDataSourceWrapper_h +#ifndef otbOGRDataSourceWrapper_h +#define otbOGRDataSourceWrapper_h #include <string> @@ -276,7 +276,7 @@ public: * \return the extent of all layers * \throw itk::ExceptionObject if the layers extents can not be retrieved. */ - OGREnvelope GetGlobalExtent(bool force = false, std::string * outwkt=0) const; + OGREnvelope GetGlobalExtent(bool force = false, std::string * outwkt=ITK_NULLPTR) const; /** Grafts data and information from one data source to another. * \deprecated \c OGRLayer has an embedded input iterator. As a consequence, @@ -286,7 +286,7 @@ public: * meta information of another data source and use the same underlying \c * GDALDataset. */ - virtual void Graft(const itk::DataObject *data); + void Graft(const itk::DataObject *data) ITK_OVERRIDE; /** * Resets current data source with the one in parameter. @@ -323,7 +323,7 @@ public: */ Layer CreateLayer( std::string const& name, - OGRSpatialReference * poSpatialRef = NULL, + OGRSpatialReference * poSpatialRef = ITK_NULLPTR, OGRwkbGeometryType eGType = wkbUnknown, std::vector<std::string> const& papszOptions = std::vector<std::string>()); @@ -363,7 +363,7 @@ public: Layer CopyLayer( Layer & srcLayer, std::string const& newName, - char ** papszOptions = NULL); + char ** papszOptions = ITK_NULLPTR); //@} /**\name Layers access @@ -466,7 +466,7 @@ public: * \see <em>Imperfect C++</em>, Matthew Wilson, Addisson-Welsey, par 24.6 */ operator int boolean ::* () const { - return m_DataSource ? &boolean::i : 0; + return m_DataSource ? &boolean::i : ITK_NULLPTR; } /** Flushes all changes to disk. @@ -510,12 +510,12 @@ protected: /** Destructor. * \post The \c GDALDataset owned is released (if not null). */ - virtual ~DataSource(); + ~DataSource() ITK_OVERRIDE; static Pointer OpenDataSource(std::string const& datasourceName, Modes::type mode); /** Prints self into stream. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** @@ -563,4 +563,4 @@ namespace boost { namespace foreach { #include "otbOGRDataSourceWrapper.txx" #endif -#endif // __otbOGRDataSourceWrapper_h +#endif // otbOGRDataSourceWrapper_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx index 3ae9e89704c1abcd31eeff29bc4ee989fa295315..1571949cef555b9bf881800cc1c6e05fa712f139 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx @@ -21,8 +21,10 @@ * \internal this file is meant to be included by otbOGRDataSourceWrapper.h */ -#ifndef __otbOGRDataSourceWrapper_txx -#define __otbOGRDataSourceWrapper_txx +#ifndef otbOGRDataSourceWrapper_txx +#define otbOGRDataSourceWrapper_txx + +#include "otbOGRDataSourceWrapper.h" /*===========================================================================*/ /*===============================[ Includes ]================================*/ @@ -127,4 +129,4 @@ Value otb::ogr::DataSource::layer_iter<Value>::dereference() const } -#endif // __otbOGRDataSourceWrapper_txx +#endif // otbOGRDataSourceWrapper_txx diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDriversInit.h b/Modules/Adapters/GdalAdapters/include/otbOGRDriversInit.h index 6db81d417aff69558464684efd16260165e7bc90..58ac052a78a20717ecfb6c63949be1f295f6e7ad 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRDriversInit.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRDriversInit.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRDriversInit_h -#define __otbOGRDriversInit_h +#ifndef otbOGRDriversInit_h +#define otbOGRDriversInit_h #include <boost/noncopyable.hpp> @@ -57,4 +57,4 @@ private: } } // end namespace otb::ogr -#endif // __otbOGRDriversInit_h +#endif // otbOGRDriversInit_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h index 593fdd67ebce8f1b7e7eacb54b5f565a8890287f..a88ee2924c455999cb7ab24834d06ed741133b00 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRFeatureWrapper_h -#define __otbOGRFeatureWrapper_h +#ifndef otbOGRFeatureWrapper_h +#define otbOGRFeatureWrapper_h // #include <iosfwd> // std::ostream& #if defined(__GNUC__) || defined(__clang__) @@ -365,4 +365,4 @@ private: #include "otbOGRFeatureWrapper.txx" #endif -#endif // __otbOGRFeatureWrapper_h +#endif // otbOGRFeatureWrapper_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx index fbc144de6a7d0de0d5d86630a94244eacc021015..891b5ae37824461705b6a1dc0319257b02e815b0 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx @@ -15,12 +15,13 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRFeatureWrapper_txx -#define __otbOGRFeatureWrapper_txx +#ifndef otbOGRFeatureWrapper_txx +#define otbOGRFeatureWrapper_txx /*===========================================================================*/ /*===============================[ Includes ]================================*/ /*===========================================================================*/ +#include "otbOGRFeatureWrapper.h" #include <cassert> #include <boost/version.hpp> #if BOOST_VERSION >= 104800 @@ -205,4 +206,4 @@ void otb::ogr::Feature::CheckInvariants() const assert(m_Feature && "OGRFeature can't be null"); } -#endif // __otbOGRFeatureWrapper_txx +#endif // otbOGRFeatureWrapper_txx diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h index 2f1ad0cced2c4f73b0a88e3427d3b1b1f9395c98..8a6ef18401b46d2e145922ceab30a467a47b2c4b 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRFieldWrapper_h -#define __otbOGRFieldWrapper_h +#ifndef otbOGRFieldWrapper_h +#define otbOGRFieldWrapper_h #include <string> #include <boost/shared_ptr.hpp> @@ -212,4 +212,4 @@ private: #include "otbOGRFieldWrapper.txx" #endif -#endif // __otbOGRFieldWrapper_h +#endif // otbOGRFieldWrapper_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx index abd5a669012ba38531fe126e6acc71c01e017ef7..d015f1f8120fae0fab5d8f589dd212227a21af66 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbOGRFieldWrapper_txx -#define __otbOGRFieldWrapper_txx +#ifndef otbOGRFieldWrapper_txx +#define otbOGRFieldWrapper_txx /*===========================================================================*/ /*===============================[ Includes ]================================*/ @@ -67,7 +67,7 @@ namespace otb { namespace ogr { * \since OTB v 3.14.0 */ namespace internal { // namespace internal -using namespace boost::mpl; +namespace mpl = boost::mpl; /**\ingroup GeometryInternals * Associative map of C++ types to OGR field types (\c OGRFieldType). @@ -76,18 +76,18 @@ using namespace boost::mpl; * \todo \c OFTBinary, \c OFTDate, \c OFTTime and \c OFTDateTime are not managed * yet. */ -typedef boost::mpl::map - < pair<int , int_<OFTInteger> > - , pair<std::vector<int> , int_<OFTIntegerList> > - , pair<double , int_<OFTReal> > - , pair<std::vector<double> , int_<OFTRealList> > - , pair<std::string , int_<OFTString> > - , pair<char* , int_<OFTString> > - , pair<char const* , int_<OFTString> > - , pair<std::vector<std::string>, int_<OFTStringList> > +typedef mpl::map + < mpl::pair<int , mpl::int_<OFTInteger> > + , mpl::pair<std::vector<int> , mpl::int_<OFTIntegerList> > + , mpl::pair<double , mpl::int_<OFTReal> > + , mpl::pair<std::vector<double> , mpl::int_<OFTRealList> > + , mpl::pair<std::string , mpl::int_<OFTString> > + , mpl::pair<char* , mpl::int_<OFTString> > + , mpl::pair<char const* , mpl::int_<OFTString> > + , mpl::pair<std::vector<std::string>, mpl::int_<OFTStringList> > #ifdef OTB_USE_GDAL_20 - , pair<GIntBig, int_<OFTInteger64> > - , pair<std::vector<GIntBig>, int_<OFTInteger64List> > + , mpl::pair<GIntBig, mpl::int_<OFTInteger64> > + , mpl::pair<std::vector<GIntBig>, mpl::int_<OFTInteger64List> > #endif // OFTBinary // OFTDate @@ -128,7 +128,7 @@ template * <tt> = T</tt>) * * \internal - * This override is required because of the particular nature of the + * This ITK_OVERRIDE is required because of the particular nature of the * <tt>char**</tt> type chosen by OGR API, plus the fact this is the only * const-correct getter... * \since OTB v 3.14.0 @@ -258,7 +258,7 @@ template * <tt> = T</tt>) * * \internal - * This override is required because of the particular nature of the + * This ITK_OVERRIDE is required because of the particular nature of the * <tt>char**</tt> type chosen by OGR API. * \since OTB v 3.14.0 */ @@ -310,16 +310,16 @@ template * \internal Relies on Boost.MPL * \since OTB v 3.14.0 */ -typedef map - < pair<int_<OFTInteger>, MemberGetterPtr<int, &OGRFeature::GetFieldAsInteger> > - , pair<int_<OFTIntegerList>, MemberContainerGetterPtr<int, &OGRFeature::GetFieldAsIntegerList> > - , pair<int_<OFTReal>, MemberGetterPtr<double, &OGRFeature::GetFieldAsDouble> > - , pair<int_<OFTRealList>, MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> > - , pair<int_<OFTString>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> > - , pair<int_<OFTStringList>, StringListMemberGetterPtr<std::vector<std::string> > > +typedef mpl::map + < mpl::pair<mpl::int_<OFTInteger>, MemberGetterPtr<int, &OGRFeature::GetFieldAsInteger> > + , mpl::pair<mpl::int_<OFTIntegerList>, MemberContainerGetterPtr<int, &OGRFeature::GetFieldAsIntegerList> > + , mpl::pair<mpl::int_<OFTReal>, MemberGetterPtr<double, &OGRFeature::GetFieldAsDouble> > + , mpl::pair<mpl::int_<OFTRealList>, MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> > + , mpl::pair<mpl::int_<OFTString>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> > + , mpl::pair<mpl::int_<OFTStringList>, StringListMemberGetterPtr<std::vector<std::string> > > #ifdef OTB_USE_GDAL_20 - , pair<int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> > - , pair<int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> > + , mpl::pair<mpl::int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> > + , mpl::pair<mpl::int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> > #endif > FieldGetters_Map; @@ -329,16 +329,16 @@ typedef map * \internal Relies on Boost.MPL * \since OTB v 3.14.0 */ -typedef map - < pair<int_<OFTInteger>, MemberSetterPtr<int, &OGRFeature::SetField> > - , pair<int_<OFTIntegerList>, MemberContainerSetterPtr<int, &OGRFeature::SetField> > - , pair<int_<OFTReal>, MemberSetterPtr<double, &OGRFeature::SetField> > - , pair<int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> > - , pair<int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > - , pair<int_<OFTStringList>, StringListMemberSetterPtr<std::vector<std::string> > > +typedef mpl::map + < mpl::pair<mpl::int_<OFTInteger>, MemberSetterPtr<int, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTIntegerList>, MemberContainerSetterPtr<int, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTReal>, MemberSetterPtr<double, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > + , mpl::pair<mpl::int_<OFTStringList>, StringListMemberSetterPtr<std::vector<std::string> > > #ifdef OTB_USE_GDAL_20 - , pair<int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> > - , pair<int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> > + , mpl::pair<mpl::int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> > #endif > FieldSetters_Map; @@ -479,4 +479,4 @@ OGRField & otb::ogr::Field::ogr() return *f; } -#endif // __otbOGRFieldWrapper_txx +#endif // otbOGRFieldWrapper_txx diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRGeometriesVisitor.h b/Modules/Adapters/GdalAdapters/include/otbOGRGeometriesVisitor.h index 9547a5124d893d4829507247f8f078c8e9af6b01..f1f051da905373be859eb0f612d3ae82b9b280fb 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRGeometriesVisitor.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRGeometriesVisitor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRGeometriesVisitor_h -#define __otbOGRGeometriesVisitor_h +#ifndef otbOGRGeometriesVisitor_h +#define otbOGRGeometriesVisitor_h #include <boost/mpl/assert.hpp> #include <boost/type_traits/is_same.hpp> @@ -94,4 +94,4 @@ TResult apply(TGeometry * geometry, TFunctor functor) // #include "otbOGRGeometriesVisitor.txx" #endif -#endif // __otbOGRGeometriesVisitor_h +#endif // otbOGRGeometriesVisitor_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRGeometryWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRGeometryWrapper.h index a25576a023d8b01dbf7eb05f54779f1d5c6b6727..261809f14c0cc387af8a291b23e41f9f7df7cc51 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRGeometryWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRGeometryWrapper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRGeometryWrapper_h -#define __otbOGRGeometryWrapper_h +#ifndef otbOGRGeometryWrapper_h +#define otbOGRGeometryWrapper_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -159,4 +159,4 @@ UniqueGeometryPtr SimplifyPreserveTopology(OGRGeometry const& g, double toleranc // #include "otbOGRGeometryWrapper.txx" #endif -#endif // __otbOGRGeometryWrapper_h +#endif // otbOGRGeometryWrapper_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRHelpers.h b/Modules/Adapters/GdalAdapters/include/otbOGRHelpers.h index 08c23f22aa614cfd117b25c5bda1976005a9c656..157e908f9ab985edfbad07ba4c06eb93743a6ae2 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRHelpers.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRHelpers.h @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRHelpers_h -#define __otbOGRHelpers_h +#ifndef otbOGRHelpers_h +#define otbOGRHelpers_h +#include "itkMacro.h" #include <string> #include <vector> #include <cassert> @@ -76,7 +77,7 @@ struct StringListConverter { m_raw.push_back(b->c_str()); } - m_raw.push_back(0); + m_raw.push_back(ITK_NULLPTR); assert(CSLCount(const_cast <char**>(&m_raw[0])) == static_cast<int>(boost::size(strings))); } /** @@ -85,7 +86,7 @@ struct StringListConverter char ** to_ogr() const { return m_raw.size() == 1 - ? NULL + ? ITK_NULLPTR : const_cast <char**>(&m_raw[0]); } private: @@ -95,4 +96,4 @@ private: } // ogr namespace } // end namespace otb -#endif // __otbOGRHelpers_h +#endif // otbOGRHelpers_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h index ece2c4180bb22a3d370e3d585359c1006ee5c6b0..f43381f083cb430793ef19094134c114bd5e20df 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRLayerWrapper_h -#define __otbOGRLayerWrapper_h +#ifndef otbOGRLayerWrapper_h +#define otbOGRLayerWrapper_h // #include <iosfwd> // std::ostream& #if defined(__GNUC__) || defined(__clang__) @@ -179,7 +179,7 @@ public: * id will be updated (in case it was previously set) * * \throw itk::ExceptionObject if the feature can't be set. - * \pre The Layer need to support <em>OLCRandomWrite</em> capability. + * \pre The Layer needs to support <em>OLCRandomWrite</em> capability. * \sa \c OGRLayer::SetFeature() * \warning Calls to this function may invalidate any feature iterator * previously obtained depending on the actual \c OGRDriver. @@ -230,7 +230,7 @@ public: */ operator int boolean ::* () const { - return m_Layer ? &boolean::i : 0; + return m_Layer ? &boolean::i : ITK_NULLPTR; } /** Access to raw \c OGRLayer. @@ -332,12 +332,12 @@ public: struct enabler {}; public: feature_iter() - : m_Layer(0), m_Crt(0) {} + : m_Layer(ITK_NULLPTR), m_Crt(ITK_NULLPTR) {} explicit feature_iter(otb::ogr::Layer & layer) : m_Layer(&layer), m_Crt(layer.GetNextFeature()) {} template <class OtherValue> feature_iter( feature_iter<OtherValue> const& other, - typename boost::enable_if<boost::is_convertible<OtherValue*,Value*> >::type* = 0 + typename boost::enable_if<boost::is_convertible<OtherValue*,Value*> >::type* = ITK_NULLPTR ) : m_Layer(other.m_Layer), m_Crt(other.m_Crt) {} @@ -548,4 +548,4 @@ inline bool operator!=(Layer const& lhs, Layer const& rhs) // #include "otbLayerWrapper.txx" #endif -#endif // __otbOGRLayerWrapper_h +#endif // otbOGRLayerWrapper_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 6db10d56d416078d3ce0b626ef51213a3f23d11f..7766d516bac2a0d19fe4ca8c4e0c0d4f4d68ff1c 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -15,12 +15,13 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRVersionProxy_h -#define __otbOGRVersionProxy_h +#ifndef otbOGRVersionProxy_h +#define otbOGRVersionProxy_h #include <string> #include <vector> #include "otbConfigure.h" +#include "itkMacro.h" #ifdef OTB_USE_GDAL_20 class GDALDataset; diff --git a/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx b/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx index bec8f7a6eee1fff0d588f025bf98057d190e2729..214aaedc7065d706a5cd6537c27b8b95799ef45d 100644 --- a/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx @@ -216,7 +216,7 @@ void otb::GeometriesToGeometriesFilter::GenerateData(void ) OGRSpatialReference* otb::GeometriesToGeometriesFilter::DoDefineNewLayerSpatialReference( ogr::Layer const& itkNotUsed(source)) const { - return 0; + return ITK_NULLPTR; } /*virtual*/ diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx index 891c22b662caa6df44cf8d1c0b04507dbc4289d2..19a2ee27c388860f3eb65f377891952780cdccc6 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx @@ -40,7 +40,7 @@ /*===========================================================================*/ bool otb::ogr::DataSource::Clear() { - Reset(0); + Reset(ITK_NULLPTR); return true; } @@ -78,6 +78,7 @@ const ExtensionDriverAssociation k_ExtensionDriverMap[] = {".SHP", "ESRI Shapefile"}, {".TAB", "MapInfo File"}, {".GML", "GML"}, + {".GMT", "OGR_GMT"}, {".GPX", "GPX"}, {".SQLITE", "SQLite"}, {".KML", "KML"}, @@ -104,7 +105,7 @@ char const* DeduceDriverName(std::string filename) boost::bind(&ExtensionDriverAssociation::Matches, _1, extension)); if (whichIt == boost::end(k_ExtensionDriverMap)) { - return 0; // nothing found + return ITK_NULLPTR; // nothing found } return whichIt->driverName; } @@ -112,7 +113,7 @@ char const* DeduceDriverName(std::string filename) otb::ogr::DataSource::DataSource() -: m_DataSource(0), +: m_DataSource(ITK_NULLPTR), m_OpenMode(Modes::Update_LayerUpdate), m_FirstModifiableLayerID(0) { @@ -195,10 +196,10 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode) ogr::version_proxy::GDALDatasetType * ds = ogr::version_proxy::Open(datasourceName.c_str(),true); - bool ds_exists = (ds!=NULL); + bool ds_exists = (ds!=ITK_NULLPTR); ogr::version_proxy::Close(ds); - + if (ds_exists && mode == Modes::Overwrite) { @@ -279,7 +280,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( OGRLayer * ol = m_DataSource->CreateLayer( name.c_str(), poSpatialRef, eGType, otb::ogr::StringListConverter(papszOptions).to_ogr()); if (!ol) - { + { itkGenericExceptionMacro(<< "Failed to create the layer <"<<name << "> in the GDALDataset file <" << GetDatasetDescription() <<">: " << CPLGetLastErrorMsg()); @@ -343,7 +344,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( } itkGenericExceptionMacro(<< "GDALDataset opening mode not supported"); - return Layer(0, false); // keep compiler happy + return Layer(ITK_NULLPTR, false); // keep compiler happy } otb::ogr::Layer otb::ogr::DataSource::CopyLayer( @@ -369,7 +370,7 @@ otb::ogr::Layer otb::ogr::DataSource::CopyLayer( OGRLayer * l0 = &srcLayer.ogr(); OGRLayer * ol = m_DataSource->CopyLayer(l0, newName.c_str(), papszOptions); if (!ol) - { + { itkGenericExceptionMacro(<< "Failed to copy the layer <" << srcLayer.GetName() << "> into the new layer <" <<newName << "> in the GDALDataset file <" << GetDatasetDescription() @@ -402,7 +403,7 @@ void otb::ogr::DataSource::DeleteLayer(size_t i) const int nb_layers = GetLayersCount(); if (int(i) >= nb_layers) - { + { itkExceptionMacro(<< "Cannot delete " << i << "th layer in the GDALDataset <" << GetDatasetDescription() << "> as it contains only " << nb_layers << "layers."); } @@ -465,7 +466,7 @@ size_t otb::ogr::DataSource::GetLayerID(std::string const& name) const { int const id = GetLayerIDUnchecked(name); if (id < 0) - { + { itkExceptionMacro( << "Cannot fetch any layer named <" << name << "> in the GDALDataset <" << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); @@ -478,7 +479,7 @@ otb::ogr::Layer otb::ogr::DataSource::GetLayerChecked(size_t i) assert(m_DataSource && "Datasource not initialized"); const int nb_layers = GetLayersCount(); if (int(i) >= nb_layers) - { + { itkExceptionMacro(<< "Cannot fetch " << i << "th layer in the GDALDataset <" << GetDatasetDescription() << "> as it contains only " << nb_layers << "layers."); } @@ -542,7 +543,7 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL( // Cannot use the deleter made for result sets obtained from // GDALDataset::ExecuteSQL because it checks for non-nullity.... // *sigh* - return otb::ogr::Layer(0, modifiable); + return otb::ogr::Layer(ITK_NULLPTR, modifiable); #endif } return otb::ogr::Layer(layer_ptr, *m_DataSource, modifiable); diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx index 24a5bd3d3460419f2bd7a7cf6a6efb566a293662..d7ee47f913e1842f21bb03457d3ba7396215f2c6 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx @@ -43,32 +43,32 @@ BOOST_STATIC_ASSERT(!(boost::is_same< BOOST_STATIC_ASSERT(!(boost::is_same< int, float >::value)); BOOST_STATIC_ASSERT(!(boost::is_same< - int_<OFTReal >::type, - int_<OFTString>::type + mpl::int_<OFTReal >::type, + mpl::int_<OFTString>::type >::value )); BOOST_STATIC_ASSERT(!(boost::is_same< - at<FieldType_Map, float>, - void_ + mpl::at<FieldType_Map, float>, + mpl::void_ >::value )); BOOST_STATIC_ASSERT(!(boost::is_same< - at<FieldType_Map, double>, - int_<OFTReal> + mpl::at<FieldType_Map, double>, + mpl::int_<OFTReal> >::value )); BOOST_STATIC_ASSERT(!(boost::is_same< - at<FieldType_Map, double >::type, - at<FieldType_Map, int >::type + mpl::at<FieldType_Map, double >::type, + mpl::at<FieldType_Map, int >::type >::value )); BOOST_STATIC_ASSERT(( - at<FieldType_Map, double>::type::value != - at<FieldType_Map, int >::type::value + mpl::at<FieldType_Map, double>::type::value != + mpl::at<FieldType_Map, int >::type::value )); BOOST_STATIC_ASSERT(!(boost::is_same< - at<FieldGetters_Map, int_<OFTReal> >, - at<FieldGetters_Map, int_<OFTString> > + mpl::at<FieldGetters_Map, mpl::int_<OFTReal> >, + mpl::at<FieldGetters_Map, mpl::int_<OFTString> > >::value )); diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx index b37eb9be8ef26199efffbecc08ab6e28ae944e96..7b48b0998ccf3f05bc185fb1bce874f5672b371e 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx @@ -270,7 +270,7 @@ OGRSpatialReference const* otb::ogr::Layer::GetSpatialRef() const std::string otb::ogr::Layer::GetProjectionRef() const { assert(m_Layer && "OGRLayer not initialized"); - char * wkt = 0; + char * wkt = ITK_NULLPTR; OGRSpatialReference const* srs = GetSpatialRef(); if(srs) { diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx index 6020ec3ebb0ab995e8098a3a86654497dd2aef4b..8a21d09882a99b96a0c098b5a46181970f9f1717 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx @@ -57,7 +57,7 @@ bool Delete(const char * name) { // Open dataset GDALDatasetType * poDS = Open(name,false); - GDALDriverType * poDriver = NULL; + GDALDriverType * poDriver = ITK_NULLPTR; if(poDS) { poDriver = poDS->GetDriver(); diff --git a/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx b/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx index 6e6eb7301bb9bb27a268e427a6eb0fe36b684294..ff19e550f6de320fc3b77ba95334ab4f3713ae2e 100644 --- a/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx +++ b/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_shp_overwrite) ogr::DataSource::Pointer ds = ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite); BOOST_ASSERT(ds); - ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); l.CreateField(k_f1); @@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_shp_overwrite) ogr::DataSource::Pointer ds = ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite); BOOST_ASSERT(ds); - ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); l.CreateField(k_f1); @@ -473,7 +473,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite) ogr::DataSource::Pointer ds = ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite); BOOST_ASSERT(ds); - ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); l.CreateField(k_f1); @@ -507,7 +507,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite) ogr::DataSource::Pointer ds = ogr::DataSource::New(filename, ogr::DataSource::Modes::Overwrite); BOOST_ASSERT(ds); - ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); l.CreateField(k_f1); @@ -600,7 +600,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_sqlite_overwrite) // Check that we can read the file BOOST_ASSERT(ds); - ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(layer1, ITK_NULLPTR, wkbPoint); BOOST_CHECK_EQUAL(l.GetFeatureCount(true), 0); // OGRFeatureDefn & defn = l.GetLayerDefn(); @@ -675,7 +675,7 @@ BOOST_AUTO_TEST_CASE(Add_n_Del_Fields) ogr::FieldDefn f5(*defn.GetFieldDefn(5)); BOOST_CHECK_EQUAL(f5, k_f5); - BOOST_CHECK_EQUAL(defn.GetFieldDefn(6), (void*)0); + BOOST_CHECK_EQUAL(defn.GetFieldDefn(6), (void*)ITK_NULLPTR); } #if GDAL_VERSION_NUM >= 1900 @@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_new_shp_with_features) const std::string k_shp = "SomeShapeFileWithFeatures"; ogr::DataSource::Pointer ds = ogr::DataSource::New(k_shp+".shp", ogr::DataSource::Modes::Overwrite); - ogr::Layer l = ds -> CreateLayer(k_one, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(k_one, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); @@ -837,7 +837,7 @@ BOOST_AUTO_TEST_CASE(Local_Geometries) BOOST_AUTO_TEST_CASE(Add_n_Read_Geometries) { ogr::DataSource::Pointer ds = ogr::DataSource::New(); - ogr::Layer l = ds -> CreateLayer(k_one, 0, wkbPoint); + ogr::Layer l = ds -> CreateLayer(k_one, ITK_NULLPTR, wkbPoint); OGRFeatureDefn & defn = l.GetLayerDefn(); for (int u=-10; u!=10; ++u) { diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h index 19312472cf5fc2f1efbb4ad02b531a2381a21b5c..778e20acdae650fe0dbc597bf56b8e3b62f5f341 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbDEMConvertAdapter_h -#define __otbDEMConvertAdapter_h +#ifndef otbDEMConvertAdapter_h +#define otbDEMConvertAdapter_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -44,7 +44,7 @@ public: protected: DEMConvertAdapter(); - virtual ~DEMConvertAdapter(); + ~DEMConvertAdapter() ITK_OVERRIDE; private: DEMConvertAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h index c15b815b8f8b24e952729b76aabf6c6679c02699..75a94d9e850f64449a7088a6bab4a638355352e7 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDEMHandler_h -#define __otbDEMHandler_h +#ifndef otbDEMHandler_h +#define otbDEMHandler_h #include <iostream> #include <cstdio> @@ -165,9 +165,9 @@ public: protected: DEMHandler(); - virtual ~DEMHandler() {} + ~DEMHandler() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; // Ossim does not allow retrieving the geoid file path // We therefore must keep it on our side diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h index f3734093599b82f496f34fdf79c1adfe3e551521..f8c3548078a900a29137e24bd154784397b5481e 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDateTimeAdapter_h -#define __otbDateTimeAdapter_h +#ifndef otbDateTimeAdapter_h +#define otbDateTimeAdapter_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -81,7 +81,7 @@ public: protected: DateTimeAdapter(); - virtual ~DateTimeAdapter(); + ~DateTimeAdapter() ITK_OVERRIDE; private: DateTimeAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h index 9764e772cac6c101e13c6963441ee8d8bb2017ba..29def359e008cdfe78e0786eb990ff6f49453517 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEllipsoidAdapter_h -#define __otbEllipsoidAdapter_h +#ifndef otbEllipsoidAdapter_h +#define otbEllipsoidAdapter_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -62,7 +62,7 @@ public: protected: EllipsoidAdapter(); - virtual ~EllipsoidAdapter(); + ~EllipsoidAdapter() ITK_OVERRIDE; private: EllipsoidAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h b/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h index d14e2f41f8b722e838a5178582bc1742dc4a5a98..e46abcb177444bdf5d3f803fb9eb373a3bafab8d 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFilterFunctionValues_h -#define __otbFilterFunctionValues_h +#ifndef otbFilterFunctionValues_h +#define otbFilterFunctionValues_h #include <vector> #include <iostream> @@ -98,10 +98,10 @@ protected: /** Constructor */ FilterFunctionValues(); /** Destructor */ - ~FilterFunctionValues() {} + ~FilterFunctionValues() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FilterFunctionValues(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h index e4395106f9613be992e476213ab5c83c29d5acb5..5ba88992bc3f6f5e99381d1926276831ad2d3c56 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometricSarSensorModelAdapter_h -#define __otbGeometricSarSensorModelAdapter_h +#ifndef otbGeometricSarSensorModelAdapter_h +#define otbGeometricSarSensorModelAdapter_h #include <vector> @@ -73,7 +73,7 @@ public: protected: GeometricSarSensorModelAdapter(); - virtual ~GeometricSarSensorModelAdapter(); + ~GeometricSarSensorModelAdapter() ITK_OVERRIDE; private: GeometricSarSensorModelAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h b/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h index 868a13a1dfe3484cf82d0c1e2ae27f67abc0480a..112c907ab6c27d701839f4a2cfedacdee94166cf 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageKeywordlist_h -#define __otbImageKeywordlist_h +#ifndef otbImageKeywordlist_h +#define otbImageKeywordlist_h #include <iostream> #include <map> @@ -95,7 +95,12 @@ public: { m_Keywordlist.clear(); } - + + KeywordlistMapSizeType Empty() const + { + return m_Keywordlist.empty(); + } + KeywordlistMapSizeType GetSize(void) const { return m_Keywordlist.size(); @@ -113,7 +118,7 @@ public: virtual void AddKey(const std::string& key, const std::string& value); virtual void convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const; - + /** try to convert the image keywordlist into a GDALRpcInfo structure * return true if successful, false otherwise */ virtual bool convertToGDALRPC(GDALRPCInfo &rpc) const; @@ -164,4 +169,4 @@ ImageKeywordlist } //namespace otb -#endif // __otbImageKeywordlist_h +#endif // otbImageKeywordlist_h diff --git a/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h index b935f8e7e00c05e397f47113594c3b2bf5cc3c20..4cbcb6968d6c34930773cafd7a3fc6ef3ae3c50a 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapProjectionAdapter_h -#define __otbMapProjectionAdapter_h +#ifndef otbMapProjectionAdapter_h +#define otbMapProjectionAdapter_h #include <string> #include <map> @@ -82,7 +82,7 @@ public: protected: MapProjectionAdapter(); - virtual ~MapProjectionAdapter(); + ~MapProjectionAdapter() ITK_OVERRIDE; private: MapProjectionAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h b/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h index d1a031b5532feb5113d6b981e994082af458c488..4eb938e392493e63090a7f148b26140fb18e5143 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMetaDataKey_h -#define __otbMetaDataKey_h +#ifndef otbMetaDataKey_h +#define otbMetaDataKey_h #include <string> #include <vector> diff --git a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h index ea0535417b3357872a60aa5f5da027df92720e91..85e7b755b84eddf375d48b63f1d5544996525205 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPlatformPositionAdapter_h -#define __otbPlatformPositionAdapter_h +#ifndef otbPlatformPositionAdapter_h +#define otbPlatformPositionAdapter_h #include <vector> @@ -73,7 +73,7 @@ public: protected: PlatformPositionAdapter(); - virtual ~PlatformPositionAdapter(); + ~PlatformPositionAdapter() ITK_OVERRIDE; private: PlatformPositionAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbRPCSolverAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbRPCSolverAdapter.h index 3fe64808ca9136aec5556320ac3d115824f5b388..4a21143cc70c24f068a38ef2cf394a6e9f3c5529 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbRPCSolverAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbRPCSolverAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRPCSolverAdapter_h -#define __otbRPCSolverAdapter_h +#ifndef otbRPCSolverAdapter_h +#define otbRPCSolverAdapter_h #include <vector> diff --git a/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h index 25808e93d4c4a7ae6679b99180dbfea498638807..34dacd74fca78771f1d18365c97cfe04749d80a7 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSensorModelAdapter_h -#define __otbSensorModelAdapter_h +#ifndef otbSensorModelAdapter_h +#define otbSensorModelAdapter_h #include "otbDEMHandler.h" @@ -48,7 +48,7 @@ class SensorModelAdapter: public itk::Object { public: /** Standard class typedefs. */ - typedef SensorModelAdapter Self; + typedef SensorModelAdapter Self; typedef itk::Object Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -98,7 +98,7 @@ public: double Optimize(); /** Is sensor model valid method. return false if the m_SensorModel is null*/ - bool IsValidSensorModel(); + bool IsValidSensorModel() const; /** Read geom file and instanciate sensor model */ bool ReadGeomFile(const std::string & infile); @@ -108,7 +108,7 @@ public: protected: SensorModelAdapter(); - virtual ~SensorModelAdapter(); + ~SensorModelAdapter() ITK_OVERRIDE; private: SensorModelAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx index c351930bd2c748d0fade932c4e586c19ed506eea..4144f07eaa1bce5e9affb68b9c359b7fb23ca58a 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx @@ -89,7 +89,7 @@ int DEMConvertAdapter::Convert(std::string tempFilename, std::string output) ih->initialize(); ossimRefPtr<ossimImageSource> source = ih.get(); - ossimRefPtr<ossimBandSelector> bs = 0; + ossimRefPtr<ossimBandSelector> bs = ITK_NULLPTR; // Get the image rectangle for the rrLevel selected. diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx index e5dd39cc7773ddae6fa2a9dd53c85e94434c0a82..64eaef2f8008fb7859481b05877914c69dfc505a 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx @@ -48,15 +48,15 @@ namespace otb { /** Initialize the singleton */ -DEMHandler::Pointer DEMHandler::m_Singleton = NULL; +DEMHandler::Pointer DEMHandler::m_Singleton = ITK_NULLPTR; DEMHandler::Pointer DEMHandler::Instance() { - if(m_Singleton.GetPointer() == NULL) + if(m_Singleton.GetPointer() == ITK_NULLPTR) { m_Singleton = itk::ObjectFactory<Self>::Create(); - if(m_Singleton.GetPointer() == NULL) + if(m_Singleton.GetPointer() == ITK_NULLPTR) { m_Singleton = new DEMHandler; } @@ -149,7 +149,7 @@ bool DEMHandler ::OpenGeoidFile(const char* geoidFile) { - if ((ossimGeoidManager::instance()->findGeoidByShortName("geoid1996")) == 0) + if ((ossimGeoidManager::instance()->findGeoidByShortName("geoid1996")) == ITK_NULLPTR) { otbMsgDevMacro(<< "Opening geoid: " << geoidFile); ossimFilename geoid(geoidFile); diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDateTimeAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDateTimeAdapter.cxx index 16dd4ecc5d9a7c9f4e66cfd9e5d984e0c40409b5..e4e086db444fe1434b296170474a024cddce136d 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbDateTimeAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbDateTimeAdapter.cxx @@ -29,7 +29,7 @@ DateTimeAdapter::DateTimeAdapter() DateTimeAdapter::~DateTimeAdapter() { - if (m_LocalTm != NULL) + if (m_LocalTm != ITK_NULLPTR) { delete m_LocalTm; } diff --git a/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx index 3141cb4de36964507773c862d8bc72d82f837bb2..363afa67d03886e222fbc107c9b3948341814a34 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx @@ -41,7 +41,7 @@ EllipsoidAdapter::EllipsoidAdapter() EllipsoidAdapter::~EllipsoidAdapter() { - if (m_Ellipsoid != NULL) + if (m_Ellipsoid != ITK_NULLPTR) { delete m_Ellipsoid; } diff --git a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx index b0fa03d0626aa833632640b906418fd06a14ccd3..983aef60cca3602acc3592956bc4c1aabf1dc9ff 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx @@ -42,16 +42,16 @@ namespace otb { GeometricSarSensorModelAdapter::GeometricSarSensorModelAdapter(): - m_SensorModel(NULL) + m_SensorModel(ITK_NULLPTR) { } GeometricSarSensorModelAdapter::~GeometricSarSensorModelAdapter() { - if (m_SensorModel != NULL) + if (m_SensorModel != ITK_NULLPTR) { delete m_SensorModel; - m_SensorModel = NULL; + m_SensorModel = ITK_NULLPTR; } } diff --git a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx index 1e506fd35c5839d9756109dca179e8ddf98cf301..d674378361b7f8e7e49b5dbd8cd6628692b766e7 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx @@ -47,6 +47,8 @@ #endif #include "otbSensorModelAdapter.h" +#include <memory> +#include <boost/scoped_ptr.hpp> namespace otb { @@ -84,15 +86,7 @@ void ImageKeywordlist:: SetKeywordlist(const ossimKeywordlist& kwl) { - m_Keywordlist.clear(); - for (ossimKeywordlist::KeywordMap::const_iterator it = kwl.getMap().begin(); - it != kwl.getMap().end(); - ++it) - { - std::string first(it->first); - std::string second(it->second); - m_Keywordlist[first] = second; - } + m_Keywordlist = kwl.getMap(); } const std::string& @@ -118,7 +112,6 @@ HasKey(const std::string& key) const { KeywordlistMap::const_iterator it = m_Keywordlist.find(key); - return (it != m_Keywordlist.end()); } @@ -140,14 +133,7 @@ void ImageKeywordlist:: convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const { - ossimKeywordlist::KeywordMap ossimMap; - for(KeywordlistMap::const_iterator it = m_Keywordlist.begin(); - it != m_Keywordlist.end(); - ++it) - { - ossimMap[it->first] = it->second; - } - kwl.getMap() = ossimMap; + kwl.getMap() = m_Keywordlist; } bool @@ -242,12 +228,13 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) /****************************************************/ /* First try : test the OSSIM plugins factory */ /****************************************************/ + { /** Before, the pluginfactory was tested if the ossim one returned false. - But in the case TSX, the images tif were considered as ossimQuickbirdTiffTileSource - thus a TSX tif image wasn't read with TSX Model. We don't use the ossimRegisteryFactory - because the default include factory contains ossimQuickbirdTiffTileSource. */ - ossimProjection * projection = ossimplugins::ossimPluginProjectionFactory::instance() - ->createProjection(ossimFilename(filename.c_str()), 0); + But in the case TSX, the images tif were considered as ossimQuickbirdTiffTileSource + thus a TSX tif image wasn't read with TSX Model. We don't use the ossimRegisteryFactory + because the default include factory contains ossimQuickbirdTiffTileSource. */ + boost::scoped_ptr<ossimProjection> projection(ossimplugins::ossimPluginProjectionFactory::instance() + ->createProjection(ossimFilename(filename.c_str()), 0)); if (projection) { @@ -255,20 +242,16 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) hasMetaData = projection->saveState(geom_kwl); otb_kwl.SetKeywordlist(geom_kwl); - - // Free memory - delete projection; - projection = 0; - } + } /***********************************************/ /* Second try : the OSSIM projection factory */ /***********************************************/ if (!hasMetaData) { - ossimImageHandler* handler = ossimImageHandlerRegistry::instance() - ->open(ossimFilename(filename.c_str())); + boost::scoped_ptr<ossimImageHandler> handler(ossimImageHandlerRegistry::instance() + ->open(ossimFilename(filename.c_str()))); if (handler) { otbMsgDevMacro(<< "OSSIM Open Image SUCCESS ! "); @@ -279,26 +262,25 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) ossimRefPtr<ossimImageGeometry> geom = handler->getImageGeometry(); if (geom.valid()) { - projection = geom->getProjection(); + ossimProjection const* projection = geom->getProjection(); if (projection) { hasMetaData = projection->saveState(geom_kwl); - } - } - // if the handler has found a sensor model, copy the tags found - if (hasMetaData && dynamic_cast<ossimSensorModel*>(projection)) - { - otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! "); - otb_kwl.SetKeywordlist(geom_kwl); - } - else - { - hasMetaData = false; - } - // Free memory - delete handler; - } + // if the handler has found a sensor model, copy the tags found + if (hasMetaData && dynamic_cast<ossimSensorModel const*>(projection)) + { + otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! "); + otb_kwl.SetKeywordlist(geom_kwl); + // geom_kwl.print(std::cout); + } + else + { + hasMetaData = false; + } + } // projection + } // geom.valid + } // handler } /**********************************************************/ @@ -433,15 +415,15 @@ ReadGeometryFromRPCTag(const std::string& filename) // try to use GeoTiff RPC tag if present. // Warning : RPC in subdatasets are not supported - GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), NULL); - if(identifyDriverH == NULL) + GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), ITK_NULLPTR); + if(identifyDriverH == ITK_NULLPTR) { // If no driver has identified the dataset, don't try to open it and exit return otb_kwl; } GDALDatasetH datasetH = GDALOpen(filename.c_str(), GA_ReadOnly); - if (datasetH != NULL) + if (datasetH != ITK_NULLPTR) { GDALDataset* dataset = static_cast<GDALDataset*>(datasetH); GDALRPCInfo rpcStruct; diff --git a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx index b61797163a4b2ff108b793bb0643e1b0f9be4137..8e161bfb3b1253a59b43bc6bb30319dcef5f6326 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx @@ -73,13 +73,13 @@ namespace otb { MapProjectionAdapter::MapProjectionAdapter(): - m_MapProjection(NULL), m_ProjectionRefWkt(""), m_ReinstanciateProjection(true) + m_MapProjection(ITK_NULLPTR), m_ProjectionRefWkt(""), m_ReinstanciateProjection(true) { } MapProjectionAdapter::~MapProjectionAdapter() { - if (m_MapProjection != NULL) + if (m_MapProjection != ITK_NULLPTR) { delete m_MapProjection; } @@ -88,7 +88,7 @@ MapProjectionAdapter::~MapProjectionAdapter() MapProjectionAdapter::InternalMapProjectionPointer MapProjectionAdapter::GetMapProjection() { itkDebugMacro("returning MapProjection address " << this->m_MapProjection); - if ((m_ReinstanciateProjection) || (m_MapProjection == NULL)) + if ((m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR)) { this->InstanciateProjection(); } @@ -99,7 +99,7 @@ MapProjectionAdapter::InternalMapProjectionPointer MapProjectionAdapter::GetMapP MapProjectionAdapter::InternalMapProjectionConstPointer MapProjectionAdapter::GetMapProjection() const { itkDebugMacro("returning MapProjection address " << this->m_MapProjection); - if ((m_ReinstanciateProjection) || (m_MapProjection == NULL)) + if ((m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR)) { itkExceptionMacro(<< "m_MapProjection not up-to-date, call InstanciateProjection() first"); } @@ -111,7 +111,7 @@ std::string MapProjectionAdapter::GetWkt() const { ossimKeywordlist kwl; this->GetMapProjection(); - if (m_MapProjection == NULL) + if (m_MapProjection == ITK_NULLPTR) { return ""; } @@ -217,7 +217,7 @@ std::string MapProjectionAdapter::GetParameter(const std::string& key) const bool MapProjectionAdapter::InstanciateProjection() { - if ((this->m_ReinstanciateProjection) || (m_MapProjection == NULL)) + if ((this->m_ReinstanciateProjection) || (m_MapProjection == ITK_NULLPTR)) { ossimKeywordlist kwl; ossimOgcWktTranslator wktTranslator; @@ -248,7 +248,7 @@ bool MapProjectionAdapter::InstanciateProjection() // ossimUtmProjection for example) ossimString name(m_ProjectionRefWkt); m_MapProjection = ossimMapProjectionFactory::instance()->createProjection(name); - if (m_MapProjection == NULL) + if (m_MapProjection == ITK_NULLPTR) { // Trying directly extending the m_ProjectionRefWkt (convert the // Utm to ossimUtmProjection for example) @@ -258,7 +258,7 @@ bool MapProjectionAdapter::InstanciateProjection() m_MapProjection = ossimMapProjectionFactory::instance()->createProjection(extendedName); } - if (m_MapProjection == NULL) return false; + if (m_MapProjection == ITK_NULLPTR) return false; } @@ -272,7 +272,7 @@ bool MapProjectionAdapter::InstanciateProjection() void MapProjectionAdapter::InverseTransform(double x, double y, double z, double& lon, double& lat, double& h) { - if (m_MapProjection == NULL) + if (m_MapProjection == ITK_NULLPTR) { otbMsgDevMacro(<< "WARNING: Using identity"); lon = x; @@ -296,7 +296,7 @@ void MapProjectionAdapter::InverseTransform(double x, double y, double z, void MapProjectionAdapter::ForwardTransform(double lon, double lat, double h, double& x, double& y, double& z) { - if (m_MapProjection == NULL) + if (m_MapProjection == ITK_NULLPTR) { otbMsgDevMacro(<< "WARNING: Using identity"); x = lon; diff --git a/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx index 3853baa4801bbd8155e451365d10793957aa7ec4..a0ccace85c320d42144e821dff61f348827d2484 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx @@ -30,16 +30,16 @@ namespace otb { PlatformPositionAdapter::PlatformPositionAdapter(): - m_SensorModel(NULL) + m_SensorModel(ITK_NULLPTR) { } PlatformPositionAdapter::~PlatformPositionAdapter() { - if (m_SensorModel != NULL) + if (m_SensorModel != ITK_NULLPTR) { delete m_SensorModel; - m_SensorModel = NULL; + m_SensorModel = ITK_NULLPTR; } } diff --git a/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx index 8f9ef695293f9e3ca61624fd34c6f8774e32969f..2e60780e7401d624ee6ff2a393fb8d932ff5950a 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx @@ -51,7 +51,7 @@ namespace otb { SensorModelAdapter::SensorModelAdapter(): - m_SensorModel(NULL), m_TiePoints(NULL) // FIXME keeping the original value but... + m_SensorModel(ITK_NULLPTR), m_TiePoints(ITK_NULLPTR) // FIXME keeping the original value but... { m_DEMHandler = DEMHandler::Instance(); m_TiePoints = new ossimTieGptSet(); @@ -59,16 +59,8 @@ SensorModelAdapter::SensorModelAdapter(): SensorModelAdapter::~SensorModelAdapter() { - if (m_SensorModel != NULL) - { - delete m_SensorModel; - m_SensorModel = NULL; - } - if(m_TiePoints!=NULL) - { - delete m_TiePoints; - m_TiePoints = NULL; - } + delete m_SensorModel; + delete m_TiePoints; } void SensorModelAdapter::CreateProjection(const ImageKeywordlist& image_kwl) @@ -80,28 +72,21 @@ void SensorModelAdapter::CreateProjection(const ImageKeywordlist& image_kwl) otbMsgDevMacro(<< "* type: " << geom.find("type")); m_SensorModel = ossimSensorModelFactory::instance()->createProjection(geom); - if (m_SensorModel == NULL) + if (m_SensorModel == ITK_NULLPTR) { - m_SensorModel = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom); + m_SensorModel = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom); } } -bool SensorModelAdapter::IsValidSensorModel() +bool SensorModelAdapter::IsValidSensorModel() const { - if (m_SensorModel == NULL) - { - return false; - } - else - { - return true; - } + return m_SensorModel != ITK_NULLPTR; } void SensorModelAdapter::ForwardTransformPoint(double x, double y, double z, double& lon, double& lat, double& h) const { - if (this->m_SensorModel == NULL) + if (this->m_SensorModel == ITK_NULLPTR) { itkExceptionMacro(<< "ForwardTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } @@ -120,7 +105,7 @@ void SensorModelAdapter::ForwardTransformPoint(double x, double y, double z, void SensorModelAdapter::ForwardTransformPoint(double x, double y, double& lon, double& lat, double& h) const { - if (this->m_SensorModel == NULL) + if (this->m_SensorModel == ITK_NULLPTR) { itkExceptionMacro(<< "ForwardTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } @@ -139,7 +124,7 @@ void SensorModelAdapter::ForwardTransformPoint(double x, double y, void SensorModelAdapter::InverseTransformPoint(double lon, double lat, double h, double& x, double& y, double& z) const { - if (this->m_SensorModel == NULL) + if (this->m_SensorModel == ITK_NULLPTR) { itkExceptionMacro(<< "InverseTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } @@ -159,7 +144,7 @@ void SensorModelAdapter::InverseTransformPoint(double lon, double lat, double h, void SensorModelAdapter::InverseTransformPoint(double lon, double lat, double& x, double& y, double& z) const { - if (this->m_SensorModel == NULL) + if (this->m_SensorModel == ITK_NULLPTR) { itkExceptionMacro(<< "InverseTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } @@ -213,35 +198,29 @@ void SensorModelAdapter::ClearTiePoints() double SensorModelAdapter::Optimize() { double precision = 0.; - // If tie points and model are allocated - if(m_SensorModel != NULL) + if(m_SensorModel != ITK_NULLPTR) { // try to retrieve a sensor model - ossimSensorModel * sensorModel = NULL; - sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel); + ossimSensorModel * sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel); - ossimRpcProjection * simpleRpcModel = NULL; - simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel); + ossimRpcProjection * simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel); //Handle expections - if ( (sensorModel == NULL ) && (simpleRpcModel == NULL ) ) - itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed."); + if ( (sensorModel == ITK_NULLPTR ) && (simpleRpcModel == ITK_NULLPTR ) ) + itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed."); - - if(sensorModel != NULL ) + if(sensorModel != ITK_NULLPTR ) { - // Call optimize fit - precision = sensorModel->optimizeFit(*m_TiePoints); + // Call optimize fit + precision = sensorModel->optimizeFit(*m_TiePoints); + } + else if (simpleRpcModel != ITK_NULLPTR) + { + // Call optimize fit + precision = simpleRpcModel->optimizeFit(*m_TiePoints); } - else if (simpleRpcModel != NULL) - { - // Call optimize fit - precision = simpleRpcModel->optimizeFit(*m_TiePoints); - } - - } // Return the precision @@ -256,48 +235,45 @@ bool SensorModelAdapter::ReadGeomFile(const std::string & infile) m_SensorModel = ossimSensorModelFactory::instance()->createProjection(geom); - if (m_SensorModel == NULL) + if (m_SensorModel == ITK_NULLPTR) { m_SensorModel = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom); } - return (m_SensorModel != NULL); + // otbMsgDevMacro(<< "ReadGeomFile("<<geom<<") -> " << m_SensorModel); + return (m_SensorModel != ITK_NULLPTR); } bool SensorModelAdapter::WriteGeomFile(const std::string & outfile) { // If tie points and model are allocated - if(m_SensorModel != NULL) + if(m_SensorModel != ITK_NULLPTR) { // try to retrieve a sensor model - ossimSensorModel * sensorModel = NULL; - sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel); + ossimSensorModel * sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel); - ossimRpcProjection * simpleRpcModel = NULL; - simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel); + ossimRpcProjection * simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel); - //Handle expections - if ( (sensorModel == NULL ) && (simpleRpcModel == NULL ) ) - itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed."); + //Handle expections + if ( (sensorModel == ITK_NULLPTR ) && (simpleRpcModel == ITK_NULLPTR ) ) + itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed."); - - ossimKeywordlist geom; + ossimKeywordlist geom; bool success = false; - if(sensorModel != NULL ) + if(sensorModel != ITK_NULLPTR ) { - // Save state - success = sensorModel->saveState(geom); + // Save state + success = sensorModel->saveState(geom); + } + else if (simpleRpcModel != ITK_NULLPTR) + { + // Save state + success = simpleRpcModel->saveState(geom); } - else if (simpleRpcModel != NULL) - { - // Save state - success = simpleRpcModel->saveState(geom); - } - if(success) { - return geom.write(outfile.c_str()); + return geom.write(outfile.c_str()); } } return false; diff --git a/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h b/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h index b48656787175268e9dd1d3507f1e50c282cef23c..507ac2028137092a4c6c23b1bccfbcf204b144ea 100644 --- a/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h +++ b/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbThreads_h -#define __otbThreads_h +#ifndef otbThreads_h +#define otbThreads_h namespace otb { diff --git a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx index cacfcc8141e013dc7f46854ff5baa7a76bfd56dc..d84f93db64f3b8ebe37e786bf963e293d5f2431b 100644 --- a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx +++ b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx @@ -40,7 +40,7 @@ public: itkTypeMacro(MultivariateAlterationDetector, otb::Wrapper::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("MultivariateAlterationDetector"); SetDescription("Multivariate Alteration Detector"); @@ -104,11 +104,11 @@ private: SetDocExampleParameterValue("out", "detectedChangeImage.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { typedef otb::MultivariateAlterationDetectorImageFilter< FloatVectorImageType, diff --git a/Modules/Applications/AppClassification/app/CMakeLists.txt b/Modules/Applications/AppClassification/app/CMakeLists.txt index a748f4272a9f672fb8c58a6a108872228caa68a0..3f46b917da7fa5c1e6d2e17623635bb6cbcd6e38 100644 --- a/Modules/Applications/AppClassification/app/CMakeLists.txt +++ b/Modules/Applications/AppClassification/app/CMakeLists.txt @@ -45,6 +45,12 @@ otb_create_application( SOURCES otbTrainOGRLayersClassifier.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) +otb_create_application( + NAME TrainVectorClassifier + SOURCES otbTrainVectorClassifier.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + + otb_create_application( NAME ComputeConfusionMatrix SOURCES otbComputeConfusionMatrix.cxx @@ -109,3 +115,13 @@ otb_create_application( NAME PolygonClassStatistics SOURCES otbPolygonClassStatistics.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + +otb_create_application( + NAME SampleSelection + SOURCES otbSampleSelection.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + +otb_create_application( + NAME SampleExtraction + SOURCES otbSampleExtraction.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES}) diff --git a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx index e535991b5eb6fa4d3f38b6d2e66869526c497b54..4652d5556255407d811c591fb0729add8e462b90 100644 --- a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx +++ b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx @@ -53,7 +53,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ClassificationMapRegularization"); SetDescription("Filters the input labeled image using Majority Voting in a ball shaped neighbordhood."); @@ -111,12 +111,12 @@ private: SetDocExampleParameterValue("ip.undecidedlabel", "7"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Majority Voting m_NeighMajVotingFilter = NeighborhoodMajorityVotingFilterType::New(); diff --git a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx index 3aed87bd664e084610aee0decdc16415ae71076b..f3205381dd9ef5e2cdb6b8e466a8e1f8ad99d39f 100644 --- a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx @@ -71,7 +71,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ComputeConfusionMatrix"); SetDescription("Computes the confusion matrix of a classification"); @@ -132,7 +132,7 @@ private: SetDocExampleParameterValue("nodatalabel","255"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } @@ -209,7 +209,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { Int32ImageType* input = this->GetParameterInt32Image("in"); @@ -288,27 +288,17 @@ private: if ((labelRef != nodata) && (labelProd != nodata)) { // If the current labels have not been added to their respective mapOfClasses yet - if (mapOfClassesRef.count(labelRef) == 0) + if (mapOfClassesRef.insert(MapOfClassesType::value_type(labelRef, itLabelRef)).second) { - mapOfClassesRef[labelRef] = itLabelRef; ++itLabelRef; } - if (mapOfClassesProd.count(labelProd) == 0) + if (mapOfClassesProd.insert(MapOfClassesType::value_type(labelProd, itLabelProd)).second) { - mapOfClassesProd[labelProd] = itLabelProd; ++itLabelProd; } // Filling of m_Matrix - if (m_Matrix[labelRef][labelProd] == 0) - { - m_Matrix[labelRef][labelProd] = 1; - } - else - { - m_Matrix[labelRef][labelProd]++; - } - + m_Matrix[labelRef][labelProd]++; } // END if ((labelRef != nodata) && (labelProd != nodata)) ++itRef; ++itInput; @@ -325,9 +315,11 @@ private: // Filling ossHeaderRefLabels for the output file ossHeaderRefLabels << commentRefStr; + + MapOfClassesType::iterator itMapOfClassesRefEnd = mapOfClassesRef.end(); itMapOfClassesRef = mapOfClassesRef.begin(); int indexLabelRef = 0; - while (itMapOfClassesRef != mapOfClassesRef.end()) + while (itMapOfClassesRef != itMapOfClassesRefEnd) { // labels labelRef of mapOfClassesRef are already sorted labelRef = itMapOfClassesRef->first; @@ -338,7 +330,7 @@ private: ossHeaderRefLabels << labelRef; ++itMapOfClassesRef; - if (itMapOfClassesRef != mapOfClassesRef.end()) + if (itMapOfClassesRef != itMapOfClassesRefEnd) { ossHeaderRefLabels << separatorChar; } @@ -352,9 +344,10 @@ private: // Filling ossHeaderProdLabels for the output file ossHeaderProdLabels << commentProdStr; + MapOfClassesType::iterator itMapOfClassesProdEnd = mapOfClassesProd.end(); itMapOfClassesProd = mapOfClassesProd.begin(); int indexLabelProd = 0; - while (itMapOfClassesProd != mapOfClassesProd.end()) + while (itMapOfClassesProd != itMapOfClassesProdEnd) { // labels labelProd of mapOfClassesProd are already sorted labelProd = itMapOfClassesProd->first; @@ -365,7 +358,7 @@ private: ossHeaderProdLabels << labelProd; ++itMapOfClassesProd; - if (itMapOfClassesProd != mapOfClassesProd.end()) + if (itMapOfClassesProd != itMapOfClassesProdEnd) { ossHeaderProdLabels << separatorChar; } @@ -402,13 +395,13 @@ private: // Initialization of m_MatrixLOG m_MatrixLOG.SetSize(nbClassesRef, nbClassesRef); m_MatrixLOG.Fill(0); - for (itMapOfClassesRef = mapOfClassesRef.begin(); itMapOfClassesRef != mapOfClassesRef.end(); ++itMapOfClassesRef) + for (itMapOfClassesRef = mapOfClassesRef.begin(); itMapOfClassesRef != itMapOfClassesRefEnd; ++itMapOfClassesRef) { // labels labelRef of mapOfClassesRef are already sorted labelRef = itMapOfClassesRef->first; indexLabelProd = 0; - for (itMapOfClassesProd = mapOfClassesProd.begin(); itMapOfClassesProd != mapOfClassesProd.end(); ++itMapOfClassesProd) + for (itMapOfClassesProd = mapOfClassesProd.begin(); itMapOfClassesProd != itMapOfClassesProdEnd; ++itMapOfClassesProd) { // labels labelProd of mapOfClassesProd are already sorted labelProd = itMapOfClassesProd->first; @@ -458,7 +451,7 @@ private: confMatMeasurements->SetConfusionMatrix(m_MatrixLOG); confMatMeasurements->Compute(); - for (itMapOfClassesRef = mapOfClassesRef.begin(); itMapOfClassesRef != mapOfClassesRef.end(); ++itMapOfClassesRef) + for (itMapOfClassesRef = mapOfClassesRef.begin(); itMapOfClassesRef != itMapOfClassesRefEnd; ++itMapOfClassesRef) { labelRef = itMapOfClassesRef->first; indexLabelRef = itMapOfClassesRef->second; diff --git a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx index f48ec15b740efb567106090e87eb7b0ccb56b439..990d41ba1a9d7fb4e80ad69ee4ef1c7db3d9a96c 100644 --- a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx @@ -42,7 +42,7 @@ public: itkTypeMacro(ComputeImagesStatistics, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ComputeImagesStatistics"); SetDescription("Computes global mean and standard deviation for each band from a set of images and optionally saves the results in an XML file."); @@ -71,12 +71,12 @@ private: SetDocExampleParameterValue("out", "EstimateImageStatisticsQB1.xml"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //Statistics estimator typedef otb::StreamingStatisticsVectorImageFilter<FloatVectorImageType> StreamingStatisticsVImageFilterType; diff --git a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx index 096a70cc4c1dfb13060de010a1bd451d2fec8732..5ef1ccaed7b02d6521b7f87f5773b817f74ee766 100644 --- a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx @@ -42,7 +42,7 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ComputeOGRLayersFeaturesStatistics"); SetDescription("Compute statistics of the features in a set of OGR Layers"); @@ -70,14 +70,14 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if ( HasValue("inshp") ) { std::string shapefile = GetParameterString("inshp"); otb::ogr::DataSource::Pointer ogrDS; - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); OGRSpatialReference oSRS(""); std::vector<std::string> options; @@ -101,7 +101,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { clock_t tic = clock(); @@ -130,7 +130,7 @@ private: featValue.push_back(mv); feature = layer.ogr().GetNextFeature(); - goesOn = feature.addr() != 0; + goesOn = feature.addr() != ITK_NULLPTR; } MeasurementType mean; mean.SetSize(nbFeatures); diff --git a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx index 8d588ae7b1a6e32a4dbf5d7734a918d0b16202f6..ff97cd686cdfc98f575136d0ca8a77261cc7d445 100644 --- a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx +++ b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx @@ -73,7 +73,7 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ComputePolylineFeatureFromImage"); SetDescription("This application compute for each studied polyline, contained in the input VectorData, the chosen descriptors."); @@ -111,12 +111,12 @@ private: SetDocExampleParameterValue("out", "PolylineFeatureFromImage_LI_NONDVI_gt.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Vector Data into Image projection FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx index cd7c9883616e5514719ca1242b7089c357992e73..dd9d347a1fc42ecfc0a190384dfeaa1b321e6b25 100644 --- a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx +++ b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx @@ -48,12 +48,12 @@ typedef itk::AmoebaOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; -void Execute(itk::Object *caller, const itk::EventObject & event) +void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE { Execute( (const itk::Object *)caller, event); } -void Execute(const itk::Object * object, const itk::EventObject & event) +void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE { OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >( object ); @@ -112,7 +112,7 @@ public: itkTypeMacro(DSFuzzyModelEstimation, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("DSFuzzyModelEstimation"); SetDescription("Estimate feature fuzzy model parameters using 2 vector data (ground truth samples and wrong samples)."); @@ -179,7 +179,7 @@ private: SetDocExampleParameterValue("out", "DSFuzzyModelEstimation.xml"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent @@ -189,7 +189,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //Instantiate @@ -414,7 +414,7 @@ private: { // An error has occurred in the optimization. // Update the parameters - otbAppLogFATAL("ERROR: Exception Catched : "<< err.GetDescription() << std::endl + otbAppLogFATAL("ERROR: Exception Caught : "<< err.GetDescription() << std::endl << "numberOfIterations : " << m_Optimizer->GetOptimizer()->get_num_evaluations() << std::endl << "Results : " << m_Optimizer->GetCurrentPosition() << std::endl); } diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx index 3eac231b527e3c257ac611d54a26beb56cf337c1..7b52a9026b4870c26f8897c0d808e79a1006f18e 100644 --- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx +++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx @@ -90,7 +90,7 @@ public: itkTypeMacro(FusionOfClassifications, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("FusionOfClassifications"); SetDescription("Fuses several classifications maps of the same image on the basis of class labels."); @@ -168,7 +168,7 @@ private: SetDocExampleParameterValue("out","classification_fused.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } @@ -280,7 +280,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Clear any previous filter m_Filters.clear(); diff --git a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx index 2a33fb63e53b79af092def8328e4e0681796ebfa..1a3c2943fe2562154642827acbcd820c3f49a30c 100644 --- a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx @@ -61,8 +61,15 @@ public: typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType; typedef ClassificationFilterType::ConfidenceImageType ConfidenceImageType; +protected: + + ~ImageClassifier() ITK_OVERRIDE + { + MachineLearningModelFactoryType::CleanFactories(); + } + private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ImageClassifier"); SetDescription("Performs a classification of the input image according to a model file."); @@ -119,12 +126,12 @@ private: SetDocExampleParameterValue("out", "clLabeledImageQB1.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index 3d42261c525a277654cfbabaee7f4183e3da7adf..e713cda0a8d193fb7231dba8cdb5c7c850b26c28 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -164,7 +164,7 @@ public: itkTypeMacro(KMeansClassification, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("KMeansClassification"); SetDescription("Unsupervised KMeans image classification"); @@ -218,7 +218,7 @@ private: SetDocExampleParameterValue("out", "ClassificationFilterOutput.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // test of input image // if (HasValue("in")) @@ -251,7 +251,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { GetLogger()->Debug("Entering DoExecute\n"); diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx index 27b56434f64437218be777ea225a519064c96c35..b1161dddd7a2fd9e8bd66bf930f299aa7ca29e46 100644 --- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx @@ -51,7 +51,7 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("OGRLayerClassifier"); SetDescription("Classify an OGR layer based on a machine learning model and a list of features to consider."); @@ -89,14 +89,14 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if ( HasValue("inshp") ) { std::string shapefile = GetParameterString("inshp"); otb::ogr::DataSource::Pointer ogrDS; - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); OGRSpatialReference oSRS(""); std::vector<std::string> options; @@ -120,7 +120,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { #ifdef OTB_USE_LIBSVM @@ -168,7 +168,7 @@ private: input->PushBack(mv); target->PushBack(feature.ogr().GetFieldAsInteger("class")); feature = layer.ogr().GetNextFeature(); - goesOn = feature.addr() != 0; + goesOn = feature.addr() != ITK_NULLPTR; } ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); @@ -210,7 +210,7 @@ private: feature2.ogr().SetField(GetParameterString("cfield").c_str(),(int)labelListSample->GetMeasurementVector(count)[0]); layer2.SetFeature(feature2); feature2 = layer2.ogr().GetNextFeature(); - goesOn2 = feature2.addr() != 0; + goesOn2 = feature2.addr() != ITK_NULLPTR; count++; } diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index 50f699b13792ff0a2119c1a0b6e22cfdc2ad49f8..c20c799b3e75c11970108f1255dd8b10b0d4b28a 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -20,6 +20,8 @@ #include "otbOGRDataToClassStatisticsFilter.h" #include "otbStatisticsXMLFileWriter.h" +#include "otbGeometriesProjectionFilter.h" +#include "otbGeometriesSet.h" namespace otb { @@ -45,13 +47,17 @@ public: typedef otb::StatisticsXMLFileWriter<FloatVectorImageType::PixelType> StatWriterType; + typedef otb::GeometriesSet GeometriesType; + + typedef otb::GeometriesProjectionFilter ProjectionFilterType; + private: PolygonClassStatistics() { } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("PolygonClassStatistics"); SetDescription("Computes statistics on a training polygon set."); @@ -108,26 +114,65 @@ private: SetDocExampleParameterValue("out","polygonStat.xml"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(this->GetParameterString("vec")); std::string fieldName = this->GetParameterString("field"); + // Reproject geometries + FloatVectorImageType::Pointer inputImg = this->GetParameterImage("in"); + std::string imageProjectionRef = inputImg->GetProjectionRef(); + FloatVectorImageType::ImageKeywordlistType imageKwl = + inputImg->GetImageKeywordlist(); + std::string vectorProjectionRef = + vectors->GetLayer(GetParameterInt("layer")).GetProjectionRef(); + + otb::ogr::DataSource::Pointer reprojVector = vectors; + GeometriesType::Pointer inputGeomSet; + ProjectionFilterType::Pointer geometriesProjFilter; + GeometriesType::Pointer outputGeomSet; + bool doReproj = true; + // don't reproject for these cases + if (vectorProjectionRef.empty() || + (imageProjectionRef == vectorProjectionRef) || + (imageProjectionRef.empty() && imageKwl.GetSize() == 0)) + doReproj = false; + + if (doReproj) + { + inputGeomSet = GeometriesType::New(vectors); + reprojVector = otb::ogr::DataSource::New(); + outputGeomSet = GeometriesType::New(reprojVector); + // Filter instanciation + geometriesProjFilter = ProjectionFilterType::New(); + geometriesProjFilter->SetInput(inputGeomSet); + if (imageProjectionRef.empty()) + { + geometriesProjFilter->SetOutputKeywordList(inputImg->GetImageKeywordlist()); // nec qd capteur + } + geometriesProjFilter->SetOutputProjectionRef(imageProjectionRef); + geometriesProjFilter->SetOutput(outputGeomSet); + otbAppLogINFO("Reprojecting input vectors..."); + geometriesProjFilter->Update(); + } + FilterType::Pointer filter = FilterType::New(); filter->SetInput(this->GetParameterImage("in")); if (IsParameterEnabled("mask") && HasValue("mask")) { filter->SetMask(this->GetParameterImage<UInt8ImageType>("mask")); } - filter->SetOGRData(vectors); + filter->SetOGRData(reprojVector); filter->SetFieldName(fieldName); filter->SetLayerIndex(this->GetParameterInt("layer")); + + AddProcess(filter->GetStreamer(),"Analyse polygons..."); filter->Update(); FilterType::ClassCountMapType &classCount = filter->GetClassCountOutput()->Get(); diff --git a/Modules/Applications/AppClassification/app/otbPredictRegression.cxx b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx index 80b1f2ce2f47d2949b9e108ab550ab1ee2d9ee9c..d36ba169b9f5a897f1f1d420de903a47f2e17188 100644 --- a/Modules/Applications/AppClassification/app/otbPredictRegression.cxx +++ b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx @@ -102,8 +102,15 @@ public: typedef ClassificationFilterType::LabelType LabelType; typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType; +protected: + + ~PredictRegression() ITK_OVERRIDE + { + MachineLearningModelFactoryType::CleanFactories(); + } + private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("PredictRegression"); SetDescription("Performs a prediction of the input image according to a regression model file."); @@ -170,12 +177,12 @@ private: SetDocExampleParameterValue("out", "clLabeledImageQB1.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx index de5dc07beaf9ff492b241f74ef2cd0e57d781456..d7f90750fc158ea06ccab2de176fdca0290c1f46 100644 --- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx @@ -73,7 +73,7 @@ private: m_Classifier = ClassificationFilterType::New(); } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SOMClassification"); SetDescription("SOM image classification."); @@ -173,12 +173,12 @@ private: SetDocExampleParameterValue("iv", "0"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // initiating random number generation itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer diff --git a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1cc0f910231585c8b829e65c58e43200f852014 --- /dev/null +++ b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx @@ -0,0 +1,174 @@ +/*========================================================================= + + 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 "otbWrapperApplication.h" +#include "otbWrapperApplicationFactory.h" + +#include "otbImageSampleExtractorFilter.h" + +namespace otb +{ +namespace Wrapper +{ + +class SampleExtraction : public Application +{ +public: + /** Standard class typedefs. */ + typedef SampleExtraction Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + + itkTypeMacro(SampleExtraction, otb::Application); + + /** Filters typedef */ + typedef otb::ImageSampleExtractorFilter<FloatVectorImageType> FilterType; + +private: + SampleExtraction() {} + + void DoInit() + { + SetName("SampleExtraction"); + SetDescription("Extracts samples values from an image."); + + // Documentation + SetDocName("Sample Extraction"); + SetDocLongDescription("The application extracts samples values from an" + "image using positions contained in a vector data file. "); + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso(" "); + + AddDocTag(Tags::Learning); + + AddParameter(ParameterType_InputImage, "in", "InputImage"); + SetParameterDescription("in", "Support image"); + + AddParameter(ParameterType_InputFilename, "vec", "Input sampling positions"); + SetParameterDescription("vec","Vector data file containing sampling" + "positions. (OGR format)"); + + AddParameter(ParameterType_OutputFilename, "out", "Output samples"); + SetParameterDescription("out","Output vector data file storing sample" + "values (OGR format). If not given, the input vector data file is updated"); + MandatoryOff("out"); + + AddParameter(ParameterType_Choice, "outfield", "Output field names"); + SetParameterDescription("outfield", "Choice between naming method for output fields"); + + AddChoice("outfield.prefix","Use a prefix and an incremental counter"); + SetParameterDescription("outfield.prefix","Use a prefix and an incremental counter"); + + AddParameter(ParameterType_String, "outfield.prefix.name", "Output field prefix"); + SetParameterDescription("outfield.prefix.name","Prefix used to form the field names that" + "will contain the extracted values."); + SetParameterString("outfield.prefix.name", "value_"); + + AddChoice("outfield.list","Use the given name list"); + SetParameterDescription("outfield.list","Use the given name list"); + + AddParameter(ParameterType_StringList, "outfield.list.names", "Output field names"); + SetParameterDescription("outfield.list.names","Full list of output field names."); + + AddParameter(ParameterType_String, "field", "Field Name"); + SetParameterDescription("field","Name of the field carrying the class" + "name in the input vectors. This field is copied to output."); + MandatoryOff("field"); + SetParameterString("field", "class"); + + AddParameter(ParameterType_Int, "layer", "Layer Index"); + SetParameterDescription("layer", "Layer index to read in the input vector file."); + MandatoryOff("layer"); + SetDefaultParameterInt("layer",0); + + AddRAMParameter(); + + // Doc example parameter settings + SetDocExampleParameterValue("in", "support_image.tif"); + SetDocExampleParameterValue("vec", "sample_positions.sqlite"); + SetDocExampleParameterValue("outfield","prefix"); + SetDocExampleParameterValue("outfield.prefix.name","band_"); + SetDocExampleParameterValue("field", "label"); + SetDocExampleParameterValue("out","sample_values.sqlite"); + } + + void DoUpdateParameters() + { + // Nothing to do + } + + void DoExecute() + { + ogr::DataSource::Pointer vectors; + ogr::DataSource::Pointer output; + if (IsParameterEnabled("out") && HasValue("out")) + { + vectors = ogr::DataSource::New(this->GetParameterString("vec")); + output = ogr::DataSource::New(this->GetParameterString("out"), + ogr::DataSource::Modes::Overwrite); + } + else + { + // Update mode + vectors = ogr::DataSource::New(this->GetParameterString("vec"), + ogr::DataSource::Modes::Update_LayerUpdate); + output = vectors; + } + + std::vector<std::string> nameList; + std::string namePrefix(""); + if (this->GetParameterString("outfield").compare("prefix") == 0) + { + namePrefix = this->GetParameterString("outfield.prefix.name"); + } + else if (this->GetParameterString("outfield").compare("list") == 0) + { + nameList = this->GetParameterStringList("outfield.list.names"); + } + else + { + otbAppLogFATAL("Unknown output field option : " << this->GetParameterString("outfield")); + } + + + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(this->GetParameterImage("in")); + filter->SetLayerIndex(this->GetParameterInt("layer")); + filter->SetSamplePositions(vectors); + filter->SetOutputSamples(output); + filter->SetClassFieldName(this->GetParameterString("field")); + filter->SetOutputFieldPrefix(namePrefix); + filter->SetOutputFieldNames(nameList); + filter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + + + AddProcess(filter->GetStreamer(),"Extracting sample values..."); + filter->Update(); + output->SyncToDisk(); + } + +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::SampleExtraction) diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6b17b0f0b92e5dfd138425c3b4e7ec044c233772 --- /dev/null +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -0,0 +1,432 @@ +/*========================================================================= + + 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 "otbWrapperApplication.h" +#include "otbWrapperApplicationFactory.h" +#include "otbSamplingRateCalculator.h" +#include "otbOGRDataToSamplePositionFilter.h" +#include "otbStatisticsXMLFileReader.h" +#include "otbRandomSampler.h" +#include "otbGeometriesProjectionFilter.h" +#include "otbGeometriesSet.h" + +namespace otb +{ +namespace Wrapper +{ + +class SampleSelection : public Application +{ +public: + /** Standard class typedefs. */ + typedef SampleSelection Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + + itkTypeMacro(SampleSelection, otb::Application); + + /** typedef */ + typedef otb::OGRDataToSamplePositionFilter< + FloatVectorImageType, + UInt8ImageType, + otb::PeriodicSampler> PeriodicSamplerType; + typedef otb::OGRDataToSamplePositionFilter< + FloatVectorImageType, + UInt8ImageType, + otb::RandomSampler> RandomSamplerType; + typedef otb::SamplingRateCalculator RateCalculatorType; + + typedef std::map<std::string, unsigned long> ClassCountMapType; + typedef RateCalculatorType::MapRateType MapRateType; + typedef itk::VariableLengthVector<float> MeasurementType; + typedef otb::StatisticsXMLFileReader<MeasurementType> XMLReaderType; + + typedef otb::GeometriesSet GeometriesType; + + typedef otb::GeometriesProjectionFilter ProjectionFilterType; + +private: + SampleSelection() + { + m_Periodic = PeriodicSamplerType::New(); + m_Random = RandomSamplerType::New(); + m_ReaderStat = XMLReaderType::New(); + m_RateCalculator = RateCalculatorType::New(); + } + + void DoInit() + { + SetName("SampleSelection"); + SetDescription("Selects samples from a training vector data set."); + + // Documentation + SetDocName("Sample Selection"); + SetDocLongDescription("The application selects a set of samples from geometries " + "intended for training (they should have a field giving the associated " + "class). \n\nFirst of all, the geometries must be analyzed by the PolygonClassStatistics application " + "to compute statistics about the geometries, which are summarized in an xml file. " + "\nThen, this xml file must be given as input to this application (parameter instats).\n\n" + "The input support image and the input training vectors shall be given in " + "parameters 'in' and 'vec' respectively. Only the sampling grid (origin, size, spacing)" + "will be read in the input image.\n" + "There are several strategies to select samples (parameter strategy) :\n" + " - smallest (default) : select the same number of sample in each class\n" + " so that the smallest one is fully sampled.\n" + " - constant : select the same number of samples N in each class\n" + " (with N below or equal to the size of the smallest class).\n" + " - byclass : set the required number for each class manually, with an input CSV file\n" + " (first column is class name, second one is the required samples number).\n" + "There is also a choice on the sampling type to performs :\n" + " - periodic : select samples uniformly distributed\n" + " - random : select samples randomly distributed\n" + "Once the strategy and type are selected, the application outputs samples positions" + "(parameter out).\n\n" + + "The other parameters to look at are :\n" + " - layer : index specifying from which layer to pick geometries.\n" + " - field : set the field name containing the class.\n" + " - mask : an optional raster mask can be used to discard samples.\n" + " - outrates : allows outputting a CSV file that summarizes the sampling rates for each class.\n" + + "\nAs with the PolygonClassStatistics application, different types of geometry are supported : " + "polygons, lines, points. \nThe behavior of this application is different for each type of geometry :\n" + " - polygon: select points whose center is inside the polygon\n" + " - lines : select points intersecting the line\n" + " - points : select closest point to the provided point\n"); + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso(" "); + + AddDocTag(Tags::Learning); + + AddParameter(ParameterType_InputImage, "in", "InputImage"); + SetParameterDescription("in", "Support image that will be classified"); + + AddParameter(ParameterType_InputImage, "mask", "InputMask"); + SetParameterDescription("mask", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics)"); + MandatoryOff("mask"); + + AddParameter(ParameterType_InputFilename, "vec", "Input vectors"); + SetParameterDescription("vec","Input geometries to analyse"); + + AddParameter(ParameterType_OutputFilename, "out", "Output vectors"); + SetParameterDescription("out","Output resampled geometries"); + + AddParameter(ParameterType_InputFilename, "instats", "Input Statistics"); + SetParameterDescription("instats","Input file storing statistics (XML format)"); + + AddParameter(ParameterType_OutputFilename, "outrates", "Output rates"); + SetParameterDescription("outrates","Output rates (CSV formatted)"); + MandatoryOff("outrates"); + + AddParameter(ParameterType_Choice, "sampler", "Sampler type"); + SetParameterDescription("sampler", "Type of sampling (periodic, pattern based, random)"); + + AddChoice("sampler.periodic","Periodic sampler"); + SetParameterDescription("sampler.periodic","Takes samples regularly spaced"); + + AddParameter(ParameterType_Int, "sampler.periodic.jitter","Jitter amplitude"); + SetParameterDescription("sampler.periodic.jitter", "Jitter amplitude added during sample selection (0 = no jitter)"); + SetDefaultParameterInt("sampler.periodic.jitter",0); + MandatoryOff("sampler.periodic.jitter"); + + AddChoice("sampler.random","Random sampler"); + SetParameterDescription("sampler.random","The positions to select are randomly shuffled."); + + AddParameter(ParameterType_Choice, "strategy", "Sampling strategy"); + + AddChoice("strategy.byclass","Set samples count for each class"); + SetParameterDescription("strategy.byclass","Set samples count for each class"); + + AddParameter(ParameterType_InputFilename, "strategy.byclass.in", "Number of samples by class"); + SetParameterDescription("strategy.byclass.in", "Number of samples by class " + "(CSV format with class name in 1st column and required samples in the 2nd."); + + AddChoice("strategy.constant","Set the same samples counts for all classes"); + SetParameterDescription("strategy.constant","Set the same samples counts for all classes"); + + AddParameter(ParameterType_Int, "strategy.constant.nb", "Number of samples for all classes"); + SetParameterDescription("strategy.constant.nb", "Number of samples for all classes"); + + AddChoice("strategy.smallest","Set same number of samples for all classes, with the smallest class fully sampled"); + SetParameterDescription("strategy.smallest","Set same number of samples for all classes, with the smallest class fully sampled"); + + AddChoice("strategy.all","Take all samples"); + SetParameterDescription("strategy.all","Take all samples"); + + // Default strategy : smallest + SetParameterString("strategy","smallest"); + + AddParameter(ParameterType_String, "field", "Field Name"); + SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); + MandatoryOff("field"); + SetParameterString("field", "class"); + + AddParameter(ParameterType_Int, "layer", "Layer Index"); + SetParameterDescription("layer", "Layer index to read in the input vector file."); + MandatoryOff("layer"); + SetDefaultParameterInt("layer",0); + + AddRAMParameter(); + + AddRANDParameter(); + + // Doc example parameter settings + SetDocExampleParameterValue("in", "support_image.tif"); + SetDocExampleParameterValue("vec", "variousVectors.sqlite"); + SetDocExampleParameterValue("field", "label"); + SetDocExampleParameterValue("instats","apTvClPolygonClassStatisticsOut.xml"); + SetDocExampleParameterValue("out","resampledVectors.sqlite"); + } + + void DoUpdateParameters() + { + } + + ClassCountMapType ReadRequiredSamples(std::string filename) + { + ClassCountMapType output; + std::ifstream ifs(filename.c_str()); + + if (ifs) + { + std::string line; + std::string sep(""); + + while(!ifs.eof()) + { + std::getline(ifs,line); + if (line.empty()) continue; + std::string::size_type pos = line.find_first_not_of(" \t"); + if (pos != std::string::npos && line[pos] == '#') continue; + + if (sep.size() == 0) + { + // Try to detect the separator + std::string separators("\t;,"); + for (unsigned int k=0 ; k<separators.size() ; k++) + { + std::vector<itksys::String> words = itksys::SystemTools::SplitString(line,separators[k]); + if (words.size() >= 2) + { + sep.push_back(separators[k]); + break; + } + } + if (sep.size() == 0) continue; + } + // parse the line + std::vector<itksys::String> parts = itksys::SystemTools::SplitString(line,sep[0]); + if (parts.size() >= 2) + { + std::string::size_type pos1 = parts[0].find_first_not_of(" \t"); + std::string::size_type pos2 = parts[0].find_last_not_of(" \t"); + std::string::size_type pos3 = parts[1].find_first_not_of(" \t"); + std::string::size_type pos4 = parts[1].find_last_not_of(" \t"); + if (pos1 != std::string::npos && pos3 != std::string::npos) + { + std::string name = parts[0].substr(pos1, pos2 - pos1 + 1); + std::string value = parts[1].substr(pos3, pos4 - pos3 + 1); + output[name] = boost::lexical_cast<unsigned long>(value); + } + } + } + ifs.close(); + } + else + { + otbAppLogFATAL(<< " Couldn't open " << filename); + } + return output; + } + + void DoExecute() + { + // Clear state + m_RateCalculator->ClearRates(); + m_Periodic->GetFilter()->ClearOutputs(); + m_Random->GetFilter()->ClearOutputs(); + + // Setup ram + m_Periodic->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + m_Random->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + + m_ReaderStat->SetFileName(this->GetParameterString("instats")); + ClassCountMapType classCount = m_ReaderStat->GetStatisticMapByName<ClassCountMapType>("samplesPerClass"); + m_RateCalculator->SetClassCount(classCount); + + switch (this->GetParameterInt("strategy")) + { + // byclass + case 0: + { + otbAppLogINFO("Sampling strategy : set number of samples for each class"); + ClassCountMapType requiredCount = + this->ReadRequiredSamples(this->GetParameterString("strategy.byclass.in")); + m_RateCalculator->SetNbOfSamplesByClass(requiredCount); + } + break; + // constant + case 1: + { + otbAppLogINFO("Sampling strategy : set a constant number of samples for all classes"); + m_RateCalculator->SetNbOfSamplesAllClasses(GetParameterInt("strategy.constant.nb")); + } + break; + // smallest class + case 2: + { + otbAppLogINFO("Sampling strategy : fit the number of samples based on the smallest class"); + m_RateCalculator->SetMinimumNbOfSamplesByClass(); + } + break; + // all samples + case 3: + { + otbAppLogINFO("Sampling strategy : take all samples"); + m_RateCalculator->SetAllSamples(); + } + break; + default: + otbAppLogFATAL("Strategy mode unknown :"<<this->GetParameterString("strategy")); + break; + } + + if (IsParameterEnabled("outrates") && HasValue("outrates")) + { + m_RateCalculator->Write(this->GetParameterString("outrates")); + } + + MapRateType rates = m_RateCalculator->GetRatesByClass(); + std::ostringstream oss; + oss << " className requiredSamples totalSamples rate" << std::endl; + MapRateType::const_iterator itRates = rates.begin(); + for(; itRates != rates.end(); ++itRates) + { + otb::SamplingRateCalculator::TripletType tpt = itRates->second; + oss << itRates->first << "\t" << tpt.Required << "\t" << tpt.Tot << "\t" << tpt.Rate << std::endl; + } + otbAppLogINFO("Sampling rates : " << oss.str()); + + // Open input geometries + otb::ogr::DataSource::Pointer vectors = + otb::ogr::DataSource::New(this->GetParameterString("vec")); + + // Reproject geometries + FloatVectorImageType::Pointer inputImg = this->GetParameterImage("in"); + std::string imageProjectionRef = inputImg->GetProjectionRef(); + FloatVectorImageType::ImageKeywordlistType imageKwl = + inputImg->GetImageKeywordlist(); + std::string vectorProjectionRef = + vectors->GetLayer(GetParameterInt("layer")).GetProjectionRef(); + + otb::ogr::DataSource::Pointer reprojVector = vectors; + GeometriesType::Pointer inputGeomSet; + ProjectionFilterType::Pointer geometriesProjFilter; + GeometriesType::Pointer outputGeomSet; + bool doReproj = true; + // don't reproject for these cases + if (vectorProjectionRef.empty() || + (imageProjectionRef == vectorProjectionRef) || + (imageProjectionRef.empty() && imageKwl.GetSize() == 0)) + doReproj = false; + + if (doReproj) + { + inputGeomSet = GeometriesType::New(vectors); + reprojVector = otb::ogr::DataSource::New(); + outputGeomSet = GeometriesType::New(reprojVector); + // Filter instanciation + geometriesProjFilter = ProjectionFilterType::New(); + geometriesProjFilter->SetInput(inputGeomSet); + if (imageProjectionRef.empty()) + { + geometriesProjFilter->SetOutputKeywordList(inputImg->GetImageKeywordlist()); // nec qd capteur + } + geometriesProjFilter->SetOutputProjectionRef(imageProjectionRef); + geometriesProjFilter->SetOutput(outputGeomSet); + otbAppLogINFO("Reprojecting input vectors..."); + geometriesProjFilter->Update(); + } + + // Create output dataset for sample positions + otb::ogr::DataSource::Pointer outputSamples = + otb::ogr::DataSource::New(this->GetParameterString("out"),otb::ogr::DataSource::Modes::Overwrite); + + switch (this->GetParameterInt("sampler")) + { + // periodic + case 0: + { + PeriodicSamplerType::SamplerParameterType param; + param.Offset = 0; + param.MaxJitter = this->GetParameterInt("sampler.periodic.jitter"); + + m_Periodic->SetInput(this->GetParameterImage("in")); + m_Periodic->SetOGRData(reprojVector); + m_Periodic->SetOutputPositionContainerAndRates(outputSamples, rates); + m_Periodic->SetFieldName(this->GetParameterString("field")); + m_Periodic->SetLayerIndex(this->GetParameterInt("layer")); + m_Periodic->SetSamplerParameters(param); + if (IsParameterEnabled("mask") && HasValue("mask")) + { + m_Periodic->SetMask(this->GetParameterImage<UInt8ImageType>("mask")); + } + m_Periodic->GetStreamer()->SetAutomaticTiledStreaming(this->GetParameterInt("ram")); + AddProcess(m_Periodic->GetStreamer(),"Selecting positions with periodic sampler..."); + m_Periodic->Update(); + } + break; + // random + case 1: + { + m_Random->SetInput(this->GetParameterImage("in")); + m_Random->SetOGRData(reprojVector); + m_Random->SetOutputPositionContainerAndRates(outputSamples, rates); + m_Random->SetFieldName(this->GetParameterString("field")); + m_Random->SetLayerIndex(this->GetParameterInt("layer")); + if (IsParameterEnabled("mask") && HasValue("mask")) + { + m_Random->SetMask(this->GetParameterImage<UInt8ImageType>("mask")); + } + m_Random->GetStreamer()->SetAutomaticTiledStreaming(this->GetParameterInt("ram")); + AddProcess(m_Random->GetStreamer(),"Selecting positions with random sampler..."); + m_Random->Update(); + } + break; + default: + otbAppLogFATAL("Sampler type unknown :"<<this->GetParameterString("sampler")); + break; + } + } + + RateCalculatorType::Pointer m_RateCalculator; + + PeriodicSamplerType::Pointer m_Periodic; + RandomSamplerType::Pointer m_Random; + + XMLReaderType::Pointer m_ReaderStat; +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::SampleSelection) diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx index 3ffecfbb0e6f750070f120493d45b9c8b9434c57..87d80a7a4410f96dbb2e0af7880c066c19e23b28 100644 --- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx @@ -102,7 +102,7 @@ protected: private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("TrainImagesClassifier"); SetDescription( @@ -199,7 +199,7 @@ void DoInit() SetDocExampleParameterValue("io.confmatout", "svmConfusionMatrixQB1.csv"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } @@ -275,7 +275,7 @@ void LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc) otbAppLogINFO("Confusion matrix (rows = reference labels, columns = produced labels):\n" << os.str()); } -void DoExecute() +void DoExecute() ITK_OVERRIDE { //Create training and validation for list samples and label list samples ConcatenateLabelListSampleFilterType::Pointer concatenateTrainingLabels = diff --git a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx index 96dfef756458d2185f5553c2d264a5ccf001b014..b461ac2a89f97fda7b2b2308d6e6f08ce5834964 100644 --- a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx @@ -51,13 +51,16 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("TrainOGRLayersClassifier"); SetDescription("Train a SVM classifier based on labeled geometries and a list of features to consider."); - SetDocName("TrainOGRLayersClassifier"); - SetDocLongDescription("This application trains a SVM classifier based on labeled geometries and a list of features to consider for classification."); + SetDocName("TrainOGRLayersClassifier (DEPRECATED)"); + SetDocLongDescription("This application trains a SVM classifier based on " + "labeled geometries and a list of features to consider for classification." + " This application is deprecated, prefer using TrainVectorClassifier which" + " offers access to all the classifiers."); SetDocLimitations("Experimental. For now only shapefiles are supported. Tuning of SVM classifier is not available."); SetDocAuthors("David Youssefi during internship at CNES"); SetDocSeeAlso("OGRLayerClassifier,ComputeOGRLayersFeaturesStatistics"); @@ -88,14 +91,14 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if ( HasValue("inshp") ) { std::string shapefile = GetParameterString("inshp"); otb::ogr::DataSource::Pointer ogrDS; - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); OGRSpatialReference oSRS(""); std::vector<std::string> options; @@ -119,7 +122,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { #ifdef OTB_USE_LIBSVM clock_t tic = clock(); @@ -170,7 +173,7 @@ private: target->PushBack(feature.ogr().GetFieldAsInteger(GetParameterString("cfield").c_str())); } feature = layer.ogr().GetNextFeature(); - goesOn = feature.addr() != 0; + goesOn = feature.addr() != ITK_NULLPTR; } ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); diff --git a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx index 01a8398323a82ca8625ccb5056c50086b51892e3..3039d44a0a053a5a84787683258069c16575b27c 100644 --- a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx @@ -95,7 +95,7 @@ protected: private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("TrainRegression"); SetDescription( @@ -172,7 +172,7 @@ void DoInit() SetDocExampleParameterValue("classifier", "libsvm"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { if (HasValue("io.csv") && IsParameterEnabled("io.csv")) { @@ -253,7 +253,7 @@ void ParseCSVPredictors(std::string path, ListSampleType* outputList) ifs.close(); } -void DoExecute() +void DoExecute() ITK_OVERRIDE { GetLogger()->Debug("Entering DoExecute\n"); //Create training and validation for list samples and label list samples diff --git a/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ee4c3a8f92724f359378fd8dcc4e5ce6227c7658 --- /dev/null +++ b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx @@ -0,0 +1,520 @@ +/*========================================================================= + 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 "otbWrapperApplication.h" +#include "otbWrapperApplicationFactory.h" + +#include "otbLearningApplicationBase.h" + +#include "otbOGRDataSourceWrapper.h" +#include "otbOGRFeatureWrapper.h" +#include "otbStatisticsXMLFileWriter.h" + +#include "itkVariableLengthVector.h" +#include "otbStatisticsXMLFileReader.h" + +#include "itkListSample.h" +#include "otbShiftScaleSampleListFilter.h" + +// Validation +#include "otbConfusionMatrixCalculator.h" + +#include <algorithm> +#include <locale> + +namespace otb +{ +namespace Wrapper +{ + +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) + { + return !std::isalnum(c); + } + +class TrainVectorClassifier : public LearningApplicationBase<float,int> +{ +public: + typedef TrainVectorClassifier Self; + typedef LearningApplicationBase<float, int> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + itkNewMacro(Self) + + itkTypeMacro(Self, Superclass) + + typedef Superclass::SampleType SampleType; + typedef Superclass::ListSampleType ListSampleType; + typedef Superclass::TargetListSampleType TargetListSampleType; + typedef Superclass::SampleImageType SampleImageType; + + typedef double ValueType; + typedef itk::VariableLengthVector<ValueType> MeasurementType; + + typedef otb::StatisticsXMLFileReader<SampleType> StatisticsReader; + + typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType; + + // Estimate performance on validation sample + typedef otb::ConfusionMatrixCalculator<TargetListSampleType, TargetListSampleType> ConfusionMatrixCalculatorType; + typedef ConfusionMatrixCalculatorType::ConfusionMatrixType ConfusionMatrixType; + typedef ConfusionMatrixCalculatorType::MapOfIndicesType MapOfIndicesType; + typedef ConfusionMatrixCalculatorType::ClassLabelType ClassLabelType; + +private: + void DoInit() + { + SetName("TrainVectorClassifier"); + SetDescription("Train a classifier based on labeled geometries and a list of features to consider."); + + SetDocName("Train Vector Classifier"); + SetDocLongDescription("This application trains a classifier based on " + "labeled geometries and a list of features to consider for classification."); + SetDocLimitations(" "); + SetDocAuthors("OTB Team"); + SetDocSeeAlso(" "); + + //Group IO + AddParameter(ParameterType_Group, "io", "Input and output data"); + SetParameterDescription("io", "This group of parameters allows setting input and output data."); + + AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector Data"); + SetParameterDescription("io.vd", "Input geometries used for training (note : all geometries from the layer will be used)"); + + AddParameter(ParameterType_InputFilename, "io.stats", "Input XML image statistics file"); + MandatoryOff("io.stats"); + SetParameterDescription("io.stats", "XML file containing mean and variance of each feature."); + + AddParameter(ParameterType_OutputFilename, "io.confmatout", "Output confusion matrix"); + SetParameterDescription("io.confmatout", "Output file containing the confusion matrix (.csv format)."); + MandatoryOff("io.confmatout"); + + AddParameter(ParameterType_OutputFilename, "io.out", "Output model"); + SetParameterDescription("io.out", "Output file containing the model estimated (.txt format)."); + + AddParameter(ParameterType_ListView, "feat", "Field names for training features."); + SetParameterDescription("feat","List of field names in the input vector data to be used as features for training."); + + AddParameter(ParameterType_String,"cfield","Field containing the class id for supervision"); + SetParameterDescription("cfield","Field containing the class id for supervision. " + "Only geometries with this field available will be taken into account."); + SetParameterString("cfield","class"); + + AddParameter(ParameterType_Int, "layer", "Layer Index"); + SetParameterDescription("layer", "Index of the layer to use in the input vector file."); + MandatoryOff("layer"); + SetDefaultParameterInt("layer",0); + + AddParameter(ParameterType_Group, "valid", "Validation data"); + SetParameterDescription("valid", "This group of parameters defines validation data."); + + AddParameter(ParameterType_InputVectorData, "valid.vd", "Validation Vector Data"); + SetParameterDescription("valid.vd", "Geometries used for validation " + "(must contain the same fields used for training, all geometries from the layer will be used)"); + MandatoryOff("valid.vd"); + + AddParameter(ParameterType_Int, "valid.layer", "Layer Index"); + SetParameterDescription("valid.layer", "Index of the layer to use in the validation vector file."); + MandatoryOff("valid.layer"); + SetDefaultParameterInt("valid.layer",0); + + // Add parameters for the classifier choice + Superclass::DoInit(); + + AddRANDParameter(); + // Doc example parameter settings + SetDocExampleParameterValue("io.vd", "vectorData.shp"); + SetDocExampleParameterValue("io.stats", "meanVar.xml"); + SetDocExampleParameterValue("io.out", "svmModel.svm"); + SetDocExampleParameterValue("feat", "perimeter area width"); + SetDocExampleParameterValue("cfield", "predicted"); + } + + void DoUpdateParameters() + { + if ( HasValue("io.vd") ) + { + std::string vectorFile = GetParameterString("io.vd"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("feat"); + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::transform(key.begin(), end, key.begin(), tolower); + key="feat."+key.substr(0, end - key.begin()); + AddChoice(key,item); + } + } + } + + +void LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc) +{ + ConfusionMatrixCalculatorType::ConfusionMatrixType matrix = confMatCalc->GetConfusionMatrix(); + + // Compute minimal width + size_t minwidth = 0; + + for (unsigned int i = 0; i < matrix.Rows(); i++) + { + for (unsigned int j = 0; j < matrix.Cols(); j++) + { + std::ostringstream os; + os << matrix(i, j); + size_t size = os.str().size(); + + if (size > minwidth) + { + minwidth = size; + } + } + } + + MapOfIndicesType mapOfIndices = confMatCalc->GetMapOfIndices(); + + MapOfIndicesType::const_iterator it = mapOfIndices.begin(); + MapOfIndicesType::const_iterator end = mapOfIndices.end(); + + for (; it != end; ++it) + { + std::ostringstream os; + os << "[" << it->second << "]"; + + size_t size = os.str().size(); + if (size > minwidth) + { + minwidth = size; + } + } + + // Generate matrix string, with 'minwidth' as size specifier + std::ostringstream os; + + // Header line + for (size_t i = 0; i < minwidth; ++i) + os << " "; + os << " "; + + it = mapOfIndices.begin(); + end = mapOfIndices.end(); + for (; it != end; ++it) + { + os << "[" << it->second << "]" << " "; + } + + os << std::endl; + + // Each line of confusion matrix + for (unsigned int i = 0; i < matrix.Rows(); i++) + { + ConfusionMatrixCalculatorType::ClassLabelType label = mapOfIndices[i]; + os << "[" << std::setw(minwidth - 2) << label << "]" << " "; + for (unsigned int j = 0; j < matrix.Cols(); j++) + { + os << std::setw(minwidth) << matrix(i, j) << " "; + } + os << std::endl; + } + + otbAppLogINFO("Confusion matrix (rows = reference labels, columns = produced labels):\n" << os.str()); +} + + +void DoExecute() + { + std::string shapefile = GetParameterString("io.vd"); + std::string modelfile = GetParameterString("io.out"); + typedef int LabelPixelType; + typedef itk::FixedArray<LabelPixelType,1> LabelSampleType; + typedef itk::Statistics::ListSample <LabelSampleType> LabelListSampleType; + + const int nbFeatures = GetSelectedItems("feat").size(); + + // Statistics for shift/scale + MeasurementType meanMeasurementVector; + MeasurementType stddevMeasurementVector; + if (HasValue("io.stats") && IsParameterEnabled("io.stats")) + { + StatisticsReader::Pointer statisticsReader = StatisticsReader::New(); + std::string XMLfile = GetParameterString("io.stats"); + statisticsReader->SetFileName(XMLfile); + meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean"); + stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev"); + } + else + { + meanMeasurementVector.SetSize(nbFeatures); + meanMeasurementVector.Fill(0.); + stddevMeasurementVector.SetSize(nbFeatures); + stddevMeasurementVector.Fill(1.); + } + + ogr::DataSource::Pointer source = ogr::DataSource::New(shapefile, ogr::DataSource::Modes::Read); + ogr::Layer layer = source->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + bool goesOn = feature.addr() != 0; + + ListSampleType::Pointer input = ListSampleType::New(); + LabelListSampleType::Pointer target = LabelListSampleType::New(); + input->SetMeasurementVectorSize(nbFeatures); + + int cFieldIndex=-1; + std::vector<int> featureFieldIndex = GetSelectedItems("feat"); + if (feature.addr()) + { + cFieldIndex = feature.ogr().GetFieldIndex(GetParameterString("cfield").c_str()); + } + + // Check that the class field exists + if (cFieldIndex < 0) + { + std::ostringstream oss; + std::vector<std::string> names = GetChoiceNames("feat"); + for (unsigned int i=0 ; i<names.size() ; i++) + { + if (i) oss << ", "; + oss << names[i]; + } + otbAppLogFATAL("The field name for class label ("<<GetParameterString("cfield") + <<") has not been found in the input vector file! Choices are "<< oss.str()); + } + + while(goesOn) + { + if(feature.ogr().IsFieldSet(cFieldIndex)) + { + MeasurementType mv; + mv.SetSize(nbFeatures); + for(int idx=0; idx < nbFeatures; ++idx) + mv[idx] = feature.ogr().GetFieldAsDouble(featureFieldIndex[idx]); + + input->PushBack(mv); + target->PushBack(feature.ogr().GetFieldAsInteger(cFieldIndex)); + } + feature = layer.ogr().GetNextFeature(); + goesOn = feature.addr() != 0; + } + + ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); + trainingShiftScaleFilter->SetInput(input); + trainingShiftScaleFilter->SetShifts(meanMeasurementVector); + trainingShiftScaleFilter->SetScales(stddevMeasurementVector); + trainingShiftScaleFilter->Update(); + + ListSampleType::Pointer listSample; + LabelListSampleType::Pointer labelListSample; + + listSample = trainingShiftScaleFilter->GetOutput(); + labelListSample = target; + + ListSampleType::Pointer trainingListSample = listSample; + LabelListSampleType::Pointer trainingLabeledListSample = labelListSample; + + //-------------------------- + // Estimate model + //-------------------------- + this->Train(trainingListSample,trainingLabeledListSample,GetParameterString("io.out")); + + //-------------------------- + // Performances estimation + //-------------------------- + ListSampleType::Pointer validationListSample=ListSampleType::New(); + TargetListSampleType::Pointer validationLabeledListSample = TargetListSampleType::New(); + + // Import validation data + if (HasValue("valid.vd") && IsParameterEnabled("valid.vd")) + { + std::string validFile = this->GetParameterString("valid.vd"); + source = ogr::DataSource::New(validFile, ogr::DataSource::Modes::Read); + layer = source->GetLayer(this->GetParameterInt("valid.layer")); + feature = layer.ogr().GetNextFeature(); + goesOn = feature.addr() != 0; + + // find usefull field indexes + + // TODO : detect corresponding indexes in validation data set, for the moment + // Assume they have the same fields, in the same order. + + input = ListSampleType::New(); + target = LabelListSampleType::New(); + input->SetMeasurementVectorSize(nbFeatures); + while(goesOn) + { + if(feature.ogr().IsFieldSet(cFieldIndex)) + { + MeasurementType mv; + mv.SetSize(nbFeatures); + for(int idx=0; idx < nbFeatures; ++idx) + mv[idx] = feature.ogr().GetFieldAsDouble(featureFieldIndex[idx]); + + input->PushBack(mv); + target->PushBack(feature.ogr().GetFieldAsInteger(cFieldIndex)); + } + feature = layer.ogr().GetNextFeature(); + goesOn = feature.addr() != 0; + } + + ShiftScaleFilterType::Pointer validShiftScaleFilter = ShiftScaleFilterType::New(); + validShiftScaleFilter->SetInput(input); + validShiftScaleFilter->SetShifts(meanMeasurementVector); + validShiftScaleFilter->SetScales(stddevMeasurementVector); + validShiftScaleFilter->Update(); + + validationListSample = validShiftScaleFilter->GetOutput(); + validationLabeledListSample = target; + } + + //Test the input validation set size + TargetListSampleType::Pointer predictedList = TargetListSampleType::New(); + ListSampleType::Pointer performanceListSample; + TargetListSampleType::Pointer performanceLabeledListSample; + if(validationLabeledListSample->Size() != 0) + { + performanceListSample = validationListSample; + performanceLabeledListSample = validationLabeledListSample; + } + else + { + otbAppLogWARNING("The validation set is empty. The performance estimation is done using the input training set in this case."); + performanceListSample = trainingListSample; + performanceLabeledListSample = trainingLabeledListSample; + } + + this->Classify(performanceListSample, predictedList, GetParameterString("io.out")); + + ConfusionMatrixCalculatorType::Pointer confMatCalc = ConfusionMatrixCalculatorType::New(); + + otbAppLogINFO("Predicted list size : " << predictedList->Size()); + otbAppLogINFO("ValidationLabeledListSample size : " << performanceLabeledListSample->Size()); + confMatCalc->SetReferenceLabels(performanceLabeledListSample); + confMatCalc->SetProducedLabels(predictedList); + confMatCalc->Compute(); + + otbAppLogINFO("training performances"); + LogConfusionMatrix(confMatCalc); + + for (unsigned int itClasses = 0; itClasses < confMatCalc->GetNumberOfClasses(); itClasses++) + { + ConfusionMatrixCalculatorType::ClassLabelType classLabel = confMatCalc->GetMapOfIndices()[itClasses]; + + otbAppLogINFO("Precision of class [" << classLabel << "] vs all: " << confMatCalc->GetPrecisions()[itClasses]); + otbAppLogINFO("Recall of class [" << classLabel << "] vs all: " << confMatCalc->GetRecalls()[itClasses]); + otbAppLogINFO( + "F-score of class [" << classLabel << "] vs all: " << confMatCalc->GetFScores()[itClasses] << "\n"); + } + otbAppLogINFO("Global performance, Kappa index: " << confMatCalc->GetKappaIndex()); + + + if (this->HasValue("io.confmatout")) + { + // Writing the confusion matrix in the output .CSV file + + MapOfIndicesType::iterator itMapOfIndicesValid, itMapOfIndicesPred; + ClassLabelType labelValid = 0; + + ConfusionMatrixType confusionMatrix = confMatCalc->GetConfusionMatrix(); + MapOfIndicesType mapOfIndicesValid = confMatCalc->GetMapOfIndices(); + + unsigned int nbClassesPred = mapOfIndicesValid.size(); + + ///////////////////////////////////////////// + // Filling the 2 headers for the output file + const std::string commentValidStr = "#Reference labels (rows):"; + const std::string commentPredStr = "#Produced labels (columns):"; + const char separatorChar = ','; + std::ostringstream ossHeaderValidLabels, ossHeaderPredLabels; + + // Filling ossHeaderValidLabels and ossHeaderPredLabels for the output file + ossHeaderValidLabels << commentValidStr; + ossHeaderPredLabels << commentPredStr; + + itMapOfIndicesValid = mapOfIndicesValid.begin(); + + while (itMapOfIndicesValid != mapOfIndicesValid.end()) + { + // labels labelValid of mapOfIndicesValid are already sorted in otbConfusionMatrixCalculator + labelValid = itMapOfIndicesValid->second; + + otbAppLogINFO("mapOfIndicesValid[" << itMapOfIndicesValid->first << "] = " << labelValid); + + ossHeaderValidLabels << labelValid; + ossHeaderPredLabels << labelValid; + + ++itMapOfIndicesValid; + + if (itMapOfIndicesValid != mapOfIndicesValid.end()) + { + ossHeaderValidLabels << separatorChar; + ossHeaderPredLabels << separatorChar; + } + else + { + ossHeaderValidLabels << std::endl; + ossHeaderPredLabels << std::endl; + } + } + + std::ofstream outFile; + outFile.open(this->GetParameterString("io.confmatout").c_str()); + outFile << std::fixed; + outFile.precision(10); + + ///////////////////////////////////// + // Writing the 2 headers + outFile << ossHeaderValidLabels.str(); + outFile << ossHeaderPredLabels.str(); + ///////////////////////////////////// + + unsigned int indexLabelValid = 0, indexLabelPred = 0; + + for (itMapOfIndicesValid = mapOfIndicesValid.begin(); itMapOfIndicesValid != mapOfIndicesValid.end(); ++itMapOfIndicesValid) + { + indexLabelPred = 0; + + for (itMapOfIndicesPred = mapOfIndicesValid.begin(); itMapOfIndicesPred != mapOfIndicesValid.end(); ++itMapOfIndicesPred) + { + // Writing the confusion matrix (sorted in otbConfusionMatrixCalculator) in the output file + outFile << confusionMatrix(indexLabelValid, indexLabelPred); + if (indexLabelPred < (nbClassesPred - 1)) + { + outFile << separatorChar; + } + else + { + outFile << std::endl; + } + ++indexLabelPred; + } + + ++indexLabelValid; + } + + outFile.close(); + } // END if (this->HasValue("io.confmatout")) + } + +}; +} +} + +OTB_APPLICATION_EXPORT(otb::Wrapper::TrainVectorClassifier) diff --git a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx index 4c29d7d5b5da68e87a3bdf1f9f58b5eb799932ad..c260e168195bc5b9e923b4ac34e48bec6a054a63 100644 --- a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx @@ -55,7 +55,7 @@ public: itkTypeMacro(VectorDataDSValidation, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VectorDataDSValidation"); SetDescription("Vector data validation based on the fusion of features using Dempster-Shafer evidence theory framework."); @@ -102,7 +102,7 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent @@ -112,7 +112,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //Read the vector data diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h index c7edff5f5c5ce6e18b64a9f1159678611dc58a58..aaeb2e2ebd5984bc5d7c7538c076cfc2500fc499 100644 --- a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h +++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLearningApplicationBase_h -#define __otbLearningApplicationBase_h +#ifndef otbLearningApplicationBase_h +#define otbLearningApplicationBase_h #include "otbConfigure.h" @@ -135,6 +135,8 @@ public: protected: LearningApplicationBase(); + ~LearningApplicationBase() ITK_OVERRIDE; + /** Generic method to train and save the machine learning model. This method * uses specific train methods depending on the chosen model.*/ void Train(typename ListSampleType::Pointer trainingListSample, diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx index e8f6b74b780b52a7a4ac7800215e1a9f8caac5e1..d92296ff4b551a0ea245c4149f6fd97aff87f153 100644 --- a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx +++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLearningApplicationBase_txx -#define __otbLearningApplicationBase_txx +#ifndef otbLearningApplicationBase_txx +#define otbLearningApplicationBase_txx #include "otbLearningApplicationBase.h" // only need this filter as a dummy process object @@ -30,7 +30,14 @@ template <class TInputValue, class TOutputValue> LearningApplicationBase<TInputValue,TOutputValue> ::LearningApplicationBase() : m_RegressionFlag(false) { -} +} + +template <class TInputValue, class TOutputValue> +LearningApplicationBase<TInputValue,TOutputValue> +::~LearningApplicationBase() +{ + ModelFactoryType::CleanFactories(); +} template <class TInputValue, class TOutputValue> void diff --git a/Modules/Applications/AppClassification/include/otbTrainBoost.txx b/Modules/Applications/AppClassification/include/otbTrainBoost.txx index 5e99db8f2eeaf2043d12a14542885a4b52466a8d..fbd99531a4eff13525b9db92ddad63643397bb2a 100644 --- a/Modules/Applications/AppClassification/include/otbTrainBoost.txx +++ b/Modules/Applications/AppClassification/include/otbTrainBoost.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainBoost_txx -#define __otbTrainBoost_txx +#ifndef otbTrainBoost_txx +#define otbTrainBoost_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx index 285ae198e87ff3bcfe6f780fef3e1e66f8a61784..61cd1a34befbcf00aa70ea0703f3f43af3c81570 100644 --- a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainDecisionTree_txx -#define __otbTrainDecisionTree_txx +#ifndef otbTrainDecisionTree_txx +#define otbTrainDecisionTree_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx index 9bc2bcdd9e589cede06a507e7e34f15aacd317dc..bcf5caa86181a84c546c264052bad32f2d8fd95f 100644 --- a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainGradientBoostedTree_txx -#define __otbTrainGradientBoostedTree_txx +#ifndef otbTrainGradientBoostedTree_txx +#define otbTrainGradientBoostedTree_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainKNN.txx b/Modules/Applications/AppClassification/include/otbTrainKNN.txx index 10ad85822c7e757288544447f3367289a346e70d..fdf10cdf283f1a5f22f3044aea335c844c16101c 100644 --- a/Modules/Applications/AppClassification/include/otbTrainKNN.txx +++ b/Modules/Applications/AppClassification/include/otbTrainKNN.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainKNN_txx -#define __otbTrainKNN_txx +#ifndef otbTrainKNN_txx +#define otbTrainKNN_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx index 774121472a073d390a2d13839a3f39fbe1d45a5f..f89b7141566e3993f117990eaea5c7cb87f9438b 100644 --- a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainLibSVM_txx -#define __otbTrainLibSVM_txx +#ifndef otbTrainLibSVM_txx +#define otbTrainLibSVM_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx index 559f30e33b485c083db4b8ae221c9504d9de99d2..ee7bf43d47c7e9f9b653208b8c7d611afc13c62e 100644 --- a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx +++ b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainNeuralNetwork_txx -#define __otbTrainNeuralNetwork_txx +#ifndef otbTrainNeuralNetwork_txx +#define otbTrainNeuralNetwork_txx #include <boost/lexical_cast.hpp> #include "otbLearningApplicationBase.h" diff --git a/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx b/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx index d5f3cce8e3ef2ae3fbe02a2b21e99d0004df3944..e0a45d4c6f7c73955d994780bd780b7dbd4e1d24 100644 --- a/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx +++ b/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainNormalBayes_txx -#define __otbTrainNormalBayes_txx +#ifndef otbTrainNormalBayes_txx +#define otbTrainNormalBayes_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx index 88f3b7cf966a115ded3e52cf54e4d624801c2777..669b4562b6e955aaf34dd821675e3194d5b8f37b 100644 --- a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx +++ b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainRandomForests_txx -#define __otbTrainRandomForests_txx +#ifndef otbTrainRandomForests_txx +#define otbTrainRandomForests_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/include/otbTrainSVM.txx b/Modules/Applications/AppClassification/include/otbTrainSVM.txx index 58e2ee44015d340d24589f21fc256e683a291680..d36c28dd052097b98a06bd7be44e163d5dc1cf38 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainSVM.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTrainSVM_txx -#define __otbTrainSVM_txx +#ifndef otbTrainSVM_txx +#define otbTrainSVM_txx #include "otbLearningApplicationBase.h" namespace otb diff --git a/Modules/Applications/AppClassification/test/CMakeLists.txt b/Modules/Applications/AppClassification/test/CMakeLists.txt index 2bc24e7161831fe9a2bc0ee9426291ba5a8b0a22..3d804e38aff893b539c937ca72f401a224033f51 100644 --- a/Modules/Applications/AppClassification/test/CMakeLists.txt +++ b/Modules/Applications/AppClassification/test/CMakeLists.txt @@ -8,7 +8,7 @@ otb_test_application(NAME apTvClComputeOGRLayersFeaturesStatistics VALID --compare-ascii ${NOTOL} ${OTBAPP_BASELINE_FILES}/apTvClComputeOGRLayersFeaturesStatistics.xml ${TEMP}/apTvClComputeOGRLayersFeaturesStatistics.xml) - + #----------- SOMClassification TESTS ---------------- otb_test_application(NAME apTvClSOMClassificationSmall APP SOMClassification @@ -323,7 +323,7 @@ otb_test_application(NAME apTvClTrainOGRLayersClassifier ${OTBAPP_BASELINE_FILES}/apTvClModel.svm ${TEMP}/apTvClModel.svm) -set_tests_properties(apTvClTrainOGRLayersClassifier PROPERTIES DEPENDS apTvClComputeOGRLayersFeaturesStatistics) +set_tests_properties(apTvClTrainOGRLayersClassifier PROPERTIES DEPENDS apTvClComputeOGRLayersFeaturesStatistics) #----------- ComputeConfusionMatrix TESTS ---------------- otb_test_application(NAME apTvComputeConfusionMatrixV @@ -580,7 +580,7 @@ otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp) -set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt) +set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt) otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication APP ComputePolylineFeatureFromImage @@ -593,7 +593,7 @@ otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadE ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp) -set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication) +set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication) endif() #----------- KMeansClassification TESTS ---------------- @@ -846,10 +846,52 @@ endif() #----------- PolygonClassStatistics TESTS ---------------- otb_test_application(NAME apTvClPolygonClassStatisticsTest APP PolygonClassStatistics - OPTIONS -in ${INPUTDATA}/cthead1_flip.tif - -vec ${INPUTDATA}/variousVectors.sqlite - -field label + OPTIONS -in ${INPUTDATA}/Classification/QB_1_ortho.tif + -vec ${INPUTDATA}/Classification/VectorData_QB1.shp + -field Class -out ${TEMP}/apTvClPolygonClassStatisticsOut.xml VALID --compare-ascii ${NOTOL} ${OTBAPP_BASELINE_FILES}/apTvClPolygonClassStatisticsOut.xml ${TEMP}/apTvClPolygonClassStatisticsOut.xml) + +#----------- SampleSelection TESTS ----------------------- +otb_test_application(NAME apTvClSampleSelection + APP SampleSelection + OPTIONS -in ${INPUTDATA}/Classification/QB_1_ortho.tif + -vec ${INPUTDATA}/Classification/VectorData_QB1.shp + -field Class + -out ${TEMP}/apTvClSampleSelectionOut.sqlite + -instats ${OTBAPP_BASELINE_FILES}/apTvClPolygonClassStatisticsOut.xml + -outrates ${TEMP}/apTvClSampleSelectionOutRates.txt + -strategy byclass + -strategy.byclass.in ${INPUTDATA}/Classification/sampling_required.csv + -sampler periodic + VALID --compare-ogr ${NOTOL} + ${OTBAPP_BASELINE_FILES}/apTvClSampleSelectionOut.sqlite + ${TEMP}/apTvClSampleSelectionOut.sqlite) + +#----------- SampleExtraction TESTS ----------------------- +otb_test_application(NAME apTvClSampleExtraction + APP SampleExtraction + OPTIONS -in ${INPUTDATA}/Classification/QB_1_ortho.tif + -vec ${INPUTDATA}/Classification/apTvClSampleSelectionOut.sqlite + -field Class + -out ${TEMP}/apTvClSampleExtractionOut.sqlite + VALID --compare-ogr ${NOTOL} + ${OTBAPP_BASELINE_FILES}/apTvClSampleExtractionOut.sqlite + ${TEMP}/apTvClSampleExtractionOut.sqlite) + +#----------- TrainVectorClassifier TESTS ---------------- +if(OTB_USE_OPENCV) + otb_test_application(NAME apTvClTrainVectorClassifier + APP TrainVectorClassifier + OPTIONS -io.vd ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite + -feat value_0 value_1 value_2 value_3 + -cfield class + -classifier rf + -io.confmatout ${TEMP}/apTvClTrainVectorClassifierConfMat.txt + -io.out ${TEMP}/apTvClTrainVectorClassifierModel.rf + VALID --compare-ascii ${NOTOL} + ${OTBAPP_BASELINE_FILES}/apTvClTrainVectorClassifierModel.rf + ${TEMP}/apTvClTrainVectorClassifierModel.rf) +endif() \ No newline at end of file diff --git a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx index bc1c11ada2ac2ee3be87c871bccba14d8fe7869a..d0089f61a9d1011c013c4f6153e21f34e4a16c42 100644 --- a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx +++ b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx @@ -77,7 +77,7 @@ public: itkTypeMacro(HomologousPointsExtraction, otb::Wrapper::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("HomologousPointsExtraction"); SetDocName("Homologous points extraction"); @@ -197,12 +197,12 @@ private: SetDocExampleParameterValue("out","homologous.txt"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void Match(FloatImageType * im1, FloatImageType * im2, RSTransformType * rsTransform, RSTransformType * rsTransform1ToWGS84,RSTransformType * rsTransform2ToWGS84, std::ofstream & file, OGRMultiLineString * mls = NULL) + void Match(FloatImageType * im1, FloatImageType * im2, RSTransformType * rsTransform, RSTransformType * rsTransform1ToWGS84,RSTransformType * rsTransform2ToWGS84, std::ofstream & file, OGRMultiLineString * mls = ITK_NULLPTR) { MatchingFilterType::Pointer matchingFilter = MatchingFilterType::New(); @@ -321,7 +321,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { OGRMultiLineString mls; @@ -501,7 +501,7 @@ private: if(IsParameterEnabled("outvector")) { // Create the datasource (for matches export) - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); otb::ogr::DataSource::Pointer ogrDS; ogrDS = otb::ogr::DataSource::New(GetParameterString("outvector"), otb::ogr::DataSource::Modes::Overwrite); diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx index 9fcd0ed5a87b35502c5e8091fc918ef16994bb33..06e07d00ad394a5f89004263db84829073823cd1 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx @@ -86,7 +86,7 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("DimensionalityReduction"); SetDescription("Perform Dimension reduction of the input image."); @@ -175,7 +175,7 @@ private: SetDocExampleParameterValue("method", "pca"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if (HasValue("in")) { @@ -223,7 +223,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get Parameters diff --git a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx index caca296741ccb7b6adc11dd0d1f50dcbcc338aab..444749182f0b0c937d2e3a7ee6f36bd7df1c0097 100644 --- a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx +++ b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx @@ -58,7 +58,7 @@ itkTypeMacro(EdgeExtraction, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("EdgeExtraction"); SetDescription("Computes edge features on every pixel of the input image selected channel"); @@ -121,12 +121,12 @@ SetDocExampleParameterValue("channel", "1"); SetDocExampleParameterValue("out", "Edges.tif"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx index 230fe1a4d3a9be11a187383edcfdf1a066239e61..4212104bde1e006197b27e4863b259fb07c91baf 100644 --- a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx +++ b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx @@ -50,7 +50,7 @@ public: itkTypeMacro(LineSegmentDetection, otb::Wrapper::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("LineSegmentDetection"); SetDescription("Detect line segments in raster"); @@ -82,11 +82,11 @@ private: SetDocExampleParameterValue("out", "LineSegmentDetection.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { typedef otb::VectorImageToAmplitudeImageFilter<FloatVectorImageType, FloatImageType> VectorImageToAmplitudeImageFilterType; diff --git a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx index bdd6b49716617018bb03971f16d12fe04a7e185e..0fde206f26a6a2577acfb4fa32bf37dae162631b 100644 --- a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx +++ b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx @@ -51,7 +51,7 @@ public: itkTypeMacro(Despeckle, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Despeckle"); SetDescription("Perform speckle noise reduction on SAR image."); @@ -123,12 +123,12 @@ private: SetDocExampleParameterValue("out", "despeckle.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType* inVImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx index 210c2f2eb73254b9970d6bc96ede77802cfd6ee9..18cd825f50212ee39e70be300824861e15503d23 100644 --- a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx +++ b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx @@ -52,7 +52,7 @@ public: itkTypeMacro(Smoothing, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Smoothing"); SetDescription("Apply a smoothing filter to an image"); @@ -120,12 +120,12 @@ private: SetDocExampleParameterValue("type.anidif.conductance", "1.5", exId); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { GetLogger()->Debug("Entering DoExecute\n"); diff --git a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx index 8fe879ccf4efc16b3658e07ab5330833f326cf14..2f31cd6344d4c8a76db4436b4303e1aed42af98d 100644 --- a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx +++ b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx @@ -50,7 +50,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("BundleToPerfectSensor"); SetDescription("Perform P+XS pansharpening"); @@ -70,6 +70,9 @@ private: AddParameter(ParameterType_InputImage, "inxs", "Input XS Image"); SetParameterDescription("inxs"," Input XS image."); + AddParameter(ParameterType_OutputImage, "out", "Output image"); + SetParameterDescription("out"," Output image."); + // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); @@ -89,8 +92,7 @@ private: AddParameter(ParameterType_Float, "lms", "Spacing of the deformation field"); SetParameterDescription("lms"," Spacing of the deformation field. Default is 10 times the PAN image spacing."); - AddParameter(ParameterType_OutputImage, "out", "Output image"); - SetParameterDescription("out"," Output image."); + AddRAMParameter(); MandatoryOff("lms"); @@ -102,7 +104,7 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if(!HasUserValue("mode") && HasValue("inp") && HasValue("inxs") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inp"),GetParameterImage("inxs"))) { @@ -111,7 +113,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType* panchroV = GetParameterImage("inp"); FloatVectorImageType* xs = GetParameterImage("inxs"); diff --git a/Modules/Applications/AppFusion/app/otbPansharpening.cxx b/Modules/Applications/AppFusion/app/otbPansharpening.cxx index 41d98e0fdcead3bcb8b9baaa8c969411a53610b3..7b5e9def30223975eec5380f251ee6bb061e59fc 100644 --- a/Modules/Applications/AppFusion/app/otbPansharpening.cxx +++ b/Modules/Applications/AppFusion/app/otbPansharpening.cxx @@ -70,7 +70,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Pansharpening"); SetDescription("Perform P+XS pansharpening"); @@ -134,12 +134,12 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType* panchroV = GetParameterImage("inp"); if ( panchroV->GetNumberOfComponentsPerPixel() != 1 ) diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index e627f82a415578e269b454675f8a5de733568cd4..3894ed1484558ebe1df7314b0294b6f6f91889f0 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -89,7 +89,7 @@ public: itkTypeMacro(HyperspectralUnmixing, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("HyperspectralUnmixing"); SetDescription("Estimate abundance maps from an hyperspectral image and a set of endmembers."); @@ -137,12 +137,12 @@ private: SetDocExampleParameterValue("ua", "ucls"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { m_ProcessObjects.clear(); diff --git a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx index 34a521e47d32831d114c5c3404d09bea832d4f91..cc729585ce5ae1ec0a16af75048f930f15f12973 100644 --- a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx @@ -44,7 +44,7 @@ public: itkTypeMacro(VertexComponentAnalysis, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VertexComponentAnalysis"); SetDescription("Find endmembers in hyperspectral images with Vertex Component Analysis"); @@ -78,12 +78,12 @@ private: SetDocExampleParameterValue("outendm", "VertexComponentAnalysis.tif double"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { DoubleVectorImageType::Pointer inputImage = GetParameterDoubleVectorImage("in"); DoubleVectorImageType::Pointer endmembersImage; diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index e6433df582042a908680c72c384c79278d11bb72..37d55102e538f1be969756ead476735f1deccf4a 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -244,7 +244,7 @@ public: <FloatImageType, LabelImageType> CasterToLabelImageType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ColorMapping"); SetDescription("Maps an input label image to 8-bits RGB using look-up tables."); @@ -392,7 +392,7 @@ private: SetDocExampleParameterValue("out", "Colorized_ROI_QB_MUL_1_SVN_CLASS_MULTI.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Make sure the operation color->label is not called with methods continuous or image. // These methods are not implemented for this operation yet. @@ -406,7 +406,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { if(GetParameterInt("op")==0) { diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index 4b336187ae9cf0591b62d6d631248915b2f47172..7cc5fec08428478bb239073828e314cc96e7d24f 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -46,7 +46,7 @@ public: typedef otb::StreamingCompareImageFilter<FloatImageType> StreamingCompareImageFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("CompareImages"); SetDescription("Estimator between 2 images."); @@ -109,6 +109,10 @@ private: AddParameter(ParameterType_Float, "psnr", "PSNR"); SetParameterDescription("psnr", "Peak Signal to Noise Ratio value"); SetParameterRole("psnr", Role_Output); + + AddParameter(ParameterType_Float, "count", "count"); + SetParameterDescription("count", "Nb of pixels which are different"); + SetParameterRole("count", Role_Output); // Doc example parameter settings SetDocExampleParameterValue("ref.in", "GomaApres.png"); @@ -121,7 +125,7 @@ private: SetDocExampleParameterValue("roi.sizey", "200"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Set channel interval if( HasValue("ref.in") ) @@ -156,7 +160,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Init filters m_ExtractRefFilter = ExtractROIMonoFilterType::New(); @@ -208,10 +212,12 @@ private: otbAppLogINFO( << "MSE: " << m_CompareFilter->GetMSE() ); otbAppLogINFO( << "MAE: " << m_CompareFilter->GetMAE() ); otbAppLogINFO( << "PSNR: " << m_CompareFilter->GetPSNR() ); + otbAppLogINFO( << "Number of Pixel different: " << m_CompareFilter->GetDiffCount() ); SetParameterFloat( "mse", m_CompareFilter->GetMSE() ); SetParameterFloat( "mae", m_CompareFilter->GetMAE() ); SetParameterFloat( "psnr", m_CompareFilter->GetPSNR() ); + SetParameterFloat( "count", m_CompareFilter->GetDiffCount() ); } diff --git a/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx b/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx index 9d39a839b2adc63419da5d37edf0badf83a26ee2..3b981669cba94d03ec8254a80b294a635f71b3b4 100644 --- a/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx @@ -51,7 +51,7 @@ public: typedef ObjectList<ExtractROIFilterType> ExtractROIFilterListType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ConcatenateImages"); SetDescription("Concatenate a list of images of the same size into a single multi-channel one."); @@ -84,7 +84,7 @@ private: SetDocExampleParameterValue("out", "otbConcatenateImages.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent @@ -94,7 +94,7 @@ private: m_ExtractorList = ExtractROIFilterListType::New(); } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image list FloatVectorImageListType::Pointer inList = this->GetParameterImageList("il"); diff --git a/Modules/Applications/AppImageUtils/app/otbConvert.cxx b/Modules/Applications/AppImageUtils/app/otbConvert.cxx index 7bd8d1ffcbf5d7d5bdbb2f71ab4582531323c3b7..7de721d7863d62698879a16c4800a58b436cb0db 100644 --- a/Modules/Applications/AppImageUtils/app/otbConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConvert.cxx @@ -75,7 +75,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Convert"); SetDescription("Convert an image to a different format, eventually rescaling the data" @@ -136,7 +136,7 @@ private: SetDocExampleParameterValue("type", "linear"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } @@ -316,7 +316,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { switch ( this->GetParameterOutputImagePixelType("out") ) { diff --git a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx b/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx index af07ee3ac3805f844be855ff953433246e1300a1..a997f673d3eaf95a2f04b40e7bb162e05b0ae281 100644 --- a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx @@ -42,7 +42,7 @@ public: itkTypeMacro(DEMConvert, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("DEMConvert"); SetDescription("Converts a geo-referenced DEM image into a general raster file compatible with OTB DEM handling."); @@ -70,7 +70,7 @@ private: SetDocExampleParameterValue("out", "outputDEM"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // nothing to update } @@ -80,7 +80,7 @@ void DoUpdateParameters() * (.ras, .geom and . omd) */ -void DoExecute() +void DoExecute() ITK_OVERRIDE { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx index 8e06ba0db20ea13f998c2587f7a86dc23b638958..cc992824c1d2c90bd8c865598fbf6d4195962b6c 100644 --- a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx @@ -91,7 +91,7 @@ private: } return false; } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("DownloadSRTMTiles"); SetDescription("Download or list SRTM tiles related to a set of images"); @@ -132,13 +132,13 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //Get the mode diff --git a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx index 2f623fa19b7f15f0e309a1bb3d44f777eb7d2f46..82ad12495626d09a2fb9b57d8ad04ef1c6211e18 100644 --- a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx +++ b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx @@ -55,7 +55,7 @@ public: FloatVectorImageType::InternalPixelType> ExtractROIFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ExtractROI"); SetDescription("Extract a ROI defined by the user."); @@ -116,7 +116,7 @@ private: SetDocExampleParameterValue("out", "ExtractROI.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Update the sizes only if the user has not defined a size if ( HasValue("in") ) @@ -133,7 +133,7 @@ private: unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); ListViewParameter *clParam = dynamic_cast<ListViewParameter*>(GetParameterByKey("cl")); // Update the values of the channels to be selected if nbComponents is changed - if (clParam != NULL && clParam->GetNbChoices() != nbComponents) + if (clParam != ITK_NULLPTR && clParam->GetNbChoices() != nbComponents) { ClearChoices("cl"); @@ -219,7 +219,7 @@ private: return false; } - void DoExecute() + void DoExecute() ITK_OVERRIDE { ExtractROIFilterType::InputImageType* inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx index fc2e201298f3fd8ab11a986e311b8934fc65574a..ba5231c409bc9e8f05fdda3caf5a8a5f6f122653 100644 --- a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx +++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx @@ -55,7 +55,7 @@ public: typedef otb::ChangeInformationImageFilter<FloatVectorImageType> ChangeInfoFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ManageNoData"); SetDescription("Manage No-Data"); @@ -104,6 +104,9 @@ private: SetParameterDescription("mode.apply","Apply an external mask to an image using the no-data value of the input image"); AddParameter(ParameterType_InputImage, "mode.apply.mask", "Mask image"); SetParameterDescription("mode.apply.mask","Mask to be applied on input image (valid pixels have non null values)"); + AddParameter(ParameterType_Float, "mode.apply.ndval", "Nodata value used"); + SetParameterDescription("mode.apply.ndval","No Data value used according to the mask image"); + SetDefaultParameterFloat("mode.apply.ndval", 0.0); SetParameterString("mode","buildmask"); @@ -116,13 +119,13 @@ private: SetDocExampleParameterValue("mode.buildmask.outv", "0"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inputPtr = this->GetParameterImage("in"); @@ -160,7 +163,7 @@ private: if (!ret) { flags.resize(nbBands,true); - values.resize(nbBands,0.0); + values.resize(nbBands,GetParameterFloat("mode.apply.ndval")); } m_V2L = VectorToListFilterType::New(); diff --git a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx index d22a13717890683784cd6d92aeb20a86e7b85288..4e7ce61476dd258c9a6e024504536165a7fddd82 100644 --- a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx +++ b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx @@ -55,7 +55,7 @@ public: FloatVectorImageType> ShrinkFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("MultiResolutionPyramid"); SetDescription("Build a multi-resolution pyramid of the image."); @@ -109,14 +109,14 @@ private: SetDocExampleParameterValue("fast", "false"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent // Reinitialize the internal process used } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Initializing the process m_SmoothingFilter = SmoothingVectorImageFilterType::New(); diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index ee40c5ca594948409ae750bf2549a2598881d61e..35a860d0d4473d1962879d4bb9951ac36a229025 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -43,7 +43,7 @@ public: itkTypeMacro(PixelValue, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("PixelValue"); SetDescription("Get the value of a pixel."); @@ -85,7 +85,7 @@ private: SetDocExampleParameterValue("cl", "Channel1"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if ( HasValue("in") ) { @@ -108,7 +108,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { std::ostringstream ossOutput; FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx index fbf901e9a7ab0c58d5e314d1a14174bfb630e2c3..7c3677041f526f47dbad77da25e6b96344ebdd3a 100644 --- a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx +++ b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx @@ -50,7 +50,7 @@ public: <ExtractROIFilterType::OutputImageType, ExtractROIFilterType::OutputImageType> ShrinkImageFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Quicklook"); SetDescription("Generates a subsampled version of an image extract"); @@ -116,7 +116,7 @@ private: SetDocExampleParameterValue("out", "quicklookImage.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Update the sizes only if the user does not defined a size if ( HasValue("in") ) @@ -193,7 +193,7 @@ bool CropRegionOfInterest() return false; } - void DoExecute() + void DoExecute() ITK_OVERRIDE { InputImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx index bba8905a176bd5c23f7b98d1056bf25cfab734cb..d4b4514c47e27afe0b1b27fc745500de724284a2 100644 --- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx +++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx @@ -45,7 +45,7 @@ public: itkTypeMacro(ReadImageInfo, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ReadImageInfo"); SetDescription("Get information about the image"); @@ -245,12 +245,12 @@ private: SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { std::ostringstream ossOutput; FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbRescale.cxx b/Modules/Applications/AppImageUtils/app/otbRescale.cxx index ace0ee39f5999526bd82c74f55d2a106d1ed2505..d0304e74a465fcad7c70add4e02a67c89f5d54fa 100644 --- a/Modules/Applications/AppImageUtils/app/otbRescale.cxx +++ b/Modules/Applications/AppImageUtils/app/otbRescale.cxx @@ -46,7 +46,7 @@ public: typedef otb::VectorRescaleIntensityImageFilter<FloatVectorImageType> RescaleImageFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Rescale"); SetDescription("Rescale the image between two given values."); @@ -84,12 +84,12 @@ private: SetDocExampleParameterValue("outmax", "255"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx b/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx index 8a732d68ce109e70038fe42e339d6280068ff8bd..42e609144d364a7cec6329a47058c97a36ca9bac 100644 --- a/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx +++ b/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx @@ -46,7 +46,7 @@ public: FloatVectorImageType::InternalPixelType> FilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SplitImage"); SetDescription("Split a N multiband image into N images"); @@ -73,12 +73,12 @@ private: SetDocExampleParameterValue("out", "splittedImage.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx b/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx index 9140183ce4c08903fef3e3aa3b28ae081cf546e2..932f2114fccefa2f9412b3aba74953d7ea6b9fad 100644 --- a/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx +++ b/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx @@ -42,7 +42,7 @@ public: typedef otb::TileImageFilter<FloatVectorImageType> TileFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("TileFusion"); SetDescription("Fusion of an image made of several tile files."); @@ -75,12 +75,12 @@ private: SetDocExampleParameterValue("out", "EntireImage.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to be done } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image list FloatVectorImageListType::Pointer tileList = this->GetParameterImageList("il"); diff --git a/Modules/Applications/AppImageUtils/test/CMakeLists.txt b/Modules/Applications/AppImageUtils/test/CMakeLists.txt index 1e7b6065de108b486dffd80abeb60d9c56c776db..e77cace8b9e8fe152e2dcb60b5acbbaa6a166ca5 100644 --- a/Modules/Applications/AppImageUtils/test/CMakeLists.txt +++ b/Modules/Applications/AppImageUtils/test/CMakeLists.txt @@ -107,23 +107,23 @@ otb_test_application(NAME apTuUtReadImageInfoExtendedFilename_reader APP ReadImageInfo OPTIONS -in ${INPUTDATA}/ToulouseExtract_WithGeom.tif?&skipgeom=true&skipcarto=true ) - + set(TESTNAME -"gd-pleiades-1" #LARGEINPUT{PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R1C1.JP2} -"gd-wv2-1" #LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} +"gd-pleiades-1" #LARGEINPUT{PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R1C1.JP2} +"gd-wv2-1" #LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} "gd-spot6-1" #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} "gd-qb-1" #LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} -"gd-ikonos-1" #LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} +"gd-ikonos-1" #LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} "gd-rapideye-1" #LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf} ) 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{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} +LARGEINPUT{PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R1C1.JP2} +LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_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{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} -LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} +LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf} ) @@ -131,7 +131,7 @@ set( GEOM_TESTNB 0) foreach( file ${IMG} ) list(GET TESTNAME ${GEOM_TESTNB} current_testname ) math(EXPR GEOM_TESTNB "${GEOM_TESTNB} + 1") - + otb_test_application(NAME apTuReadImageInfoTest_${current_testname} APP ReadImageInfo OPTIONS -in ${file} @@ -156,7 +156,7 @@ otb_test_application(NAME apTvUtQuicklookROI1Channel otb_test_application(NAME apTvUtQuicklookSpot5 APP Quicklook OPTIONS -in LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - -out ${TEMP}/apTvUtQuicklookSpot5.tif + -out ${TEMP}/apTvUtQuicklookSpot5.img -cl Channel1 Channel2 Channel3 -rox 10 -roy 10 @@ -165,7 +165,7 @@ otb_test_application(NAME apTvUtQuicklookSpot5 -sr 2 VALID --compare-image ${NOTOL} ${BASELINE}/apTvUtQuicklookSpot5.tif - ${TEMP}/apTvUtQuicklookSpot5.tif + ${TEMP}/apTvUtQuicklookSpot5.img ) @@ -353,4 +353,3 @@ otb_test_application(NAME apTvUtSplitImage ${INPUTDATA}/poupees_sub_c3.png ${TEMP}/apTvUtSplitImageOutput_2.tif) - diff --git a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx index eacd3e2ad12accc3801a1fc772aad58db1b70f46..3c910f26e15995ebf50ba52d578572fa3791c709 100644 --- a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx +++ b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx @@ -126,7 +126,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("RadiometricIndices"); SetDescription("Compute radiometric indices."); @@ -433,7 +433,7 @@ private: } } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { //Nothing to do here } @@ -483,7 +483,7 @@ private: otbAppLogINFO(<< m_Map[GetSelectedItems("list")[idx]].item << " added.");\ } - void DoExecute() + void DoExecute() ITK_OVERRIDE { int nbChan = GetParameterImage("in")->GetNumberOfComponentsPerPixel(); diff --git a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx index 506d390dd7918b1ea3d38123b0e4e0d5b89bd339..e4156451bc87c17692475e0111599ff8c0ad355f 100644 --- a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx +++ b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx @@ -42,7 +42,7 @@ public: itkTypeMacro(KmzExport, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("KmzExport"); SetDescription("Export the input image in a KMZ product."); @@ -85,12 +85,12 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { typedef otb::KmzProductWriter<FloatVectorImageType> KmzProductWriterType; diff --git a/Modules/Applications/AppMathParser/app/otbBandMath.cxx b/Modules/Applications/AppMathParser/app/otbBandMath.cxx index 64f8893a1b07c93ff911d51631334e7e0030f34c..29e5f898c39539ee510b299c19eea558d8f64c48 100644 --- a/Modules/Applications/AppMathParser/app/otbBandMath.cxx +++ b/Modules/Applications/AppMathParser/app/otbBandMath.cxx @@ -50,16 +50,18 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("BandMath"); SetDescription("Perform a mathematical operation on monoband images"); SetDocName("Band Math"); SetDocLongDescription("This application performs a mathematical operation on monoband images." - " Mathematical formula interpretation is done via MuParser libraries http://muparser.sourceforge.net/." - "For MuParser version prior to v2 use 'and' and 'or' logical operators, and ternary operator 'if(; ; )'." - "For MuParser version superior to 2.0 uses '&&' and '||' logical operators, and C++ like ternary if-then-else operator."); + "Mathematical formula interpretation is done via MuParser libraries.\n" + "For MuParser version superior to 2.0 uses '&&' and '||' logical operators, and ternary operator 'boolean_expression ? if_true : if_false'\n" + "For older version of MuParser (prior to v2) use 'and' and 'or' logical operators, and ternary operator 'if(; ; )'.\n" + "The list of features and operators is available on MuParser website: http://muparser.sourceforge.net/\n" + ); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); @@ -81,10 +83,10 @@ private: // Doc example parameter settings SetDocExampleParameterValue("il", "verySmallFSATSW_r.tif verySmallFSATSW_nir.tif verySmallFSATSW.tif"); SetDocExampleParameterValue("out", "apTvUtBandMathOutput.tif"); - SetDocExampleParameterValue("exp", "\"cos(im1b1)+im2b1*im3b1-im3b2+ndvi(im3b3, im3b4)\""); + SetDocExampleParameterValue("exp", "\"cos(im1b1) > cos(im2b1) ? im3b1 : im3b2 \""); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Check if the expression is correctly set if (HasValue("il")) @@ -155,7 +157,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image list FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 1aa1c471e300c643d8bec640e48b7949cea0b110..ab0876183bc2e9d0912d1077f3d625d64bb3d5d9 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -52,7 +52,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("BandMathX"); SetDescription("This application performs mathematical operations on multiband images.\n" @@ -171,7 +171,7 @@ private: SetDocExampleParameterValue("exp", "\"cos(im1b1)+im2b1*im3b1-im3b2+ndvi(im3b3, im3b4)\""); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // check if input context should be used bool useContext = this->ContextCheck(); @@ -265,7 +265,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image list FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); diff --git a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx index 86848cbcc7bba60f2f458b14f0c09d7fec893ebe..e60b4bb8e90a5212e4fe37f6a34845bd1d404547 100644 --- a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx +++ b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx @@ -52,7 +52,7 @@ itkTypeMacro(LocalStatisticExtraction, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("LocalStatisticExtraction"); SetDescription("Computes local statistical moments on every pixel in the selected channel of the input image"); @@ -92,12 +92,12 @@ SetDocExampleParameterValue("radius", "3"); SetDocExampleParameterValue("out", "Statistics.tif"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx index d453b699a4bfac2148040b7167b67d59ed11f495..9e5e121d5fd1a92cfc369c571f4300ee2f6f5b57 100644 --- a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx @@ -73,7 +73,7 @@ itkTypeMacro(BinaryMorphologicalOperation, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("BinaryMorphologicalOperation"); SetDescription("Performs morphological operations on an input image channel"); @@ -156,12 +156,12 @@ SetDocExampleParameterValue("structype.ball.yradius", "5"); SetDocExampleParameterValue("filter", "erode"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx index c00828e06541fff2130828ed07f32c32c9ae87bd..ae025a22becff71995aff75d945151f80fe55103 100644 --- a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx @@ -73,7 +73,7 @@ itkTypeMacro(GrayScaleMorphologicalOperation, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("GrayScaleMorphologicalOperation"); SetDescription("Performs morphological operations on a grayscale input image"); @@ -139,12 +139,12 @@ SetDocExampleParameterValue("structype.ball.yradius", "5"); SetDocExampleParameterValue("filter", "erode"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx index 9e26eca3356c5d1bec6376590f783e7bb7b2f76c..150b5950641a29da7e9bb2baa1cfd69e7e27e2f4 100644 --- a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx +++ b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx @@ -121,7 +121,7 @@ private: std::string m_inImageName; bool m_currentEnabledStateOfFluxParam; - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("OpticalCalibration"); SetDescription("Perform optical calibration TOA/TOC (Top Of Atmosphere/Top Of Canopy). Supported sensors: QuickBird, Ikonos, WorldView2, Formosat, Spot5, Pleiades, Spot6. For other sensors the application also allows providing calibration parameters manually."); @@ -153,7 +153,7 @@ private: "- d is the earth-sun distance (in astronomical units) and depends on the acquisition's day and month \n" "- ESUN(b) is the mean TOA solar irradiance (or solar illumination) in W/m2/micrometers\n" "- θ is the solar zenith angle in degrees. \n" -"Note that the application asks for the solar elevation angle, and will perfom the conversion to the zenith angle itself (ze. angle = 90° - el. angle).\n" +"Note that the application asks for the solar elevation angle, and will perfom the conversion to the zenith angle itself (zenith_angle = 90 - elevation_angle , units : degrees).\n" "Note also that ESUN(b) not only depends on the band b, but also on the spectral sensitivity of the sensor in this particular band. " "In other words, the influence of spectral sensitivities is included within the ESUN different values.\n" "These values are provided by the user thanks to a txt file following the same convention as before.\n" @@ -247,13 +247,13 @@ private: AddParameter(ParameterType_Group,"acqui.sun","Sun angles"); SetParameterDescription("acqui.sun","This group contains the sun angles"); //Sun elevation angle - AddParameter(ParameterType_Float, "acqui.sun.elev", "Sun elevation angle (°)"); + AddParameter(ParameterType_Float, "acqui.sun.elev", "Sun elevation angle (deg)"); SetParameterDescription("acqui.sun.elev", "Sun elevation angle (in degrees)"); SetMinimumParameterFloatValue("acqui.sun.elev", 0.); SetMaximumParameterFloatValue("acqui.sun.elev", 120.); SetDefaultParameterFloat("acqui.sun.elev",90.0); //Sun azimuth angle - AddParameter(ParameterType_Float, "acqui.sun.azim", "Sun azimuth angle (°)"); + AddParameter(ParameterType_Float, "acqui.sun.azim", "Sun azimuth angle (deg)"); SetParameterDescription("acqui.sun.azim", "Sun azimuth angle (in degrees)"); SetMinimumParameterFloatValue("acqui.sun.azim", 0.); SetMaximumParameterFloatValue("acqui.sun.azim", 360.); @@ -262,13 +262,13 @@ private: AddParameter(ParameterType_Group,"acqui.view","Viewing angles"); SetParameterDescription("acqui.view","This group contains the sensor viewing angles"); //Viewing elevation angle - AddParameter(ParameterType_Float, "acqui.view.elev", "Viewing elevation angle (°)"); + AddParameter(ParameterType_Float, "acqui.view.elev", "Viewing elevation angle (deg)"); SetParameterDescription("acqui.view.elev", "Viewing elevation angle (in degrees)"); SetMinimumParameterFloatValue("acqui.view.elev", 0.); SetMaximumParameterFloatValue("acqui.view.elev", 120.); SetDefaultParameterFloat("acqui.view.elev",90.0); //Viewing azimuth angle - AddParameter(ParameterType_Float, "acqui.view.azim", "Viewing azimuth angle (°)"); + AddParameter(ParameterType_Float, "acqui.view.azim", "Viewing azimuth angle (deg)"); SetParameterDescription("acqui.view.azim", "Viewing azimuth angle (in degrees)"); SetMinimumParameterFloatValue("acqui.view.azim", 0.); SetMaximumParameterFloatValue("acqui.view.azim", 360.); @@ -354,7 +354,7 @@ private: m_currentEnabledStateOfFluxParam=false; } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { std::ostringstream ossOutput; //ossOutput << std::endl << "--DoUpdateParameters--" << std::endl; @@ -558,7 +558,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //Main filters instanciations m_ImageToLuminanceFilter = ImageToLuminanceImageFilterType::New(); diff --git a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt index 5455ab9513416e6c224368c8635f8d60df40bb10..ea89fc2e601b00aef4d40fdc1031a79c5840961a 100644 --- a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt +++ b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt @@ -32,10 +32,10 @@ otb_test_application(NAME apTvRaOpticalCalibration_Formosat APP OpticalCalibration OPTIONS -in ${INPUTDATA}/FORMOSAT_ROI_1000_100.tif -level toa - -out ${TEMP}/apTvRaOpticalCalibration_Formosat.tif + -out ${TEMP}/apTvRaOpticalCalibration_Formosat.img VALID --compare-image ${EPSILON_7} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif - ${TEMP}/apTvRaOpticalCalibration_Formosat.tif ) + ${TEMP}/apTvRaOpticalCalibration_Formosat.img ) otb_test_application(NAME apTvRaOpticalCalibration_QuickbirdPAN APP OpticalCalibration @@ -50,10 +50,10 @@ otb_test_application(NAME apTvRaOpticalCalibration_Spot5 APP OpticalCalibration OPTIONS -in ${INPUTDATA}/SPOT5_ROI_1000_100.tif -level toa - -out ${TEMP}/apTvRaOpticalCalibration_Spot5.tif + -out ${TEMP}/apTvRaOpticalCalibration_Spot5.img VALID --compare-image ${EPSILON_7} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif - ${TEMP}/apTvRaOpticalCalibration_Spot5.tif ) + ${TEMP}/apTvRaOpticalCalibration_Spot5.img ) otb_test_application(NAME apTvRaOpticalCalibration_UnknownSensor APP OpticalCalibration diff --git a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx index dfed5067597784ad16809fcb8609d24ae94f31c4..2a59b8c74e9f9d921ce190c972b081890e846169 100644 --- a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx @@ -47,7 +47,7 @@ public: typedef otb::GenericRSTransform<> TransformType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ConvertCartoToGeoPoint"); SetDescription("Convert cartographic coordinates to geographic one."); @@ -88,11 +88,11 @@ private: SetDocExampleParameterValue("mapproj.utm.zone", "31"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the projectionRef std::string inputProjRef = MapProjectionParametersHandler::GetProjectionRefFromChoice(this, "mapproj"); diff --git a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx index 91efb2578febe9a2538e4269c58f254d3d5e25a2..8a01ff5c61a39bb90af703ad7a87ef8f3fefa71f 100644 --- a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx @@ -46,7 +46,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ConvertSensorToGeoPoint"); SetDescription("Sensor to geographic coordinates conversion."); @@ -96,11 +96,11 @@ private: SetDocExampleParameterValue("input.idy","200"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get input Image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx b/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx index 4d98fbf52134ba510efd5e06d8467e12354e36df..8936100c8428de08dbee25e9fa985bd3e9b7c0e1 100644 --- a/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx +++ b/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx @@ -54,7 +54,7 @@ public: itkTypeMacro(GenerateRPCSensorModel, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("GenerateRPCSensorModel"); SetDescription("Generate a RPC sensor model from a list of Ground Control Points."); @@ -97,12 +97,12 @@ private: SetDocExampleParameterValue("map.epsg.code","32631"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { OGRMultiLineString mls; @@ -261,7 +261,7 @@ private: if(IsParameterEnabled("outvector")) { // Create the datasource (for matches export) - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); otb::ogr::DataSource::Pointer ogrDS; ogrDS = otb::ogr::DataSource::New(GetParameterString("outvector"), otb::ogr::DataSource::Modes::Overwrite); diff --git a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx index 6f71f0ff7794fb0ef75110ffeeb0dbde2493ded2..d6cf00da8f5956ced07fb4f4418be00ebb5b8a31 100644 --- a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx +++ b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx @@ -101,7 +101,7 @@ private: m_DisplacementFieldCaster = DisplacementFieldCastFilterType::New(); } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("GridBasedImageResampling"); SetDescription("Resamples an image according to a resampling grid"); @@ -183,12 +183,12 @@ private: SetDocExampleParameterValue("grid.type","def"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here } -void DoExecute() +void DoExecute() ITK_OVERRIDE { // Get the input image FloatVectorImageType* inImage = GetParameterImage("io.in"); diff --git a/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx b/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx index 11653420aa7920e8f74b5d8d3d56078f245847dd..acd93b447213cd1c812cc41ba126b938c177cfb0 100644 --- a/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx +++ b/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx @@ -46,7 +46,7 @@ public: <FloatVectorImageType, VectorDataType> EnvelopeFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ImageEnvelope"); SetDescription("Extracts an image envelope."); @@ -84,12 +84,12 @@ private: SetDocExampleParameterValue("out", "ImageEnvelope.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to be done } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer input = GetParameterImage("in"); diff --git a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx index b78e4f90644242b068750adf16d19cae1688708a..e411fa356efded2277aa0a68015c988e456e5118 100644 --- a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx @@ -45,11 +45,11 @@ private: { } - virtual ~ObtainUTMZoneFromGeoPoint() + ~ObtainUTMZoneFromGeoPoint() ITK_OVERRIDE { } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ObtainUTMZoneFromGeoPoint"); SetDescription("UTM zone determination from a geographic point."); @@ -79,12 +79,12 @@ private: SetDocExampleParameterValue("lon","124.0"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { int utmZone = otb::Utils::GetZoneFromGeoPoint(GetParameterFloat("lon"), GetParameterFloat("lat")); diff --git a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx index aeaa06779569f536e3ba8abcf084943948966472..987586e89a976e38e9532b37aee0c48777e47f13 100644 --- a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx +++ b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx @@ -84,7 +84,7 @@ public: typedef otb::BCOInterpolateImageFunction<FloatVectorImageType> BCOInterpolationType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("OrthoRectification"); std::ostringstream oss; @@ -231,7 +231,7 @@ private: SetDocExampleParameterValue("io.out","QB_Toulouse_ortho.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if (HasValue("io.in")) { @@ -590,7 +590,7 @@ private: } // if (HasValue("io.in")) } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input image FloatVectorImageType* inImage = GetParameterImage("io.in"); diff --git a/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx b/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx index e34600f5f180d3d3a0275e8f8a0bef66b3f5d3ec..a0c32c67e2299a166034230f2fca71505d5f0156 100644 --- a/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx +++ b/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx @@ -53,7 +53,7 @@ public: itkTypeMacro(RefineSensorModel, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("RefineSensorModel"); SetDescription("Perform least-square fit of a sensor model to a set of tie points"); @@ -100,12 +100,12 @@ private: SetDocExampleParameterValue("map.epsg.code","32631"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { OGRMultiLineString mls; @@ -319,7 +319,7 @@ private: if(IsParameterEnabled("outvector")) { // Create the datasource (for matches export) - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); otb::ogr::DataSource::Pointer ogrDS; ogrDS = otb::ogr::DataSource::New(GetParameterString("outvector"), otb::ogr::DataSource::Modes::Overwrite); diff --git a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx index 682ceb7d96cdeb92c4ba1244abb6da2f19723e50..30e0ba020f473acbf67a6d6d6332857bd11d6381 100644 --- a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx +++ b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx @@ -77,7 +77,7 @@ public: private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("RigidTransformResample"); SetDescription("Resample an image with a rigid transform"); @@ -171,12 +171,12 @@ private: SetDocExampleParameterValue("transform.type.rotation.scaley", "2."); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType* inputImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index dc8661fd039630f48cee4aa10a9884d3833ff631..20cdd5b9575b91ce01997319edf2dfff06fa60e1 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -78,7 +78,7 @@ public: FloatVectorImageType> BasicResamplerType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Superimpose"); SetDescription("Using available image metadata, project one image onto another one"); @@ -148,7 +148,7 @@ private: SetDocExampleParameterValue("out", "SuperimposedXS_to_PAN.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if(!HasUserValue("mode") && HasValue("inr") && HasValue("inm") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inr"),GetParameterImage("inm"))) { @@ -158,7 +158,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the inputs FloatVectorImageType* refImage = GetParameterImage("inr"); diff --git a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx index a05557666d3b1ae28de663a36b878fa7f53c0a3c..f829053c6f237e53c63328216a5c095d3a8138f3 100644 --- a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx +++ b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx @@ -57,7 +57,7 @@ public: ; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VectorDataReprojection"); std::ostringstream oss; @@ -112,12 +112,12 @@ private: SetDocExampleParameterValue("out.vd","reprojected_vd.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { GetLogger()->Debug("Entering DoExecute\n"); diff --git a/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx b/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx index e68fea82d17f45b1fe19d3d92652851fd4cb2be9..7b6b61e24f4babd11c7f7d1637b81ffdfeb77788 100644 --- a/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx +++ b/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx @@ -42,7 +42,7 @@ public: FloatImageType> CalibrationFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SARCalibration"); SetDescription("Perform radiometric calibration of SAR images. Following sensors are supported: TerraSAR-X, Sentinel1 and Radarsat-2.Both Single Look Complex(SLC) and detected products are supported as input.\n"); @@ -86,12 +86,12 @@ private: SetDocExampleParameterValue("out", "SarRadiometricCalibration.tif" ); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input complex image ComplexFloatImageType* floatComplexImage = GetParameterComplexFloatImage("in"); diff --git a/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx b/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx index 58bae02e5efdf895b6d907d014145f05b24aa82d..b8877b68bbe9aaa7a99c53824bb7eed881a1777a 100644 --- a/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx +++ b/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx @@ -42,7 +42,7 @@ public: FloatImageType> CalibrationFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SarRadiometricCalibration"); SetDescription("Perform radiometric calibration of SAR images. Following sensors are supported: TerraSAR-X, Sentinel1 and Radarsat-2.Both Single Look Complex(SLC) and detected products are supported as input.\n"); @@ -86,12 +86,12 @@ private: SetDocExampleParameterValue("out", "SarRadiometricCalibration.tif" ); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { otbAppLogWARNING("This application is deprecated, it will be renamed in next" " version of OTB. Please consider using the renamed copy SARCalibration." diff --git a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt index 8314b9ec71f2313a43fa1c65c2328065e11b8c8f..585c4d1e48dd3f1603123ce7ffcc7d5eb51c345b 100644 --- a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt +++ b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt @@ -12,6 +12,6 @@ otb_test_application(NAME apTvRaSarRadiometricCalibration_RADARSAT2 APP SARCalibration OPTIONS -in ${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.tif?&geom=${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.geom -out ${TEMP}/apTvRaSarRadiometricCalibration_RADARSAT2.tif - VALID --compare-image ${NOTOL} + VALID --compare-image ${EPSILON_5} ${BASELINE}/raTvSarRadiometricCalibration_RADARSAT2.tif ${TEMP}/apTvRaSarRadiometricCalibration_RADARSAT2.tif ) diff --git a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx index e54c19274498be006bb4f0f69d8a65645c1d0b7f..7bcf5d63e57cbf9027bfa2212ef2e9c59a8d17bd 100644 --- a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx +++ b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx @@ -81,7 +81,7 @@ public: itkTypeMacro(SARDecompositions, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SARDecompositions"); SetDescription("From one-band complex images (each one related to an element of the Sinclair matrix), returns the selected decomposition."); @@ -134,7 +134,7 @@ private: SetParameterDescription("decomp.pauli","Pauli coherent decomposition"); AddParameter(ParameterType_Group,"inco","Incoherent decompositions"); - SetParameterDescription("inco","This group allows to set parameters related to the incoherent decompositions."); + SetParameterDescription("inco","This group allows setting parameters related to the incoherent decompositions."); AddParameter(ParameterType_Int, "inco.kernelsize", "Kernel size for spatial incoherent averaging."); SetParameterDescription("inco.kernelsize", "Minute (0-59)"); @@ -155,12 +155,12 @@ private: SetDocExampleParameterValue("out", "HaA.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { bool inhv = HasUserValue("inhv"); diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx index c3edee8da659e019c1c4fd94289f7338abb3aa8e..208d1355d036c7d281cca401719e6c6ecf248fc3 100644 --- a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx +++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx @@ -181,7 +181,7 @@ public: itkTypeMacro(SARPolarMatrixConvert, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SARPolarMatrixConvert"); SetDescription("This applications allows converting classical polarimetric matrices to each other."); @@ -193,7 +193,7 @@ private: "This application allows converting classical polarimetric matrices to each other.\n" "For instance, it is possible to get the coherency matrix from the Sinclar one, or the Mueller matrix from the coherency one.\n" "The filters used in this application never handle matrices, but images where each band is related to their elements.\n" - "As most of the time SAR polarimetry handles symetric/hermitian matrices, only the relevant elements are stored, so that the images representing them have a minimal number of bands.\n" + "As most of the time SAR polarimetry handles symmetric/hermitian matrices, only the relevant elements are stored, so that the images representing them have a minimal number of bands.\n" "For instance, the coherency matrix size is 3x3 in the monostatic case, and 4x4 in the bistatic case : it will thus be stored in a 6-band or a 10-band complex image (the diagonal and the upper elements of the matrix).\n" "\n" "The Sinclair matrix is a special case : it is always represented as 3 or 4 one-band complex images (for mono- or bistatic case).\n" @@ -351,7 +351,7 @@ private: SetDocExampleParameterValue("outc", "mcoherency.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { int convType = GetParameterInt("conv"); @@ -435,7 +435,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //**************************************** diff --git a/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx index b1017b3d7e963dfb648937dfde34d5bfbbabfff0..488b8c68b36c0efe82281b250e37aa10f1d684f1 100644 --- a/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx +++ b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx @@ -41,7 +41,7 @@ public: itkTypeMacro(SARPolarSynth, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("SARPolarSynth"); SetDescription("Gives, for each pixel, the power that would have been received by a SAR system with a basis different from the classical (H,V) one (polarimetric synthetis)."); @@ -51,7 +51,7 @@ private: SetDocLongDescription("This application gives, for each pixel, the power that would have been received by a SAR system with a basis different from the classical (H,V) one (polarimetric synthetis).\n" "The new basis A and B are indicated through two Jones vectors, defined by the user thanks to orientation (psi) and ellipticity (khi) parameters.\n" "These parameters are namely psii, khii, psir and khir. The suffixes (i) and (r) refer to the transmiting antenna and the receiving antenna respectively.\n" - "Orientations and ellipticities are given in degrees, and are between -90°/90° and -45°/45° respectively.\n " + "Orientations and ellipticities are given in degrees, and are between -90/90 degrees and -45/45 degrees respectively.\n " "\n" "Four polarization architectures can be processed : \n" "1) HH_HV_VH_VV : full polarization, general bistatic case.\n" @@ -63,13 +63,13 @@ private: "\n" "In order to determine the architecture, the application first relies on the number of bands of the input image.\n" "1) Architecture HH_HV_VH_VV is the only one with four bands, there is no possible confusion.\n" - "2) Concerning HH_HV_VV and HH_VH_VV architectures, both correspond to a three channels image. But they are processed in the same way, as the Sinclair matrix is symetric in the monostatic case.\n" + "2) Concerning HH_HV_VV and HH_VH_VV architectures, both correspond to a three channels image. But they are processed in the same way, as the Sinclair matrix is symmetric in the monostatic case.\n" "3) Finally, the two last architectures (dual polarizations), can't be distinguished only by the number of bands of the input image.\n" " User must then use the parameters emissionh and emissionv to indicate the architecture of the system : emissionh=1 and emissionv=0 --> HH_HV, emissionh=0 and emissionv=1 --> VH_VV.\n" - "Note : if the architecture is HH_HV, khii and psii are automatically set to 0°/0°; if the architecture is VH_VV, khii and psii are automatically set to 0°/90°.\n" + "Note : if the architecture is HH_HV, khii and psii are automatically both set to 0 degree; if the architecture is VH_VV, khii and psii are automatically set to 0 degree and 90 degrees respectively.\n" "\n" "It is also possible to force the calculation to co-polar or cross-polar modes.\n" - "In the co-polar case, values for psir and khir will be ignored and forced to psii and khii; same as the cross-polar mode, where khir and psir will be forced to psii+90° and -khii.\n" + "In the co-polar case, values for psir and khir will be ignored and forced to psii and khii; same as the cross-polar mode, where khir and psir will be forced to (psii + 90 degrees) and -khii.\n" "\n" "Finally, the result of the polarimetric synthetis is expressed in the power domain, through a one-band scalar image.\n" "Note: this application doesn't take into account the terms which do not depend on the polarization of the antennas. \n" @@ -149,12 +149,12 @@ private: SetDocExampleParameterValue("out", "newbasis.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { m_MCPSFilter = MCPSFilterType::New(); diff --git a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx index ae569d67e1771c8a993bd62d893d766e3a733a59..8f014d3ecd7f8e2407c9ddfef7eef7c5535b7c28 100644 --- a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx @@ -66,7 +66,7 @@ public: <VectorDataType, VectorDataType> VectorDataProjectionFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ConnectedComponentSegmentation"); SetDescription("Connected component segmentation and object based image filtering of the input image according to user-defined criterions."); @@ -117,12 +117,12 @@ private: SetDocExampleParameterValue("out", "ConnectedComponentSegmentation.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { InputVectorImageType::Pointer inputImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx index 74423df47757fbc95af9beaa887723395dcd3eb1..d8224dbf51a08fa5b72f858ee1d2df1820e07da5 100644 --- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx @@ -127,7 +127,7 @@ public: <FloatPixelType, Int16PixelType> > HooverColorFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("HooverCompareSegmentation"); SetDescription("Compare two segmentations with Hoover metrics"); @@ -197,12 +197,12 @@ private: SetDocExampleParameterValue("outgt", "maur_colored_GT.tif uint8"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { UInt32ImageType::Pointer inputGT = GetParameterUInt32Image("ingt"); UInt32ImageType::Pointer inputMS = GetParameterUInt32Image("inms"); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx index f693b50234138745727a1b9661ccfeed37546caa..160b6e233b8b91e551495947d67b3f76f07b4134 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx @@ -87,7 +87,7 @@ public: LSMSSegmentation(): m_FinalReader(),m_ImportGeoInformationFilter(),m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){} - virtual ~LSMSSegmentation(){} + ~LSMSSegmentation() ITK_OVERRIDE{} private: LabelImageReaderType::Pointer m_FinalReader; @@ -211,7 +211,7 @@ private: return vrtfname; } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("LSMSSegmentation"); SetDescription("Second step of the exact Large-Scale Mean-Shift segmentation workflow."); @@ -234,17 +234,17 @@ private: SetParameterDescription( "out", "The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32." ); SetDefaultOutputPixelType("out",ImagePixelType_uint32); - AddParameter(ParameterType_Float, "ranger", "Range radius"); - SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space."); - SetDefaultParameterFloat("ranger", 15); - SetMinimumParameterFloatValue("ranger", 0); - MandatoryOff("ranger"); - AddParameter(ParameterType_Float, "spatialr", "Spatial radius"); SetParameterDescription("spatialr", "Spatial radius of the neighborhood."); SetDefaultParameterFloat("spatialr", 5); SetMinimumParameterFloatValue("spatialr", 0); MandatoryOff("spatialr"); + + AddParameter(ParameterType_Float, "ranger", "Range radius"); + SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space."); + SetDefaultParameterFloat("ranger", 15); + SetMinimumParameterFloatValue("ranger", 0); + MandatoryOff("ranger"); AddParameter(ParameterType_Int, "minsize", "Minimum Region Size"); SetParameterDescription("minsize", "Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is deleted."); @@ -276,19 +276,19 @@ private: SetDocExampleParameterValue("in","smooth.tif"); SetDocExampleParameterValue("inpos","position.tif"); SetDocExampleParameterValue("out","segmentation.tif"); - SetDocExampleParameterValue("ranger","15"); SetDocExampleParameterValue("spatialr","5"); + SetDocExampleParameterValue("ranger","15"); SetDocExampleParameterValue("minsize","0"); SetDocExampleParameterValue("tilesizex","256"); SetDocExampleParameterValue("tilesizey","256"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { m_FilesToRemoveAfterExecute.clear(); @@ -597,7 +597,7 @@ private: WriteTile(changeLabel->GetOutput(),row,column,"RELAB"); // Remove previous tile (not needed anymore) - readerIn = 0; // release the input file + readerIn = ITK_NULLPTR; // release the input file RemoveFile(tileIn); } } @@ -654,7 +654,7 @@ private: m_FilesToRemoveAfterExecute.push_back(tmpfile); // Clean previous tiles (not needed anymore) - readerIn = 0; // release the input file + readerIn = ITK_NULLPTR; // release the input file RemoveFile(tileIn); } } @@ -683,10 +683,10 @@ private: SetParameterOutputImage("out",m_ImportGeoInformationFilter->GetOutput()); } - void AfterExecuteAndWriteOutputs() + void AfterExecuteAndWriteOutputs() ITK_OVERRIDE { // Release input files - m_FinalReader = 0; + m_FinalReader = ITK_NULLPTR; if(IsParameterEnabled("cleanup")) { diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx index 64156f9eda640859db4c3bbeab02b0fe950f61b1..23f33978594b6c16e37190d2e30f9b3bed16ae20 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx @@ -70,7 +70,7 @@ public: private: ChangeLabelImageFilterType::Pointer m_ChangeLabelFilter; - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("LSMSSmallRegionsMerging"); SetDescription("Third (optional) step of the exact Large-Scale Mean-Shift segmentation workflow."); @@ -118,11 +118,11 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { clock_t tic = clock(); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx index e037361874fa99685b7453750a5e5b833df32669..9a0c070e995925392b067ed4d42508694f0b2151 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx @@ -63,7 +63,7 @@ public: itkTypeMacro(Vectorization, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("LSMSVectorization"); SetDescription("Fourth step of the exact Large-Scale Mean-Shift segmentation workflow."); @@ -102,11 +102,11 @@ private: SetDocExampleParameterValue("tilesizey","256"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { clock_t tic = clock(); @@ -154,7 +154,7 @@ private: std::vector<ImageType::PixelType>sum2(regionCount+1,defaultValue); otb::ogr::DataSource::Pointer ogrDS; - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); OGRSpatialReference oSRS(projRef.c_str()); std::vector<std::string> options; @@ -258,7 +258,7 @@ private: std::ostringstream sqloss; sqloss.str(""); sqloss<<"SELECT * FROM \""<<layername<<"\" ORDER BY label"; - otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str().c_str(), NULL, NULL); + otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str().c_str(), ITK_NULLPTR, ITK_NULLPTR); otb::ogr::Feature firstFeature = layerTmp.ogr().GetNextFeature(); //Geometry fusion @@ -271,7 +271,7 @@ private: OGRMultiPolygon geomToMerge; geomToMerge.addGeometry(firstFeature.GetGeometry()); bool merging = true; - otb::ogr::Feature nextFeature(NULL); + otb::ogr::Feature nextFeature(ITK_NULLPTR); bool haveMerged=false; while(merging) @@ -345,7 +345,7 @@ private: if(extension==".shp"){ sqloss.str(""); sqloss<<"REPACK "<<layername; - ogrDS->ogr().ExecuteSQL(sqloss.str().c_str(), NULL, NULL); + ogrDS->ogr().ExecuteSQL(sqloss.str().c_str(), ITK_NULLPTR, ITK_NULLPTR); } ogrDS->SyncToDisk(); diff --git a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx index a1fb4bb0302ad9b6d08a9eff8338d4a1c7a8a98f..c69ec3f1475c44852e8165140fb040a7863ed28b 100644 --- a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx +++ b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx @@ -43,7 +43,7 @@ public: itkTypeMacro(MeanShiftSmoothing, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("MeanShiftSmoothing"); SetDescription("Perform mean shift filtering"); @@ -100,7 +100,7 @@ private: MandatoryOff("rangeramp"); AddParameter(ParameterType_Empty, "modesearch", "Mode search."); - SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path . Be careful, with this option, the result will slightly depend on thread number"); + SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path crosses an already converged pixel. Be careful, with this option, the result will slightly depend on thread number"); EnableParameter("modesearch"); @@ -115,20 +115,10 @@ private: } - void DoUpdateParameters() - { - if(IsParameterEnabled("modesearch")) - { - MandatoryOn("foutpos"); - EnableParameter("foutpos"); - } - else - { - MandatoryOff("foutpos"); - } - } + void DoUpdateParameters() ITK_OVERRIDE + {} - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType* input = GetParameterImage("in"); diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index c726d12e09444c0ad9632ac44aab86d2140204e9..3f8bcd0a9b6e2f112df06773c3336ee7d8ca76d4 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -131,7 +131,7 @@ public: itkTypeMacro(Segmentation, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Segmentation"); SetDescription("Performs segmentation of an image, and output either a raster or a vector file. In vector mode, large input datasets are supported."); @@ -340,7 +340,7 @@ private: SetDocExampleParameterValue("filter", "meanshift",1); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } @@ -441,7 +441,7 @@ private: return streamingVectorizedFilter->GetStreamSize(); } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Switch on segmentation mode const std::string segModeType = GetParameterString("mode"); @@ -449,7 +449,7 @@ private: const std::string segType = GetParameterString("filter"); otb::ogr::DataSource::Pointer ogrDS; - otb::ogr::Layer layer(NULL, false); + otb::ogr::Layer layer(ITK_NULLPTR, false); std::string projRef = GetParameterFloatVectorImage("in")->GetProjectionRef(); @@ -686,7 +686,7 @@ private: std::string repack("REPACK "); repack = repack + shpLayerName; - ogrDS->ExecuteSQL(repack, NULL, NULL); + ogrDS->ExecuteSQL(repack, ITK_NULLPTR, ITK_NULLPTR); } } } diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx index 3307a8f817cf0e369d711605c304e8908212cedd..92383058a87de091e1220fdec735c41f2157677a 100644 --- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx +++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx @@ -121,7 +121,7 @@ private: m_VMedianFilter = MedianFilterType::New(); } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("BlockMatching"); SetDescription("Performs block-matching to estimate pixel-wise disparities between two images"); @@ -321,7 +321,7 @@ private: SetDocExampleParameterValue("io.out","MyDisparity.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if(IsParameterEnabled("mask.variancet") || IsParameterEnabled("mask.nodata")) { @@ -354,7 +354,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatImageType::Pointer leftImage = GetParameterFloatImage("io.inleft"); FloatImageType::Pointer rightImage = GetParameterFloatImage("io.inright"); diff --git a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx index 3f434a7672dc9a532d05405fe1747dddbb920df1..894c73e97313594922474eab975acca30b2bab2d 100644 --- a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx +++ b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx @@ -59,7 +59,7 @@ private: m_DispToElev = DisparityToElevationFilterType::New(); } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("DisparityMapToElevationMap"); SetDescription("Projects a disparity map into a regular elevation map"); @@ -125,12 +125,12 @@ private: SetDocExampleParameterValue("io.out","dem.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inputDisp = this->GetParameterImage("io.in"); FloatVectorImageType::Pointer sensorLeft = this->GetParameterImage("io.left"); diff --git a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx index 23f993bd3a367d7ed605ea8d45fd012546ac6fec..33481d3185cb8c5d25ae58798e8315b8dac57d12 100644 --- a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx +++ b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx @@ -111,7 +111,7 @@ public: typedef otb::ImageFileReader<VectorImageType> InternalReaderType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("FineRegistration"); SetDescription("Estimate disparity map between two images."); @@ -225,12 +225,12 @@ private: SetDocExampleParameterValue("mry", "3"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer refImage = GetParameterImage("ref"); // fixed FloatVectorImageType::Pointer secImage = GetParameterImage("sec"); // moved diff --git a/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx b/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx index c6422776ea8dbed59195c0bc595bbe49e8dd5954..0be9121fdf5def3a67458f595f6a88c5ba479409 100644 --- a/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx +++ b/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx @@ -49,7 +49,7 @@ public: private: GeneratePlyFile(){} - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("GeneratePlyFile"); SetDescription("Generate a 3D Ply file from a DEM and a color image."); @@ -87,13 +87,13 @@ private: SetDocExampleParameterValue("incolor","image_color.tif"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Update the UTM zone params MapProjectionParametersHandler::InitializeUTMParameters(this, "incolor", "map"); } - void DoExecute() + void DoExecute() ITK_OVERRIDE { std::string outfname = GetParameterString("out"); diff --git a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx index d1077c56bc73e60da2e5cebe76b8e0e17bab5dc4..2c28ba79ab264ebd7da438bf12977b26623f4421 100644 --- a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx @@ -312,7 +312,7 @@ private: } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("StereoFramework"); SetDescription("Compute the ground elevation based on one or multiple stereo pair(s)"); @@ -525,7 +525,7 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { if( HasValue("input.il") ) { @@ -591,7 +591,7 @@ private: } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Setup the DSM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this, "elev"); @@ -899,9 +899,9 @@ private: } // Compute disparities - FilterType* blockMatcherFilterPointer = NULL; - FilterType* invBlockMatcherFilterPointer = NULL; - FilterType* subPixelFilterPointer = NULL; + FilterType* blockMatcherFilterPointer = ITK_NULLPTR; + FilterType* invBlockMatcherFilterPointer = ITK_NULLPTR; + FilterType* subPixelFilterPointer = ITK_NULLPTR; BijectionFilterType::Pointer bijectFilter; // pointer diff --git a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx index d7934029a81180bd841b8af0d093f9c03ec6b3a6..de20a9b507a1cad27f6888c89661f46eb280e3b3 100644 --- a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx @@ -96,7 +96,7 @@ private: m_StatisticsFilter = StatisticsFilterType::New(); } - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("StereoRectificationGridGenerator"); SetDescription("Generates two deformation fields to stereo-rectify (i.e. resample in epipolar geometry) a pair of stereo images up to the sensor model precision"); @@ -198,12 +198,12 @@ private: SetDocExampleParameterValue("epi.elevation.default","400"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here } - void DoExecute() + void DoExecute() ITK_OVERRIDE { m_DisplacementFieldSource->SetLeftImage(GetParameterImage("io.inleft")); m_DisplacementFieldSource->SetRightImage(GetParameterImage("io.inright")); diff --git a/Modules/Applications/AppTest/app/otbTestApplication.cxx b/Modules/Applications/AppTest/app/otbTestApplication.cxx index 86d70293e90421da9eeb48c3958c84411660515f..e1bfd325fcb581117af3f0282555b3f822300de8 100644 --- a/Modules/Applications/AppTest/app/otbTestApplication.cxx +++ b/Modules/Applications/AppTest/app/otbTestApplication.cxx @@ -38,7 +38,7 @@ public: itkTypeMacro(TestApplication, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("TestApplication"); SetDescription("This application helps developers to test parameters types"); @@ -99,12 +99,12 @@ private: SetDocExampleParameterValue("filename", "myFilename.foo"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { //std::cout << "TestApplication::DoUpdateParameters" << std::endl; } - void DoExecute() + void DoExecute() ITK_OVERRIDE { //std::cout << "TestApplication::DoExecute" << std::endl; } diff --git a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx index 7695115d543bc159d9d29de1dce3226655ccbac3..fa14c6dc8209bb748c16f62e55c7eeaef716db9b 100644 --- a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx @@ -64,7 +64,7 @@ itkTypeMacro(HaralickTextureExtraction, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("HaralickTextureExtraction"); SetDescription("Computes textures on every pixel of the input image selected channel"); @@ -154,12 +154,12 @@ SetDocExampleParameterValue("texture", "simple"); SetDocExampleParameterValue("out", "HaralickTextures.tif"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx index 8369046672766c396246822b9c7cc07a3445f100..3fe88a9897dfc0b58ab64b9d378be0a45397a926 100644 --- a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx @@ -55,7 +55,7 @@ itkTypeMacro(SFSTextureExtraction, otb::Application); private: -void DoInit() +void DoInit() ITK_OVERRIDE { SetName("SFSTextureExtraction"); SetDescription("Computes Structural Feature Set textures on every pixel of the input image selected channel"); @@ -116,12 +116,12 @@ SetDocExampleParameterValue("parameters.spathre", "100"); SetDocExampleParameterValue("out", "SFSTextures.tif"); } -void DoUpdateParameters() +void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here : all parameters are independent } -void DoExecute() +void DoExecute() ITK_OVERRIDE { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx index 045b6b321d445a75680f607a277b1c61f645c9a3..9cacf044bea7fc7a0244774ef969b5df9c096e69 100644 --- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx +++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx @@ -57,7 +57,7 @@ public: typedef otb::OGRDataSourceToLabelImageFilter<FloatImageType> OGRDataSourceToMapFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("Rasterization"); SetDescription("Rasterize a vector dataset."); @@ -139,13 +139,13 @@ private: SetDocExampleParameterValue("spy","1."); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do } - void DoExecute() + void DoExecute() ITK_OVERRIDE { otb::ogr::DataSource::Pointer ogrDS; UInt8ImageType::Pointer referenceImage; diff --git a/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx b/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx index c7d5c1cb977593ef62ea8d3c5b9f1c93917e9dd3..5c668497f458965d70001fb8e0fbaef0bd819410 100644 --- a/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx @@ -44,7 +44,7 @@ public: typedef otb::ConcatenateVectorDataFilter<VectorDataType> ConcatenateFilterType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("ConcatenateVectorData"); SetDescription("Concatenate VectorDatas"); @@ -71,12 +71,12 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the input VectorData list VectorDataListType* vectorDataList = GetParameterVectorDataList("vd"); diff --git a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx index e163a340949805c892bfb648811490ec5638f1b2..3ff6ee10d1ec3047b183c11877000d4891aa63ae 100644 --- a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx @@ -47,7 +47,7 @@ public: typedef otb::OSMDataToVectorDataGenerator VectorDataProviderType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("OSMDownloader"); SetDescription("Generate a vector data from OSM on the input image extend"); @@ -91,7 +91,7 @@ private: } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // CASE: when the -print option is not required and the User // does not set the option OSMKey or the option Output or does not @@ -108,7 +108,7 @@ private: } } - void DoExecute() + void DoExecute() ITK_OVERRIDE { typedef otb::ImageToEnvelopeVectorDataFilter<FloatVectorImageType, VectorDataType> EnvelopeFilterType; diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx index 3084e59302b3624d1183f754aa10e159347f4741..95e1ef3968fa18f09215ef0b1dccc9512d050627 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx @@ -62,7 +62,7 @@ public: typedef otb::RemoteSensingRegion<double> RemoteSensingRegionType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VectorDataExtractROI"); SetDescription("Perform an extract ROI on the input vector data according to the input image extent"); @@ -100,12 +100,12 @@ private: SetDocExampleParameterValue("io.out", "apTvUtVectorDataExtractROIApplicationTest.shp"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do here for the parameters : all are independent } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the inputs VectorDataType* vd = GetParameterVectorData("io.vd"); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx index 6f0d0ef88898d81300fca3e4a4ea104b45fe8f12..570c269fd79b5f5f699745b7b7944efce4249404 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx @@ -40,7 +40,7 @@ public: itkTypeMacro(VectorDataSetField, otb::Application); private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VectorDataSetField"); SetDescription("Set a field in vector data."); @@ -71,12 +71,12 @@ private: SetDocExampleParameterValue("fv", "Sample polygon"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // Nothing to do (for now) } - void DoExecute() + void DoExecute() ITK_OVERRIDE { m_InputData = GetParameterVectorData("in"); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx index 3fb4a0aeef980aea110c378785ab5232be81f637..089d05813fff369e901ca4f0f735f805385960e9 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx @@ -51,7 +51,7 @@ public: typedef itk::CenteredSimilarity2DTransform<double> TransformType; private: - void DoInit() + void DoInit() ITK_OVERRIDE { SetName("VectorDataTransform"); SetDescription("Apply a transform to each vertex of the input VectorData"); @@ -106,12 +106,12 @@ private: SetDocExampleParameterValue("transform.ro", "5"); } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { // nothing to update } - void DoExecute() + void DoExecute() ITK_OVERRIDE { // Get the support image FloatVectorImageType* inImage = GetParameterImage("in"); diff --git a/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h b/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h index 8c7eef2f55695b23bd5f5ceef8c1066c5589cf5d..0c9cf53cfd836c2a124b13cb9c49f0034878bcee 100644 --- a/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h +++ b/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCommandLineArgumentParser_h -#define __otbCommandLineArgumentParser_h +#ifndef otbCommandLineArgumentParser_h +#define otbCommandLineArgumentParser_h #include <iostream> #include <vector> @@ -137,7 +137,7 @@ public: // const char *GetOptionParameter(const char *option, unsigned int number = 0); int GetNumberOfParameters(const std::string& option); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; #define otbGetParameterMacro(name, type) \ virtual type GetParameter ## name (const std::string& option, unsigned int number = 0) const \ @@ -167,7 +167,7 @@ public: protected: CommandLineArgumentParseResult(); - virtual ~CommandLineArgumentParseResult(); + ~CommandLineArgumentParseResult() ITK_OVERRIDE; private: template<typename TypeValeur> @@ -237,12 +237,12 @@ public: /** Add a new option with fixed number of parameters */ void AddOption(const std::string& name, const std::string& comment, - const std::string& synonym = NULL, + const std::string& synonym = ITK_NULLPTR, int nParameters = 1, bool obligatory = true); /** Add a new option with unknown number of parameters */ - void AddOptionNParams(const std::string& name, const std::string& comment, const std::string& synonym = NULL, bool obligatory = true); + void AddOptionNParams(const std::string& name, const std::string& comment, const std::string& synonym = ITK_NULLPTR, bool obligatory = true); /** Interpret options from the command line */ void ParseCommandLine(int argc, char *argv[], @@ -251,7 +251,7 @@ public: protected: CommandLineArgumentParser(); - virtual ~CommandLineArgumentParser(); + ~CommandLineArgumentParser() ITK_OVERRIDE; private: @@ -287,4 +287,4 @@ private: } -#endif // __otbCommandLineArgumentParser_h_ +#endif // otbCommandLineArgumentParser_h_ diff --git a/Modules/Core/CommandLineParser/src/otbCommandLineArgumentParser.cxx b/Modules/Core/CommandLineParser/src/otbCommandLineArgumentParser.cxx index eff12c580afaa74fea3393e75100712f069df772..29cfb9dfd2308462a6c787c50aa0a3a758fb5a53 100644 --- a/Modules/Core/CommandLineParser/src/otbCommandLineArgumentParser.cxx +++ b/Modules/Core/CommandLineParser/src/otbCommandLineArgumentParser.cxx @@ -280,7 +280,7 @@ bool CommandLineArgumentParser::TryParseCommandLine(int argc, char *argv[], bool goOnFlag(true); while (goOnFlag == true) { - if (argv[i + 1] != NULL) + if (argv[i + 1] != ITK_NULLPTR) { std::string strArgv = std::string(argv[i + 1]); if (strArgv[0] == '-' ) diff --git a/Modules/Core/Common/include/otbChannelSelectorFunctor.h b/Modules/Core/Common/include/otbChannelSelectorFunctor.h index 8780dc3910fb36a07fd43e0ac2e8962523e22bf4..d3442262455f6e847061e7213aca4671ef3cce6d 100644 --- a/Modules/Core/Common/include/otbChannelSelectorFunctor.h +++ b/Modules/Core/Common/include/otbChannelSelectorFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChannelSelectorFunctor_h -#define __otbChannelSelectorFunctor_h +#ifndef otbChannelSelectorFunctor_h +#define otbChannelSelectorFunctor_h #include <cassert> #include "itkVariableLengthVector.h" @@ -245,7 +245,7 @@ protected: } /** Destructor */ - virtual ~ChannelSelectorFunctor() {} + ~ChannelSelectorFunctor() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Common/include/otbCommandProgressUpdate.h b/Modules/Core/Common/include/otbCommandProgressUpdate.h index 7842014eddc5049777d88a15dfd53a14dde1a6d9..3053bde813bf31c62802ac417901e0e8a581cd30 100644 --- a/Modules/Core/Common/include/otbCommandProgressUpdate.h +++ b/Modules/Core/Common/include/otbCommandProgressUpdate.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCommandProgressUpdate_h -#define __otbCommandProgressUpdate_h +#ifndef otbCommandProgressUpdate_h +#define otbCommandProgressUpdate_h #include "itkCommand.h" #include <sstream> @@ -45,9 +45,9 @@ protected: public: typedef const TFilter * FilterPointer; - void Execute(itk::Object *caller, const itk::EventObject& event); + void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE; - void Execute(const itk::Object * object, const itk::EventObject& event); + void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE; }; } // end namespace otb diff --git a/Modules/Core/Common/include/otbCommandProgressUpdate.txx b/Modules/Core/Common/include/otbCommandProgressUpdate.txx index a722def497fc939f8af346ea5a616f6f2d7fb77e..79fa731f747a2713bd64fa162bb67f3aac1fc5f8 100644 --- a/Modules/Core/Common/include/otbCommandProgressUpdate.txx +++ b/Modules/Core/Common/include/otbCommandProgressUpdate.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCommandProgressUpdate_txx -#define __otbCommandProgressUpdate_txx +#ifndef otbCommandProgressUpdate_txx +#define otbCommandProgressUpdate_txx #include "otbCommandProgressUpdate.h" diff --git a/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h b/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h index 6c2ab5ffc807ba570a0128a486320453385cb770..8a8e1a522a2b8c2eb7e6f5c7abd3c5d587d68ea6 100644 --- a/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h +++ b/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexToIntensityImageFilter_h -#define __otbComplexToIntensityImageFilter_h +#ifndef otbComplexToIntensityImageFilter_h +#define otbComplexToIntensityImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -96,7 +96,7 @@ public: protected: ComplexToIntensityImageFilter() {} - virtual ~ComplexToIntensityImageFilter() {} + ~ComplexToIntensityImageFilter() ITK_OVERRIDE {} private: ComplexToIntensityImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h b/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h index 763447c38590cfbeae4f8266caeb752fbc726020..de60929a4f38ccc392764d786a173eef037663b0 100644 --- a/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h +++ b/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexToVectorImageCastFilter_h -#define __otbComplexToVectorImageCastFilter_h +#ifndef otbComplexToVectorImageCastFilter_h +#define otbComplexToVectorImageCastFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -137,7 +137,7 @@ public: protected: ComplexToVectorImageCastFilter() {} - virtual ~ComplexToVectorImageCastFilter() {} + ~ComplexToVectorImageCastFilter() ITK_OVERRIDE {} template<class T> bool PixelIsSingle(const T& /*dummy*/) @@ -151,7 +151,7 @@ protected: return false; } - void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); InputPixelType dummy; diff --git a/Modules/Core/Common/include/otbDecimateImageFilter.h b/Modules/Core/Common/include/otbDecimateImageFilter.h index a171a7670ee7ff27e7adf247faf6e93dfda1e2b8..8974d23bca1e7e81ce6ae7e9e11b3cd594f16df9 100644 --- a/Modules/Core/Common/include/otbDecimateImageFilter.h +++ b/Modules/Core/Common/include/otbDecimateImageFilter.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbDecimateImageFilter_h -#define __otbDecimateImageFilter_h +#ifndef otbDecimateImageFilter_h +#define otbDecimateImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" diff --git a/Modules/Core/Common/include/otbDecimateImageFilter.txx b/Modules/Core/Common/include/otbDecimateImageFilter.txx index cfe08abf4ec68f40576326d962fa572511d6d7ef..ea97be241e25e1163a5f8e84b0c94cd3a53752dc 100644 --- a/Modules/Core/Common/include/otbDecimateImageFilter.txx +++ b/Modules/Core/Common/include/otbDecimateImageFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbDecimateImageFilter_txx -#define __otbDecimateImageFilter_txx +#ifndef otbDecimateImageFilter_txx +#define otbDecimateImageFilter_txx #include "otbDecimateImageFilter.h" diff --git a/Modules/Core/Common/include/otbDotProductImageFilter.h b/Modules/Core/Common/include/otbDotProductImageFilter.h index 34effe45e5c1105f3c29e8c2bf2ebef5aceb23af..b97be6154eedb4ac2c1cc325c45324a28c2e65bb 100644 --- a/Modules/Core/Common/include/otbDotProductImageFilter.h +++ b/Modules/Core/Common/include/otbDotProductImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDotProductImageFilter_h -#define __otbDotProductImageFilter_h +#ifndef otbDotProductImageFilter_h +#define otbDotProductImageFilter_h #include "itkMacro.h" #include "otbUnaryFunctorImageFilter.h" @@ -137,9 +137,9 @@ public: protected: DotProductImageFilter(); - virtual ~DotProductImageFilter() {} + ~DotProductImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: DotProductImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbDotProductImageFilter.txx b/Modules/Core/Common/include/otbDotProductImageFilter.txx index 1c56622a985649af56d0583d3ebc8e55ab4e9cb3..5b017f95c94406ecf19066a79ec28d87dd734bff 100644 --- a/Modules/Core/Common/include/otbDotProductImageFilter.txx +++ b/Modules/Core/Common/include/otbDotProductImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDotProductImageFilter_txx -#define __otbDotProductImageFilter_txx +#ifndef otbDotProductImageFilter_txx +#define otbDotProductImageFilter_txx #include "otbDotProductImageFilter.h" diff --git a/Modules/Core/Common/include/otbFilterWatcherBase.h b/Modules/Core/Common/include/otbFilterWatcherBase.h index 66a01f085710afc1d359f58ff753d0e2e4f8f221..e9d74750b441910134251786f3dff390eb79a273 100644 --- a/Modules/Core/Common/include/otbFilterWatcherBase.h +++ b/Modules/Core/Common/include/otbFilterWatcherBase.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFilterWatcherBase_h -#define __otbFilterWatcherBase_h +#ifndef otbFilterWatcherBase_h +#define otbFilterWatcherBase_h #include "itkCommand.h" #include "itkProcessObject.h" diff --git a/Modules/Core/Common/include/otbFunctionToImageFilter.h b/Modules/Core/Common/include/otbFunctionToImageFilter.h index b01099fc25722f90521097e437bee075bb5c3341..40c1a24fd8ce5292b9ad17ad0f577a75aad8ea57 100644 --- a/Modules/Core/Common/include/otbFunctionToImageFilter.h +++ b/Modules/Core/Common/include/otbFunctionToImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFunctionToImageFilter_h -#define __otbFunctionToImageFilter_h +#ifndef otbFunctionToImageFilter_h +#define otbFunctionToImageFilter_h #include "itkInPlaceImageFilter.h" #include "itkImageFunction.h" @@ -93,6 +93,10 @@ public: { return m_PixelFunction; } + FunctionType const* GetFunction() const + { + return m_PixelFunction; + } /** Image dimensions */ @@ -103,11 +107,11 @@ public: protected: FunctionToImageFilter(); - virtual ~FunctionToImageFilter() {} + ~FunctionToImageFilter() ITK_OVERRIDE {} /** Validate the presence of all three inputs. If one or more inputs * are missing, throw an exception. */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** SpatialFunctionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -119,8 +123,8 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; private: FunctionToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbFunctionToImageFilter.txx b/Modules/Core/Common/include/otbFunctionToImageFilter.txx index e9110eb9b0fa47d5be3cfa5c4410de52f770416c..553a76a8ce89b9354922a1d340aed3486c3d8214 100644 --- a/Modules/Core/Common/include/otbFunctionToImageFilter.txx +++ b/Modules/Core/Common/include/otbFunctionToImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFunctionToImageFilter_txx -#define __otbFunctionToImageFilter_txx +#ifndef otbFunctionToImageFilter_txx +#define otbFunctionToImageFilter_txx #include "otbFunctionToImageFilter.h" #include "itkImageRegionConstIterator.h" diff --git a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h index 8689065323a77c208bb468d131402d242ad97953..5eb8fac75e787aafd0dfd9b40b875605dbd7c172 100644 --- a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h +++ b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbImageAndVectorImageOperationFilter_h -#define __otbImageAndVectorImageOperationFilter_h +#ifndef otbImageAndVectorImageOperationFilter_h +#define otbImageAndVectorImageOperationFilter_h #include "itkBinaryFunctorImageFilter.h" #include "itkImageToImageFilter.h" @@ -160,7 +160,7 @@ public: /** Set the input images of this process object. */ using Superclass::SetInput; - void SetInput(const InputImageType *input); + void SetInput(const InputImageType *input) ITK_OVERRIDE; void SetVectorInput(const VectorInputImageType *input); /** Get the input images of this process object. */ @@ -212,12 +212,12 @@ public: protected: ImageAndVectorImageOperationFilter(); - virtual ~ImageAndVectorImageOperationFilter(); + ~ImageAndVectorImageOperationFilter() ITK_OVERRIDE; /** This is a source, so it must set the spacing, size, and largest possible * region for the output image that it will produce. * \sa ProcessObject::GenerateOutputInformation() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: ImageAndVectorImageOperationFilter(const ImageAndVectorImageOperationFilter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.txx b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.txx index 86febca3793bb1a00ba273af9c8cc19b0d8c149b..5e254ae9514f740e689b753aaec132c942a73c87 100644 --- a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.txx +++ b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageAndVectorImageOperationFilter_txx -#define __otbImageAndVectorImageOperationFilter_txx +#ifndef otbImageAndVectorImageOperationFilter_txx +#define otbImageAndVectorImageOperationFilter_txx #include "otbImageAndVectorImageOperationFilter.h" #include "itkObjectFactory.h" @@ -71,7 +71,7 @@ const typename ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage> ::GetVectorInput() { - if (this->GetNumberOfInputs() < 2) return 0; + if (this->GetNumberOfInputs() < 2) return ITK_NULLPTR; return dynamic_cast<const VectorInputImageType*>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h index 16ce4cd343e5de0a6e871a993beeb3db27bee071..fc4cad3cdec9d92ebb8dca0dc9a1638577f9eb47 100644 --- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageRegionAdaptativeSplitter_h -#define __otbImageRegionAdaptativeSplitter_h +#ifndef otbImageRegionAdaptativeSplitter_h +#define otbImageRegionAdaptativeSplitter_h #include "itkRegion.h" #include "itkImageRegionSplitter.h" @@ -119,17 +119,17 @@ public: * number of splits, and call the EstimateSplitMap() method if * necessary. */ - virtual unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber); + unsigned int GetNumberOfSplits(const RegionType& region, + unsigned int requestedNumber) ITK_OVERRIDE; /** Calling this method will set the image region and the requested * number of splits, and call the EstimateSplitMap() method if * necessary. */ - virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region); + RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, + const RegionType& region) ITK_OVERRIDE; /** Make the Modified() method update the IsUpToDate flag */ - virtual void Modified() const + void Modified() const ITK_OVERRIDE { // Call superclass implementation Superclass::Modified(); @@ -146,8 +146,8 @@ protected: m_IsUpToDate(false) {} - virtual ~ImageRegionAdaptativeSplitter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageRegionAdaptativeSplitter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** This methods actually estimate the split map and stores it in a diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx index ef5b28192b5d1f658327d89fa9b8a0b0ec403610..a76b3ce040ced8424061295c385b3bf0e86a6f9c 100644 --- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx +++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageRegionAdaptativeSplitter_txx -#define __otbImageRegionAdaptativeSplitter_txx +#ifndef otbImageRegionAdaptativeSplitter_txx +#define otbImageRegionAdaptativeSplitter_txx #include "otbImageRegionAdaptativeSplitter.h" #include "otbMath.h" diff --git a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h index cf2a68bd8f1d7a36613e040c46eaa09f5549ed64..c257af0f53ed0dd8f3515303cf269cc3fac3375a 100644 --- a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageRegionNonUniformMultidimensionalSplitter_h -#define __otbImageRegionNonUniformMultidimensionalSplitter_h +#ifndef otbImageRegionNonUniformMultidimensionalSplitter_h +#define otbImageRegionNonUniformMultidimensionalSplitter_h #include "itkRegion.h" #include "itkObjectFactory.h" @@ -95,19 +95,19 @@ public: * a certain dimensions, then some splits will not be possible. This * method returns a number less than or equal to the requested number * of pieces. */ - virtual unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber); + unsigned int GetNumberOfSplits(const RegionType& region, + unsigned int requestedNumber) ITK_OVERRIDE; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ - virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region); + RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, + const RegionType& region) ITK_OVERRIDE; protected: ImageRegionNonUniformMultidimensionalSplitter() {} - virtual ~ImageRegionNonUniformMultidimensionalSplitter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageRegionNonUniformMultidimensionalSplitter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageRegionNonUniformMultidimensionalSplitter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.txx b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.txx index 8ad23750e616f3c7f2c3eb4c1f9df6e521ac86ea..29cc47d2f1ba9a59f241182b3fc74679bf00633d 100644 --- a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.txx +++ b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageRegionNonUniformMultidimensionalSplitter_txx -#define __otbImageRegionNonUniformMultidimensionalSplitter_txx +#ifndef otbImageRegionNonUniformMultidimensionalSplitter_txx +#define otbImageRegionNonUniformMultidimensionalSplitter_txx #include "otbImageRegionNonUniformMultidimensionalSplitter.h" namespace otb diff --git a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h index a9ad5ccb2375133623494e829bb0a99bc6348119..534c30f62ada842f043f73c3947e23d3b5cd2171 100644 --- a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageRegionSquareTileSplitter_h -#define __otbImageRegionSquareTileSplitter_h +#ifndef otbImageRegionSquareTileSplitter_h +#define otbImageRegionSquareTileSplitter_h #include "itkRegion.h" #include "itkImageRegionSplitter.h" @@ -109,14 +109,14 @@ public: * instance, if the numberOfPieces exceeds the number of pixels along * a certain dimensions, then some splits will not be possible. */ - virtual unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber); + unsigned int GetNumberOfSplits(const RegionType& region, + unsigned int requestedNumber) ITK_OVERRIDE; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ - virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region); + RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, + const RegionType& region) ITK_OVERRIDE; itkGetMacro(TileSizeAlignment, unsigned int); itkSetMacro(TileSizeAlignment, unsigned int); @@ -125,8 +125,8 @@ public: protected: ImageRegionSquareTileSplitter() : m_SplitsPerDimension(0U), m_TileDimension(0), m_TileSizeAlignment(16) {} - virtual ~ImageRegionSquareTileSplitter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageRegionSquareTileSplitter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageRegionSquareTileSplitter(const ImageRegionSquareTileSplitter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.txx b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.txx index a964c82dd4f6ced85a42ac04a6f77a2b77baee63..50b0eb884c53ffb5f598b3cc35cf4a18e0e48ddd 100644 --- a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.txx +++ b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageRegionSquareTileSplitter_txx -#define __otbImageRegionSquareTileSplitter_txx +#ifndef otbImageRegionSquareTileSplitter_txx +#define otbImageRegionSquareTileSplitter_txx #include "otbImageRegionSquareTileSplitter.h" #include "otbMath.h" diff --git a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h index 34a3ea7800190c5d939aaba4d6708c7180ae7fa0..a7e5fca0e7e05694312dd2df4f00754b5978798d 100644 --- a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageRegionTileMapSplitter_h -#define __otbImageRegionTileMapSplitter_h +#ifndef otbImageRegionTileMapSplitter_h +#define otbImageRegionTileMapSplitter_h #include "itkRegion.h" #include "itkImageRegionSplitter.h" @@ -110,19 +110,19 @@ public: * a certain dimensions, then some splits will not be possible. This * method returns a number less than or equal to the requested number * of pieces. */ - virtual unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber); + unsigned int GetNumberOfSplits(const RegionType& region, + unsigned int requestedNumber) ITK_OVERRIDE; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ - virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region); + RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, + const RegionType& region) ITK_OVERRIDE; protected: ImageRegionTileMapSplitter() : m_AlignStep(256){} - virtual ~ImageRegionTileMapSplitter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageRegionTileMapSplitter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageRegionTileMapSplitter(const ImageRegionTileMapSplitter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.txx b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.txx index 77c81c95fee35926086836e09018220bb022a944..0928c6ea79a652264661314fbeabf1d5a07c3361 100644 --- a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.txx +++ b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageRegionTileMapSplitter_txx -#define __otbImageRegionTileMapSplitter_txx +#ifndef otbImageRegionTileMapSplitter_txx +#define otbImageRegionTileMapSplitter_txx #include "otbImageRegionTileMapSplitter.h" #include "otbMath.h" diff --git a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h index 359edfd4c3ffbfdad23e6b8efa8c8d47ac8e45c3..975866a5086382ba0fb1acc81ab5ae8cd3d625dc 100644 --- a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h +++ b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToModulusAndDirectionImageFilter_h -#define __otbImageToModulusAndDirectionImageFilter_h +#ifndef otbImageToModulusAndDirectionImageFilter_h +#define otbImageToModulusAndDirectionImageFilter_h #include "itkImageToImageFilter.h" @@ -83,12 +83,12 @@ public: /** Return the output image direction */ OutputImageDirectionType * GetOutputDirection(); - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; protected: ImageToModulusAndDirectionImageFilter(); - virtual ~ImageToModulusAndDirectionImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageToModulusAndDirectionImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToModulusAndDirectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.txx b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.txx index e5542f28edb3d6f85e60894c53323aef1014992a..b4a229f0a944774cb8f12eed08f570340c4ef55e 100644 --- a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.txx +++ b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToModulusAndDirectionImageFilter_txx -#define __otbImageToModulusAndDirectionImageFilter_txx +#ifndef otbImageToModulusAndDirectionImageFilter_txx +#define otbImageToModulusAndDirectionImageFilter_txx #include "otbImageToModulusAndDirectionImageFilter.h" #include "itkProcessObject.h" @@ -62,7 +62,7 @@ GetOutput() { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *> (this->itk::ProcessObject::GetOutput(0)); @@ -92,7 +92,7 @@ GetOutputDirection() { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageDirectionType *> (this->itk::ProcessObject::GetOutput(1)); diff --git a/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h b/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h index e84721599d9f92a8929b913443f74bfbae6c2d8d..fb75b24f5fd9e6a71bb937c159751d93f738eab9 100644 --- a/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h +++ b/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImaginaryImageToComplexImageFilter_h -#define __otbImaginaryImageToComplexImageFilter_h +#ifndef otbImaginaryImageToComplexImageFilter_h +#define otbImaginaryImageToComplexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -89,7 +89,7 @@ public: protected: ImaginaryImageToComplexImageFilter() {} - virtual ~ImaginaryImageToComplexImageFilter() {} + ~ImaginaryImageToComplexImageFilter() ITK_OVERRIDE {} private: ImaginaryImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImportImageFilter.h b/Modules/Core/Common/include/otbImportImageFilter.h index c5a927129ea279c33274144cb5dc7d960c31eb9c..6876435f1740743c17082a5a542b723d1b28eb58 100644 --- a/Modules/Core/Common/include/otbImportImageFilter.h +++ b/Modules/Core/Common/include/otbImportImageFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbImportImageFilter_h -#define __otbImportImageFilter_h +#ifndef otbImportImageFilter_h +#define otbImportImageFilter_h #include "itkImageSource.h" @@ -142,26 +142,26 @@ public: protected: ImportImageFilter(); - virtual ~ImportImageFilter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImportImageFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** This filter does not actually "produce" any data, rather it "wraps" * the user supplied data into an itk::Image. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** This is a source, so it must set the spacing, size, and largest possible * region for the output image that it will produce. * \sa ProcessObject::GenerateOutputInformation() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** This filter can only produce the amount of data that it is given, - * so we must override ProcessObject::EnlargeOutputRequestedRegion() + * so we must ITK_OVERRIDE ProcessObject::EnlargeOutputRequestedRegion() * (The default implementation of a source produces the amount of * data requested. This source, however, can only produce what it is * given.) * * \sa ProcessObject::EnlargeOutputRequestedRegion() */ - virtual void EnlargeOutputRequestedRegion(itk::DataObject *output); + void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; private: ImportImageFilter(const ImportImageFilter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImportImageFilter.txx b/Modules/Core/Common/include/otbImportImageFilter.txx index 4b41af2ef0c2cd23ccbe360dcd2a84f084efbd00..a7cfa5a9f66cc424ae88bb958263e6817c97ae37 100644 --- a/Modules/Core/Common/include/otbImportImageFilter.txx +++ b/Modules/Core/Common/include/otbImportImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImportImageFilter_txx -#define __otbImportImageFilter_txx +#ifndef otbImportImageFilter_txx +#define otbImportImageFilter_txx #include "otbImportImageFilter.h" #include "itkObjectFactory.h" @@ -43,7 +43,7 @@ ImportImageFilter<TOutputImage> } m_Direction.SetIdentity(); - m_ImportPointer = 0; + m_ImportPointer = ITK_NULLPTR; m_FilterManageMemory = false; m_Size = 0; } diff --git a/Modules/Core/Common/include/otbImportVectorImageFilter.h b/Modules/Core/Common/include/otbImportVectorImageFilter.h index 08ebbf63cdf6469b1686c1683476affe3f7fb835..63f53628b4ba2fca96aa3fc49add2127576bfc99 100644 --- a/Modules/Core/Common/include/otbImportVectorImageFilter.h +++ b/Modules/Core/Common/include/otbImportVectorImageFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbImportVectorImageFilter_h -#define __otbImportVectorImageFilter_h +#ifndef otbImportVectorImageFilter_h +#define otbImportVectorImageFilter_h #include "itkImageSource.h" @@ -159,7 +159,7 @@ protected: virtual void GenerateOutputInformation(); /** This filter can only produce the amount of data that it is given, - * so we must override ProcessObject::EnlargeOutputRequestedRegion() + * so we must ITK_OVERRIDE ProcessObject::EnlargeOutputRequestedRegion() * (The default implementation of a source produces the amount of * data requested. This source, however, can only produce what it is * given.) diff --git a/Modules/Core/Common/include/otbImportVectorImageFilter.txx b/Modules/Core/Common/include/otbImportVectorImageFilter.txx index de232f24e03d188bf95e43320886dc4675d5d0c4..9db82edd63d755d254cb59cdd5e836a9425ee886 100644 --- a/Modules/Core/Common/include/otbImportVectorImageFilter.txx +++ b/Modules/Core/Common/include/otbImportVectorImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImportVectorImageFilter_txx -#define __otbImportVectorImageFilter_txx +#ifndef otbImportVectorImageFilter_txx +#define otbImportVectorImageFilter_txx #include "otbImportVectorImageFilter.h" #include "itkObjectFactory.h" diff --git a/Modules/Core/Common/include/otbMacro.h b/Modules/Core/Common/include/otbMacro.h index 7b1b06d187a052f2559297dc6a30f73fa387792d..9d745248c9284097b9522dd1d8b69665705c130e 100644 --- a/Modules/Core/Common/include/otbMacro.h +++ b/Modules/Core/Common/include/otbMacro.h @@ -22,8 +22,8 @@ * to interface to instance variables in a standard fashion. */ -#ifndef __otbMacro_h -#define __otbMacro_h +#ifndef otbMacro_h +#define otbMacro_h #include "itkMacro.h" #include "itkObject.h" diff --git a/Modules/Core/Common/include/otbMath.h b/Modules/Core/Common/include/otbMath.h index 3e2fecdbbc305f568bb448e5d95b5d6fd22822fe..3e769eb82308460bee3debd532b78d7310498c0f 100644 --- a/Modules/Core/Common/include/otbMath.h +++ b/Modules/Core/Common/include/otbMath.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMath_h -#define __otbMath_h +#ifndef otbMath_h +#define otbMath_h /** * otbMath.h defines standard math macros, constants, and other diff --git a/Modules/Core/Common/include/otbModelComponentBase.h b/Modules/Core/Common/include/otbModelComponentBase.h index f8956cd307f52042e506271f6d485cc51c9d8cc1..3476680584f307144eb1ee02d5850e436653532b 100644 --- a/Modules/Core/Common/include/otbModelComponentBase.h +++ b/Modules/Core/Common/include/otbModelComponentBase.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbModelComponentBase_h -#define __otbModelComponentBase_h +#ifndef otbModelComponentBase_h +#define otbModelComponentBase_h #include <vnl/vnl_vector.h> #include <vnl/vnl_matrix.h> @@ -128,8 +128,8 @@ public: protected: ModelComponentBase(); - virtual ~ModelComponentBase() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ModelComponentBase() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; virtual void GenerateData(); diff --git a/Modules/Core/Common/include/otbModelComponentBase.txx b/Modules/Core/Common/include/otbModelComponentBase.txx index 7c04686518e0295a693a5684f96d3be9474314f5..b0b6b348b8f8e54f183988a8d2cc1db0fce37f99 100644 --- a/Modules/Core/Common/include/otbModelComponentBase.txx +++ b/Modules/Core/Common/include/otbModelComponentBase.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbModelComponentBase_txx -#define __otbModelComponentBase_txx +#ifndef otbModelComponentBase_txx +#define otbModelComponentBase_txx #include <iostream> @@ -34,9 +34,9 @@ template<class TSample> ModelComponentBase<TSample> ::ModelComponentBase() { - m_Sample = 0; - m_PdfFunction = 0; - m_CdfFunction = 0; + m_Sample = ITK_NULLPTR; + m_PdfFunction = ITK_NULLPTR; + m_CdfFunction = ITK_NULLPTR; m_SampleModified = 0; } @@ -48,7 +48,7 @@ ModelComponentBase<TSample> Superclass::PrintSelf(os, indent); os << indent << "Sample: "; - if (m_Sample != 0) + if (m_Sample != ITK_NULLPTR) { os << m_Sample << std::endl; } @@ -58,7 +58,7 @@ ModelComponentBase<TSample> } os << indent << "Membership Function for pdf: "; - if (m_PdfFunction != 0) + if (m_PdfFunction != ITK_NULLPTR) { os << m_PdfFunction << std::endl; } @@ -68,7 +68,7 @@ ModelComponentBase<TSample> } os << indent << "Membership Function for cdf: "; - if (m_CdfFunction != 0) + if (m_CdfFunction != ITK_NULLPTR) { os << m_CdfFunction << std::endl; } @@ -186,7 +186,7 @@ void ModelComponentBase<TSample> ::GenerateData() { - /** subclasses should override this function to perform + /** subclasses should ITK_OVERRIDE this function to perform * parameter estimation. But it allows switching m_SampleModified * when necessary. */ diff --git a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h index 80be874f90fd44fea0fb9bb9bc9ff39165bb77c1..8ea5b235277e173fd449c1e0f9141433edfc88f7 100644 --- a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h +++ b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQuaternaryFunctorImageFilter_h -#define __otbQuaternaryFunctorImageFilter_h +#ifndef otbQuaternaryFunctorImageFilter_h +#define otbQuaternaryFunctorImageFilter_h #include "itkInPlaceImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -141,11 +141,11 @@ public: protected: QuaternaryFunctorImageFilter(); - virtual ~QuaternaryFunctorImageFilter() {} + ~QuaternaryFunctorImageFilter() ITK_OVERRIDE {} /** Validate the presence of all three inputs. If one or more inputs * are missing, throw an exception. */ - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** QuaternaryFunctorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -158,7 +158,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: QuaternaryFunctorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.txx b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.txx index b4d6cee9b700613ca5c0b681c2931ba46354fd56..9a36abbc568a88f9543866d69212712e0586ea3a 100644 --- a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.txx +++ b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQuaternaryFunctorImageFilter_txx -#define __otbQuaternaryFunctorImageFilter_txx +#ifndef otbQuaternaryFunctorImageFilter_txx +#define otbQuaternaryFunctorImageFilter_txx #include "otbQuaternaryFunctorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/Common/include/otbRGBAPixelConverter.h b/Modules/Core/Common/include/otbRGBAPixelConverter.h index e3ee8bcf3ee77bf1c97338b5523a430a3883147f..5dc1cb27185c2325713622a80c220119d2e18b50 100644 --- a/Modules/Core/Common/include/otbRGBAPixelConverter.h +++ b/Modules/Core/Common/include/otbRGBAPixelConverter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbRGBAPixelConverter_h -#define __otbRGBAPixelConverter_h +#ifndef otbRGBAPixelConverter_h +#define otbRGBAPixelConverter_h #include "itkProcessObject.h" #include "itkRGBAPixel.h" @@ -63,8 +63,8 @@ public: protected: RGBAPixelConverter(){} - virtual ~RGBAPixelConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~RGBAPixelConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } @@ -100,8 +100,8 @@ public: protected: RGBAPixelConverter(){} - virtual ~RGBAPixelConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~RGBAPixelConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } @@ -137,8 +137,8 @@ public: protected: RGBAPixelConverter(){} - virtual ~RGBAPixelConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~RGBAPixelConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Common/include/otbRGBAPixelConverter.txx b/Modules/Core/Common/include/otbRGBAPixelConverter.txx index 4914870fab48ccf3f0cd2b16a275c5438f634f36..9c38ed12daf79791a6aa22cf1557fe92a12b59c3 100644 --- a/Modules/Core/Common/include/otbRGBAPixelConverter.txx +++ b/Modules/Core/Common/include/otbRGBAPixelConverter.txx @@ -16,9 +16,10 @@ =========================================================================*/ -#ifndef __otbRGBAPixelConverter_txx -#define __otbRGBAPixelConverter_txx +#ifndef otbRGBAPixelConverter_txx +#define otbRGBAPixelConverter_txx +#include "otbRGBAPixelConverter.h" namespace otb { diff --git a/Modules/Core/Common/include/otbRectangle.h b/Modules/Core/Common/include/otbRectangle.h index c6d6c07b4f1b95c236af694d6936db980ae6c55d..7dd144e85db6d68ae62070c7801b2f0302b15b87 100644 --- a/Modules/Core/Common/include/otbRectangle.h +++ b/Modules/Core/Common/include/otbRectangle.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRectangle_h -#define __otbRectangle_h +#ifndef otbRectangle_h +#define otbRectangle_h #include "itkImageRegion.h" @@ -97,10 +97,10 @@ protected: }; /** Destructor */ - virtual ~Rectangle() {} + ~Rectangle() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** */ virtual double ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const; diff --git a/Modules/Core/Common/include/otbRectangle.txx b/Modules/Core/Common/include/otbRectangle.txx index c50a4b19e9b4dc437815f463bd0650f4745d37f6..7b8e4b87393bc58a7b12405539e52f091be401ac 100644 --- a/Modules/Core/Common/include/otbRectangle.txx +++ b/Modules/Core/Common/include/otbRectangle.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRectangle_txx -#define __otbRectangle_txx +#ifndef otbRectangle_txx +#define otbRectangle_txx #include "otbRectangle.h" diff --git a/Modules/Core/Common/include/otbStandardFilterWatcher.h b/Modules/Core/Common/include/otbStandardFilterWatcher.h index 53b9cb67cb3e0940f283e4bf10c6ad4d80673368..8bced112e2828dec3478bb035260ad881394bfb6 100644 --- a/Modules/Core/Common/include/otbStandardFilterWatcher.h +++ b/Modules/Core/Common/include/otbStandardFilterWatcher.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardFilterWatcher_h -#define __otbStandardFilterWatcher_h +#ifndef otbStandardFilterWatcher_h +#define otbStandardFilterWatcher_h #include "otbFilterWatcherBase.h" @@ -82,13 +82,13 @@ public: protected: /** Callback method to show the ProgressEvent */ - virtual void ShowProgress(); + void ShowProgress() ITK_OVERRIDE; /** Callback method to show the StartEvent */ - virtual void StartFilter(); + void StartFilter() ITK_OVERRIDE; /** Callback method to show the EndEvent */ - virtual void EndFilter(); + void EndFilter() ITK_OVERRIDE; private: diff --git a/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h b/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h index 4508b4632c666d34d5800d22caf73fe2e288187e..453249db3a6ee00a51c847d2ece6373a7f5cc936 100644 --- a/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h +++ b/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardOneLineFilterWatcher_h -#define __otbStandardOneLineFilterWatcher_h +#ifndef otbStandardOneLineFilterWatcher_h +#define otbStandardOneLineFilterWatcher_h #include "otbFilterWatcherBase.h" @@ -76,13 +76,13 @@ public: protected: /** Callback method to show the ProgressEvent */ - virtual void ShowProgress(); + void ShowProgress() ITK_OVERRIDE; /** Callback method to show the StartEvent */ - virtual void StartFilter(); + void StartFilter() ITK_OVERRIDE; /** Callback method to show the EndEvent */ - virtual void EndFilter(); + void EndFilter() ITK_OVERRIDE; private: diff --git a/Modules/Core/Common/include/otbStandardWriterWatcher.h b/Modules/Core/Common/include/otbStandardWriterWatcher.h index 4bb1aa5ed3625112c07209e6b0474bee08bd2d3d..77a3f092e0d96d3b9bc2952d606f01e30d8852c1 100644 --- a/Modules/Core/Common/include/otbStandardWriterWatcher.h +++ b/Modules/Core/Common/include/otbStandardWriterWatcher.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardWriterWatcher_h -#define __otbStandardWriterWatcher_h +#ifndef otbStandardWriterWatcher_h +#define otbStandardWriterWatcher_h #include "otbWriterWatcherBase.h" @@ -86,22 +86,22 @@ public: protected: /** Callback method to show the ProgressEvent */ - virtual void ShowWriterProgress(); + void ShowWriterProgress() ITK_OVERRIDE; /** Callback method to show the StartEvent */ - virtual void StartWriter(); + void StartWriter() ITK_OVERRIDE; /** Callback method to show the EndEvent */ - virtual void EndWriter(); + void EndWriter() ITK_OVERRIDE; /** Callback method to show the ProgressEvent */ - virtual void ShowFilterProgress(); + void ShowFilterProgress() ITK_OVERRIDE; /** Callback method to show the StartEvent */ - virtual void StartFilter() {} + void StartFilter() ITK_OVERRIDE {} /** Callback method to show the EndEvent */ - virtual void EndFilter() {} + void EndFilter() ITK_OVERRIDE {} /** This is the method invoked by ShowFilterProgress() and ShowWriterProgress() */ virtual void ShowProgress(); diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h index def95bcbaaaaa28299e9bc6a3be7fa80fc384154..475166e9d7f5940ccac0f9c6d7dd3aea5c57937a 100644 --- a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h +++ b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSubsampledImageRegionConstIterator_h -#define __otbSubsampledImageRegionConstIterator_h +#ifndef otbSubsampledImageRegionConstIterator_h +#define otbSubsampledImageRegionConstIterator_h #include "itkImageRegionConstIterator.h" @@ -164,7 +164,7 @@ public: /** Set the index. * It is moved to the next available (usable) index. * \sa GetIndex */ - void SetIndex(const IndexType& ind); + void SetIndex(const IndexType& ind) ITK_OVERRIDE; /** Get the Index. */ IndexType GetIndex() const diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx index 6fed1404d389a5eb920cb195425caa90aa3ef76e..a5cf8550ee0313fba707592dcd72f55b07114817 100644 --- a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx +++ b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSubsampledImageRegionConstIterator_txx -#define __otbSubsampledImageRegionConstIterator_txx +#ifndef otbSubsampledImageRegionConstIterator_txx +#define otbSubsampledImageRegionConstIterator_txx #include "otbSubsampledImageRegionConstIterator.h" diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h b/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h index 0fa6f966784b8e7335849e8fa19df498c8b39b67..ebb3a505e7a48e20bd675189488e7bd6ed42cc92 100644 --- a/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h +++ b/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSubsampledImageRegionIterator_h -#define __otbSubsampledImageRegionIterator_h +#ifndef otbSubsampledImageRegionIterator_h +#define otbSubsampledImageRegionIterator_h #include "otbSubsampledImageRegionConstIterator.h" diff --git a/Modules/Core/Common/include/otbSystem.h b/Modules/Core/Common/include/otbSystem.h index eecd10785ab4a2359b8e23234a41489ed209bd83..ad2277e363066bde82ea557984fc55957f42132c 100644 --- a/Modules/Core/Common/include/otbSystem.h +++ b/Modules/Core/Common/include/otbSystem.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSystem_h -#define __otbSystem_h +#ifndef otbSystem_h +#define otbSystem_h #include <string> #include <vector> diff --git a/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h index e0df8601f86bbcd534c0a3e53842cf8cf2cc7e63..c8112f9bc1be9fc0ab2f7062ff9fc838611e6bed 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorImageFilter_h -#define __otbUnaryFunctorImageFilter_h +#ifndef otbUnaryFunctorImageFilter_h +#define otbUnaryFunctorImageFilter_h #include "itkUnaryFunctorImageFilter.h" @@ -55,7 +55,7 @@ public: protected: UnaryFunctorImageFilter() {}; - virtual ~UnaryFunctorImageFilter() {} + ~UnaryFunctorImageFilter() ITK_OVERRIDE {} /** UnaryFunctorImageFilter can produce an image which has a different number of bands * than its input image. As such, UnaryFunctorImageFilter @@ -65,7 +65,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h index ba29df414a9730478720e8535769ebfcd9f12d9b..2882667a9a2d1fd36c3bbd537cce3889f1cdf8b2 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodVectorImageFilter_h -#define __otbUnaryFunctorNeighborhoodVectorImageFilter_h +#ifndef otbUnaryFunctorNeighborhoodVectorImageFilter_h +#define otbUnaryFunctorNeighborhoodVectorImageFilter_h #include "itkInPlaceImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -105,7 +105,7 @@ public: protected: UnaryFunctorNeighborhoodVectorImageFilter(); - virtual ~UnaryFunctorNeighborhoodVectorImageFilter() { } + ~UnaryFunctorNeighborhoodVectorImageFilter() ITK_OVERRIDE { } /** UnaryFunctorNeighborhoodVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -117,14 +117,14 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; RadiusType m_Radius; diff --git a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.txx b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.txx index 1784c56d2c7e9ec89565c6db1c93fe86ef1497af..4a408eabb9a3145e39c2a334c3c5e40b4d2a9b30 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.txx +++ b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodVectorImageFilter_txx -#define __otbUnaryFunctorNeighborhoodVectorImageFilter_txx +#ifndef otbUnaryFunctorNeighborhoodVectorImageFilter_txx +#define otbUnaryFunctorNeighborhoodVectorImageFilter_txx #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h index 47bf386febcedbad4178998abe9f88b0ef1c8fd1..f403a7cb4df087da7d4a90cf63051739e6fd9b63 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorVectorImageFilter_h -#define __otbUnaryFunctorVectorImageFilter_h +#ifndef otbUnaryFunctorVectorImageFilter_h +#define otbUnaryFunctorVectorImageFilter_h #include "itkInPlaceImageFilter.h" @@ -90,7 +90,7 @@ public: protected: UnaryFunctorVectorImageFilter(); - virtual ~UnaryFunctorVectorImageFilter() { } + ~UnaryFunctorVectorImageFilter() ITK_OVERRIDE { } /** UnaryFunctorVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -102,14 +102,14 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; private: UnaryFunctorVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.txx b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.txx index 9a0b2287ffa7959f12c724cfd2fd69f7032e038f..3aeab9496416d55830af55aeded5d44cff7266f9 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.txx +++ b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorVectorImageFilter_txx -#define __otbUnaryFunctorVectorImageFilter_txx +#ifndef otbUnaryFunctorVectorImageFilter_txx +#define otbUnaryFunctorVectorImageFilter_txx #include "otbUnaryFunctorVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h index 6ec57f90ef0ba9c3e426dccec5c41b8de0279d0f..8df5d5d58b99631172dc70c8d1bf28735bf850a6 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorWithIndexWithOutputSizeImageFilter_h -#define __otbUnaryFunctorWithIndexWithOutputSizeImageFilter_h +#ifndef otbUnaryFunctorWithIndexWithOutputSizeImageFilter_h +#define otbUnaryFunctorWithIndexWithOutputSizeImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -108,7 +108,7 @@ protected: /** * Destructor */ - virtual ~UnaryFunctorWithIndexWithOutputSizeImageFilter() {} + ~UnaryFunctorWithIndexWithOutputSizeImageFilter() ITK_OVERRIDE {} /** UnaryFunctorWithIndexWithOutputSizeImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -120,12 +120,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the input requested region by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** UnaryFunctorWithIndexWithOutputSizeImageFilter can produce an image which has a different number of bands * than its input image. As such, UnaryFunctorImageFilter @@ -135,7 +135,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.txx b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.txx index 3dcf939a744a92741eab9dfb1aa94fe2ee82e6ac..b2d9fd057df40da63b27d1a2578ec5c956cacabe 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.txx +++ b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorWithIndexWithOutputSizeImageFilter_txx -#define __otbUnaryFunctorWithIndexWithOutputSizeImageFilter_txx +#ifndef otbUnaryFunctorWithIndexWithOutputSizeImageFilter_txx +#define otbUnaryFunctorWithIndexWithOutputSizeImageFilter_txx #include "otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/Common/include/otbUniformAlphaBlendingFunctor.h b/Modules/Core/Common/include/otbUniformAlphaBlendingFunctor.h index fe69507c8c99142a728cef296e6dd61d83427a24..155766d3a94ba80a87fc6834793d03e54e27b3ad 100644 --- a/Modules/Core/Common/include/otbUniformAlphaBlendingFunctor.h +++ b/Modules/Core/Common/include/otbUniformAlphaBlendingFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUniformAlphaBlendingFunctor_h -#define __otbUniformAlphaBlendingFunctor_h +#ifndef otbUniformAlphaBlendingFunctor_h +#define otbUniformAlphaBlendingFunctor_h #include "itkMacro.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/Common/include/otbUtils.h b/Modules/Core/Common/include/otbUtils.h index 0894276c627fe23cab1bb58087a71477bc39bc76..1784646cd181b5cbafda0f81218bddc237e846ad 100644 --- a/Modules/Core/Common/include/otbUtils.h +++ b/Modules/Core/Common/include/otbUtils.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUtils_h -#define __otbUtils_h +#ifndef otbUtils_h +#define otbUtils_h #include "itkMacro.h" diff --git a/Modules/Core/Common/include/otbVariableLengthVectorConverter.h b/Modules/Core/Common/include/otbVariableLengthVectorConverter.h index 2c8f53a92da361ee3e542dfa9ec2b99f76bd859c..525abe5fb9c73edb2f8216c5922f2e32d84bea99 100644 --- a/Modules/Core/Common/include/otbVariableLengthVectorConverter.h +++ b/Modules/Core/Common/include/otbVariableLengthVectorConverter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVariableLengthVectorConverter_h -#define __otbVariableLengthVectorConverter_h +#ifndef otbVariableLengthVectorConverter_h +#define otbVariableLengthVectorConverter_h #include "itkProcessObject.h" #include "itkVariableLengthVector.h" @@ -70,8 +70,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Attempt to use inexistant implementation of the converter!" @@ -113,8 +113,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Attempt to use inexistant implementation of the converter!" @@ -154,8 +154,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Converter: std::vector<std::vector<RealType>> => VariableLengthVector<RealType>" @@ -195,8 +195,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Converter: std::vector<std::vector<std::complex<RealType>>> => VariableLengthVector<RealType>" @@ -236,8 +236,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Converter: itk::FixedArray<RealType, VArrayDimension> => VariableLengthVector<RealType>" @@ -276,8 +276,8 @@ public: protected: VariableLengthVectorConverter(){} - virtual ~VariableLengthVectorConverter(){} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + ~VariableLengthVectorConverter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << "Converter: itk::Statistics::Histogram<RealType, VMeasurementVectorSize, TFrequencyContainer> => VariableLengthVector<RealType>" diff --git a/Modules/Core/Common/include/otbVariableLengthVectorConverter.txx b/Modules/Core/Common/include/otbVariableLengthVectorConverter.txx index d689c406362f5c3812c82dd742f0c1afb54a81be..c3514174fa32ab2135ccc2f31cb9b0b5f216c6f4 100644 --- a/Modules/Core/Common/include/otbVariableLengthVectorConverter.txx +++ b/Modules/Core/Common/include/otbVariableLengthVectorConverter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVariableLengthVectorConverter_txx -#define __otbVariableLengthVectorConverter_txx +#ifndef otbVariableLengthVectorConverter_txx +#define otbVariableLengthVectorConverter_txx #include "otbVariableLengthVectorConverter.h" #include <complex> diff --git a/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h b/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h index 48832da89e4907315a0260a8489c728f3808a104..f1dce6e69f65868d6c595c9e42942a392fa6625d 100644 --- a/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h +++ b/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorImageToASImageAdaptor_h -#define __otbVectorImageToASImageAdaptor_h +#ifndef otbVectorImageToASImageAdaptor_h +#define otbVectorImageToASImageAdaptor_h #include "itkImageAdaptor.h" #include "otbVectorImageToASPixelAccessor.h" @@ -63,7 +63,7 @@ public: protected: VectorImageToASImageAdaptor() {} - virtual ~VectorImageToASImageAdaptor() {} + ~VectorImageToASImageAdaptor() ITK_OVERRIDE {} private: VectorImageToASImageAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbVectorImageToASPixelAccessor.h b/Modules/Core/Common/include/otbVectorImageToASPixelAccessor.h index 4fefbcaf8f6c819ec5ae7b47e73dc5ab6a7e49fa..ee9be8bb3941d0657956c42e943b54d3fe16ef3b 100644 --- a/Modules/Core/Common/include/otbVectorImageToASPixelAccessor.h +++ b/Modules/Core/Common/include/otbVectorImageToASPixelAccessor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorImageToASPixelAccessor_h -#define __otbVectorImageToASPixelAccessor_h +#ifndef otbVectorImageToASPixelAccessor_h +#define otbVectorImageToASPixelAccessor_h #include "itkVector.h" diff --git a/Modules/Core/Common/include/otbWriterWatcherBase.h b/Modules/Core/Common/include/otbWriterWatcherBase.h index 657733eedf1a0c9068555b6c3dd2641e14704763..eacefa45347772a437d76dd6eedbd6dd4c8bbed5 100644 --- a/Modules/Core/Common/include/otbWriterWatcherBase.h +++ b/Modules/Core/Common/include/otbWriterWatcherBase.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWriterWatcherBase_h -#define __otbWriterWatcherBase_h +#ifndef otbWriterWatcherBase_h +#define otbWriterWatcherBase_h #include "itkCommand.h" #include "itkProcessObject.h" diff --git a/Modules/Core/Common/src/otbConfigurationManager.cxx b/Modules/Core/Common/src/otbConfigurationManager.cxx index 562924a071efcce5d8865d165156e5c3721d7393..43f1b683a9e0ebb14a65203ba8bd8dce8db79285 100644 --- a/Modules/Core/Common/src/otbConfigurationManager.cxx +++ b/Modules/Core/Common/src/otbConfigurationManager.cxx @@ -47,7 +47,7 @@ ConfigurationManager::RAMValueType ConfigurationManager::GetMaxRAMHint() if(itksys::SystemTools::GetEnv("OTB_MAX_RAM_HINT",svalue)) { - unsigned long int tmp = strtoul(svalue.c_str(),NULL,10); + unsigned long int tmp = strtoul(svalue.c_str(),ITK_NULLPTR,10); if(tmp) { diff --git a/Modules/Core/Common/src/otbFilterWatcherBase.cxx b/Modules/Core/Common/src/otbFilterWatcherBase.cxx index bd88046e43f82123da7ce2666dcfafaf35932e81..570dbbf03e6d263527a4604f6ae9b4fe1061cb05 100644 --- a/Modules/Core/Common/src/otbFilterWatcherBase.cxx +++ b/Modules/Core/Common/src/otbFilterWatcherBase.cxx @@ -26,7 +26,7 @@ namespace otb FilterWatcherBase ::FilterWatcherBase() : m_Comment("Not watching an object"), - m_Process(0), + m_Process(ITK_NULLPTR), m_StartTag(0), m_EndTag(0), m_ProgressTag(0), diff --git a/Modules/Core/Common/src/otbSystem.cxx b/Modules/Core/Common/src/otbSystem.cxx index 50301533a7ab884a2dbce213332106ca0ab7fc7e..c0a063035aa42999f0519c08e24f52eff0631a60 100644 --- a/Modules/Core/Common/src/otbSystem.cxx +++ b/Modules/Core/Common/src/otbSystem.cxx @@ -124,9 +124,9 @@ std::vector<std::string> System::Readdir(const std::string& pszPath) if (pszPath.empty() == true) path = "."; - if ((hDir = opendir(path.c_str())) != NULL) + if ((hDir = opendir(path.c_str())) != ITK_NULLPTR) { - while ((psDirEntry = readdir(hDir)) != NULL) + while ((psDirEntry = readdir(hDir)) != ITK_NULLPTR) { listFileFind.push_back(psDirEntry->d_name); } diff --git a/Modules/Core/Common/src/otbWriterWatcherBase.cxx b/Modules/Core/Common/src/otbWriterWatcherBase.cxx index cce575ef8249c347d834419f34f4f627ec803578..5ba4efff048469af8771d870560d682fa679be0b 100644 --- a/Modules/Core/Common/src/otbWriterWatcherBase.cxx +++ b/Modules/Core/Common/src/otbWriterWatcherBase.cxx @@ -28,7 +28,7 @@ WriterWatcherBase { // Initialize state m_Comment = "Not watching any object"; - m_Process = 0; + m_Process = ITK_NULLPTR; m_StartFilterTag = 0; m_EndFilterTag = 0; m_ProgressFilterTag = 0; diff --git a/Modules/Core/Common/test/otbSystemTest.cxx b/Modules/Core/Common/test/otbSystemTest.cxx index f8fd3ecf5d89f7473bf625cea1f8fa7f267dcc0b..e2adb3ab9d772a3487f7b68cdf936f45daf5775b 100644 --- a/Modules/Core/Common/test/otbSystemTest.cxx +++ b/Modules/Core/Common/test/otbSystemTest.cxx @@ -29,10 +29,10 @@ int otbSystemTest(int itkNotUsed(argc), char * argv[]) std::ostringstream msg; // Check instanciation test - otb::System * var(NULL); + otb::System * var(ITK_NULLPTR); var = new otb::System(); delete var; - var = NULL; + var = ITK_NULLPTR; if (itksys::SystemTools::FileExists(inputFileName, true) == false) { diff --git a/Modules/Core/ComplexImage/include/otbAmplitudePhaseToRGBFunctor.h b/Modules/Core/ComplexImage/include/otbAmplitudePhaseToRGBFunctor.h index 9d034f0162d7eb9a5c08e08f88f77b6f73362eef..b80f6781f5659d79acb1686f30865902ce352afa 100644 --- a/Modules/Core/ComplexImage/include/otbAmplitudePhaseToRGBFunctor.h +++ b/Modules/Core/ComplexImage/include/otbAmplitudePhaseToRGBFunctor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbAmplitudePhaseToRGBFunctor_h -#define __otbAmplitudePhaseToRGBFunctor_h +#ifndef otbAmplitudePhaseToRGBFunctor_h +#define otbAmplitudePhaseToRGBFunctor_h #include "otbScalarToRainbowRGBPixelFunctor.h" #include "otbMath.h" diff --git a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h index 371e34f1edc2ddd13cbcfb26e7301803c569f685..faf57857167dbf30f789b6e18802dae70a8a4765 100644 --- a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h +++ b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConvertPixelBuffer_h -#define __otbConvertPixelBuffer_h +#ifndef otbConvertPixelBuffer_h +#define otbConvertPixelBuffer_h #include <complex> #include "itkObject.h" @@ -81,4 +81,4 @@ private: #include "otbConvertPixelBuffer.txx" #endif -#endif // __otbConvertPixelBuffer_h +#endif // otbConvertPixelBuffer_h diff --git a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx index 3590e52c2bd92fc4cb9866ec3f4ea16a338f9237..892da6663093fd54a51ecabf5667ad7b2ce9a30f 100644 --- a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx +++ b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConvertPixelBuffer_txx -#define __otbConvertPixelBuffer_txx +#ifndef otbConvertPixelBuffer_txx +#define otbConvertPixelBuffer_txx #include "otbConvertPixelBuffer.h" #include "itkConvertPixelBuffer.h" diff --git a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h index 343bfc1acb96ad5eb5cac335a90967714681916f..ec20f86e6941125689c4c0fde28e10220033362a 100644 --- a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h +++ b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbDefaultConvertPixelTraits_h -#define __otbDefaultConvertPixelTraits_h +#ifndef otbDefaultConvertPixelTraits_h +#define otbDefaultConvertPixelTraits_h #include "itkOffset.h" #include "itkVector.h" diff --git a/Modules/Core/ImageBase/include/otbExtractROI.h b/Modules/Core/ImageBase/include/otbExtractROI.h index 831456ad0488a3bf526f4a6d3a095023608b98c8..2cefc79e281b750ee5cb0b0808aa578645a569ee 100644 --- a/Modules/Core/ImageBase/include/otbExtractROI.h +++ b/Modules/Core/ImageBase/include/otbExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractROI_h -#define __otbExtractROI_h +#ifndef otbExtractROI_h +#define otbExtractROI_h #include "otbExtractROIBase.h" #include "otbImage.h" @@ -77,17 +77,17 @@ public: OutputImageType::ImageDimension); void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; protected: ExtractROI(); - virtual ~ExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ExtractROI * * \sa ExtractROIBase::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: ExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbExtractROI.txx b/Modules/Core/ImageBase/include/otbExtractROI.txx index 21f24f8a1fc890bd6ab8a15d96c6894d368b7e13..afac3e8cd17f5a612d05fe307230bb645e0c68da 100644 --- a/Modules/Core/ImageBase/include/otbExtractROI.txx +++ b/Modules/Core/ImageBase/include/otbExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractROI_txx -#define __otbExtractROI_txx +#ifndef otbExtractROI_txx +#define otbExtractROI_txx #include "otbExtractROI.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.h b/Modules/Core/ImageBase/include/otbExtractROIBase.h index 7112ad4f6b040a24cdfa859e1b0ffdb8ccd95a62..c1c81ab290dff3c5e1a5dd75dd63bb5449290761 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.h +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractROIBase_h -#define __otbExtractROIBase_h +#ifndef otbExtractROIBase_h +#define otbExtractROIBase_h #include "itkImageToImageFilter.h" #include "itkSmartPointer.h" @@ -105,10 +105,10 @@ public: protected: ExtractROIBase(); - virtual ~ExtractROIBase() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ExtractROIBase() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** ExtractROIBase can produce an image which is a different * resolution than its input image. As such, ExtractROIBase @@ -118,7 +118,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** This function calls the actual region copier to do the mapping from * output image space to input image space. It uses a @@ -130,8 +130,8 @@ protected: * support output images of a lower dimension that the input. * * \sa ImageToImageFilter::CallCopyRegion() */ - virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, - const OutputImageRegionType& srcRegion); + void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, + const OutputImageRegionType& srcRegion) ITK_OVERRIDE; /** ExtractROIBase can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -146,7 +146,7 @@ protected: // ATTENTION bizarre void ThreadedGenerateData(const OutputImageRegionType& /*outputRegionForThread*/, - itk::ThreadIdType /*threadId*/) + itk::ThreadIdType /*threadId*/) ITK_OVERRIDE { diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.txx b/Modules/Core/ImageBase/include/otbExtractROIBase.txx index deb23dcd3b5488be12b078049e37d4520251aed5..d335c047202cadad0785461a8e0ffedb526cc81e 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.txx +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractROIBase_txx -#define __otbExtractROIBase_txx +#ifndef otbExtractROIBase_txx +#define otbExtractROIBase_txx #include "otbExtractROIBase.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index 2d8e30dc15ecc5929cc727e45d9e929dccfe13f7..84f06761ceeca580ae6f39ef83f4fdb26d15fe93 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImage_h -#define __otbImage_h +#ifndef otbImage_h +#define otbImage_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -184,14 +184,14 @@ public: virtual void SetImageKeywordList(const ImageKeywordlistType& kwl); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /// Copy metadata from a DataObject - virtual void CopyInformation(const itk::DataObject *); + void CopyInformation(const itk::DataObject *) ITK_OVERRIDE; protected: Image(); - virtual ~Image() {} + ~Image() ITK_OVERRIDE {} private: Image(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbImage.txx b/Modules/Core/ImageBase/include/otbImage.txx index 8c081b502ba8b643c25bfe6f32ec0e02a2e0a0e2..0ab4bbb26eeb0af189758416d775174bf00a08b6 100644 --- a/Modules/Core/ImageBase/include/otbImage.txx +++ b/Modules/Core/ImageBase/include/otbImage.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImage_txx -#define __otbImage_txx +#ifndef otbImage_txx +#define otbImage_txx #include "otbImage.h" diff --git a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h index 0f461ddecc92f83c2faeffbc4a9807cee6357d8a..4b832dbbc354b70255870e6e562bb077b9375faf 100644 --- a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h +++ b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFunctionAdaptor_h -#define __otbImageFunctionAdaptor_h +#ifndef otbImageFunctionAdaptor_h +#define otbImageFunctionAdaptor_h #include "itkImageFunction.h" @@ -85,17 +85,17 @@ class ITK_EXPORT ImageFunctionAdaptor : itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension); // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; // Evaluate the function at non-integer positions // - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -108,8 +108,8 @@ class ITK_EXPORT ImageFunctionAdaptor : protected: ImageFunctionAdaptor(); - virtual ~ImageFunctionAdaptor() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageFunctionAdaptor() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageFunctionAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.txx b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.txx index b9abf06cf8b4f3c92c756fc2369591144bdf79d4..eec6f683d939ac4d985baccbe01ac358c98d460b 100644 --- a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.txx +++ b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFunctionAdaptor_txx -#define __otbImageFunctionAdaptor_txx +#ifndef otbImageFunctionAdaptor_txx +#define otbImageFunctionAdaptor_txx #include "otbImageFunctionAdaptor.h" diff --git a/Modules/Core/ImageBase/include/otbImageIOBase.h b/Modules/Core/ImageBase/include/otbImageIOBase.h index 4abd41359b95d011c10e31087103a55ccbdca2e3..9e7ecba118625f43c462bc176eef9eddbf3b37c8 100644 --- a/Modules/Core/ImageBase/include/otbImageIOBase.h +++ b/Modules/Core/ImageBase/include/otbImageIOBase.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageIOBase_h -#define __otbImageIOBase_h +#ifndef otbImageIOBase_h +#define otbImageIOBase_h #include "itkLightProcessObject.h" #include "itkIndent.h" @@ -417,8 +417,8 @@ public: protected: ImageIOBase(); - virtual ~ImageIOBase(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageIOBase() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Used internally to keep track of the type of the pixel. */ IOPixelType m_PixelType; @@ -547,4 +547,4 @@ private: } // end namespace itk -#endif // __otbImageIOBase_h +#endif // otbImageIOBase_h diff --git a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h index 027e1497c82d9362ebe31e8819e77289c6b7bdad..dc518cea36530fc53901c9823b08cea92fd26b26 100644 --- a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageOfVectorsToMonoChannelExtractROI_h -#define __otbImageOfVectorsToMonoChannelExtractROI_h +#ifndef otbImageOfVectorsToMonoChannelExtractROI_h +#define otbImageOfVectorsToMonoChannelExtractROI_h #include "otbExtractROIBase.h" #include "otbImage.h" @@ -83,8 +83,8 @@ public: protected: ImageOfVectorsToMonoChannelExtractROI(); - virtual ~ImageOfVectorsToMonoChannelExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageOfVectorsToMonoChannelExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ExtractImageFilter can produce an image which is a different * resolution than its input image. As such, ExtractImageFilter @@ -94,13 +94,13 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** ExtractImageFilter can be implemented as a multithreaded filter. * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: ImageOfVectorsToMonoChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.txx b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.txx index d00fb440a2c5686f89ff2f989269c55ecac7c896..9381f15b3cba09c2f2cc6e837db2fc5f38226391 100644 --- a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.txx +++ b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageOfVectorsToMonoChannelExtractROI_txx -#define __otbImageOfVectorsToMonoChannelExtractROI_txx +#ifndef otbImageOfVectorsToMonoChannelExtractROI_txx +#define otbImageOfVectorsToMonoChannelExtractROI_txx #include "otbImageOfVectorsToMonoChannelExtractROI.h" diff --git a/Modules/Core/ImageBase/include/otbMetaImageFunction.h b/Modules/Core/ImageBase/include/otbMetaImageFunction.h index 64b99d3584df0128336045b6126f34d2136ce67b..a378c43740d3a329616df798d2dde8a3efc3249e 100644 --- a/Modules/Core/ImageBase/include/otbMetaImageFunction.h +++ b/Modules/Core/ImageBase/include/otbMetaImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMetaImageFunction_h -#define __otbMetaImageFunction_h +#ifndef otbMetaImageFunction_h +#define otbMetaImageFunction_h #include "itkFunctionBase.h" #include "itkPoint.h" @@ -72,7 +72,7 @@ public: typedef std::vector<FunctionPointerType> FunctionContainerType; /** Evaluate the function at the given location */ - OutputType Evaluate(const PointType & point) const; + OutputType Evaluate(const PointType & point) const ITK_OVERRIDE; /** Add a new function to the functions vector */ void AddFunction(FunctionType * function); @@ -97,10 +97,10 @@ protected: MetaImageFunction(); /** Destructor */ - ~MetaImageFunction(); + ~MetaImageFunction() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: MetaImageFunction(const Self& ); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMetaImageFunction.txx b/Modules/Core/ImageBase/include/otbMetaImageFunction.txx index 448cde0b32a53a58c82d4cde9587587f9e948ff2..26bae0c5c473b8a9de0c4662177efe0b52e39198 100644 --- a/Modules/Core/ImageBase/include/otbMetaImageFunction.txx +++ b/Modules/Core/ImageBase/include/otbMetaImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMetaImageFunction_txx -#define __otbMetaImageFunction_txx +#ifndef otbMetaImageFunction_txx +#define otbMetaImageFunction_txx #include "otbMetaImageFunction.h" #include "otbImageFunctionAdaptor.h" diff --git a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h index ed692e173dd64e42d1a58d4d0a4ffc9e99bb62a2..687e984b535ff8a988fda813419fa4ee2877706a 100644 --- a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelExtractROI_h -#define __otbMultiChannelExtractROI_h +#ifndef otbMultiChannelExtractROI_h +#define otbMultiChannelExtractROI_h #include "otbExtractROIBase.h" #include "otbVectorImage.h" @@ -112,8 +112,8 @@ public: protected: MultiChannelExtractROI(); - virtual ~MultiChannelExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MultiChannelExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** MultiChannelExtractROI can produce an image which is a different * resolution than its input image. As such, MultiChannelExtractROI @@ -123,7 +123,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Reinitialize channels vector for multiple Update.*/ void ChannelsReInitialization(); @@ -134,7 +134,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: MultiChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.txx b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.txx index 5d10b1ba715aa10e98ceee5f198c309dcc884093..5a7540f6d11464d982e66a65adb669c0c0cda130 100644 --- a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.txx +++ b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelExtractROI_txx -#define __otbMultiChannelExtractROI_txx +#ifndef otbMultiChannelExtractROI_txx +#define otbMultiChannelExtractROI_txx #include "otbMultiChannelExtractROI.h" diff --git a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h index 6214a9972a0a155d67254d49b03bacd17ce9ffbd..f2bd46bfc49d00c3d7b58f6296cd672ef3c51a67 100644 --- a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiToMonoChannelExtractROI_h -#define __otbMultiToMonoChannelExtractROI_h +#ifndef otbMultiToMonoChannelExtractROI_h +#define otbMultiToMonoChannelExtractROI_h #include "otbExtractROIBase.h" #include "otbImage.h" @@ -90,8 +90,8 @@ public: protected: MultiToMonoChannelExtractROI(); - virtual ~MultiToMonoChannelExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MultiToMonoChannelExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ExtractImageFilter can produce an image which is a different * resolution than its input image. As such, ExtractImageFilter @@ -101,13 +101,13 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** ExtractImageFilter can be implemented as a multithreaded filter. * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: MultiToMonoChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.txx b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.txx index 095008aef1a9edf6dcfd34906c1765bd5ae13604..1bb293b83fa5014e062dca9340d9253d16f737d1 100644 --- a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.txx +++ b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiToMonoChannelExtractROI_txx -#define __otbMultiToMonoChannelExtractROI_txx +#ifndef otbMultiToMonoChannelExtractROI_txx +#define otbMultiToMonoChannelExtractROI_txx #include "otbMultiToMonoChannelExtractROI.h" diff --git a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h index 8fb6381a2b5808515bf2e31c564465cdf5e274cb..66e3c6b44320a8f215bcf8b074588b1b1fb69bde 100644 --- a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h +++ b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRemoteSensingRegion_h -#define __otbRemoteSensingRegion_h +#ifndef otbRemoteSensingRegion_h +#define otbRemoteSensingRegion_h #include <algorithm> #include <iomanip> @@ -78,7 +78,7 @@ public: /** ImageRegion typedef needed by the GetImageRegion() method */ typedef itk::ImageRegion<2> ImageRegionType; - virtual typename Superclass::RegionType GetRegionType() const + typename Superclass::RegionType GetRegionType() const ITK_OVERRIDE {return Superclass::ITK_STRUCTURED_REGION; } /** Constructor. RemoteSensingRegion is a lightweight object that is not reference @@ -103,7 +103,7 @@ public: /** Destructor. RemoteSensingRegion is a lightweight object that is not reference * counted, so the destructor is public. */ - virtual ~RemoteSensingRegion(){} + ~RemoteSensingRegion() ITK_OVERRIDE{} /** operator=. RemoteSensingRegion is a lightweight object that is not reference * counted, so operator= is public. */ @@ -331,7 +331,7 @@ public: protected: - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { os << std::setprecision(15); os << indent << "RemoteSensingRegion" << std::endl; diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h index 95b7f12b1caa64a312f1e45cc1ddf6a0fdf83fc3..b696965755af3e5eea8f56f478d9ffa499a99ef6 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.h +++ b/Modules/Core/ImageBase/include/otbVectorImage.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImage_h -#define __otbVectorImage_h +#ifndef otbVectorImage_h +#define otbVectorImage_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -154,9 +154,9 @@ public: virtual void SetImageKeywordList(const ImageKeywordlistType& kwl); /// Copy metadata from a DataObject - virtual void CopyInformation(const itk::DataObject *); + void CopyInformation(const itk::DataObject *) ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Return the Pixel Accessor object */ // AccessorType GetPixelAccessor( void ) @@ -184,7 +184,7 @@ public: protected: VectorImage(); - virtual ~VectorImage() {} + ~VectorImage() ITK_OVERRIDE {} private: VectorImage(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbVectorImage.txx b/Modules/Core/ImageBase/include/otbVectorImage.txx index af176c9e7bf87cfce1b3a61d7ad95cc12291c38c..be15ec5b0ea71313ba8f5f270abf23ab494e849f 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.txx +++ b/Modules/Core/ImageBase/include/otbVectorImage.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImage_txx -#define __otbVectorImage_txx +#ifndef otbVectorImage_txx +#define otbVectorImage_txx #include "otbVectorImage.h" diff --git a/Modules/Core/ImageBase/src/otbImageIOBase.cxx b/Modules/Core/ImageBase/src/otbImageIOBase.cxx index 058d1a829ad698069ceec7f8df67ed68660aa2e7..5b0c9d3831b74605e9514f02831a81fac31288a9 100644 --- a/Modules/Core/ImageBase/src/otbImageIOBase.cxx +++ b/Modules/Core/ImageBase/src/otbImageIOBase.cxx @@ -86,7 +86,7 @@ void ImageIOBase::Resize(const unsigned int numDimensions, const unsigned int* dimensions) { m_NumberOfDimensions = numDimensions; - if (dimensions != NULL) + if (dimensions != ITK_NULLPTR) { for (unsigned int i=0; i < m_NumberOfDimensions; i++) { diff --git a/Modules/Core/ImageBase/test/CMakeLists.txt b/Modules/Core/ImageBase/test/CMakeLists.txt index 3de66bd945d4345d07095fee2af18b74dce134b6..3d74d3d4230565e3486736f9b1a93ab23ae57ef7 100644 --- a/Modules/Core/ImageBase/test/CMakeLists.txt +++ b/Modules/Core/ImageBase/test/CMakeLists.txt @@ -67,10 +67,6 @@ otb_add_test(NAME bfTvItkImagePCAShapeModelEstimatorTest COMMAND otbImageBaseTes ) set_property(TEST bfTvItkImagePCAShapeModelEstimatorTest PROPERTY DEPENDS bfTvInnerProductPCAImageFilterAllsOutputsWithoutUnbiasedEstimator) - - - - otb_add_test(NAME bfTvFunctionToImageFilterTest COMMAND otbImageBaseTestDriver --compare-image ${EPSILON_7} ${BASELINE}/bfTvFunctionToImageFilterTest.tif @@ -162,29 +158,31 @@ otb_add_test(NAME coTvMultiChannelROI_RGB2NG_PNG3 COMMAND otbImageBaseTestDriver ${TEMP}/coMultiChannelExtractROI_RGB2NG_PNG_300_10_250_50_channel_3.png -startX 300 -startY 10 -sizeX 250 -sizeY 50 -channels 3 ) -otb_add_test(NAME ioTvMultiDatasetReading2 COMMAND otbImageBaseTestDriver - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReading2.txt - ${TEMP}/ioTvMultiDatasetReading2.txt - --ignore-lines-with 1 Pointer: - otbVectorImageTest - ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=5 - ${TEMP}/ioTvMultiDatasetReading2.txt - ) - -otb_add_test(NAME ioTvMultiDatasetReading1 COMMAND otbImageBaseTestDriver - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReading1.txt - ${TEMP}/ioTvMultiDatasetReading1.txt - --ignore-lines-with 1 Pointer: - otbVectorImageTest - ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=0 - ${TEMP}/ioTvMultiDatasetReading1.txt - ) +if(GDAL_HAS_HDF4) + otb_add_test(NAME ioTvMultiDatasetReading2 COMMAND otbImageBaseTestDriver + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReading2.txt + ${TEMP}/ioTvMultiDatasetReading2.txt + --ignore-lines-with 1 Pointer: + otbVectorImageTest + ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=5 + ${TEMP}/ioTvMultiDatasetReading2.txt + ) + + otb_add_test(NAME ioTvMultiDatasetReading1 COMMAND otbImageBaseTestDriver + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReading1.txt + ${TEMP}/ioTvMultiDatasetReading1.txt + --ignore-lines-with 1 Pointer: + otbVectorImageTest + ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=0 + ${TEMP}/ioTvMultiDatasetReading1.txt + ) +endif() otb_add_test(NAME coTvExtractROITestMetaData_TIFF COMMAND otbImageBaseTestDriver --compare-ascii ${NOTOL} ${TEMP}/coTvExtractROITestMetaData1.txt ${TEMP}/coTvExtractROITestMetaData2.txt - --ignore-lines-with 1 Origin: + --ignore-lines-with 4 Origin: Source: Image ImportImageContainer otbExtractROITestMetaData LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} ${TEMP}/coTvExtractROITestMetaData1.tif @@ -197,7 +195,7 @@ otb_add_test(NAME coTvExtractROITestMetaData_HDR COMMAND otbImageBaseTestDriver --compare-ascii ${NOTOL} ${TEMP}/coTvExtractROITestMetaData1_hdr.txt ${TEMP}/coTvExtractROITestMetaData2_hdr.txt - --ignore-lines-with 1 Origin: + --ignore-lines-with 4 Origin: Source: Image ImportImageContainer otbExtractROITestMetaData LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} ${TEMP}/coTvExtractROITestMetaData1.hdr @@ -258,13 +256,10 @@ otb_add_test(NAME bfTuFunctionToImageFilterNew COMMAND otbImageBaseTestDriver otbFunctionToImageFilterNew ) - - otb_add_test(NAME coTuVectorImageToASImageAdaptorNew COMMAND otbImageBaseTestDriver otbVectorImageToASImageAdaptorNew ) - otb_add_test(NAME bfTvImageAndVectorImageOperationFilterTest COMMAND otbImageBaseTestDriver --compare-n-images ${NOTOL} 4 ${BASELINE}/bfTvImageAndVectorImageOperationFilterTestAdd.tif @@ -295,17 +290,12 @@ otb_add_test(NAME coTvImageOfVectorsToMonoChannelExtractROI COMMAND otbImageBase ${TEMP}/coImageOfVectorsToMonoChannelExtractROI.png ) - otb_add_test(NAME coTuImageOfVectorsToMonoChannelExtractROINew COMMAND otbImageBaseTestDriver otbImageOfVectorsToMonoChannelExtractROINew ) - - - otb_add_test(NAME coTuExtractROINew COMMAND otbImageBaseTestDriver otbExtractROINew) - otb_add_test(NAME coTvExtractROI_RGB COMMAND otbImageBaseTestDriver --compare-image ${NOTOL} ${BASELINE}/coExtractROI_RGB_300_10_200_50.png ${TEMP}/coExtractROI_RGB_300_10_200_50.png @@ -327,7 +317,6 @@ otb_add_test(NAME coTvExtractROI_QB COMMAND otbImageBaseTestDriver otb_add_test(NAME bfTvComplexToIntensityFilterTest COMMAND otbImageBaseTestDriver otbComplexToIntensityFilterTest) - otb_add_test(NAME coTuMultiToMonoROINew COMMAND otbImageBaseTestDriver otbMultiToMonoChannelExtractROINew) @@ -366,7 +355,6 @@ otb_add_test(NAME feTuImageFunctionAdaptorNew COMMAND otbImageBaseTestDriver otbImageFunctionAdaptorNew ) - otb_add_test(NAME coTuMultiChannelROINew COMMAND otbImageBaseTestDriver otbMultiChannelExtractROINew) @@ -393,24 +381,24 @@ if(OTB_DATA_USE_LARGEINPUT) # Read info from the input file #otb_add_test(NAME ioTvVectorImageReadingInfo_${current_type} COMMAND otbImageBaseTestDriver - #--ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}.txt - #${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt - #--ignore-lines-with 4 CacheSizeInBytes SubDatasetIndex Driver Corner - #otbVectorImageTest - #${current_file}?&resol=0 - #${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt - #) + #--ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}.txt + #${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt + #--ignore-lines-with 4 CacheSizeInBytes SubDatasetIndex Driver Corner + #otbVectorImageTest + #${current_file}?&resol=0 + #${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt + #) if(NOT PHR_TIFF_FILE) # Read info from the input file (res=5) #otb_add_test(NAME ioTvVectorImageReadingInfo_${current_type}_res5 COMMAND otbImageBaseTestDriver - #--ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}_res5.txt - #${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt - #--ignore-lines-with 4 CacheSizeInBytes Driver Corner SubDatasetIndex - #otbVectorImageTest - #${current_file}?&resol=5 - #${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt - #) + #--ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}_res5.txt + #${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt + #--ignore-lines-with 4 CacheSizeInBytes Driver Corner SubDatasetIndex + #otbVectorImageTest + #${current_file}?&resol=5 + #${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt + #) # Decode an area inside one tile otb_add_test(NAME ioTvReaderWriterJP22TIF_${current_type}_1 COMMAND otbImageBaseTestDriver --compare-image ${EPSILON_9} ${BASELINE}/ioTvJP22TIF_Extract_${current_type}_1.tif @@ -452,8 +440,6 @@ if(OTB_DATA_USE_LARGEINPUT) endif() - - # --- SPOT4 (CAI) --- otb_add_test(NAME ioTvMultiChannelROI_SPOT42PNG COMMAND otbImageBaseTestDriver --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_SPOT42PNG_spot4_700_60_77_489_channels_1_2_3.png @@ -631,128 +617,127 @@ otb_add_test(NAME ioTvMultiChannelROI_QuickbirdXS2TIFF COMMAND otbImageBaseTes -startX 1000 -startY 1000 -sizeX 100 -sizeY 150 ) -# Tests which read data in HDF files. -otb_add_test(NAME ioTvMultiChannelROI_HDF4_2_TIF COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1.tif - ${TEMP}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=5 - ${TEMP}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1_OUT.tif - -startX 1400 -startY 3700 -sizeX 100 -sizeY 150 - -channels 1 ) - -otb_add_test(NAME ioTvMultiChannelROI_HDF5_2_TIF COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1.tif - ${TEMP}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/GSSTF_NCEP.2b.2008.12.31.he5?&sdataidx=3 - ${TEMP}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1_OUT.tif - -startX 100 -startY 20 -sizeX 200 -sizeY 100 - -channels 1 ) +if(GDAL_HAS_HDF4) + # Tests which read data in HDF files. + otb_add_test(NAME ioTvMultiChannelROI_HDF4_2_TIF COMMAND otbImageBaseTestDriver + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1.tif + ${TEMP}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=5 + ${TEMP}/ioExtractROI_HDF2TIF_MOD09Q1G_20_25_100_150_channel_1_OUT.tif + -startX 1400 -startY 3700 -sizeX 100 -sizeY 150 + -channels 1 ) +endif() +if(GDAL_HAS_HDF5) + otb_add_test(NAME ioTvMultiChannelROI_HDF5_2_TIF COMMAND otbImageBaseTestDriver + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1.tif + ${TEMP}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/GSSTF_NCEP.2b.2008.12.31.he5?&sdataidx=3 + ${TEMP}/ioExtractROI_HDF2TIF_GSSTF_NCEP_100_20_200_100_channel_1_OUT.tif + -startX 100 -startY 20 -sizeX 200 -sizeY 100 + -channels 1 ) +endif() # Read an area inside one tile at resolution 0 (jpeg2000 conformance file with # specific tile size at different resolution). otb_add_test(NAME ioTvMultiChannelROI_p1_06_JPEG2000_2_TIF_res0 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_p1_06.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/jpeg2000_conf_p1_06.j2k?&resol=0 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_OUT.tif - ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_p1_06.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/jpeg2000_conf_p1_06.j2k?&resol=0 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_OUT.tif + ) + +# Only do the following test if we are using the OTB Openjpeg driver, +# because gdal does not report jpeg2000 overview with size < 128 +# pixel, and will therefore interpolate. +if(OTB_USE_OPENJPEG) # Read an area inside one tile at resolution 4 (jpeg2000 conformance file with # specific tile size at different resolution). otb_add_test(NAME ioTvMultiChannelROI_p1_06_JPEG2000_2_TIF_res4 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/jpeg2000_conf_p1_06.j2k?&resol=4 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4_OUT.tif - ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/jpeg2000_conf_p1_06.j2k?&resol=4 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_p1_06_res4_OUT.tif + ) + +endif() # Read an area inside one tile at resolution 0 (quite similar coding parameter with pleiade # except it a lossless image with no quatization style). otb_add_test(NAME ioTvMultiChannelROI_lena_JPEG2000_2_TIF_res0 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/lena512color.jp2?&resol=0 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50_OUT.tif - -startX 150 -startY 75 -sizeX 100 -sizeY 50 ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/lena512color.jp2?&resol=0 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_150_75_100_50_OUT.tif + -startX 150 -startY 75 -sizeX 100 -sizeY 50 ) # Read an area inside one tile at resolution 5 (quite similar coding parameter with pleiade # except it a lossless image with no quatization style). -otb_add_test(NAME ioTvMultiChannelROI_lena_JPEG2000_2_TIF_res5 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_lena_res5.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_res5_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/lena512color.jp2?&resol=5 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_res5_OUT.tif - ) +otb_add_test(NAME ioTvMultiChannelROI_lena_JPEG2000_2_TIF_res1 COMMAND otbImageBaseTestDriver + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_lena_res1.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_res1_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/lena512color.jp2?&resol=1 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_lena_res1_OUT.tif + ) # Read an area inside one tile at resolution 0 otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res0_1 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=0 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40_OUT.tif - -startX 700 -startY 1000 -sizeX 50 -sizeY 40 ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/bretagne.j2k?&resol=0 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_700_1000_50_40_OUT.tif + -startX 700 -startY 1000 -sizeX 50 -sizeY 40 ) # Read an area which need to decode 4 tiles at resolution 0 otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res0_2 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=0 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20_OUT.tif - -startX 1260 -startY 950 -sizeX 40 -sizeY 20 ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/bretagne.j2k?&resol=0 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_1260_950_40_20_OUT.tif + -startX 1260 -startY 950 -sizeX 40 -sizeY 20 ) # Read all the image with a resolution 3 otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res3 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=3 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_OUT.tif ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/bretagne.j2k?&resol=3 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_OUT.tif ) # Read area inside one tile at resolution 3 otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res3_1 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=3 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30_OUT.tif - -startX 90 -startY 70 -sizeX 20 -sizeY 30 ) + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/bretagne.j2k?&resol=3 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_90_70_20_30_OUT.tif + -startX 90 -startY 70 -sizeX 20 -sizeY 30 ) # Read an area which need to decode 4 tiles at resolution 3 otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res3_2 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=3 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60_OUT.tif - -startX 40 -startY 30 -sizeX 80 -sizeY 60 ) - -# Read all the image with a resolution 5 -otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res5 COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res5.tif - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res5_OUT.tif - otbMultiChannelExtractROI - ${INPUTDATA}/bretagne.j2k?&resol=5 - ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res5_OUT.tif ) - - - + --compare-image ${EPSILON_9} ${BASELINE}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60.tif + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60_OUT.tif + otbMultiChannelExtractROI + ${INPUTDATA}/bretagne.j2k?&resol=3 + ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res3_40_30_80_60_OUT.tif + -startX 40 -startY 30 -sizeX 80 -sizeY 60 ) # --- RADARSAT (GDAL) --- otb_add_test(NAME ioTvMultiMonoChannelROI_RADARSAT2ENVI COMMAND otbImageBaseTestDriver - otbMultiToMonoChannelExtractROI - -ushort LARGEINPUT{RADARSAT1/GOMA/SCENE01/} - -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr - -startX 2559 -startY 3591 -sizeX 337 -sizeY 280 ) + otbMultiToMonoChannelExtractROI + -ushort LARGEINPUT{RADARSAT1/GOMA/SCENE01/} + -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr + -startX 2559 -startY 3591 -sizeX 337 -sizeY 280 ) # FIXME this test depends on an other test which requires largeinput. Need to circle the test with it(otb_data_use_large_input). It should not happen if(OTB_DATA_USE_LARGEINPUT) @@ -765,65 +750,67 @@ if(OTB_DATA_USE_LARGEINPUT) -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT_ENVI2ENVI_2559_3591_337_280_2.hdr -startX 0 -startY 0 -sizeX ParseHdfSubsetName337 -sizeY 280 ) - + set_tests_properties(ioTvMultiMonoChannelROI_RADARSAT_ENVI2ENVI PROPERTIES DEPENDS ioTvMultiMonoChannelROI_RADARSAT2ENVI) endif() # --- ENVI (GDAL) --- otb_add_test(NAME ioTvMultiMonoChannelROI_ENVI2PNG COMMAND otbImageBaseTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png - ${TEMP}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png - otbMultiToMonoChannelExtractROI - ${INPUTDATA}/poupees_1canal.c1.hdr - ${TEMP}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png - -startX 302 -startY 2 -sizeX 134 -sizeY 330 - -channel 1) + --compare-image ${EPSILON_9} ${BASELINE}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png + ${TEMP}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png + otbMultiToMonoChannelExtractROI + ${INPUTDATA}/poupees_1canal.c1.hdr + ${TEMP}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png + -startX 302 -startY 2 -sizeX 134 -sizeY 330 + -channel 1) # Tests to check if we can open JPEG2000 files specifying the resolution factor. # no access to data only PrintSelf() method. otb_add_test(NAME ioTvMultiResolutionReading0 COMMAND otbImageBaseTestDriver --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiResolutionReading0.txt - ${TEMP}/ioTvMultiResolutionReading0.txt - --ignore-lines-with 1 SubDatasetIndex - otbVectorImageTest - ${INPUTDATA}/bretagne.j2k?&resol=0 - ${TEMP}/ioTvMultiResolutionReading0.txt - ) + ${TEMP}/ioTvMultiResolutionReading0.txt + --ignore-lines-with 7 VectorImage Source PipelineMTime ImportImageContainer Pointer CacheSizeInBytes SubDatasetIndex + otbVectorImageTest + ${INPUTDATA}/bretagne.j2k?&resol=0 + ${TEMP}/ioTvMultiResolutionReading0.txt + ) otb_add_test(NAME ioTvMultiResolutionReading3 COMMAND otbImageBaseTestDriver --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiResolutionReading3.txt - ${TEMP}/ioTvMultiResolutionReading3.txt - --ignore-lines-with 1 SubDatasetIndex - otbVectorImageTest - ${INPUTDATA}/bretagne.j2k?&resol=3 - ${TEMP}/ioTvMultiResolutionReading3.txt - ) + ${TEMP}/ioTvMultiResolutionReading3.txt + --ignore-lines-with 7 VectorImage Source PipelineMTime ImportImageContainer Pointer CacheSizeInBytes SubDatasetIndex + otbVectorImageTest + ${INPUTDATA}/bretagne.j2k?&resol=3 + ${TEMP}/ioTvMultiResolutionReading3.txt + ) otb_add_test(NAME ioTvOtbVectorImageTestSpot5 COMMAND otbImageBaseTestDriver - --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestSpot5.txt - ${TEMP}/ioOtbVectorImageTestSpot5.txt - otbVectorImageLegacyTest - LARGEINPUT{/SPOT5/TEHERAN/} - ${TEMP}/ioOtbVectorImageTestSpot5.txt) + --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestSpot5.txt + ${TEMP}/ioOtbVectorImageTestSpot5.txt + otbVectorImageLegacyTest + LARGEINPUT{/SPOT5/TEHERAN/} + ${TEMP}/ioOtbVectorImageTestSpot5.txt) otb_add_test(NAME ioTvOtbVectorImageTestFORMOSAT2 COMMAND otbImageBaseTestDriver - --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestFORMOSAT2.txt - ${TEMP}/ioOtbVectorImageTestFORMOSAT2.txt - otbVectorImageLegacyTest - LARGEINPUT{/FORMOSAT/Sudouest_20071013_MS_fmsat/} - ${TEMP}/ioOtbVectorImageTestFORMOSAT2.txt) - -otb_add_test(NAME ioTvOtbVectorImageTestCOSMOSKYMED COMMAND otbImageBaseTestDriver - --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestCOSMOSKYMED.txt - ${TEMP}/ioOtbVectorImageTestCOSMOSKYMED.txt - otbVectorImageLegacyTest - LARGEINPUT{/COSMOSKYMED/Toulouse_spotlight/CSKS3_GTC_B_S2_08_HH_RD_SF_20110418180325_20110418180332.h5} - ${TEMP}/ioOtbVectorImageTestCOSMOSKYMED.txt) + --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestFORMOSAT2.txt + ${TEMP}/ioOtbVectorImageTestFORMOSAT2.txt + otbVectorImageLegacyTest + LARGEINPUT{/FORMOSAT/Sudouest_20071013_MS_fmsat/} + ${TEMP}/ioOtbVectorImageTestFORMOSAT2.txt) + +if(GDAL_HAS_HDF5) + otb_add_test(NAME ioTvOtbVectorImageTestCOSMOSKYMED COMMAND otbImageBaseTestDriver + --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/ioOtbVectorImageTestCOSMOSKYMED.txt + ${TEMP}/ioOtbVectorImageTestCOSMOSKYMED.txt + otbVectorImageLegacyTest + LARGEINPUT{/COSMOSKYMED/Toulouse_spotlight/CSKS3_GTC_B_S2_08_HH_RD_SF_20110418180325_20110418180332.h5} + ${TEMP}/ioOtbVectorImageTestCOSMOSKYMED.txt) +endif() otb_add_test(NAME ioTvOtbVectorImageTestRadarsat COMMAND otbImageBaseTestDriver - --compare-ascii ${EPSILON_3} - ${BASELINE_FILES}/ioOtbImageTestRadarsat.txt - ${TEMP}/ioOtbVectorImageTestRadarsat.txt - otbVectorImageLegacyTest - LARGEINPUT{/RADARSAT1/GOMA/SCENE01/} - ${TEMP}/ioOtbVectorImageTestRadarsat.txt) + --compare-ascii ${EPSILON_3} + ${BASELINE_FILES}/ioOtbImageTestRadarsat.txt + ${TEMP}/ioOtbVectorImageTestRadarsat.txt + otbVectorImageLegacyTest + LARGEINPUT{/RADARSAT1/GOMA/SCENE01/} + ${TEMP}/ioOtbVectorImageTestRadarsat.txt) diff --git a/Modules/Core/ImageBase/test/otbMultiChannelExtractROI.cxx b/Modules/Core/ImageBase/test/otbMultiChannelExtractROI.cxx index 910d3aa4861dd57e75e413e400d25382016b2edc..b675ef7af78409f102d271211701cc98bb387be5 100644 --- a/Modules/Core/ImageBase/test/otbMultiChannelExtractROI.cxx +++ b/Modules/Core/ImageBase/test/otbMultiChannelExtractROI.cxx @@ -37,7 +37,7 @@ int generic_otbMultiChannelExtractROI(int itkNotUsed(argc), char * argv[], const typename ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); int cpt(0), nbcanaux(0); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { std::string strArgv(argv[cpt]); if (strArgv == "-startX") @@ -76,7 +76,7 @@ int generic_otbMultiChannelExtractROI(int itkNotUsed(argc), char * argv[], const bool searchChannels(true); while (searchChannels == true) { - if (argv[cpt] == NULL) + if (argv[cpt] == ITK_NULLPTR) { searchChannels = false; } diff --git a/Modules/Core/ImageBase/test/otbMultiToMonoChannelExtractROI.cxx b/Modules/Core/ImageBase/test/otbMultiToMonoChannelExtractROI.cxx index d992ab51fa76abaf61814808eff3c6d22650728f..739dc5fb254938549a8b6839215d3f8690426ea3 100644 --- a/Modules/Core/ImageBase/test/otbMultiToMonoChannelExtractROI.cxx +++ b/Modules/Core/ImageBase/test/otbMultiToMonoChannelExtractROI.cxx @@ -33,7 +33,7 @@ int generic_otbMultiToMonoChannelExtractROI(int itkNotUsed(argc), typename ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); int cpt(0); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { std::string strArgv(argv[cpt]); if (strArgv == "-startX") diff --git a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h index 0baf3bb53da49858393f6f92bc586fd1ef938fb7..ef781a794dfe1111a593b1b749dd37191957d8dc 100644 --- a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBCOInterpolateImageFunction_h -#define __otbBCOInterpolateImageFunction_h +#ifndef otbBCOInterpolateImageFunction_h +#define otbBCOInterpolateImageFunction_h #include "itkInterpolateImageFunction.h" #include "vnl/vnl_vector.h" @@ -106,12 +106,12 @@ public: * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ - virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const = 0; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE = 0; protected: BCOInterpolateImageFunctionBase() : m_Radius(2), m_WinSize(5), m_Alpha(-0.5) {}; - virtual ~BCOInterpolateImageFunctionBase() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BCOInterpolateImageFunctionBase() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Compute the BCO coefficients. */ virtual CoefContainerType EvaluateCoef( const ContinuousIndexValueType & indexValue ) const; @@ -154,12 +154,12 @@ public: typedef typename Superclass::ContinuousIndexType ContinuousIndexType; typedef typename Superclass::CoefContainerType CoefContainerType; - virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE; protected: BCOInterpolateImageFunction() {}; - virtual ~BCOInterpolateImageFunction() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BCOInterpolateImageFunction() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BCOInterpolateImageFunction( const Self& ); //purposely not implemented @@ -193,12 +193,12 @@ public: typedef typename Superclass::ContinuousIndexType ContinuousIndexType; typedef typename Superclass::CoefContainerType CoefContainerType; - virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE; protected: BCOInterpolateImageFunction() {}; - virtual ~BCOInterpolateImageFunction() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BCOInterpolateImageFunction() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BCOInterpolateImageFunction( const Self& ); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.txx b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.txx index 91cda290839edad87b6ddeb9ead20e6825a8d900..89572aad83c63b515005883f223dc86d2d757b78 100644 --- a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.txx +++ b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBCOInterpolateImageFunction_txx -#define __otbBCOInterpolateImageFunction_txx +#ifndef otbBCOInterpolateImageFunction_txx +#define otbBCOInterpolateImageFunction_txx #include "otbBCOInterpolateImageFunction.h" diff --git a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h index 48cafebae4d52cc8749ba7b34c5625fa9a5fc5b6..2b55bc86b48e23a5774a3c5ad9c61bc95ae4304f 100644 --- a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h +++ b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplineDecompositionImageFilter_h -#define __otbBSplineDecompositionImageFilter_h +#ifndef otbBSplineDecompositionImageFilter_h +#define otbBSplineDecompositionImageFilter_h #include <vector> @@ -74,10 +74,10 @@ public: protected: BSplineDecompositionImageFilter(); - virtual ~BSplineDecompositionImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BSplineDecompositionImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** These are needed by the smoothing spline routine. */ std::vector<double> m_Scratch; // temp storage for processing of Coefficients diff --git a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.txx b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.txx index 6436db191deff4fd63a37f91e5d5441e32f7fe6d..c614e4b53debf2a3026006ff7812a20767a2d0be 100644 --- a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.txx +++ b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplineDecompositionImageFilter_txx -#define __otbBSplineDecompositionImageFilter_txx +#ifndef otbBSplineDecompositionImageFilter_txx +#define otbBSplineDecompositionImageFilter_txx #include "otbBSplineDecompositionImageFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h index f84a97cb6c09070b13793b31d29cd591b63efa2d..0d9fabd8f72c7d2938f28f7c872ee7f6c0ff0ef7 100644 --- a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplineInterpolateImageFunction_h -#define __otbBSplineInterpolateImageFunction_h +#ifndef otbBSplineInterpolateImageFunction_h +#define otbBSplineInterpolateImageFunction_h #include <vector> @@ -104,8 +104,8 @@ public: * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& index) const; + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& index) const ITK_OVERRIDE; /** Derivative typedef support */ typedef itk::CovariantVector<OutputType, @@ -128,7 +128,7 @@ public: itkGetMacro(SplineOrder, int); /** Set the input image. This must be set by the user. */ - virtual void SetInputImage(const TImageType * inputData); + void SetInputImage(const TImageType * inputData) ITK_OVERRIDE; /** Update coefficients filter. Coefficient filter are computed over the buffered region of the input image. */ @@ -136,9 +136,9 @@ public: protected: BSplineInterpolateImageFunction(); - virtual ~BSplineInterpolateImageFunction() {} + ~BSplineInterpolateImageFunction() ITK_OVERRIDE {} void operator =(const Self&); //purposely not implemented - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; // These are needed by the smoothing spline routine. std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients diff --git a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx index 3aa1274b92146a8e32be8170d5c2114d1a162796..e76b860955d28fc6cfc02ce1d0bee0770cb80408 100644 --- a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx +++ b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx @@ -15,9 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplineInterpolateImageFunction_txx -#define __otbBSplineInterpolateImageFunction_txx -#include "itkBSplineInterpolateImageFunction.h" +#ifndef otbBSplineInterpolateImageFunction_txx +#define otbBSplineInterpolateImageFunction_txx +#include "otbBSplineInterpolateImageFunction.h" #include "itkImageLinearIteratorWithIndex.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionIterator.h" @@ -95,7 +95,7 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType> } else { - m_Coefficients = NULL; + m_Coefficients = ITK_NULLPTR; } } diff --git a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h index cc803f7f99c676876321038a51b56aa255efcedb..f62a3f5a1d527662fe4e2af0aa744bb1abc3791d 100644 --- a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericInterpolateImageFunction_h -#define __otbGenericInterpolateImageFunction_h +#ifndef otbGenericInterpolateImageFunction_h +#define otbGenericInterpolateImageFunction_h #include "itkInterpolateImageFunction.h" #include "itkConstNeighborhoodIterator.h" @@ -83,7 +83,7 @@ public: * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ - virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const; + OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const ITK_OVERRIDE; /** Set/Get the window radius*/ virtual void SetRadius(unsigned int rad); @@ -112,12 +112,12 @@ public: protected: GenericInterpolateImageFunction(); - virtual ~GenericInterpolateImageFunction(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~GenericInterpolateImageFunction() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Call the superclass implementation and set the TablesHaveBeenGenerated * flag to false */ - virtual void Modified(void) const; + void Modified(void) const ITK_OVERRIDE; /** Delete tables.*/ virtual void ResetOffsetTable(); diff --git a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.txx b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.txx index 2fc1e462c999faee4fbb1f68dddb4c0cc1cf00a1..8ad04c8440664730af29010b25007768a9d6254b 100644 --- a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.txx +++ b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericInterpolateImageFunction_txx -#define __otbGenericInterpolateImageFunction_txx +#ifndef otbGenericInterpolateImageFunction_txx +#define otbGenericInterpolateImageFunction_txx #include "otbGenericInterpolateImageFunction.h" #include "vnl/vnl_math.h" @@ -30,8 +30,8 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo { m_WindowSize = 1; this->SetRadius(1); - m_OffsetTable = NULL; - m_WeightOffsetTable = NULL; + m_OffsetTable = ITK_NULLPTR; + m_WeightOffsetTable = ITK_NULLPTR; m_TablesHaveBeenGenerated = false; m_NormalizeWeight = false; } @@ -51,21 +51,21 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo ::ResetOffsetTable() { // Clear the offset table - if (m_OffsetTable != NULL) + if (m_OffsetTable != ITK_NULLPTR) { delete[] m_OffsetTable; - m_OffsetTable = NULL; + m_OffsetTable = ITK_NULLPTR; } // Clear the weights tales - if (m_WeightOffsetTable != NULL) + if (m_WeightOffsetTable != ITK_NULLPTR) { for (unsigned int i = 0; i < m_OffsetTableSize; ++i) { delete[] m_WeightOffsetTable[i]; } delete[] m_WeightOffsetTable; - m_WeightOffsetTable = NULL; + m_WeightOffsetTable = ITK_NULLPTR; } } @@ -123,7 +123,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo // Initialize the neighborhood SizeType radius; radius.Fill(this->GetRadius()); - if (this->GetInputImage() != NULL) + if (this->GetInputImage() != ITK_NULLPTR) { IteratorType it = IteratorType(radius, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); // Compute the offset tables (we ignore all the zero indices diff --git a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h index 705e93d5f4746df6ecf32abc8fb7d5bdcf3f6986..c2a3dbd1aff27140f5d00d6b6facbfa7842966e3 100644 --- a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProlateInterpolateImageFunction_h -#define __otbProlateInterpolateImageFunction_h +#ifndef otbProlateInterpolateImageFunction_h +#define otbProlateInterpolateImageFunction_h #include "otbGenericInterpolateImageFunction.h" #include "itkSize.h" @@ -310,8 +310,8 @@ public: protected: ProlateInterpolateImageFunction(); - ~ProlateInterpolateImageFunction(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ProlateInterpolateImageFunction() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ProlateInterpolateImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.txx b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.txx index cb842d40d4a9e268d29294b3bd41cc87b8bd2d43..1f4bfb7ed448b099a4272d0469b42eb5170fc72f 100644 --- a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.txx +++ b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProlateInterpolateImageFunction_txx -#define __otbProlateInterpolateImageFunction_txx +#ifndef otbProlateInterpolateImageFunction_txx +#define otbProlateInterpolateImageFunction_txx #include "otbProlateInterpolateImageFunction.h" diff --git a/Modules/Core/Interpolation/include/otbStreamingTraits.h b/Modules/Core/Interpolation/include/otbStreamingTraits.h index 0318e1f575f93994e5392d7146fd793d3d1a9bba..829e753f790f505d86913e477df29d7a71a54579 100644 --- a/Modules/Core/Interpolation/include/otbStreamingTraits.h +++ b/Modules/Core/Interpolation/include/otbStreamingTraits.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingTraits_h -#define __otbStreamingTraits_h +#ifndef otbStreamingTraits_h +#define otbStreamingTraits_h #include "otbMacro.h" diff --git a/Modules/Core/Interpolation/include/otbStreamingTraits.txx b/Modules/Core/Interpolation/include/otbStreamingTraits.txx index 3654c47c69ed722e81f7112ec7778628eca7fd40..62ff2adaa1ca8061d7b07c1ab5acc21a15a68ea3 100644 --- a/Modules/Core/Interpolation/include/otbStreamingTraits.txx +++ b/Modules/Core/Interpolation/include/otbStreamingTraits.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingTraits_txx -#define __otbStreamingTraits_txx +#ifndef otbStreamingTraits_txx +#define otbStreamingTraits_txx #include "otbStreamingTraits.h" diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h index ddbe8e3b19d60f78b2c634aea4de2c64438bc071..f47676a261a626fb19d6e9e660c87109c86a9906 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageBlackmanFunction_h -#define __otbWindowedSincInterpolateImageBlackmanFunction_h +#ifndef otbWindowedSincInterpolateImageBlackmanFunction_h +#define otbWindowedSincInterpolateImageBlackmanFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -131,8 +131,8 @@ public: protected: WindowedSincInterpolateImageBlackmanFunction() {}; - ~WindowedSincInterpolateImageBlackmanFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageBlackmanFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h index a00ce82ee57a6568556f2936634e4f33e0361ff1..fbe960fbc4064a3c3179c8947e9b99cf29e58f01 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageCosineFunction_h -#define __otbWindowedSincInterpolateImageCosineFunction_h +#ifndef otbWindowedSincInterpolateImageCosineFunction_h +#define otbWindowedSincInterpolateImageCosineFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -124,8 +124,8 @@ public: protected: WindowedSincInterpolateImageCosineFunction() {}; - ~WindowedSincInterpolateImageCosineFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageCosineFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h index 5eb242b636821f41f584cc50abada294f41d3a9d..852566f39a37528579919c256984737ab799c378 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageFunctionBase_h -#define __otbWindowedSincInterpolateImageFunctionBase_h +#ifndef otbWindowedSincInterpolateImageFunctionBase_h +#define otbWindowedSincInterpolateImageFunctionBase_h #include "otbGenericInterpolateImageFunction.h" #include "itkSize.h" @@ -176,8 +176,8 @@ public: protected: WindowedSincInterpolateImageFunctionBase(); - virtual ~WindowedSincInterpolateImageFunctionBase(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~WindowedSincInterpolateImageFunctionBase() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: WindowedSincInterpolateImageFunctionBase(const Self &); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.txx b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.txx index 2a2b35b11ca09cc1fc6a72084f391ca665fa038c..e0b88818d849fbd4d7b63d59b351aa43208dc6b3 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.txx +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageFunctionBase_txx -#define __otbWindowedSincInterpolateImageFunctionBase_txx +#ifndef otbWindowedSincInterpolateImageFunctionBase_txx +#define otbWindowedSincInterpolateImageFunctionBase_txx #include "otbWindowedSincInterpolateImageFunctionBase.h" diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h index 23026061152df1b40186343e5af07a7d6752e7cf..eabcaa326f6178ee7f6ebe3c4fa4fc20758022a4 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageGaussianFunction_h -#define __otbWindowedSincInterpolateImageGaussianFunction_h +#ifndef otbWindowedSincInterpolateImageGaussianFunction_h +#define otbWindowedSincInterpolateImageGaussianFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -124,8 +124,8 @@ public: protected: WindowedSincInterpolateImageGaussianFunction() {}; - ~WindowedSincInterpolateImageGaussianFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageGaussianFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h index 2da34dd799fa0e22b40137464cf6a190f5767231..b7d10e1a954e40126beef8856c790e4b593d4471 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageHammingFunction_h -#define __otbWindowedSincInterpolateImageHammingFunction_h +#ifndef otbWindowedSincInterpolateImageHammingFunction_h +#define otbWindowedSincInterpolateImageHammingFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -125,8 +125,8 @@ public: protected: WindowedSincInterpolateImageHammingFunction() {}; - ~WindowedSincInterpolateImageHammingFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageHammingFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h index 85e157536e2e263a80a4cc904f54f3cb78704bc2..eafa59a11f10fd566153276751198fef24e58ee6 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageLanczosFunction_h -#define __otbWindowedSincInterpolateImageLanczosFunction_h +#ifndef otbWindowedSincInterpolateImageLanczosFunction_h +#define otbWindowedSincInterpolateImageLanczosFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -135,8 +135,8 @@ public: protected: WindowedSincInterpolateImageLanczosFunction() {}; - ~WindowedSincInterpolateImageLanczosFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageLanczosFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h index 20f0fc6072490755a6d4996db778454595c4481a..19e3df3355ec95b37da1b4d080f5d2c0b90b7d40 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWindowedSincInterpolateImageWelchFunction_h -#define __otbWindowedSincInterpolateImageWelchFunction_h +#ifndef otbWindowedSincInterpolateImageWelchFunction_h +#define otbWindowedSincInterpolateImageWelchFunction_h #include "otbWindowedSincInterpolateImageFunctionBase.h" #include "vnl/vnl_math.h" @@ -124,8 +124,8 @@ public: protected: WindowedSincInterpolateImageWelchFunction() {}; - ~WindowedSincInterpolateImageWelchFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~WindowedSincInterpolateImageWelchFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h index abebf17ed63c362543f8450146f1b541e0525296..c3fbefea68e72347cc707345986682be3a4bbc1a 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAttributesMapLabelObject_h -#define __otbAttributesMapLabelObject_h +#ifndef otbAttributesMapLabelObject_h +#define otbAttributesMapLabelObject_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -274,7 +274,7 @@ public: // copy the data of the current type if possible const Self * src = dynamic_cast<const Self *>(lo); - if (src == NULL) + if (src == ITK_NULLPTR) { return; } @@ -303,10 +303,10 @@ protected: /** Constructor */ AttributesMapLabelObject() : m_Attributes(), m_Polygon(PolygonType::New()) {} /** Destructor */ - virtual ~AttributesMapLabelObject() {} + ~AttributesMapLabelObject() ITK_OVERRIDE {} /** The printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Attributes: " << std::endl; diff --git a/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h b/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h index de7b7c9a6dda2126678b6fa5740a2ffa7c2041e8..56888e933a813e8c7794f93ce4ee5926e194ad8b 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAttributesMapLabelObjectWithClassLabel_h -#define __otbAttributesMapLabelObjectWithClassLabel_h +#ifndef otbAttributesMapLabelObjectWithClassLabel_h +#define otbAttributesMapLabelObjectWithClassLabel_h #include "otbAttributesMapLabelObject.h" @@ -102,13 +102,13 @@ public: m_HasClassLabel = false; } - virtual void CopyAttributesFrom( const LabelObjectType * lo ) + void CopyAttributesFrom( const LabelObjectType * lo ) ITK_OVERRIDE { Superclass::CopyAttributesFrom( lo ); // copy the data of the current type if possible const Self * src = dynamic_cast<const Self *>( lo ); - if( src == NULL ) + if( src == ITK_NULLPTR ) { return; } @@ -122,10 +122,10 @@ protected: AttributesMapLabelObjectWithClassLabel() : m_ClassLabel(itk::NumericTraits<ClassLabelType>::Zero), m_HasClassLabel(false) {} /** Destructor */ - virtual ~AttributesMapLabelObjectWithClassLabel() {} + ~AttributesMapLabelObjectWithClassLabel() ITK_OVERRIDE {} /** The printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf( os, indent ); if(m_HasClassLabel) diff --git a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h index b804c3efc383f4ce557833a148ac3c7c8a68c5d0..9e9e0d5262d5dda0cf20905d49d6938dfbe01324 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAttributesMapOpeningLabelMapFilter_h -#define __otbAttributesMapOpeningLabelMapFilter_h +#ifndef otbAttributesMapOpeningLabelMapFilter_h +#define otbAttributesMapOpeningLabelMapFilter_h #include "otbAttributesMapLabelObject.h" #include "itkAttributeOpeningLabelMapFilter.h" @@ -68,16 +68,16 @@ public: AttributeAccessorType & GetAccessor(); - void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: /** Constructor */ AttributesMapOpeningLabelMapFilter(); /** Destructor */ - ~AttributesMapOpeningLabelMapFilter(); + ~AttributesMapOpeningLabelMapFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: @@ -94,4 +94,4 @@ private: #include "otbAttributesMapOpeningLabelMapFilter.txx" #endif -#endif // __otbAttributesMapOpeningLabelMapFilter_h +#endif // otbAttributesMapOpeningLabelMapFilter_h diff --git a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.txx index 05b94167687101f385d0102bf9c8230fd625abe7..7d96664293339e4a58e418a8f889228ca6f9c521 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbAttributesMapOpeningLabelMapFilter_txx -#define __otbAttributesMapOpeningLabelMapFilter_txx +#ifndef otbAttributesMapOpeningLabelMapFilter_txx +#define otbAttributesMapOpeningLabelMapFilter_txx #include "otbAttributesMapOpeningLabelMapFilter.h" diff --git a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h index 82e020c6e4cb94b0d6e4ca1e7bd75f83fb35b4a2..2f15a4095831530222d5057fec2cb302e64961a9 100644 --- a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBandsStatisticsAttributesLabelMapFilter_h -#define __otbBandsStatisticsAttributesLabelMapFilter_h +#ifndef otbBandsStatisticsAttributesLabelMapFilter_h +#define otbBandsStatisticsAttributesLabelMapFilter_h #include "otbStatisticsAttributesLabelMapFilter.h" #include "otbMultiToMonoChannelExtractROI.h" @@ -188,19 +188,19 @@ protected: /** Constructor */ BandsStatisticsAttributesLabelMapFilter(); /** Destructor */ - ~BandsStatisticsAttributesLabelMapFilter() {} + ~BandsStatisticsAttributesLabelMapFilter() ITK_OVERRIDE {} - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void EnlargeOutputRequestedRegion(itk::DataObject *){}; + void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE{}; /** Before threaded data generation */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BandsStatisticsAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.txx index 2ad41886e63cb6eb163b70aa01e70ecac4c55bc4..9af7b1729b9be5d6f9b390a676d1652cb8c655d5 100644 --- a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBandsStatisticsAttributesLabelMapFilter_txx -#define __otbBandsStatisticsAttributesLabelMapFilter_txx +#ifndef otbBandsStatisticsAttributesLabelMapFilter_txx +#define otbBandsStatisticsAttributesLabelMapFilter_txx #include "otbBandsStatisticsAttributesLabelMapFilter.h" #include "itkUnaryFunctorImageFilter.h" diff --git a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h index c16617bbc453a7992cba187ff5e3122c87edcdba..3e7118ce62705f72a700ca36e5ee5d3d9ae3ab49 100644 --- a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h +++ b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToLabelMapWithAttributesFilter_h -#define __otbImageToLabelMapWithAttributesFilter_h +#ifndef otbImageToLabelMapWithAttributesFilter_h +#define otbImageToLabelMapWithAttributesFilter_h #include "itkShapeLabelMapFilter.h" #include "otbAttributesMapLabelObjectWithClassLabel.h" @@ -72,21 +72,21 @@ public: typedef BandsStatisticsAttributesLabelMapFilter<LabelMapType, InputImageType> BandStatisticsLabelMapFilterType; using Superclass::SetInput; - virtual void SetInput( const InputImageType *image); + void SetInput( const InputImageType *image) ITK_OVERRIDE; virtual void SetLabeledImage( const LabeledImageType * image); const InputImageType * GetInput(void); const LabeledImageType * GetLabeledImage(); virtual LabelMapType* GetOutput(); - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: /** Constructor */ ImageToLabelMapWithAttributesFilter(); /** Destructor */ - virtual ~ImageToLabelMapWithAttributesFilter(){}; + ~ImageToLabelMapWithAttributesFilter() ITK_OVERRIDE{}; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; private: diff --git a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.txx b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.txx index 063998a3bdc68f40568bcde3bbb81fd4ba61888f..e93f51f1654a522130370aa540ccc3f88af7ee59 100644 --- a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.txx +++ b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToLabelMapWithAttributesFilter_txx -#define __otbImageToLabelMapWithAttributesFilter_txx +#ifndef otbImageToLabelMapWithAttributesFilter_txx +#define otbImageToLabelMapWithAttributesFilter_txx #include "otbImageToLabelMapWithAttributesFilter.h" #include "itkProcessObject.h" @@ -76,7 +76,7 @@ ImageToLabelMapWithAttributesFilter<TInputImage, TLabeledImage, TOutputLabel, TO { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType* > @@ -90,7 +90,7 @@ ImageToLabelMapWithAttributesFilter<TInputImage, TLabeledImage, TOutputLabel, TO { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const LabeledImageType* > diff --git a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h index a2c4a7e4b0bc6d2135a1acccdbf7ad7625bbd6ef..6da83c0eb96a2e15d58ea27e36e4b39ec02e3db4 100644 --- a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMeansAttributesLabelMapFilter_h -#define __otbKMeansAttributesLabelMapFilter_h +#ifndef otbKMeansAttributesLabelMapFilter_h +#define otbKMeansAttributesLabelMapFilter_h #include "itkLabelMapFilter.h" #include "otbLabelMapWithClassLabelToLabeledSampleListFilter.h" @@ -120,7 +120,7 @@ public: protected: KMeansAttributesLabelMapFilter(); - ~KMeansAttributesLabelMapFilter() {}; + ~KMeansAttributesLabelMapFilter() ITK_OVERRIDE {}; private: diff --git a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.txx index 965edc618c43931fc200ada24eb57c726e5816b7..cc093f06f8cf507db17d5a7e001cd9ef1277239a 100644 --- a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMeansAttributesLabelMapFilter_txx -#define __otbKMeansAttributesLabelMapFilter_txx +#ifndef otbKMeansAttributesLabelMapFilter_txx +#define otbKMeansAttributesLabelMapFilter_txx #include "otbKMeansAttributesLabelMapFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h index 3b597fe26e644d975fdda5b3870eda700fda2c25..27deeeaee290c7d4f5865fc249f08cb16677a0bc 100644 --- a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToLabelMapWithAdjacencyFilter_h -#define __otbLabelImageToLabelMapWithAdjacencyFilter_h +#ifndef otbLabelImageToLabelMapWithAdjacencyFilter_h +#define otbLabelImageToLabelMapWithAdjacencyFilter_h #include "itkImageToImageFilter.h" #include "otbLabelMapWithAdjacency.h" @@ -90,9 +90,9 @@ protected: /** Constructor */ LabelImageToLabelMapWithAdjacencyFilter(); /** Destructor */ - ~LabelImageToLabelMapWithAdjacencyFilter() {}; + ~LabelImageToLabelMapWithAdjacencyFilter() ITK_OVERRIDE {}; /** Printself */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; // class to store a RLE class RLE @@ -120,16 +120,16 @@ protected: /** LabelImageToLabelMapWithAdjacencyFilter needs the entire input be * available. Thus, it needs to provide an implementation of * GenerateInputRequestedRegion(). */ - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** LabelImageToLabelMapWithAdjacencyFilter will produce the entire output. */ - void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)); + void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** Add a new adjacency */ void AddAdjacency(LabelType label1, LabelType label2, itk::ThreadIdType threadId); diff --git a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.txx b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.txx index d8995d186ca835f470036856a8bc93dc7b6a1937..efca8c48f0d8c4499a1446017917d54124baa854 100644 --- a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToLabelMapWithAdjacencyFilter_txx -#define __otbLabelImageToLabelMapWithAdjacencyFilter_txx +#ifndef otbLabelImageToLabelMapWithAdjacencyFilter_txx +#define otbLabelImageToLabelMapWithAdjacencyFilter_txx #include "otbLabelImageToLabelMapWithAdjacencyFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h index a4e077f082a8e0f23e10b8cd060b09dd2bb2131a..6366e3f2fba7386d42d935a6c15c0b5629e13c66 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapFeaturesFunctorImageFilter_h -#define __otbLabelMapFeaturesFunctorImageFilter_h +#ifndef otbLabelMapFeaturesFunctorImageFilter_h +#define otbLabelMapFeaturesFunctorImageFilter_h #include "itkInPlaceLabelMapFilter.h" @@ -96,17 +96,17 @@ protected: LabelMapFeaturesFunctorImageFilter() : m_Functor() {} /** Destructor */ - ~LabelMapFeaturesFunctorImageFilter() {} + ~LabelMapFeaturesFunctorImageFilter() ITK_OVERRIDE {} /** Threaded generate data */ - virtual void ThreadedProcessLabelObject(LabelObjectType * labelObject) + void ThreadedProcessLabelObject(LabelObjectType * labelObject) ITK_OVERRIDE { // Call the functor m_Functor(labelObject); } /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { // Call superclass implementation Superclass::PrintSelf(os, indent); diff --git a/Modules/Core/LabelMap/include/otbLabelMapSource.h b/Modules/Core/LabelMap/include/otbLabelMapSource.h index 3801e51ff1b2e960d8a2b0b7e310e1584a161cfd..1fc4ce631e0f8195c088d91207fbbc1666b6c772 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapSource.h +++ b/Modules/Core/LabelMap/include/otbLabelMapSource.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelMapSource_h -#define __otbLabelMapSource_h +#ifndef otbLabelMapSource_h +#define otbLabelMapSource_h #include "itkProcessObject.h" @@ -61,9 +61,9 @@ public: protected: LabelMapSource(); - ~LabelMapSource(); + ~LabelMapSource() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Ensure that the output vector data are cleared before processing */ virtual void AllocateOutputs(); @@ -80,4 +80,4 @@ private: #include "otbLabelMapSource.txx" #endif -#endif // __otbLabelMapSource_h +#endif // otbLabelMapSource_h diff --git a/Modules/Core/LabelMap/include/otbLabelMapSource.txx b/Modules/Core/LabelMap/include/otbLabelMapSource.txx index 5e9a4bf37084fe53156ac860d6a06227f98fe896..c3aaff869db73e2447bda4fdcc8b657e3f40f06c 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapSource.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapSource.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelMapSource_txx -#define __otbLabelMapSource_txx +#ifndef otbLabelMapSource_txx +#define otbLabelMapSource_txx #include "otbLabelMapSource.h" @@ -62,7 +62,7 @@ LabelMapSource<TOutputLabelMap> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputLabelMapType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h index ab9fb5c17496c81867b2e407c8e8fefa570a790a..910e37edd147ecd4b111b58b8f8b5bb262ef069e 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelMapToAttributeImageFilter_h -#define __otbLabelMapToAttributeImageFilter_h +#ifndef otbLabelMapToAttributeImageFilter_h +#define otbLabelMapToAttributeImageFilter_h #include "itkLabelMapFilter.h" #include "otbAttributesMapLabelObject.h" @@ -99,13 +99,13 @@ public: protected: LabelMapToAttributeImageFilter(); - ~LabelMapToAttributeImageFilter() {}; + ~LabelMapToAttributeImageFilter() ITK_OVERRIDE {}; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; private: /** Background pixel value */ diff --git a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.txx b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.txx index 88f606e143fc86bba2f770c834727c906670bcc4..7ed28cd3a40987aea3f1323cb2b086101827c049 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelMapToAttributeImageFilter_txx -#define __otbLabelMapToAttributeImageFilter_txx +#ifndef otbLabelMapToAttributeImageFilter_txx +#define otbLabelMapToAttributeImageFilter_txx #include "otbLabelMapToAttributeImageFilter.h" #include "otbMacro.h" diff --git a/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.h index 647e431cda3be641a841f7ca9636b52279814f05..3614df39205072056d32a8be3ac62ba69522b854 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToLabelImageFilter_h -#define __otbLabelMapToLabelImageFilter_h +#ifndef otbLabelMapToLabelImageFilter_h +#define otbLabelMapToLabelImageFilter_h #include "itkLabelMapToLabelImageFilter.h" diff --git a/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.txx b/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.txx index ffc0f7e7013f2e60d47d3dbed41a642309fb3be2..1d38900990aa88ebe1f06a14d66b7b86bf130c98 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapToLabelImageFilter.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToLabelImageFilter_txx -#define __otbLabelMapToLabelImageFilter_txx +#ifndef otbLabelMapToLabelImageFilter_txx +#define otbLabelMapToLabelImageFilter_txx #include "otbLabelMapToLabelImageFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h index 38c3c4eaf31888359f0ecc0c6a5074b158c2b0bd..74e29aa9391733a2b843d2a771bdc7233f2475c7 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToSampleListFilter_h -#define __otbLabelMapToSampleListFilter_h +#ifndef otbLabelMapToSampleListFilter_h +#define otbLabelMapToSampleListFilter_h #include <algorithm> @@ -93,15 +93,15 @@ public: protected: LabelMapToSampleListFilter(); - virtual ~LabelMapToSampleListFilter(); + ~LabelMapToSampleListFilter() ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Make Output */ - virtual DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LabelMapToSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.txx b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.txx index 6a627f96c02228e1015c8da86f710864785d638d..603cca39a65eae6977bf63c635e39cb36600fed3 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToSampleListFilter_txx -#define __otbLabelMapToSampleListFilter_txx +#ifndef otbLabelMapToSampleListFilter_txx +#define otbLabelMapToSampleListFilter_txx #include "otbLabelMapToSampleListFilter.h" @@ -70,7 +70,7 @@ LabelMapToSampleListFilter<TInputLabelMap,TOutputListSample,TMeasurementFunctor> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputLabelMapType* > diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h b/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h index 92a132d29ca43e1f91300aef2df2be5b258e6c24..f50f4bd98e6d6847aef68425053d0daff07103ec 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapWithAdjacency_h -#define __otbLabelMapWithAdjacency_h +#ifndef otbLabelMapWithAdjacency_h +#define otbLabelMapWithAdjacency_h #include "itkLabelMap.h" #include "otbMergeLabelObjectFunctor.h" @@ -215,16 +215,16 @@ protected: /** Constructor */ LabelMapWithAdjacency(){} /** Destructor */ - virtual ~LabelMapWithAdjacency(){} + ~LabelMapWithAdjacency() ITK_OVERRIDE{} /** Printself */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } /** Re-implement CopyInformation to pass the adjancency graph * through */ - virtual void CopyInformation(const itk::DataObject * data) + void CopyInformation(const itk::DataObject * data) ITK_OVERRIDE { // Call superclass implementation Superclass::CopyInformation(data); diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h index f86b3f7798ec579d1ca3fac3fa82c94c60071ccd..6de97a056fc50e526a5b5b303187aa788d1e2fe8 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapWithClassLabelToClassLabelImageFilter_h -#define __otbLabelMapWithClassLabelToClassLabelImageFilter_h +#ifndef otbLabelMapWithClassLabelToClassLabelImageFilter_h +#define otbLabelMapWithClassLabelToClassLabelImageFilter_h #include "itkLabelMapFilter.h" @@ -72,11 +72,11 @@ public: protected: LabelMapWithClassLabelToClassLabelImageFilter(); - ~LabelMapWithClassLabelToClassLabelImageFilter() {}; + ~LabelMapWithClassLabelToClassLabelImageFilter() ITK_OVERRIDE {}; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; private: LabelMapWithClassLabelToClassLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.txx b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.txx index 7588b0877ba253250955fc2ed1d6545216063b55..93c0528781256a073d50020464f1eb465a33cecc 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapWithClassLabelToClassLabelImageFilter_txx -#define __otbLabelMapWithClassLabelToClassLabelImageFilter_txx +#ifndef otbLabelMapWithClassLabelToClassLabelImageFilter_txx +#define otbLabelMapWithClassLabelToClassLabelImageFilter_txx #include "otbLabelMapWithClassLabelToClassLabelImageFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h index daa2f0c54ae2816cb7ccd719cf5f0f952c26d5b6..894b569cf59dcfb2450455e7df2e489d2658bbe6 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapWithClassLabelToLabeledSampleListFilter_h -#define __otbLabelMapWithClassLabelToLabeledSampleListFilter_h +#ifndef otbLabelMapWithClassLabelToLabeledSampleListFilter_h +#define otbLabelMapWithClassLabelToLabeledSampleListFilter_h #include "otbLabelMapToSampleListFilter.h" @@ -97,14 +97,14 @@ public: protected: LabelMapWithClassLabelToLabeledSampleListFilter(); - virtual ~LabelMapWithClassLabelToLabeledSampleListFilter(); + ~LabelMapWithClassLabelToLabeledSampleListFilter() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Make Output */ - DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; private: diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.txx b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.txx index e0fdad6eddf1227c6d96dd0a06510ee6ffaae6ce..66c7fb3e86b90b7a237d282f556b164217f236c9 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.txx +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapWithClassLabelToLabeledSampleListFilter_txx -#define __otbLabelMapWithClassLabelToLabeledSampleListFilter_txx +#ifndef otbLabelMapWithClassLabelToLabeledSampleListFilter_txx +#define otbLabelMapWithClassLabelToLabeledSampleListFilter_txx #include "otbLabelMapWithClassLabelToLabeledSampleListFilter.h" #include "itkDataObject.h" diff --git a/Modules/Core/LabelMap/include/otbLabelObjectFieldsFunctor.h b/Modules/Core/LabelMap/include/otbLabelObjectFieldsFunctor.h index 4875537cfbba52f6e7f34b0a0c032b7f0a5ba2a5..4140c94bc2b6825158c284d401d5cfff20cbd583 100644 --- a/Modules/Core/LabelMap/include/otbLabelObjectFieldsFunctor.h +++ b/Modules/Core/LabelMap/include/otbLabelObjectFieldsFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelObjectFieldsFunctor_h -#define __otbLabelObjectFieldsFunctor_h +#ifndef otbLabelObjectFieldsFunctor_h +#define otbLabelObjectFieldsFunctor_h #include "itkLabelObject.h" #include <map> diff --git a/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.h b/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.h index f050fe1d65814e42178ecf7859507b07773d65b4..1a48b06d234982b31c2643b80ddf9b5fcad916da 100644 --- a/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.h +++ b/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelObjectToPolygonFunctor_h -#define __otbLabelObjectToPolygonFunctor_h +#ifndef otbLabelObjectToPolygonFunctor_h +#define otbLabelObjectToPolygonFunctor_h #include <vector> @@ -117,7 +117,7 @@ public: } /** Constructor */ - LabelObjectToPolygonFunctor() : m_Polygon(NULL), + LabelObjectToPolygonFunctor() : m_Polygon(ITK_NULLPTR), m_CurrentState(UP_LEFT), m_PositionFlag(LEFT_END), m_StartingPoint(), diff --git a/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.txx b/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.txx index cce9ffe6752ed5357611e67a10f5b51713d29d82..bab301c62dfa1e48ec36a22ba48db3662d8b6f49 100644 --- a/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.txx +++ b/Modules/Core/LabelMap/include/otbLabelObjectToPolygonFunctor.txx @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelObjectToPolygonFunctor_txx -#define __otbLabelObjectToPolygonFunctor_txx +#ifndef otbLabelObjectToPolygonFunctor_txx +#define otbLabelObjectToPolygonFunctor_txx #include "otbLabelObjectToPolygonFunctor.h" diff --git a/Modules/Core/LabelMap/include/otbLabelObjectWithClassLabelFieldsFunctor.h b/Modules/Core/LabelMap/include/otbLabelObjectWithClassLabelFieldsFunctor.h index 0317b60c012877d74ed8cd3d4c6a1c54ff036177..1c89d8f3d96a4874761dbe64bf2eccce0dc01bbc 100644 --- a/Modules/Core/LabelMap/include/otbLabelObjectWithClassLabelFieldsFunctor.h +++ b/Modules/Core/LabelMap/include/otbLabelObjectWithClassLabelFieldsFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelObjectWithClassLabelFieldsFunctor_h -#define __otbLabelObjectWithClassLabelFieldsFunctor_h +#ifndef otbLabelObjectWithClassLabelFieldsFunctor_h +#define otbLabelObjectWithClassLabelFieldsFunctor_h #include "itkLabelObject.h" #include <map> diff --git a/Modules/Core/LabelMap/include/otbMergeLabelObjectFunctor.h b/Modules/Core/LabelMap/include/otbMergeLabelObjectFunctor.h index 5c279fdca7971792f6bc8a54da5bcf8a959207e9..d7f140bd5478390adb0911746b40af5bf0af5fbc 100644 --- a/Modules/Core/LabelMap/include/otbMergeLabelObjectFunctor.h +++ b/Modules/Core/LabelMap/include/otbMergeLabelObjectFunctor.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMergeLabelObjectFunctor_h -#define __otbMergeLabelObjectFunctor_h +#ifndef otbMergeLabelObjectFunctor_h +#define otbMergeLabelObjectFunctor_h #include <algorithm> diff --git a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h index 4f7ca0333c8bcc8b016531f9810541add57acc14..53943dd2b3e7aca93d9ddf6a2ae72816ecd6a308 100644 --- a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMinMaxAttributesLabelMapFilter_h -#define __otbMinMaxAttributesLabelMapFilter_h +#ifndef otbMinMaxAttributesLabelMapFilter_h +#define otbMinMaxAttributesLabelMapFilter_h #include "itkLabelMapFilter.h" #include "itkSimpleDataObjectDecorator.h" @@ -86,14 +86,14 @@ public: AttributesMapObjectType* GetMaximumOutput(); const AttributesMapObjectType* GetMaximumOutput() const; - virtual DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; protected: MinMaxAttributesLabelMapFilter(); - ~MinMaxAttributesLabelMapFilter() {}; + ~MinMaxAttributesLabelMapFilter() ITK_OVERRIDE {}; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: MinMaxAttributesLabelMapFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.txx index 5285e63d8b6879662d1df366cc2a6f08db88266f..4f28217deec986a04331a6890102f4405eefb1ba 100644 --- a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMinMaxAttributesLabelMapFilter_txx -#define __otbMinMaxAttributesLabelMapFilter_txx +#ifndef otbMinMaxAttributesLabelMapFilter_txx +#define otbMinMaxAttributesLabelMapFilter_txx #include "otbMinMaxAttributesLabelMapFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h index 4e61817e7010642e266710291f55322c3024b1b6..ac8289eb64780be270963d768eebae233bd7f62a 100644 --- a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeAttributesLabelMapFilter_h -#define __otbNormalizeAttributesLabelMapFilter_h +#ifndef otbNormalizeAttributesLabelMapFilter_h +#define otbNormalizeAttributesLabelMapFilter_h #include "otbLabelMapFeaturesFunctorImageFilter.h" #include <vector> @@ -142,10 +142,10 @@ protected: NormalizeAttributesLabelMapFilter(){} /** Destructor */ - virtual ~NormalizeAttributesLabelMapFilter(){} + ~NormalizeAttributesLabelMapFilter() ITK_OVERRIDE{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: NormalizeAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.txx index 4b3b86c2646419a867ceee05ee2143eb410e9730..d82e98355bc2cbafa850b4410d48671c87b74b12 100644 --- a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeAttributesLabelMapFilter_txx -#define __otbNormalizeAttributesLabelMapFilter_txx +#ifndef otbNormalizeAttributesLabelMapFilter_txx +#define otbNormalizeAttributesLabelMapFilter_txx #include "otbNormalizeAttributesLabelMapFilter.h" diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h index 67465b98205a2fad661b589eab03412358ed0a7c..7aa2b3bf1bf01727a2a3f435e8befc29f5634837 100644 --- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShapeAttributesLabelMapFilter_h -#define __otbShapeAttributesLabelMapFilter_h +#ifndef otbShapeAttributesLabelMapFilter_h +#define otbShapeAttributesLabelMapFilter_h #include "otbLabelMapFeaturesFunctorImageFilter.h" #include "otbImage.h" @@ -287,19 +287,19 @@ protected: ShapeAttributesLabelMapFilter(){} /** Destructor */ - virtual ~ShapeAttributesLabelMapFilter(){} + ~ShapeAttributesLabelMapFilter() ITK_OVERRIDE{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; /** Things to to before threaded data generation */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void EnlargeOutputRequestedRegion(itk::DataObject *){}; + void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE{}; private: ShapeAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx index ea28e703c6b7e7616d3e0d904095da6ce7958b1e..4b5083061f46090bc58ce093fca3d10689ea5964 100644 --- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShapeAttributesLabelMapFilter_txx -#define __otbShapeAttributesLabelMapFilter_txx +#ifndef otbShapeAttributesLabelMapFilter_txx +#define otbShapeAttributesLabelMapFilter_txx #include "otbShapeAttributesLabelMapFilter.h" #include "itkProgressReporter.h" @@ -46,7 +46,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> m_ComputeFlusser(true), m_ComputePolygon(true), m_ReducedAttributeSet(true), - m_LabelImage(NULL) + m_LabelImage(ITK_NULLPTR) {} /** The comparator (!=) */ @@ -380,7 +380,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> // do this one here to avoid the double assigment in the following loop // when i == j centralMoments[i][i] += length * physicalPosition[i] * physicalPosition[i]; - // central moments are symetrics, so avoid to compute them 2 times + // central moments are symmetrics, so avoid to compute them 2 times for (DimensionType j = i + 1; j < LabelObjectType::ImageDimension; ++j) { // note that we won't use that code if the image dimension is less than 3 diff --git a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h index 37f3fbe7b4ec7f43ed3b78d949895cf424c2361a..06314975f568d658b88f3e2f4aa1a4a579a31c70 100644 --- a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsAttributesLabelMapFilter_h -#define __otbStatisticsAttributesLabelMapFilter_h +#ifndef otbStatisticsAttributesLabelMapFilter_h +#define otbStatisticsAttributesLabelMapFilter_h #include "otbLabelMapFeaturesFunctorImageFilter.h" #include "itkMatrix.h" @@ -194,13 +194,13 @@ protected: StatisticsAttributesLabelMapFilter(); /** Destructor */ - ~StatisticsAttributesLabelMapFilter(); + ~StatisticsAttributesLabelMapFilter() ITK_OVERRIDE; /** Before threaded data generation */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StatisticsAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.txx index bd77a6b5b8c1ca62c961de41f374276e3b0f61e5..0640feb2b0604ba44cf59822141453f977febe86 100644 --- a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsAttributesLabelMapFilter_txx -#define __otbStatisticsAttributesLabelMapFilter_txx +#ifndef otbStatisticsAttributesLabelMapFilter_txx +#define otbStatisticsAttributesLabelMapFilter_txx #include "otbStatisticsAttributesLabelMapFilter.h" diff --git a/Modules/Core/Metadata/include/otbBandName.h b/Modules/Core/Metadata/include/otbBandName.h index e00d69444ff0619b4d3bc234168290a9c02e7da0..040fea3299b34e99958c1aef0146dd65ad3dee58 100644 --- a/Modules/Core/Metadata/include/otbBandName.h +++ b/Modules/Core/Metadata/include/otbBandName.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBandName_h -#define __otbBandName_h +#ifndef otbBandName_h +#define otbBandName_h namespace otb { diff --git a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h index 775b42e909b28d1967f922f88ea60fdc0b47609f..b2fa1043359fddd0adc3c0e24d983a4c0424d974 100644 --- a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDefaultImageMetadataInterface_h -#define __otbDefaultImageMetadataInterface_h +#ifndef otbDefaultImageMetadataInterface_h +#define otbDefaultImageMetadataInterface_h #include <algorithm> @@ -72,49 +72,49 @@ public: } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const + int GetDay() const ITK_OVERRIDE { itkExceptionMacro("GetDay not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const + int GetMonth() const ITK_OVERRIDE { itkExceptionMacro("GetMonth not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const + int GetYear() const ITK_OVERRIDE { itkExceptionMacro("GetYear not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const + int GetHour() const ITK_OVERRIDE { itkExceptionMacro("GetHour not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const + int GetMinute() const ITK_OVERRIDE { itkExceptionMacro("GetMinute not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const + int GetProductionDay() const ITK_OVERRIDE { itkExceptionMacro("GetProductionDay not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const + int GetProductionMonth() const ITK_OVERRIDE { itkExceptionMacro("GetProductionMonth not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const + int GetProductionYear() const ITK_OVERRIDE { itkExceptionMacro("GetProductionYear not implemented in DefaultImageMetadataInterface, no captor type found"); } @@ -144,13 +144,13 @@ public: } /** Get the enhanced band names */ - std::vector<std::string> GetEnhancedBandNames() const + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE { itkExceptionMacro("GetEnhancedBandNames not implemented in DefaultImageMetadataInterface, no captor type found"); } - bool CanRead() const + bool CanRead() const ITK_OVERRIDE { // This clas is the default one, it has to be able to call every metadata return true; @@ -163,7 +163,7 @@ public: * When one spectral band is available : the only band is given to the R, G and B channel. * */ - std::vector<unsigned int> GetDefaultDisplay() const + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE { unsigned int i = 0; std::vector<unsigned int> rgb(3); @@ -190,7 +190,7 @@ public: protected: DefaultImageMetadataInterface(){}; - virtual ~DefaultImageMetadataInterface() {} + ~DefaultImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h index f5fca02115c0008e3961f8f5457c4a5fa41dbd1c..7515336fcff4674d18d4e7fcfcd17cd25b09b17e 100644 --- a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDefaultImageMetadataInterfaceFactory_h -#define __otbDefaultImageMetadataInterfaceFactory_h +#ifndef otbDefaultImageMetadataInterfaceFactory_h +#define otbDefaultImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -39,8 +39,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: DefaultImageMetadataInterfaceFactory(); - virtual ~DefaultImageMetadataInterfaceFactory(); + ~DefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; private: DefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h index e7860a1d788274fbcdf5f46ff8d897e439c0c5d1..d2a005f13ed29fe5c678c5db4f778bc97fa12b84 100644 --- a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFormosatImageMetadataInterface_h -#define __otbFormosatImageMetadataInterface_h +#ifndef otbFormosatImageMetadataInterface_h +#define otbFormosatImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,55 +51,55 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; /** Get Instrument */ std::string GetInstrument() const; /** Get the enhanced band names (here nothing because the metadata did not provide band names) */ - std::vector<std::string> GetEnhancedBandNames() const + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE { return this->Superclass::GetBandName(); } @@ -111,21 +111,21 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - virtual unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - virtual std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: FormosatImageMetadataInterface(); - virtual ~FormosatImageMetadataInterface() {} + ~FormosatImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h index b2dc609d07ff72622f0fcc540e23b3b6d6187f1c..91a62c2ba155de75cefebf7710276ee4b177255f 100644 --- a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFormosatImageMetadataInterfaceFactory_h -#define __otbFormosatImageMetadataInterfaceFactory_h +#ifndef otbFormosatImageMetadataInterfaceFactory_h +#define otbFormosatImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: FormosatImageMetadataInterfaceFactory(); - virtual ~FormosatImageMetadataInterfaceFactory(); + ~FormosatImageMetadataInterfaceFactory() ITK_OVERRIDE; private: FormosatImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h index ec961bfa6155f3a0a9fe059f22ab2ec8711b24fe..358161f66e6466c741a9630e8c73e9ee65970e23 100644 --- a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbIkonosImageMetadataInterface_h -#define __otbIkonosImageMetadataInterface_h +#ifndef otbIkonosImageMetadataInterface_h +#define otbIkonosImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,66 +51,66 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the enhanced band names of Ikonos data*/ - std::vector<std::string> GetEnhancedBandNames() const; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: IkonosImageMetadataInterface(); - virtual ~IkonosImageMetadataInterface() {} + ~IkonosImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h index 9bec791d4dcd03d05868256ef76bcf6e51d163d7..24c9212c18ef52c5e8ffb15ed6e36ef4016ae759 100644 --- a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbIkonosImageMetadataInterfaceFactory_h -#define __otbIkonosImageMetadataInterfaceFactory_h +#ifndef otbIkonosImageMetadataInterfaceFactory_h +#define otbIkonosImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: IkonosImageMetadataInterfaceFactory(); - virtual ~IkonosImageMetadataInterfaceFactory(); + ~IkonosImageMetadataInterfaceFactory() ITK_OVERRIDE; private: IkonosImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h index 2a685790333b2959489715b8cf4450ceee3ba58c..f607d16666c13fde7601f04755420c79a60a708b 100644 --- a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h +++ b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageMetadataInterfaceBase_h -#define __otbImageMetadataInterfaceBase_h +#ifndef otbImageMetadataInterfaceBase_h +#define otbImageMetadataInterfaceBase_h #include <string> @@ -203,9 +203,9 @@ public: protected: ImageMetadataInterfaceBase(); - virtual ~ImageMetadataInterfaceBase() {} + ~ImageMetadataInterfaceBase() ITK_OVERRIDE {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; MetaDataDictionaryType m_MetaDataDictionary; diff --git a/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h index 9f10f645f890328fe4fc98db8c6d5006c65e29f5..11bea1aba68a03e49bef6a6b8df03d85d8b5be05 100644 --- a/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageMetadataInterfaceFactory_h -#define __otbImageMetadataInterfaceFactory_h +#ifndef otbImageMetadataInterfaceFactory_h +#define otbImageMetadataInterfaceFactory_h #include "itkObject.h" #include "otbImageMetadataInterfaceBase.h" @@ -58,7 +58,7 @@ public: protected: ImageMetadataInterfaceFactory(); - ~ImageMetadataInterfaceFactory(); + ~ImageMetadataInterfaceFactory() ITK_OVERRIDE; private: ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbNoDataHelper.h b/Modules/Core/Metadata/include/otbNoDataHelper.h index 57d927c78fb7bf737e11e3d6663b3f60cd52d828..4ab2546bb990d8c235bf8827d8d471c26c94d149 100644 --- a/Modules/Core/Metadata/include/otbNoDataHelper.h +++ b/Modules/Core/Metadata/include/otbNoDataHelper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNoDataHelper_h -#define __otbNoDataHelper_h +#ifndef otbNoDataHelper_h +#define otbNoDataHelper_h #include <vector> #include <cassert> #include "vnl/vnl_math.h" diff --git a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h index 515d32b466af5d4d1011b99a556071d1dedb8a94..d25d96fbf1ac5464e8341cb7a683f4779a3a8d12 100644 --- a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpticalDefaultImageMetadataInterface_h -#define __otbOpticalDefaultImageMetadataInterface_h +#ifndef otbOpticalDefaultImageMetadataInterface_h +#define otbOpticalDefaultImageMetadataInterface_h #include "otbMacro.h" @@ -54,103 +54,103 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE { itkExceptionMacro("GetPhysicalBias not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE { itkExceptionMacro("GetPhysicalGain not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE { itkExceptionMacro("GetSolarIrradiance not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const + int GetDay() const ITK_OVERRIDE { itkExceptionMacro("GetDay not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const + int GetMonth() const ITK_OVERRIDE { itkExceptionMacro("GetMonth not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const + int GetYear() const ITK_OVERRIDE { itkExceptionMacro("GetYear not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const + int GetHour() const ITK_OVERRIDE { itkExceptionMacro("GetHour not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const + int GetMinute() const ITK_OVERRIDE { itkExceptionMacro("GetMinute not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const + int GetProductionDay() const ITK_OVERRIDE { itkExceptionMacro("GetProductionDay not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const + int GetProductionMonth() const ITK_OVERRIDE { itkExceptionMacro("GetProductionMonth not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const + int GetProductionYear() const ITK_OVERRIDE { itkExceptionMacro("GetProductionYear not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const + double GetSatElevation() const ITK_OVERRIDE { itkExceptionMacro("GetSatElevation not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const + double GetSatAzimuth() const ITK_OVERRIDE { itkExceptionMacro("GetSatElevation not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE { itkExceptionMacro("GetFirstWavelengths not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE { itkExceptionMacro("GetLastWavelengths not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the enhanced band names (here nothing because the sensor is not identify) */ - std::vector<std::string> GetEnhancedBandNames() const + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE { std::vector<std::string> nothing; return nothing; } - bool CanRead() const + bool CanRead() const ITK_OVERRIDE { // This clas is the default one, it has to be able to call every metadata return false; @@ -158,7 +158,7 @@ public: /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - virtual std::vector<unsigned int> GetDefaultDisplay() const + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE { std::vector<unsigned int> rgb(3); rgb[0] = 0; @@ -169,14 +169,14 @@ public: /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE { itkExceptionMacro("GetSpectralSensitivity not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } protected: OpticalDefaultImageMetadataInterface(){}; - virtual ~OpticalDefaultImageMetadataInterface() {} + ~OpticalDefaultImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h index c379df4a199c6e6654f601a4b18dbad1dde1e8ac..af4d0f4f58bb7422f632a0cf72f24bfe3101fe51 100644 --- a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpticalDefaultImageMetadataInterfaceFactory_h -#define __otbOpticalDefaultImageMetadataInterfaceFactory_h +#ifndef otbOpticalDefaultImageMetadataInterfaceFactory_h +#define otbOpticalDefaultImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -39,8 +39,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: OpticalDefaultImageMetadataInterfaceFactory(); - virtual ~OpticalDefaultImageMetadataInterfaceFactory(); + ~OpticalDefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; private: OpticalDefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h index 39f2db591003f955b03685e2b5e0db0ce55bc75f..7c2ca8745ad5bf295dda431f558e5456bb2c74fc 100644 --- a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpticalImageMetadataInterface_h -#define __otbOpticalImageMetadataInterface_h +#ifndef otbOpticalImageMetadataInterface_h +#define otbOpticalImageMetadataInterface_h #include <string> @@ -83,7 +83,7 @@ public: virtual VariableLengthVectorType GetLastWavelengths() const = 0; /** Get the enhanced band names */ - std::vector<std::string> GetEnhancedBandNames() const = 0; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE = 0; /** This method is to handle the permutation of the spectral band by some image provider * in most cases, this method won't change the value, but for SPOT data, the bands are set up as @@ -96,9 +96,9 @@ public: virtual WavelengthSpectralBandVectorType GetSpectralSensitivity () const = 0; protected: OpticalImageMetadataInterface(); - virtual ~OpticalImageMetadataInterface() {} + ~OpticalImageMetadataInterface() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h index 135259d19a022f38bc968cadfb46fd5f046e8612..30310fac1cad2428551bb6dbb6ec1d5651e0b81a 100644 --- a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpticalImageMetadataInterfaceFactory_h -#define __otbOpticalImageMetadataInterfaceFactory_h +#ifndef otbOpticalImageMetadataInterfaceFactory_h +#define otbOpticalImageMetadataInterfaceFactory_h #include "itkObject.h" #include "otbOpticalImageMetadataInterface.h" @@ -58,7 +58,7 @@ public: protected: OpticalImageMetadataInterfaceFactory(); - ~OpticalImageMetadataInterfaceFactory(); + ~OpticalImageMetadataInterfaceFactory() ITK_OVERRIDE; private: OpticalImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h index ea7f49d2701850af1a460c96cbd1ac86352d412d..64d8bf2e6789c3563c695036fbc16f8f1f742582 100644 --- a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPleiadesImageMetadataInterface_h -#define __otbPleiadesImageMetadataInterface_h +#ifndef otbPleiadesImageMetadataInterface_h +#define otbPleiadesImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,49 +51,49 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; /** Get Instrument */ std::string GetInstrument() const; @@ -105,25 +105,25 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the enhanced band names of the Pleiades data */ - std::vector<std::string> GetEnhancedBandNames() const; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: PleiadesImageMetadataInterface(); - virtual ~PleiadesImageMetadataInterface() {} + ~PleiadesImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h index 13e293b50d69935ef5ab607097bc8fec8b568d1d..6b31c3b6bab8f5c23ed40a321dfe4dd272abc626 100644 --- a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPleiadesImageMetadataInterfaceFactory_h -#define __otbPleiadesImageMetadataInterfaceFactory_h +#ifndef otbPleiadesImageMetadataInterfaceFactory_h +#define otbPleiadesImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: PleiadesImageMetadataInterfaceFactory(); - virtual ~PleiadesImageMetadataInterfaceFactory(); + ~PleiadesImageMetadataInterfaceFactory() ITK_OVERRIDE; private: PleiadesImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h index 94d23133520a3eaca1d7c96132ed01d7e84ba0a1..81b79cd4cd93870eaa21ce07fa0e2dddabd5fd54 100644 --- a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQuickBirdImageMetadataInterface_h -#define __otbQuickBirdImageMetadataInterface_h +#ifndef otbQuickBirdImageMetadataInterface_h +#define otbQuickBirdImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,65 +51,65 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : TLCTime metadata value */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : TLCTime metadata value */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : TLCTime metadata value */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : generationTime metadata value */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : generationTime metadata value */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : generationTime metadata value */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; /** Get the enhanced band names of QuickBird data */ - std::vector<std::string> GetEnhancedBandNames() const; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: QuickBirdImageMetadataInterface(); - virtual ~QuickBirdImageMetadataInterface() {} + ~QuickBirdImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h index 070138b3699f75a97befe8354f7f6ba37d83d31d..426ff73bbd930881c822b853f84c6851fe322f43 100644 --- a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQuickBirdImageMetadataInterfaceFactory_h -#define __otbQuickBirdImageMetadataInterfaceFactory_h +#ifndef otbQuickBirdImageMetadataInterfaceFactory_h +#define otbQuickBirdImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: QuickBirdImageMetadataInterfaceFactory(); - virtual ~QuickBirdImageMetadataInterfaceFactory(); + ~QuickBirdImageMetadataInterfaceFactory() ITK_OVERRIDE; private: QuickBirdImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h index 46439ca65227e1671ad6cfb565d2a0c6786da27b..7e4e725865d585fcb512436b496e5027b332614f 100644 --- a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadarsat2ImageMetadataInterface_h -#define __otbRadarsat2ImageMetadataInterface_h +#ifndef otbRadarsat2ImageMetadataInterface_h +#define otbRadarsat2ImageMetadataInterface_h #include "otbSarImageMetadataInterface.h" @@ -55,40 +55,40 @@ public: /*ImageMetadataInterfaceBase pure virtuals */ /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** check sensor ID */ - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; - int GetDay() const; + int GetDay() const ITK_OVERRIDE; - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; - int GetYear() const; + int GetYear() const ITK_OVERRIDE; - int GetHour() const; + int GetHour() const ITK_OVERRIDE; - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; - UIntVectorType GetDefaultDisplay() const; + UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE; /*SarImageMetadataInterface pure virutals rituals */ - double GetPRF() const; + double GetPRF() const ITK_OVERRIDE; - double GetRSF() const; + double GetRSF() const ITK_OVERRIDE; - double GetRadarFrequency() const; + double GetRadarFrequency() const ITK_OVERRIDE; - double GetCenterIncidenceAngle() const; + double GetCenterIncidenceAngle() const ITK_OVERRIDE; /*get lookup data for calulating backscatter */ - void CreateCalibrationLookupData(const short type); + void CreateCalibrationLookupData(const short type) ITK_OVERRIDE; protected: @@ -96,7 +96,7 @@ protected: Radarsat2ImageMetadataInterface(); /* class desctructor */ - virtual ~Radarsat2ImageMetadataInterface() {} + ~Radarsat2ImageMetadataInterface() ITK_OVERRIDE {} private: Radarsat2ImageMetadataInterface(const Self &); //purposely not implemented @@ -144,7 +144,7 @@ public: } - virtual ~Radarsat2CalibrationLookupData() + ~Radarsat2CalibrationLookupData() ITK_OVERRIDE { } @@ -156,7 +156,7 @@ public: m_Gains = gains; } - double GetValue(const IndexValueType x, const IndexValueType itkNotUsed(y)) + double GetValue(const IndexValueType x, const IndexValueType itkNotUsed(y)) const ITK_OVERRIDE { double lutVal = 1.0; @@ -172,7 +172,7 @@ public: return lutVal; } - void PrintSelf(std::ostream & os, itk::Indent indent) const + void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE { os << indent << " offset:'" << m_Offset << "'" << std::endl; os << " referenceNoiseLevel.gain: " << std::endl; diff --git a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h index 2aeb8a8f583be04f5b8fcb0f022015daea6d283f..388452d3eee7c2e9be9e7776828dd561902d43fd 100644 --- a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadarsat2ImageMetadataInterfaceFactory_h -#define __otbRadarsat2ImageMetadataInterfaceFactory_h +#ifndef otbRadarsat2ImageMetadataInterfaceFactory_h +#define otbRadarsat2ImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -55,7 +55,7 @@ public: protected: Radarsat2ImageMetadataInterfaceFactory(); - virtual ~Radarsat2ImageMetadataInterfaceFactory(); + ~Radarsat2ImageMetadataInterfaceFactory() ITK_OVERRIDE; private: Radarsat2ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h index ef95f2b687f54ac5b3f4e9d9239d64a96a7c5fc6..7168ff19aee3a5fe65016019d44fb335a7fa91a9 100644 --- a/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h +++ b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h @@ -35,14 +35,13 @@ class ITK_EXPORT SarCalibrationLookupData : public itk::LightObject { SarCalibrationLookupData() :m_Type(0) { - } - virtual ~SarCalibrationLookupData() + ~SarCalibrationLookupData() ITK_OVERRIDE { } - virtual double GetValue(const IndexValueType itkNotUsed(x), const IndexValueType itkNotUsed(y)) + virtual double GetValue(const IndexValueType itkNotUsed(x), const IndexValueType itkNotUsed(y)) const { return 1.0; } @@ -54,7 +53,7 @@ class ITK_EXPORT SarCalibrationLookupData : public itk::LightObject { itkGetMacro(Type, short); - void PrintSelf(std::ostream & os, itk::Indent indent) const + void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE { os << indent << " lookup table type:'" << m_Type << "'" << std::endl; Superclass::PrintSelf(os, indent); diff --git a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h index dd6529ab2454abc3274b3e5d7645cec4b06d4106..b109f34d5f8e37fb28e14bc7a44e9a2f6d814a5e 100644 --- a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarDefaultImageMetadataInterface_h -#define __otbSarDefaultImageMetadataInterface_h +#ifndef otbSarDefaultImageMetadataInterface_h +#define otbSarDefaultImageMetadataInterface_h #include "otbMacro.h" @@ -58,134 +58,134 @@ public: typedef double RealType; typedef PointSetType::PointType PointType; - RealType GetRadiometricCalibrationScale() const + RealType GetRadiometricCalibrationScale() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationScale() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationAntennaPatternNewGain() const + PointSetPointer GetRadiometricCalibrationAntennaPatternNewGain() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternNewGain() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const + PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternOldGain() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationIncidenceAngle() const + PointSetPointer GetRadiometricCalibrationIncidenceAngle() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationIncidenceAngle() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationRangeSpreadLoss() const + PointSetPointer GetRadiometricCalibrationRangeSpreadLoss() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationRangeSpreadLoss() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationNoise() const + PointSetPointer GetRadiometricCalibrationNoise() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationNoise() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() const + IndexType GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() const + IndexType GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const + IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationIncidenceAnglePolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() const + IndexType GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationNoisePolynomialDegree() const + IndexType GetRadiometricCalibrationNoisePolynomialDegree() const ITK_OVERRIDE { itkExceptionMacro("GetRadiometricCalibrationNoisePolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const + int GetDay() const ITK_OVERRIDE { itkExceptionMacro("GetDay not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const + int GetMonth() const ITK_OVERRIDE { itkExceptionMacro("GetMonth not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const + int GetYear() const ITK_OVERRIDE { itkExceptionMacro("GetYear not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const + int GetHour() const ITK_OVERRIDE { itkExceptionMacro("GetHour not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const + int GetMinute() const ITK_OVERRIDE { itkExceptionMacro("GetMinute not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const + int GetProductionDay() const ITK_OVERRIDE { itkExceptionMacro("GetProductionDay not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const + int GetProductionMonth() const ITK_OVERRIDE { itkExceptionMacro("GetProductionMonth not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const + int GetProductionYear() const ITK_OVERRIDE { itkExceptionMacro("GetProductionYear not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the PRF */ - double GetPRF() const + double GetPRF() const ITK_OVERRIDE { itkExceptionMacro("GetPRF not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the RSF */ - double GetRSF() const + double GetRSF() const ITK_OVERRIDE { itkExceptionMacro("GetRSF not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the radar frequency */ - double GetRadarFrequency() const + double GetRadarFrequency() const ITK_OVERRIDE { itkExceptionMacro("GetRadarFrequency not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the center incidence angle */ - double GetCenterIncidenceAngle() const + double GetCenterIncidenceAngle() const ITK_OVERRIDE { itkExceptionMacro("GetCenterIncidenceAngle not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - bool CanRead() const + bool CanRead() const ITK_OVERRIDE { // This clas is the default one, it has to be able to call every metadata return false; @@ -193,7 +193,7 @@ public: /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - UIntVectorType GetDefaultDisplay() const + UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE { UIntVectorType rgb(3); rgb[0] = 0; @@ -204,7 +204,7 @@ public: protected: SarDefaultImageMetadataInterface(){}; - virtual ~SarDefaultImageMetadataInterface() {} + ~SarDefaultImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h index 8eb0f384903cfc2578c2f5edb21e4775ad8956d8..71543d00ffd06c726ac8ce08fe2355a560253193 100644 --- a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarDefaultImageMetadataInterfaceFactory_h -#define __otbSarDefaultImageMetadataInterfaceFactory_h +#ifndef otbSarDefaultImageMetadataInterfaceFactory_h +#define otbSarDefaultImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -39,8 +39,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: SarDefaultImageMetadataInterfaceFactory(); - virtual ~SarDefaultImageMetadataInterfaceFactory(); + ~SarDefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; private: SarDefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h index 7ce844f4207ca378e11c7e8d49722bcd6e953bfd..1a9047b070ad8ce389a6bae293d28e384dd63d7b 100644 --- a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarImageMetadataInterface_h -#define __otbSarImageMetadataInterface_h +#ifndef otbSarImageMetadataInterface_h +#define otbSarImageMetadataInterface_h #include <string> #include <vector> @@ -100,7 +100,7 @@ public: virtual const std::string GetAcquisitionMode() const; /** Get the enhanced band names (No enhanced band name support for SAR) */ - StringVectorType GetEnhancedBandNames() const + StringVectorType GetEnhancedBandNames() const ITK_OVERRIDE { StringVectorType nothing; return nothing; @@ -108,12 +108,12 @@ public: protected: SarImageMetadataInterface(); - virtual ~SarImageMetadataInterface() {} + ~SarImageMetadataInterface() ITK_OVERRIDE {} PointSetPointer GetConstantValuePointSet(const RealType& value) const; IndexType GetConstantPolynomialDegree() const; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; LookupDataPointerType m_SarLut; diff --git a/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h index caa77c33d36969e81c48ebe1b72cffd267430142..b12c0b970d4cadfefca2fd8f07ee50df520a17d0 100644 --- a/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarImageMetadataInterfaceFactory_h -#define __otbSarImageMetadataInterfaceFactory_h +#ifndef otbSarImageMetadataInterfaceFactory_h +#define otbSarImageMetadataInterfaceFactory_h #include "itkObject.h" #include "otbSarImageMetadataInterface.h" @@ -58,7 +58,7 @@ public: protected: SarImageMetadataInterfaceFactory(); - ~SarImageMetadataInterfaceFactory(); + ~SarImageMetadataInterfaceFactory() ITK_OVERRIDE; private: SarImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h index c67ead32a4656b69c84f35dfabb0072dfd9d8e1a..d465989964bf5b680ac4bc3ac687f8b98eba1e6e 100644 --- a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSentinel1ImageMetadataInterface_h -#define __otbSentinel1ImageMetadataInterface_h +#ifndef otbSentinel1ImageMetadataInterface_h +#define otbSentinel1ImageMetadataInterface_h #include "otbSarImageMetadataInterface.h" @@ -56,40 +56,40 @@ public: typedef Superclass::LookupDataPointerType LookupDataPointerType; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** check sensor ID */ - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; - int GetDay() const; + int GetDay() const ITK_OVERRIDE; - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; - int GetYear() const; + int GetYear() const ITK_OVERRIDE; - int GetHour() const; + int GetHour() const ITK_OVERRIDE; - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; - UIntVectorType GetDefaultDisplay() const; + UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE; /*SarImageMetadataInterface pure virutals rituals */ - double GetPRF() const; + double GetPRF() const ITK_OVERRIDE; - double GetRSF() const; + double GetRSF() const ITK_OVERRIDE; - double GetRadarFrequency() const; + double GetRadarFrequency() const ITK_OVERRIDE; - double GetCenterIncidenceAngle() const; + double GetCenterIncidenceAngle() const ITK_OVERRIDE; /*get lookup data for calulating backscatter */ - void CreateCalibrationLookupData(const short type); + void CreateCalibrationLookupData(const short type) ITK_OVERRIDE; protected: @@ -97,7 +97,7 @@ protected: Sentinel1ImageMetadataInterface(); /* class dtor */ - virtual ~Sentinel1ImageMetadataInterface() {} + ~Sentinel1ImageMetadataInterface() ITK_OVERRIDE {} private: @@ -118,21 +118,21 @@ private: -struct Sentinel1CalibrationStruct { - +struct Sentinel1CalibrationStruct +{ public: double timeMJD; + double deltaMJD; // time difference to previous MJD in the list int line; std::vector<int> pixels; + std::vector<double> deltaPixels; std::vector<float> vect; }; class Sentinel1CalibrationLookupData : public SarCalibrationLookupData { - public: - /** Standard typedefs */ typedef Sentinel1CalibrationLookupData Self; typedef SarCalibrationLookupData Superclass; @@ -154,17 +154,15 @@ public: , count(0) , lineTimeInterval(0.) { - } - virtual ~Sentinel1CalibrationLookupData() + ~Sentinel1CalibrationLookupData() ITK_OVERRIDE { - } void InitParameters(short type, double ft, double lt, int lines, int c, - std::vector<Sentinel1CalibrationStruct> vlist) + std::vector<Sentinel1CalibrationStruct> const& vlist) { firstLineTime = ft; lastLineTime = lt; @@ -175,21 +173,23 @@ public: lineTimeInterval = (lt - ft) / ((lines - 1) * 1.0); } - virtual double GetValue(const IndexValueType x, const IndexValueType y) + double GetValue(const IndexValueType x, const IndexValueType y) const ITK_OVERRIDE { const int calVecIdx = GetVectorIndex(y); - const Sentinel1CalibrationStruct vec0 = calibrationVectorList[calVecIdx]; - const Sentinel1CalibrationStruct vec1 = calibrationVectorList[calVecIdx + 1]; + assert(calVecIdx>=0 && calVecIdx < count-1); + const Sentinel1CalibrationStruct & vec0 = calibrationVectorList[calVecIdx]; + const Sentinel1CalibrationStruct & vec1 = calibrationVectorList[calVecIdx + 1]; const double azTime = firstLineTime + y * lineTimeInterval; - const double muY = (azTime - vec0.timeMJD) /(vec1.timeMJD - vec0.timeMJD); + const double muY = (azTime - vec0.timeMJD) / vec1.deltaMJD; const int pixelIdx = GetPixelIndex(x, calibrationVectorList[calVecIdx]); - const double muX = (static_cast<float>(x) - static_cast<float>(vec0.pixels[pixelIdx])) / (static_cast<float>(vec0.pixels[pixelIdx + 1] - vec0.pixels[pixelIdx])); - const double lutVal = (1 - muY) * ((1 - muX) * vec0.vect[pixelIdx] + muX * vec0.vect[pixelIdx + 1]) + - muY * ((1 - muX) * vec1.vect[pixelIdx] + muX * vec1.vect[pixelIdx + 1]); + const double muX = (x - vec0.pixels[pixelIdx]) / vec0.deltaPixels[pixelIdx + 1]; + const double lutVal + = (1 - muY) * ((1 - muX) * vec0.vect[pixelIdx] + muX * vec0.vect[pixelIdx + 1]) + + muY * ((1 - muX) * vec1.vect[pixelIdx] + muX * vec1.vect[pixelIdx + 1]); return lutVal; } - int GetVectorIndex(int y) + int GetVectorIndex(int y) const { for (int i = 1; i < count; i++) { @@ -199,20 +199,13 @@ public: } } return -1; - } - int GetPixelIndex(int x, const Sentinel1CalibrationStruct& calVec) + int GetPixelIndex(int x, const Sentinel1CalibrationStruct& calVec) const { - const int size = calVec.pixels.size(); - for (int i = 0; i < size; i++) - { - if (x < calVec.pixels[i]) - { - return i - 1; - } - } - return size - 2; + const int size = calVec.pixels.size(); + std::vector<int>::const_iterator wh = std::upper_bound(calVec.pixels.begin(), calVec.pixels.end(), x); + return wh == calVec.pixels.end() ? size - 2 : std::distance(calVec.pixels.begin(),wh)-1; } private: @@ -227,7 +220,6 @@ private: int count; std::vector<Sentinel1CalibrationStruct> calibrationVectorList; double lineTimeInterval; - }; diff --git a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h index 76964bb4fc2beca05728862e17f16719e0087041..18e0fb0d41e4c99b63080cb5d81e8952809f3d7e 100644 --- a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSentinel1ImageMetadataInterfaceFactory_h -#define __otbSentinel1ImageMetadataInterfaceFactory_h +#ifndef otbSentinel1ImageMetadataInterfaceFactory_h +#define otbSentinel1ImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: Sentinel1ImageMetadataInterfaceFactory(); - virtual ~Sentinel1ImageMetadataInterfaceFactory(); + ~Sentinel1ImageMetadataInterfaceFactory() ITK_OVERRIDE; private: Sentinel1ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h index 269af29003625d526fa1e6b0bf9b2a1988b0ef37..d1d3483e6e2bed221e82b8e3b687d63c2a7ba497 100644 --- a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpot6ImageMetadataInterface_h -#define __otbSpot6ImageMetadataInterface_h +#ifndef otbSpot6ImageMetadataInterface_h +#define otbSpot6ImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,49 +51,49 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; /** Get Instrument */ std::string GetInstrument() const; @@ -105,25 +105,25 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the enhanced band names of the Spot6 data */ - std::vector<std::string> GetEnhancedBandNames() const; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: Spot6ImageMetadataInterface(); - virtual ~Spot6ImageMetadataInterface() {} + ~Spot6ImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h index 5534e97e2427206a1cb1b1c691e619c2bbd2092b..7958c3cd1a3201c3c32d0c1a430787ceb85b2325 100644 --- a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpot6ImageMetadataInterfaceFactory_h -#define __otbSpot6ImageMetadataInterfaceFactory_h +#ifndef otbSpot6ImageMetadataInterfaceFactory_h +#define otbSpot6ImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: Spot6ImageMetadataInterfaceFactory(); - virtual ~Spot6ImageMetadataInterfaceFactory(); + ~Spot6ImageMetadataInterfaceFactory() ITK_OVERRIDE; private: Spot6ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h index 4e6555cf0cb88b08250a4f2788ba347b5c772d22..5e802dc24a4afd49bc4b7ab2e1a0fda1c2a672fd 100644 --- a/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpotImageMetadataInterface_h -#define __otbSpotImageMetadataInterface_h +#ifndef otbSpotImageMetadataInterface_h +#define otbSpotImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,52 +51,52 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; /** Get the enhanced band names (here nothing because the metadata did not provide band names) */ - std::vector<std::string> GetEnhancedBandNames() const + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE { return this->Superclass::GetBandName(); } @@ -111,21 +111,21 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - virtual unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; protected: SpotImageMetadataInterface(); - virtual ~SpotImageMetadataInterface() {} + ~SpotImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h index 7413f1e8f048a3b4292b173cf8377e586024776a..8ea90bc6020bf1651d67577582ef6e0e909680f1 100644 --- a/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpotImageMetadataInterfaceFactory_h -#define __otbSpotImageMetadataInterfaceFactory_h +#ifndef otbSpotImageMetadataInterfaceFactory_h +#define otbSpotImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: SpotImageMetadataInterfaceFactory(); - virtual ~SpotImageMetadataInterfaceFactory(); + ~SpotImageMetadataInterfaceFactory() ITK_OVERRIDE; private: SpotImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h index 22687cfca53d83929230b9bd083975f9cdc2b3b3..6877a03962bbb20df9ce217b701b43e72d7c54cb 100644 --- a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbTerraSarImageMetadataInterface_h -#define __otbTerraSarImageMetadataInterface_h +#ifndef otbTerraSarImageMetadataInterface_h +#define otbTerraSarImageMetadataInterface_h #include <string> @@ -64,28 +64,28 @@ public: typedef double RealType; /** Get the imaging start acquisition day from the ossim metadata */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging start acquisition month from the ossim metadata */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging start acquisition year from the ossim metadata */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging start acquisition hour from the ossim metadata */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging start acquisition minute from the ossim metadata */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : generationTime variable */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : generationTime variable */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : generationTime variable */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the calibration.calFactor : generationTime variable */ double GetCalibrationFactor() const; @@ -112,13 +112,13 @@ public: DoubleVectorType GetNoiseReferencePointList() const; /** Get the radar frequency */ - double GetRadarFrequency() const; + double GetRadarFrequency() const ITK_OVERRIDE; /** Get the PRF */ - double GetPRF() const; + double GetPRF() const ITK_OVERRIDE; /** Get the RSF */ - double GetRSF() const; + double GetRSF() const ITK_OVERRIDE; /** Get the number of corner incidence angles */ unsigned int GetNumberOfCornerIncidenceAngles() const; @@ -127,7 +127,7 @@ public: double GetMeanIncidenceAngles() const; /** Get the center incidence angle */ - double GetCenterIncidenceAngle() const; + double GetCenterIncidenceAngle() const ITK_OVERRIDE; /** Get the center index */ IndexType GetCenterIncidenceAngleIndex() const; @@ -139,26 +139,26 @@ public: IndexVectorType GetCornersIncidenceAnglesIndex() const; /** Get the constant calibration factor */ - RealType GetRadiometricCalibrationScale() const; + RealType GetRadiometricCalibrationScale() const ITK_OVERRIDE; - PointSetPointer GetRadiometricCalibrationNoise() const; - IndexType GetRadiometricCalibrationNoisePolynomialDegree() const; + PointSetPointer GetRadiometricCalibrationNoise() const ITK_OVERRIDE; + IndexType GetRadiometricCalibrationNoisePolynomialDegree() const ITK_OVERRIDE; //PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const; - PointSetPointer GetRadiometricCalibrationIncidenceAngle() const; - IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const; + PointSetPointer GetRadiometricCalibrationIncidenceAngle() const ITK_OVERRIDE; + IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; protected: TerraSarImageMetadataInterface(); - virtual ~TerraSarImageMetadataInterface() {} + ~TerraSarImageMetadataInterface() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Evaluate polynom with Horner scheme*/ inline double Horner(std::vector<double>& coefficients, const double tauMinusTauRef) const; diff --git a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h index 9a92a0b8bbf1f72d0fe7334702723acd06793a48..4e33968586d35ae40f7ad6e974b6b2904e4bbed0 100644 --- a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTerraSarImageMetadataInterfaceFactory_h -#define __otbTerraSarImageMetadataInterfaceFactory_h +#ifndef otbTerraSarImageMetadataInterfaceFactory_h +#define otbTerraSarImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: TerraSarImageMetadataInterfaceFactory(); - virtual ~TerraSarImageMetadataInterfaceFactory(); + ~TerraSarImageMetadataInterfaceFactory() ITK_OVERRIDE; private: TerraSarImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h index 3fb4b79d65f1e989f228a0f24320a3ff7b171e0e..5383ae7612fa5b57bb8cf36820afd05df3dfd302 100644 --- a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWorldView2ImageMetadataInterface_h -#define __otbWorldView2ImageMetadataInterface_h +#ifndef otbWorldView2ImageMetadataInterface_h +#define otbWorldView2ImageMetadataInterface_h #include "otbOpticalImageMetadataInterface.h" @@ -51,66 +51,66 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const; + VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const; + VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const; + VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; /** Get the imaging acquisition day from the ossim metadata : TLCTime metadata value */ - int GetDay() const; + int GetDay() const ITK_OVERRIDE; /** Get the imaging acquisition month from the ossim metadata : TLCTime metadata value */ - int GetMonth() const; + int GetMonth() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetYear() const; + int GetYear() const ITK_OVERRIDE; /** Get the imaging acquisition hour from the ossim metadata : TLCTime metadata value */ - int GetHour() const; + int GetHour() const ITK_OVERRIDE; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetMinute() const; + int GetMinute() const ITK_OVERRIDE; /** Get the imaging production day from the ossim metadata : generationTime metadata value */ - int GetProductionDay() const; + int GetProductionDay() const ITK_OVERRIDE; /** Get the imaging production month from the ossim metadata : generationTime metadata value */ - int GetProductionMonth() const; + int GetProductionMonth() const ITK_OVERRIDE; /** Get the imaging production year from the ossim metadata : generationTime metadata value */ - int GetProductionYear() const; + int GetProductionYear() const ITK_OVERRIDE; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const; + double GetSatElevation() const ITK_OVERRIDE; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const; + double GetSatAzimuth() const ITK_OVERRIDE; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const; + VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const; + VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; - bool CanRead() const; + bool CanRead() const ITK_OVERRIDE; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const; + std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; /** Get the enhanced band names from band names collected by ossim */ - std::vector<std::string> GetEnhancedBandNames() const; + std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; protected: WorldView2ImageMetadataInterface(); - virtual ~WorldView2ImageMetadataInterface() {} + ~WorldView2ImageMetadataInterface() ITK_OVERRIDE {} private: diff --git a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h index 7434ed9856aa33a316908c1cd2b45cae2dd25d19..6d83e95ad70374182c123a7918a4f5bb5462477a 100644 --- a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWorldView2ImageMetadataInterfaceFactory_h -#define __otbWorldView2ImageMetadataInterfaceFactory_h +#ifndef otbWorldView2ImageMetadataInterfaceFactory_h +#define otbWorldView2ImageMetadataInterfaceFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: WorldView2ImageMetadataInterfaceFactory(); - virtual ~WorldView2ImageMetadataInterfaceFactory(); + ~WorldView2ImageMetadataInterfaceFactory() ITK_OVERRIDE; private: WorldView2ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx index 11fbe8b08f957f51b949170a9176312c357e0f7c..bda99a81f0825d24eaefcb9a55ecf008b41eea1a 100644 --- a/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx @@ -984,215 +984,215 @@ PleiadesImageMetadataInterface { const float pan[209] = { - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0004358, - 0.0008051, - 0.0030464, - 0.0060688, - 0.0130170, - 0.0240166, - 0.0421673, - 0.0718226, - 0.1151660, - 0.1738520, - 0.2442960, - 0.3204090, - 0.3940400, - 0.4552560, - 0.5015220, - 0.5324310, - 0.5537040, - 0.5683830, - 0.5824280, - 0.5967100, - 0.6107110, - 0.6232080, - 0.6335930, - 0.6421600, - 0.6501020, - 0.6570500, - 0.6640260, - 0.6707420, - 0.6765340, - 0.6808170, - 0.6829760, - 0.6834310, - 0.6831800, - 0.6831390, - 0.6846760, - 0.6892820, - 0.6964400, - 0.7073100, - 0.7193370, - 0.7323050, - 0.7449550, - 0.7554270, - 0.7638770, - 0.7715940, - 0.7776340, - 0.7826480, - 0.7871060, - 0.7913600, - 0.7949010, - 0.7974290, - 0.7996850, - 0.8007000, - 0.8003370, - 0.8002560, - 0.8000160, - 0.8012780, - 0.8035920, - 0.8077100, - 0.8136680, - 0.8209800, - 0.8302930, - 0.8390660, - 0.8482460, - 0.8564130, - 0.8634600, - 0.8689680, - 0.8738000, - 0.8767770, - 0.8799960, - 0.8825630, - 0.8849870, - 0.8894330, - 0.8939110, - 0.8994160, - 0.9056300, - 0.9123790, - 0.9188800, - 0.9244770, - 0.9289540, - 0.9338010, - 0.9374110, - 0.9414880, - 0.9449190, - 0.9480210, - 0.9509810, - 0.9532570, - 0.9560420, - 0.9581430, - 0.9600910, - 0.9609580, - 0.9631350, - 0.9649320, - 0.9674470, - 0.9728920, - 0.9774240, - 0.9827830, - 0.9874630, - 0.9926650, - 0.9966400, - 0.9993680, - 0.9999140, - 0.9942900, - 0.9882640, - 0.9810720, - 0.9751580, - 0.9699990, - 0.9659940, - 0.9632210, - 0.9624050, - 0.9621500, - 0.9633410, - 0.9654310, - 0.9671030, - 0.9672570, - 0.9677370, - 0.9653110, - 0.9633140, - 0.9579490, - 0.9533250, - 0.9486410, - 0.9423590, - 0.9358410, - 0.9299340, - 0.9243940, - 0.9190090, - 0.9141220, - 0.9087800, - 0.9039750, - 0.8980690, - 0.8927220, - 0.8870500, - 0.8828150, - 0.8771870, - 0.8734510, - 0.8694140, - 0.8664310, - 0.8660560, - 0.8588170, - 0.8477750, - 0.8331070, - 0.8135860, - 0.7865930, - 0.7489860, - 0.6981680, - 0.6306270, - 0.5506620, - 0.4616840, - 0.3695890, - 0.2823490, - 0.2074510, - 0.1465300, - 0.1010100, - 0.0686868, - 0.0471034, - 0.0324221, - 0.0246752, - 0.0174143, - 0.0126697, - 0.0116629, - 0.0086694, - 0.0081772, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000, - 0.0000000 + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0004358f, + 0.0008051f, + 0.0030464f, + 0.0060688f, + 0.0130170f, + 0.0240166f, + 0.0421673f, + 0.0718226f, + 0.1151660f, + 0.1738520f, + 0.2442960f, + 0.3204090f, + 0.3940400f, + 0.4552560f, + 0.5015220f, + 0.5324310f, + 0.5537040f, + 0.5683830f, + 0.5824280f, + 0.5967100f, + 0.6107110f, + 0.6232080f, + 0.6335930f, + 0.6421600f, + 0.6501020f, + 0.6570500f, + 0.6640260f, + 0.6707420f, + 0.6765340f, + 0.6808170f, + 0.6829760f, + 0.6834310f, + 0.6831800f, + 0.6831390f, + 0.6846760f, + 0.6892820f, + 0.6964400f, + 0.7073100f, + 0.7193370f, + 0.7323050f, + 0.7449550f, + 0.7554270f, + 0.7638770f, + 0.7715940f, + 0.7776340f, + 0.7826480f, + 0.7871060f, + 0.7913600f, + 0.7949010f, + 0.7974290f, + 0.7996850f, + 0.8007000f, + 0.8003370f, + 0.8002560f, + 0.8000160f, + 0.8012780f, + 0.8035920f, + 0.8077100f, + 0.8136680f, + 0.8209800f, + 0.8302930f, + 0.8390660f, + 0.8482460f, + 0.8564130f, + 0.8634600f, + 0.8689680f, + 0.8738000f, + 0.8767770f, + 0.8799960f, + 0.8825630f, + 0.8849870f, + 0.8894330f, + 0.8939110f, + 0.8994160f, + 0.9056300f, + 0.9123790f, + 0.9188800f, + 0.9244770f, + 0.9289540f, + 0.9338010f, + 0.9374110f, + 0.9414880f, + 0.9449190f, + 0.9480210f, + 0.9509810f, + 0.9532570f, + 0.9560420f, + 0.9581430f, + 0.9600910f, + 0.9609580f, + 0.9631350f, + 0.9649320f, + 0.9674470f, + 0.9728920f, + 0.9774240f, + 0.9827830f, + 0.9874630f, + 0.9926650f, + 0.9966400f, + 0.9993680f, + 0.9999140f, + 0.9942900f, + 0.9882640f, + 0.9810720f, + 0.9751580f, + 0.9699990f, + 0.9659940f, + 0.9632210f, + 0.9624050f, + 0.9621500f, + 0.9633410f, + 0.9654310f, + 0.9671030f, + 0.9672570f, + 0.9677370f, + 0.9653110f, + 0.9633140f, + 0.9579490f, + 0.9533250f, + 0.9486410f, + 0.9423590f, + 0.9358410f, + 0.9299340f, + 0.9243940f, + 0.9190090f, + 0.9141220f, + 0.9087800f, + 0.9039750f, + 0.8980690f, + 0.8927220f, + 0.8870500f, + 0.8828150f, + 0.8771870f, + 0.8734510f, + 0.8694140f, + 0.8664310f, + 0.8660560f, + 0.8588170f, + 0.8477750f, + 0.8331070f, + 0.8135860f, + 0.7865930f, + 0.7489860f, + 0.6981680f, + 0.6306270f, + 0.5506620f, + 0.4616840f, + 0.3695890f, + 0.2823490f, + 0.2074510f, + 0.1465300f, + 0.1010100f, + 0.0686868f, + 0.0471034f, + 0.0324221f, + 0.0246752f, + 0.0174143f, + 0.0126697f, + 0.0116629f, + 0.0086694f, + 0.0081772f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f, + 0.0000000f }; //add panchromatic band to the temporary list const std::vector<float> vpan (pan, pan + sizeof(pan) / sizeof(float) ); @@ -1202,41 +1202,41 @@ PleiadesImageMetadataInterface { const float pan[209] = { - 8.4949016432e-06,1.27423524648e-05,2.54847049296e-05,4.10586912755e-05,5.94643115024e-05,7.64541147888e-05, - 0.0001047705,0.0001628184,0.0004077553,0.0007560434,0.0027948226,0.0055783471, - 0.0119863062,0.022134882,0.0389179761,0.0664188043,0.1067016279,0.1614272001, - 0.2272018077,0.2986552571,0.367815083,0.4258041132,0.4697397445,0.4991660838, - 0.5193159905,0.5332504608,0.5467262065,0.5603038909,0.5736437182,0.5855337488, - 0.5956625032,0.6041036038,0.6120151889,0.618774299,0.625564557,0.6319045853, - 0.6377943837,0.6421862479,0.6443949223,0.6448819633,0.644884795,0.6451141573, - 0.6468357907,0.6513182672,0.6590911022,0.6691405708,0.6811806781,0.6937021631, - 0.7056091836,0.7157690859,0.7250568451,0.7323511339,0.7384193253,0.7438758838, - 0.7492531566,0.7536450207,0.7580793594,0.7610893862,0.7639125252,0.7652348982, - 0.766172169,0.7665969141,0.767494542,0.7687546191,0.7723026564,0.7771079391, - 0.7833828397,0.7917191699,0.8015449394,0.8109516272,0.8200326771,0.8290684208, - 0.8364646485,0.8426517685,0.8481876127,0.8519168746,0.8555045547,0.8583361886, - 0.8620173126,0.8666838452,0.8715797402,0.8780188757,0.8847071949,0.8913473763, - 0.898890849,0.9045824331,0.9105090428,0.9154615705,0.9207935371,0.9253156564, - 0.9289882855,0.9328931087,0.9369565033,0.9400797954,0.9441601799,0.9469295178, - 0.9503472999,0.9521085762,0.9542804394,0.9574405428,0.9607705442,0.9663148834, - 0.9720999114,0.9788278735,0.9845959117,0.991221935,0.9956874216,0.9990882139, - 1.0,0.9963273709,0.9914682871,0.9869688209,0.9817019819,0.9771458829, - 0.9745974125,0.9729012638,0.9739319785,0.9741924888,0.9768712145,0.9798246086, - 0.9827723395,0.9845732586,0.9850772894,0.9837266001,0.9825967782,0.9790232562, - 0.9745945808,0.9697411603,0.9648141174,0.9598389367,0.9533346736,0.9483566613, - 0.9445481137,0.93968903,0.9344561706,0.9297160154,0.9248342786,0.9183356789, - 0.9111942982,0.9061001889,0.9006181457,0.8953456434,0.8908093659,0.8894954878, - 0.8885412272,0.8809779331,0.8707840511,0.8566683562,0.8369346997,0.8102408871, - 0.7728519933,0.718954674,0.6528501811,0.5710810895,0.4795853355,0.3846491464, - 0.294773087,0.2166449103,0.1531319287,0.1057054591,0.0716799801,0.0491432892, - 0.0337757289,0.0256986066,0.0181762579,0.0131968863,0.0121562043,0.0090201414, - 0.0084156159,0.0042799863,0.0033130116,0.0026688064,0.0022115061,0.0018292327, - 0.0015290823,0.0013634289,0.0012147709,0.0011015056,0.0009939035,0.0009188652, - 0.0008523218,0.0008225925,0.0006965819,0.0007220666,0.0006682656,0.0006470283, - 0.0006144646,0.000603138,0.0006116329,0.0005578319,0.0005295155,0.0005295155, - 0.0005210206,0.0005054466,0.0004473982,0.0004473953,0.0004077553,0.0004558931, - 0.0004077553,0.0004346558,0.0003766073,0.0003851022,0.0003879338,0.0003723599, - 0.0003341328,0.0003723599,0.0003313012,0.0003341328,0.0003143114 + 8.4949016432e-06f,1.27423524648e-05f,2.54847049296e-05f,4.10586912755e-05f,5.94643115024e-05f,7.64541147888e-05f, + 0.0001047705f,0.0001628184f,0.0004077553f,0.0007560434f,0.0027948226f,0.0055783471f, + 0.0119863062f,0.022134882f,0.0389179761f,0.0664188043f,0.1067016279f,0.1614272001f, + 0.2272018077f,0.2986552571f,0.367815083f,0.4258041132f,0.4697397445f,0.4991660838f, + 0.5193159905f,0.5332504608f,0.5467262065f,0.5603038909f,0.5736437182f,0.5855337488f, + 0.5956625032f,0.6041036038f,0.6120151889f,0.618774299f,0.625564557f,0.6319045853f, + 0.6377943837f,0.6421862479f,0.6443949223f,0.6448819633f,0.644884795f,0.6451141573f, + 0.6468357907f,0.6513182672f,0.6590911022f,0.6691405708f,0.6811806781f,0.6937021631f, + 0.7056091836f,0.7157690859f,0.7250568451f,0.7323511339f,0.7384193253f,0.7438758838f, + 0.7492531566f,0.7536450207f,0.7580793594f,0.7610893862f,0.7639125252f,0.7652348982f, + 0.766172169f,0.7665969141f,0.767494542f,0.7687546191f,0.7723026564f,0.7771079391f, + 0.7833828397f,0.7917191699f,0.8015449394f,0.8109516272f,0.8200326771f,0.8290684208f, + 0.8364646485f,0.8426517685f,0.8481876127f,0.8519168746f,0.8555045547f,0.8583361886f, + 0.8620173126f,0.8666838452f,0.8715797402f,0.8780188757f,0.8847071949f,0.8913473763f, + 0.898890849f,0.9045824331f,0.9105090428f,0.9154615705f,0.9207935371f,0.9253156564f, + 0.9289882855f,0.9328931087f,0.9369565033f,0.9400797954f,0.9441601799f,0.9469295178f, + 0.9503472999f,0.9521085762f,0.9542804394f,0.9574405428f,0.9607705442f,0.9663148834f, + 0.9720999114f,0.9788278735f,0.9845959117f,0.991221935f,0.9956874216f,0.9990882139f, + 1.0f,0.9963273709f,0.9914682871f,0.9869688209f,0.9817019819f,0.9771458829f, + 0.9745974125f,0.9729012638f,0.9739319785f,0.9741924888f,0.9768712145f,0.9798246086f, + 0.9827723395f,0.9845732586f,0.9850772894f,0.9837266001f,0.9825967782f,0.9790232562f, + 0.9745945808f,0.9697411603f,0.9648141174f,0.9598389367f,0.9533346736f,0.9483566613f, + 0.9445481137f,0.93968903f,0.9344561706f,0.9297160154f,0.9248342786f,0.9183356789f, + 0.9111942982f,0.9061001889f,0.9006181457f,0.8953456434f,0.8908093659f,0.8894954878f, + 0.8885412272f,0.8809779331f,0.8707840511f,0.8566683562f,0.8369346997f,0.8102408871f, + 0.7728519933f,0.718954674f,0.6528501811f,0.5710810895f,0.4795853355f,0.3846491464f, + 0.294773087f,0.2166449103f,0.1531319287f,0.1057054591f,0.0716799801f,0.0491432892f, + 0.0337757289f,0.0256986066f,0.0181762579f,0.0131968863f,0.0121562043f,0.0090201414f, + 0.0084156159f,0.0042799863f,0.0033130116f,0.0026688064f,0.0022115061f,0.0018292327f, + 0.0015290823f,0.0013634289f,0.0012147709f,0.0011015056f,0.0009939035f,0.0009188652f, + 0.0008523218f,0.0008225925f,0.0006965819f,0.0007220666f,0.0006682656f,0.0006470283f, + 0.0006144646f,0.000603138f,0.0006116329f,0.0005578319f,0.0005295155f,0.0005295155f, + 0.0005210206f,0.0005054466f,0.0004473982f,0.0004473953f,0.0004077553f,0.0004558931f, + 0.0004077553f,0.0004346558f,0.0003766073f,0.0003851022f,0.0003879338f,0.0003723599f, + 0.0003341328f,0.0003723599f,0.0003313012f,0.0003341328f,0.0003143114f }; //add panchromatic band to the temporary list const std::vector<float> vpan (pan, pan + sizeof(pan) / sizeof(float) ); @@ -1254,854 +1254,854 @@ PleiadesImageMetadataInterface //band B0 (blue band) const float b0[209] = { - 0.0098681, - 0.0293268, - 0.0877320, - 0.1287040, - 0.1341240, - 0.2457050, - 0.4345520, - 0.5133040, - 0.4710970, - 0.5125880, - 0.6530370, - 0.7707870, - 0.7879420, - 0.7648330, - 0.7718380, - 0.8013290, - 0.8240790, - 0.8352890, - 0.8326150, - 0.8249150, - 0.8168160, - 0.8163380, - 0.8285420, - 0.8623820, - 0.9075060, - 0.9379000, - 0.9505710, - 0.9572260, - 0.9650570, - 0.9632790, - 0.9587260, - 0.9567320, - 0.9646760, - 0.9804620, - 0.9900240, - 0.9838940, - 0.9719110, - 0.9715280, - 0.9574890, - 0.8770130, - 0.7103910, - 0.4943810, - 0.3021990, - 0.1722720, - 0.0943537, - 0.0543895, - 0.0345732, - 0.0261018, - 0.0230010, - 0.0223203, - 0.0210136, - 0.0173172, - 0.0119112, - 0.0072895, - 0.0046311, - 0.0033297, - 0.0025865, - 0.0020232, - 0.0015030, - 0.0010527, - 0.0007044, - 0.0005199, - 0.0004117, - 0.0004097, - 0.0005317, - 0.0009532, - 0.0013521, - 0.0014273, - 0.0009182, - 0.0003440, - 0.0001323, - 0.0000783, - 0.0000626, - 0.0000511, - 0.0000538, - 0.0000533, - 0.0000454, - 0.0000404, - 0.0000315, - 0.0000327, - 0.0000262, - 0.0000303, - 0.0000206, - 0.0000241, - 0.0000241, - 0.0000273, - 0.0000258, - 0.0000208, - 0.0000341, - 0.0000379, - 0.0000393, - 0.0000429, - 0.0000281, - 0.0000277, - 0.0000187, - 0.0000272, - 0.0000245, - 0.0000209, - 0.0000137, - 0.0000171, - 0.0000257, - 0.0000300, - 0.0000330, - 0.0000446, - 0.0000397, - 0.0000399, - 0.0000384, - 0.0000336, - 0.0000307, - 0.0000300, - 0.0000242, - 0.0000224, - 0.0000210, - 0.0000325, - 0.0000690, - 0.0002195, - 0.0005063, - 0.0008373, - 0.0009464, - 0.0007099, - 0.0004910, - 0.0004433, - 0.0006064, - 0.0012019, - 0.0016241, - 0.0016779, - 0.0009733, - 0.0003606, - 0.0001659, - 0.0000864, - 0.0000564, - 0.0000562, - 0.0000590, - 0.0000458, - 0.0000382, - 0.0000586, - 0.0000685, - 0.0000474, - 0.0000872, - 0.0000628, - 0.0000948, - 0.0001015, - 0.0001564, - 0.0002379, - 0.0003493, - 0.0005409, - 0.0007229, - 0.0007896, - 0.0007188, - 0.0005204, - 0.0003939, - 0.0003128, - 0.0002699, - 0.0002605, - 0.0002378, - 0.0002286, - 0.0002406, - 0.0002741, - 0.0003203, - 0.0003812, - 0.0004904, - 0.0006077, - 0.0008210, - 0.0011791, - 0.0018150, - 0.0030817, - 0.0055589, - 0.0103652, - 0.0166309, - 0.0211503, - 0.0216246, - 0.0176910, - 0.0136927, - 0.0107136, - 0.0089555, - 0.0079790, - 0.0079189, - 0.0080456, - 0.0088920, - 0.0102062, - 0.0126157, - 0.0162251, - 0.0221306, - 0.0308295, - 0.0411980, - 0.0498232, - 0.0531265, - 0.0484487, - 0.0391122, - 0.0291405, - 0.0212633, - 0.0162146, - 0.0128925, - 0.0108169, - 0.0094115, - 0.0084386, - 0.0077249, - 0.0074231, - 0.0072603, - 0.0073459, - 0.0074214, - 0.0076433, - 0.0077788, - 0.0078151, - 0.0077003, - 0.0072256, - 0.0065903, - 0.0057120, - 0.0048136 + 0.0098681f, + 0.0293268f, + 0.0877320f, + 0.1287040f, + 0.1341240f, + 0.2457050f, + 0.4345520f, + 0.5133040f, + 0.4710970f, + 0.5125880f, + 0.6530370f, + 0.7707870f, + 0.7879420f, + 0.7648330f, + 0.7718380f, + 0.8013290f, + 0.8240790f, + 0.8352890f, + 0.8326150f, + 0.8249150f, + 0.8168160f, + 0.8163380f, + 0.8285420f, + 0.8623820f, + 0.9075060f, + 0.9379000f, + 0.9505710f, + 0.9572260f, + 0.9650570f, + 0.9632790f, + 0.9587260f, + 0.9567320f, + 0.9646760f, + 0.9804620f, + 0.9900240f, + 0.9838940f, + 0.9719110f, + 0.9715280f, + 0.9574890f, + 0.8770130f, + 0.7103910f, + 0.4943810f, + 0.3021990f, + 0.1722720f, + 0.0943537f, + 0.0543895f, + 0.0345732f, + 0.0261018f, + 0.0230010f, + 0.0223203f, + 0.0210136f, + 0.0173172f, + 0.0119112f, + 0.0072895f, + 0.0046311f, + 0.0033297f, + 0.0025865f, + 0.0020232f, + 0.0015030f, + 0.0010527f, + 0.0007044f, + 0.0005199f, + 0.0004117f, + 0.0004097f, + 0.0005317f, + 0.0009532f, + 0.0013521f, + 0.0014273f, + 0.0009182f, + 0.0003440f, + 0.0001323f, + 0.0000783f, + 0.0000626f, + 0.0000511f, + 0.0000538f, + 0.0000533f, + 0.0000454f, + 0.0000404f, + 0.0000315f, + 0.0000327f, + 0.0000262f, + 0.0000303f, + 0.0000206f, + 0.0000241f, + 0.0000241f, + 0.0000273f, + 0.0000258f, + 0.0000208f, + 0.0000341f, + 0.0000379f, + 0.0000393f, + 0.0000429f, + 0.0000281f, + 0.0000277f, + 0.0000187f, + 0.0000272f, + 0.0000245f, + 0.0000209f, + 0.0000137f, + 0.0000171f, + 0.0000257f, + 0.0000300f, + 0.0000330f, + 0.0000446f, + 0.0000397f, + 0.0000399f, + 0.0000384f, + 0.0000336f, + 0.0000307f, + 0.0000300f, + 0.0000242f, + 0.0000224f, + 0.0000210f, + 0.0000325f, + 0.0000690f, + 0.0002195f, + 0.0005063f, + 0.0008373f, + 0.0009464f, + 0.0007099f, + 0.0004910f, + 0.0004433f, + 0.0006064f, + 0.0012019f, + 0.0016241f, + 0.0016779f, + 0.0009733f, + 0.0003606f, + 0.0001659f, + 0.0000864f, + 0.0000564f, + 0.0000562f, + 0.0000590f, + 0.0000458f, + 0.0000382f, + 0.0000586f, + 0.0000685f, + 0.0000474f, + 0.0000872f, + 0.0000628f, + 0.0000948f, + 0.0001015f, + 0.0001564f, + 0.0002379f, + 0.0003493f, + 0.0005409f, + 0.0007229f, + 0.0007896f, + 0.0007188f, + 0.0005204f, + 0.0003939f, + 0.0003128f, + 0.0002699f, + 0.0002605f, + 0.0002378f, + 0.0002286f, + 0.0002406f, + 0.0002741f, + 0.0003203f, + 0.0003812f, + 0.0004904f, + 0.0006077f, + 0.0008210f, + 0.0011791f, + 0.0018150f, + 0.0030817f, + 0.0055589f, + 0.0103652f, + 0.0166309f, + 0.0211503f, + 0.0216246f, + 0.0176910f, + 0.0136927f, + 0.0107136f, + 0.0089555f, + 0.0079790f, + 0.0079189f, + 0.0080456f, + 0.0088920f, + 0.0102062f, + 0.0126157f, + 0.0162251f, + 0.0221306f, + 0.0308295f, + 0.0411980f, + 0.0498232f, + 0.0531265f, + 0.0484487f, + 0.0391122f, + 0.0291405f, + 0.0212633f, + 0.0162146f, + 0.0128925f, + 0.0108169f, + 0.0094115f, + 0.0084386f, + 0.0077249f, + 0.0074231f, + 0.0072603f, + 0.0073459f, + 0.0074214f, + 0.0076433f, + 0.0077788f, + 0.0078151f, + 0.0077003f, + 0.0072256f, + 0.0065903f, + 0.0057120f, + 0.0048136f }; //B1 green band const float b1[209] = { - 0.0000144, - 0.0000143, - 0.0000259, - 0.0000189, - 0.0000132, - 0.0000179, - 0.0000224, - 0.0000179, - 0.0000124, - 0.0000202, - 0.0000276, - 0.0000292, - 0.0000420, - 0.0000366, - 0.0000261, - 0.0000247, - 0.0000445, - 0.0000902, - 0.0001144, - 0.0000823, - 0.0000778, - 0.0001923, - 0.0003401, - 0.0004085, - 0.0004936, - 0.0007849, - 0.0045979, - 0.0085122, - 0.0143014, - 0.0243310, - 0.0480572, - 0.1097360, - 0.2353890, - 0.4328370, - 0.6491340, - 0.8095770, - 0.8847680, - 0.9066640, - 0.9131150, - 0.9186700, - 0.9273270, - 0.9405210, - 0.9512930, - 0.9587500, - 0.9667360, - 0.9709750, - 0.9728630, - 0.9769560, - 0.9850710, - 0.9892500, - 0.9865960, - 0.9743300, - 0.9575190, - 0.9435550, - 0.9439310, - 0.9571350, - 0.9712530, - 0.9761580, - 0.9619590, - 0.9244890, - 0.8734580, - 0.8349840, - 0.8166740, - 0.8015960, - 0.7435910, - 0.6160350, - 0.4321320, - 0.2544540, - 0.1360870, - 0.0769553, - 0.0479321, - 0.0342014, - 0.0266703, - 0.0212632, - 0.0160541, - 0.0106967, - 0.0060543, - 0.0030797, - 0.0015416, - 0.0008333, - 0.0004706, - 0.0002918, - 0.0001917, - 0.0001472, - 0.0001063, - 0.0000912, - 0.0000589, - 0.0000552, - 0.0000752, - 0.0000884, - 0.0000985, - 0.0001125, - 0.0001368, - 0.0001947, - 0.0002284, - 0.0002088, - 0.0001498, - 0.0000637, - 0.0000307, - 0.0000283, - 0.0000311, - 0.0000331, - 0.0000215, - 0.0000236, - 0.0000205, - 0.0000186, - 0.0000233, - 0.0000233, - 0.0000198, - 0.0000195, - 0.0000161, - 0.0000308, - 0.0000464, - 0.0000290, - 0.0000264, - 0.0000233, - 0.0000395, - 0.0001113, - 0.0001903, - 0.0002290, - 0.0002229, - 0.0001322, - 0.0000548, - 0.0000608, - 0.0000414, - 0.0000382, - 0.0000381, - 0.0000269, - 0.0000233, - 0.0000198, - 0.0000208, - 0.0000302, - 0.0000419, - 0.0000305, - 0.0000340, - 0.0000334, - 0.0000362, - 0.0000282, - 0.0000337, - 0.0000330, - 0.0000424, - 0.0000420, - 0.0000470, - 0.0000417, - 0.0000233, - 0.0000439, - 0.0000503, - 0.0000446, - 0.0000428, - 0.0000597, - 0.0000671, - 0.0001142, - 0.0001780, - 0.0003546, - 0.0009610, - 0.0041260, - 0.0066679, - 0.0078563, - 0.0068645, - 0.0029441, - 0.0011320, - 0.0007028, - 0.0005471, - 0.0004967, - 0.0004929, - 0.0005351, - 0.0006223, - 0.0007957, - 0.0010708, - 0.0016699, - 0.0030334, - 0.0054959, - 0.0091390, - 0.0125045, - 0.0144212, - 0.0141099, - 0.0117418, - 0.0089824, - 0.0067916, - 0.0056849, - 0.0051998, - 0.0053640, - 0.0060350, - 0.0067668, - 0.0083174, - 0.0106521, - 0.0139110, - 0.0183736, - 0.0231289, - 0.0272661, - 0.0298126, - 0.0300318, - 0.0286507, - 0.0266172, - 0.0247529, - 0.0236974, - 0.0232734, - 0.0236733, - 0.0245808, - 0.0257173, - 0.0267721, - 0.0267455, - 0.0254447, - 0.0227056, - 0.0188513, - 0.0147988, - 0.0109864, - 0.0079795, - 0.0057516 + 0.0000144f, + 0.0000143f, + 0.0000259f, + 0.0000189f, + 0.0000132f, + 0.0000179f, + 0.0000224f, + 0.0000179f, + 0.0000124f, + 0.0000202f, + 0.0000276f, + 0.0000292f, + 0.0000420f, + 0.0000366f, + 0.0000261f, + 0.0000247f, + 0.0000445f, + 0.0000902f, + 0.0001144f, + 0.0000823f, + 0.0000778f, + 0.0001923f, + 0.0003401f, + 0.0004085f, + 0.0004936f, + 0.0007849f, + 0.0045979f, + 0.0085122f, + 0.0143014f, + 0.0243310f, + 0.0480572f, + 0.1097360f, + 0.2353890f, + 0.4328370f, + 0.6491340f, + 0.8095770f, + 0.8847680f, + 0.9066640f, + 0.9131150f, + 0.9186700f, + 0.9273270f, + 0.9405210f, + 0.9512930f, + 0.9587500f, + 0.9667360f, + 0.9709750f, + 0.9728630f, + 0.9769560f, + 0.9850710f, + 0.9892500f, + 0.9865960f, + 0.9743300f, + 0.9575190f, + 0.9435550f, + 0.9439310f, + 0.9571350f, + 0.9712530f, + 0.9761580f, + 0.9619590f, + 0.9244890f, + 0.8734580f, + 0.8349840f, + 0.8166740f, + 0.8015960f, + 0.7435910f, + 0.6160350f, + 0.4321320f, + 0.2544540f, + 0.1360870f, + 0.0769553f, + 0.0479321f, + 0.0342014f, + 0.0266703f, + 0.0212632f, + 0.0160541f, + 0.0106967f, + 0.0060543f, + 0.0030797f, + 0.0015416f, + 0.0008333f, + 0.0004706f, + 0.0002918f, + 0.0001917f, + 0.0001472f, + 0.0001063f, + 0.0000912f, + 0.0000589f, + 0.0000552f, + 0.0000752f, + 0.0000884f, + 0.0000985f, + 0.0001125f, + 0.0001368f, + 0.0001947f, + 0.0002284f, + 0.0002088f, + 0.0001498f, + 0.0000637f, + 0.0000307f, + 0.0000283f, + 0.0000311f, + 0.0000331f, + 0.0000215f, + 0.0000236f, + 0.0000205f, + 0.0000186f, + 0.0000233f, + 0.0000233f, + 0.0000198f, + 0.0000195f, + 0.0000161f, + 0.0000308f, + 0.0000464f, + 0.0000290f, + 0.0000264f, + 0.0000233f, + 0.0000395f, + 0.0001113f, + 0.0001903f, + 0.0002290f, + 0.0002229f, + 0.0001322f, + 0.0000548f, + 0.0000608f, + 0.0000414f, + 0.0000382f, + 0.0000381f, + 0.0000269f, + 0.0000233f, + 0.0000198f, + 0.0000208f, + 0.0000302f, + 0.0000419f, + 0.0000305f, + 0.0000340f, + 0.0000334f, + 0.0000362f, + 0.0000282f, + 0.0000337f, + 0.0000330f, + 0.0000424f, + 0.0000420f, + 0.0000470f, + 0.0000417f, + 0.0000233f, + 0.0000439f, + 0.0000503f, + 0.0000446f, + 0.0000428f, + 0.0000597f, + 0.0000671f, + 0.0001142f, + 0.0001780f, + 0.0003546f, + 0.0009610f, + 0.0041260f, + 0.0066679f, + 0.0078563f, + 0.0068645f, + 0.0029441f, + 0.0011320f, + 0.0007028f, + 0.0005471f, + 0.0004967f, + 0.0004929f, + 0.0005351f, + 0.0006223f, + 0.0007957f, + 0.0010708f, + 0.0016699f, + 0.0030334f, + 0.0054959f, + 0.0091390f, + 0.0125045f, + 0.0144212f, + 0.0141099f, + 0.0117418f, + 0.0089824f, + 0.0067916f, + 0.0056849f, + 0.0051998f, + 0.0053640f, + 0.0060350f, + 0.0067668f, + 0.0083174f, + 0.0106521f, + 0.0139110f, + 0.0183736f, + 0.0231289f, + 0.0272661f, + 0.0298126f, + 0.0300318f, + 0.0286507f, + 0.0266172f, + 0.0247529f, + 0.0236974f, + 0.0232734f, + 0.0236733f, + 0.0245808f, + 0.0257173f, + 0.0267721f, + 0.0267455f, + 0.0254447f, + 0.0227056f, + 0.0188513f, + 0.0147988f, + 0.0109864f, + 0.0079795f, + 0.0057516f }; //B2 red band const float b2[209] = { - 0.0097386, - 0.0035306, - 0.0035374, - 0.0114418, - 0.0266686, - 0.0373494, - 0.0904431, - 0.0907580, - 0.0399312, - 0.0208748, - 0.0080694, - 0.0027002, - 0.0011241, - 0.0006460, - 0.0005029, - 0.0006051, - 0.0009979, - 0.0019446, - 0.0014554, - 0.0006090, - 0.0003230, - 0.0002503, - 0.0002538, - 0.0003360, - 0.0005377, - 0.0007773, - 0.0004895, - 0.0002045, - 0.0000875, - 0.0000594, - 0.0000217, - 0.0000290, - 0.0000297, - 0.0000408, - 0.0000456, - 0.0000447, - 0.0000322, - 0.0000222, - 0.0000147, - 0.0000095, - 0.0000072, - 0.0000113, - 0.0000313, - 0.0000123, - 0.0000122, - 0.0000280, - 0.0000180, - 0.0000261, - 0.0000138, - 0.0000392, - 0.0000517, - 0.0000695, - 0.0000797, - 0.0000785, - 0.0001004, - 0.0001170, - 0.0001483, - 0.0001837, - 0.0002110, - 0.0002973, - 0.0004162, - 0.0006371, - 0.0010012, - 0.0032888, - 0.0100109, - 0.0181837, - 0.0330510, - 0.0624784, - 0.1183670, - 0.2218740, - 0.3756820, - 0.5574830, - 0.7342220, - 0.8636840, - 0.9319920, - 0.9527010, - 0.9620090, - 0.9527340, - 0.9437220, - 0.9456300, - 0.9562330, - 0.9693120, - 0.9839640, - 0.9949160, - 0.9992700, - 0.9993300, - 0.9963430, - 0.9944130, - 0.9883050, - 0.9857580, - 0.9807560, - 0.9683790, - 0.9544700, - 0.9371750, - 0.9170350, - 0.8922820, - 0.8662710, - 0.8442750, - 0.8220420, - 0.7888070, - 0.7372920, - 0.6625080, - 0.5662120, - 0.4493120, - 0.3260000, - 0.2194040, - 0.1416500, - 0.0925669, - 0.0619437, - 0.0456444, - 0.0355683, - 0.0310879, - 0.0295168, - 0.0233351, - 0.0189628, - 0.0158627, - 0.0132266, - 0.0107473, - 0.0083969, - 0.0063847, - 0.0046601, - 0.0033814, - 0.0024167, - 0.0017478, - 0.0012949, - 0.0009939, - 0.0007442, - 0.0006312, - 0.0005142, - 0.0004354, - 0.0003549, - 0.0003156, - 0.0003079, - 0.0002906, - 0.0002867, - 0.0002751, - 0.0003048, - 0.0003010, - 0.0003342, - 0.0004310, - 0.0004955, - 0.0005488, - 0.0005838, - 0.0006687, - 0.0006968, - 0.0006650, - 0.0005866, - 0.0004688, - 0.0004086, - 0.0003611, - 0.0002404, - 0.0002609, - 0.0002476, - 0.0002133, - 0.0002098, - 0.0001916, - 0.0001642, - 0.0001799, - 0.0002180, - 0.0002003, - 0.0002030, - 0.0002348, - 0.0002735, - 0.0002652, - 0.0002944, - 0.0004666, - 0.0004882, - 0.0006642, - 0.0007798, - 0.0010588, - 0.0014008, - 0.0019011, - 0.0024917, - 0.0034379, - 0.0042182, - 0.0053618, - 0.0062814, - 0.0068774, - 0.0071141, - 0.0070399, - 0.0065876, - 0.0067873, - 0.0066877, - 0.0068572, - 0.0070486, - 0.0073911, - 0.0081201, - 0.0087391, - 0.0096581, - 0.0106625, - 0.0120129, - 0.0137222, - 0.0159817, - 0.0180896, - 0.0206562, - 0.0236408, - 0.0269627, - 0.0310497, - 0.0353146, - 0.0398729, - 0.0438795, - 0.0462377, - 0.0454916, - 0.0408754, - 0.0333175, - 0.0251186, - 0.0179089, - 0.0125129, - 0.0086117 + 0.0097386f, + 0.0035306f, + 0.0035374f, + 0.0114418f, + 0.0266686f, + 0.0373494f, + 0.0904431f, + 0.0907580f, + 0.0399312f, + 0.0208748f, + 0.0080694f, + 0.0027002f, + 0.0011241f, + 0.0006460f, + 0.0005029f, + 0.0006051f, + 0.0009979f, + 0.0019446f, + 0.0014554f, + 0.0006090f, + 0.0003230f, + 0.0002503f, + 0.0002538f, + 0.0003360f, + 0.0005377f, + 0.0007773f, + 0.0004895f, + 0.0002045f, + 0.0000875f, + 0.0000594f, + 0.0000217f, + 0.0000290f, + 0.0000297f, + 0.0000408f, + 0.0000456f, + 0.0000447f, + 0.0000322f, + 0.0000222f, + 0.0000147f, + 0.0000095f, + 0.0000072f, + 0.0000113f, + 0.0000313f, + 0.0000123f, + 0.0000122f, + 0.0000280f, + 0.0000180f, + 0.0000261f, + 0.0000138f, + 0.0000392f, + 0.0000517f, + 0.0000695f, + 0.0000797f, + 0.0000785f, + 0.0001004f, + 0.0001170f, + 0.0001483f, + 0.0001837f, + 0.0002110f, + 0.0002973f, + 0.0004162f, + 0.0006371f, + 0.0010012f, + 0.0032888f, + 0.0100109f, + 0.0181837f, + 0.0330510f, + 0.0624784f, + 0.1183670f, + 0.2218740f, + 0.3756820f, + 0.5574830f, + 0.7342220f, + 0.8636840f, + 0.9319920f, + 0.9527010f, + 0.9620090f, + 0.9527340f, + 0.9437220f, + 0.9456300f, + 0.9562330f, + 0.9693120f, + 0.9839640f, + 0.9949160f, + 0.9992700f, + 0.9993300f, + 0.9963430f, + 0.9944130f, + 0.9883050f, + 0.9857580f, + 0.9807560f, + 0.9683790f, + 0.9544700f, + 0.9371750f, + 0.9170350f, + 0.8922820f, + 0.8662710f, + 0.8442750f, + 0.8220420f, + 0.7888070f, + 0.7372920f, + 0.6625080f, + 0.5662120f, + 0.4493120f, + 0.3260000f, + 0.2194040f, + 0.1416500f, + 0.0925669f, + 0.0619437f, + 0.0456444f, + 0.0355683f, + 0.0310879f, + 0.0295168f, + 0.0233351f, + 0.0189628f, + 0.0158627f, + 0.0132266f, + 0.0107473f, + 0.0083969f, + 0.0063847f, + 0.0046601f, + 0.0033814f, + 0.0024167f, + 0.0017478f, + 0.0012949f, + 0.0009939f, + 0.0007442f, + 0.0006312f, + 0.0005142f, + 0.0004354f, + 0.0003549f, + 0.0003156f, + 0.0003079f, + 0.0002906f, + 0.0002867f, + 0.0002751f, + 0.0003048f, + 0.0003010f, + 0.0003342f, + 0.0004310f, + 0.0004955f, + 0.0005488f, + 0.0005838f, + 0.0006687f, + 0.0006968f, + 0.0006650f, + 0.0005866f, + 0.0004688f, + 0.0004086f, + 0.0003611f, + 0.0002404f, + 0.0002609f, + 0.0002476f, + 0.0002133f, + 0.0002098f, + 0.0001916f, + 0.0001642f, + 0.0001799f, + 0.0002180f, + 0.0002003f, + 0.0002030f, + 0.0002348f, + 0.0002735f, + 0.0002652f, + 0.0002944f, + 0.0004666f, + 0.0004882f, + 0.0006642f, + 0.0007798f, + 0.0010588f, + 0.0014008f, + 0.0019011f, + 0.0024917f, + 0.0034379f, + 0.0042182f, + 0.0053618f, + 0.0062814f, + 0.0068774f, + 0.0071141f, + 0.0070399f, + 0.0065876f, + 0.0067873f, + 0.0066877f, + 0.0068572f, + 0.0070486f, + 0.0073911f, + 0.0081201f, + 0.0087391f, + 0.0096581f, + 0.0106625f, + 0.0120129f, + 0.0137222f, + 0.0159817f, + 0.0180896f, + 0.0206562f, + 0.0236408f, + 0.0269627f, + 0.0310497f, + 0.0353146f, + 0.0398729f, + 0.0438795f, + 0.0462377f, + 0.0454916f, + 0.0408754f, + 0.0333175f, + 0.0251186f, + 0.0179089f, + 0.0125129f, + 0.0086117f }; //B3 nir band const float b3[209] = { - 0.0024163, - 0.0017305, - 0.0020803, - 0.0020499, - 0.0012660, - 0.0007361, - 0.0006198, - 0.0006344, - 0.0007721, - 0.0011837, - 0.0020819, - 0.0023991, - 0.0013377, - 0.0006328, - 0.0003544, - 0.0002890, - 0.0002498, - 0.0002541, - 0.0003346, - 0.0005048, - 0.0008684, - 0.0009871, - 0.0006587, - 0.0003833, - 0.0002606, - 0.0002356, - 0.0002364, - 0.0002791, - 0.0003613, - 0.0005575, - 0.0007414, - 0.0007413, - 0.0005768, - 0.0004230, - 0.0003206, - 0.0003044, - 0.0003019, - 0.0003201, - 0.0003813, - 0.0004630, - 0.0005930, - 0.0007080, - 0.0008577, - 0.0009017, - 0.0008813, - 0.0007801, - 0.0006583, - 0.0005863, - 0.0005224, - 0.0005506, - 0.0006403, - 0.0008293, - 0.0013444, - 0.0023942, - 0.0027274, - 0.0014330, - 0.0006388, - 0.0003596, - 0.0002416, - 0.0001718, - 0.0001566, - 0.0001642, - 0.0001892, - 0.0002351, - 0.0003227, - 0.0006734, - 0.0014311, - 0.0013325, - 0.0005796, - 0.0002424, - 0.0001263, - 0.0001022, - 0.0000446, - 0.0000652, - 0.0000544, - 0.0000573, - 0.0000518, - 0.0000504, - 0.0000649, - 0.0000723, - 0.0000833, - 0.0000739, - 0.0000691, - 0.0001382, - 0.0001692, - 0.0002240, - 0.0002296, - 0.0001553, - 0.0001492, - 0.0001121, - 0.0001058, - 0.0001068, - 0.0001012, - 0.0000864, - 0.0000533, - 0.0000354, - 0.0000440, - 0.0000371, - 0.0000691, - 0.0000769, - 0.0000791, - 0.0001333, - 0.0001244, - 0.0002048, - 0.0002455, - 0.0002721, - 0.0003812, - 0.0004568, - 0.0006255, - 0.0008185, - 0.0009733, - 0.0012281, - 0.0013528, - 0.0015758, - 0.0017458, - 0.0019104, - 0.0020863, - 0.0023053, - 0.0025241, - 0.0037234, - 0.0044186, - 0.0053574, - 0.0066118, - 0.0083509, - 0.0107509, - 0.0150393, - 0.0212756, - 0.0292566, - 0.0414246, - 0.0586633, - 0.0834879, - 0.1190380, - 0.1671850, - 0.2326370, - 0.3124060, - 0.4070470, - 0.5091930, - 0.6148270, - 0.7140870, - 0.8017550, - 0.8714840, - 0.9241260, - 0.9587210, - 0.9782990, - 0.9882040, - 0.9922940, - 0.9902030, - 0.9854020, - 0.9777560, - 0.9660200, - 0.9532070, - 0.9421250, - 0.9303560, - 0.9241490, - 0.9212220, - 0.9203820, - 0.9217020, - 0.9227420, - 0.9230000, - 0.9237670, - 0.9243070, - 0.9206520, - 0.9154840, - 0.9090910, - 0.9003380, - 0.8905620, - 0.8776420, - 0.8668600, - 0.8537290, - 0.8428590, - 0.8305310, - 0.8195740, - 0.8069090, - 0.7921080, - 0.7791670, - 0.7660510, - 0.7521190, - 0.7375270, - 0.7217320, - 0.7043220, - 0.6853170, - 0.6642500, - 0.6413850, - 0.6173030, - 0.5919540, - 0.5672310, - 0.5430130, - 0.5184560, - 0.4957540, - 0.4734340, - 0.4528220, - 0.4332270, - 0.4131920, - 0.3919120, - 0.3659660, - 0.3325420, - 0.2917680, - 0.2453910, - 0.1962540, - 0.1486850, - 0.1068860, - 0.0738260, - 0.0491777, - 0.0327991, - 0.0215831, - 0.0145386, - 0.0103219, - 0.0076144, - 0.0061346 + 0.0024163f, + 0.0017305f, + 0.0020803f, + 0.0020499f, + 0.0012660f, + 0.0007361f, + 0.0006198f, + 0.0006344f, + 0.0007721f, + 0.0011837f, + 0.0020819f, + 0.0023991f, + 0.0013377f, + 0.0006328f, + 0.0003544f, + 0.0002890f, + 0.0002498f, + 0.0002541f, + 0.0003346f, + 0.0005048f, + 0.0008684f, + 0.0009871f, + 0.0006587f, + 0.0003833f, + 0.0002606f, + 0.0002356f, + 0.0002364f, + 0.0002791f, + 0.0003613f, + 0.0005575f, + 0.0007414f, + 0.0007413f, + 0.0005768f, + 0.0004230f, + 0.0003206f, + 0.0003044f, + 0.0003019f, + 0.0003201f, + 0.0003813f, + 0.0004630f, + 0.0005930f, + 0.0007080f, + 0.0008577f, + 0.0009017f, + 0.0008813f, + 0.0007801f, + 0.0006583f, + 0.0005863f, + 0.0005224f, + 0.0005506f, + 0.0006403f, + 0.0008293f, + 0.0013444f, + 0.0023942f, + 0.0027274f, + 0.0014330f, + 0.0006388f, + 0.0003596f, + 0.0002416f, + 0.0001718f, + 0.0001566f, + 0.0001642f, + 0.0001892f, + 0.0002351f, + 0.0003227f, + 0.0006734f, + 0.0014311f, + 0.0013325f, + 0.0005796f, + 0.0002424f, + 0.0001263f, + 0.0001022f, + 0.0000446f, + 0.0000652f, + 0.0000544f, + 0.0000573f, + 0.0000518f, + 0.0000504f, + 0.0000649f, + 0.0000723f, + 0.0000833f, + 0.0000739f, + 0.0000691f, + 0.0001382f, + 0.0001692f, + 0.0002240f, + 0.0002296f, + 0.0001553f, + 0.0001492f, + 0.0001121f, + 0.0001058f, + 0.0001068f, + 0.0001012f, + 0.0000864f, + 0.0000533f, + 0.0000354f, + 0.0000440f, + 0.0000371f, + 0.0000691f, + 0.0000769f, + 0.0000791f, + 0.0001333f, + 0.0001244f, + 0.0002048f, + 0.0002455f, + 0.0002721f, + 0.0003812f, + 0.0004568f, + 0.0006255f, + 0.0008185f, + 0.0009733f, + 0.0012281f, + 0.0013528f, + 0.0015758f, + 0.0017458f, + 0.0019104f, + 0.0020863f, + 0.0023053f, + 0.0025241f, + 0.0037234f, + 0.0044186f, + 0.0053574f, + 0.0066118f, + 0.0083509f, + 0.0107509f, + 0.0150393f, + 0.0212756f, + 0.0292566f, + 0.0414246f, + 0.0586633f, + 0.0834879f, + 0.1190380f, + 0.1671850f, + 0.2326370f, + 0.3124060f, + 0.4070470f, + 0.5091930f, + 0.6148270f, + 0.7140870f, + 0.8017550f, + 0.8714840f, + 0.9241260f, + 0.9587210f, + 0.9782990f, + 0.9882040f, + 0.9922940f, + 0.9902030f, + 0.9854020f, + 0.9777560f, + 0.9660200f, + 0.9532070f, + 0.9421250f, + 0.9303560f, + 0.9241490f, + 0.9212220f, + 0.9203820f, + 0.9217020f, + 0.9227420f, + 0.9230000f, + 0.9237670f, + 0.9243070f, + 0.9206520f, + 0.9154840f, + 0.9090910f, + 0.9003380f, + 0.8905620f, + 0.8776420f, + 0.8668600f, + 0.8537290f, + 0.8428590f, + 0.8305310f, + 0.8195740f, + 0.8069090f, + 0.7921080f, + 0.7791670f, + 0.7660510f, + 0.7521190f, + 0.7375270f, + 0.7217320f, + 0.7043220f, + 0.6853170f, + 0.6642500f, + 0.6413850f, + 0.6173030f, + 0.5919540f, + 0.5672310f, + 0.5430130f, + 0.5184560f, + 0.4957540f, + 0.4734340f, + 0.4528220f, + 0.4332270f, + 0.4131920f, + 0.3919120f, + 0.3659660f, + 0.3325420f, + 0.2917680f, + 0.2453910f, + 0.1962540f, + 0.1486850f, + 0.1068860f, + 0.0738260f, + 0.0491777f, + 0.0327991f, + 0.0215831f, + 0.0145386f, + 0.0103219f, + 0.0076144f, + 0.0061346f }; //Add multispectral bands to the temporary list const std::vector<float> vb0 (b0, b0 + sizeof(b0) / sizeof(float) ); @@ -2119,155 +2119,155 @@ PleiadesImageMetadataInterface { //B0 blue band const float b0[209] = - {0.0016025229,0.0013381709,0.0043437933,0.0110724631,0.0176270388,0.0233671533, - 0.057403285,0.1345548468,0.2237631463,0.3085427458,0.4615565735,0.650820526, - 0.755369094,0.7477203647,0.7168186424,0.7185381794,0.7566962056,0.8101088802, - 0.842166474,0.8234370764,0.775247228,0.7527006008,0.7802203291,0.8199266521, - 0.8516631705,0.8602751259,0.858684019,0.8658261626,0.8828217532,0.9040412689, - 0.9196954778,0.9325955734,0.9502333148,0.9757980507,0.9949769539,1.0, - 0.995062574,0.9806284516,0.9417497895,0.8436220158,0.6711424576,0.4633403256, - 0.2888651055,0.1670783567,0.0901800876,0.0505194286,0.0314882201,0.0238137335, - 0.0213108438,0.0206298072,0.0195599127,0.0167943833,0.0113582202,0.0066519685, - 0.004144013,0.0030298814,0.0024159139,0.0019903178,0.0015682749,0.0011355438, - 0.0012529075,0.0008355166,0.0005508227,0.000419896,0.0003617449,0.000377798, - 0.0005322716,0.0011091514,0.0019870999,0.0012200722,0.0003753015,0.0001469798, - 7.49175906503e-05,5.2799e-05,5.56530673402e-05,5.74373902992e-05,5.63665682035e-05,3.78155457568e-05, - 3.49615423035e-05,2.06915250367e-05,1.35565164034e-05,1.99783095738e-05,4.281e-06,1.10591920316e-05, - 1.21295146767e-05,1.14159424633e-05,9.27551122337e-06,1.1773e-05,1.92645233101e-05,8.919e-06, - 1.1416e-05,1.71237353197e-05,4.99450604335e-06,8.56172495969e-06,2.4259e-05,3.85286898697e-05, - 1.2843e-05,2.35456711903e-05,9.989e-06,1.14162992137e-05,2.06915250367e-05,1.39132668351e-05, - 5.708e-06,2.854e-06,8.562e-06,1.24862651084e-05,8.562e-06,9.27565392354e-06, - 6.42150777002e-06,1.1773e-05,5.708e-06,1.35566591036e-05,1.7124e-05,7.13522268362e-06, - 9.989e-06,2.71133895572e-05,6.35015768369e-05,0.0002194051,0.0007613054,0.0011194829, - 0.0007541704,0.0004084771,0.0003546099,0.0004063402,0.0006792528,0.0016292935, - 0.0024002169,0.0010317222,0.0003481884,0.000165889,8.2766100147e-05,9.70361174137e-05, - 4.63775561168e-05,2.63994605933e-05,3.21075388501e-05,4.1026442342e-05,1.5697e-05,8.9192602423e-06, - 4.70910569802e-05,7.88411318978e-05,2.21185267634e-05,5.35134923013e-05,8.2766100147e-05,0.0001052421, - 0.0001833697,0.00026043,0.000441657,0.000710293,0.000864763,0.0007370464, - 0.0005515362,0.000394566,0.0002811193,0.0002340283,0.0002247528,0.0001922885, - 0.0002197583,0.0002340276,0.0002454443,0.0002454436,0.0002782653,0.000350685, - 0.000431668,0.0005326263,0.0006885283,0.0010277909,0.0015625669,0.0026085734, - 0.0045749675,0.0090618891,0.0171625498,0.0237927565,0.021523467,0.0159138519, - 0.011956134,0.0094824265,0.007869201,0.0072241962,0.0072420338,0.0075677469, - 0.0083793541,0.0098637927,0.0122586583,0.0162673916,0.0226015668,0.0320271273, - 0.0444304123,0.0546690783,0.0564243618,0.048004124,0.0357991923,0.0258336544, - 0.0188870814,0.0144386889,0.0116792956,0.0099112405,0.008646917,0.0078099805, - 0.0072270502,0.006995876,0.0069230989,0.0069141801,0.0070208485,0.0072527363, - 0.0073726044,0.0075049588,0.007470354,0.0070672332,0.0063679952 + {0.0016025229f,0.0013381709f,0.0043437933f,0.0110724631f,0.0176270388f,0.0233671533f, + 0.057403285f,0.1345548468f,0.2237631463f,0.3085427458f,0.4615565735f,0.650820526f, + 0.755369094f,0.7477203647f,0.7168186424f,0.7185381794f,0.7566962056f,0.8101088802f, + 0.842166474f,0.8234370764f,0.775247228f,0.7527006008f,0.7802203291f,0.8199266521f, + 0.8516631705f,0.8602751259f,0.858684019f,0.8658261626f,0.8828217532f,0.9040412689f, + 0.9196954778f,0.9325955734f,0.9502333148f,0.9757980507f,0.9949769539f,1.0f, + 0.995062574f,0.9806284516f,0.9417497895f,0.8436220158f,0.6711424576f,0.4633403256f, + 0.2888651055f,0.1670783567f,0.0901800876f,0.0505194286f,0.0314882201f,0.0238137335f, + 0.0213108438f,0.0206298072f,0.0195599127f,0.0167943833f,0.0113582202f,0.0066519685f, + 0.004144013f,0.0030298814f,0.0024159139f,0.0019903178f,0.0015682749f,0.0011355438f, + 0.0012529075f,0.0008355166f,0.0005508227f,0.000419896f,0.0003617449f,0.000377798f, + 0.0005322716f,0.0011091514f,0.0019870999f,0.0012200722f,0.0003753015f,0.0001469798f, + 7.49175906503e-05f,5.2799e-05f,5.56530673402e-05f,5.74373902992e-05f,5.63665682035e-05f,3.78155457568e-05f, + 3.49615423035e-05f,2.06915250367e-05f,1.35565164034e-05f,1.99783095738e-05f,4.281e-06f,1.10591920316e-05f, + 1.21295146767e-05f,1.14159424633e-05f,9.27551122337e-06f,1.1773e-05f,1.92645233101e-05f,8.919e-06f, + 1.1416e-05f,1.71237353197e-05f,4.99450604335e-06f,8.56172495969e-06f,2.4259e-05f,3.85286898697e-05f, + 1.2843e-05f,2.35456711903e-05f,9.989e-06f,1.14162992137e-05f,2.06915250367e-05f,1.39132668351e-05f, + 5.708e-06f,2.854e-06f,8.562e-06f,1.24862651084e-05f,8.562e-06f,9.27565392354e-06f, + 6.42150777002e-06f,1.1773e-05f,5.708e-06f,1.35566591036e-05f,1.7124e-05f,7.13522268362e-06f, + 9.989e-06f,2.71133895572e-05f,6.35015768369e-05f,0.0002194051f,0.0007613054f,0.0011194829f, + 0.0007541704f,0.0004084771f,0.0003546099f,0.0004063402f,0.0006792528f,0.0016292935f, + 0.0024002169f,0.0010317222f,0.0003481884f,0.000165889f,8.2766100147e-05f,9.70361174137e-05f, + 4.63775561168e-05f,2.63994605933e-05f,3.21075388501e-05f,4.1026442342e-05f,1.5697e-05f,8.9192602423e-06f, + 4.70910569802e-05f,7.88411318978e-05f,2.21185267634e-05f,5.35134923013e-05f,8.2766100147e-05f,0.0001052421f, + 0.0001833697f,0.00026043f,0.000441657f,0.000710293f,0.000864763f,0.0007370464f, + 0.0005515362f,0.000394566f,0.0002811193f,0.0002340283f,0.0002247528f,0.0001922885f, + 0.0002197583f,0.0002340276f,0.0002454443f,0.0002454436f,0.0002782653f,0.000350685f, + 0.000431668f,0.0005326263f,0.0006885283f,0.0010277909f,0.0015625669f,0.0026085734f, + 0.0045749675f,0.0090618891f,0.0171625498f,0.0237927565f,0.021523467f,0.0159138519f, + 0.011956134f,0.0094824265f,0.007869201f,0.0072241962f,0.0072420338f,0.0075677469f, + 0.0083793541f,0.0098637927f,0.0122586583f,0.0162673916f,0.0226015668f,0.0320271273f, + 0.0444304123f,0.0546690783f,0.0564243618f,0.048004124f,0.0357991923f,0.0258336544f, + 0.0188870814f,0.0144386889f,0.0116792956f,0.0099112405f,0.008646917f,0.0078099805f, + 0.0072270502f,0.006995876f,0.0069230989f,0.0069141801f,0.0070208485f,0.0072527363f, + 0.0073726044f,0.0075049588f,0.007470354f,0.0070672332f,0.0063679952f }; //B1 green band const float b1[209] = - {3.2793605247e-06,3.2793605247e-06,4.919e-06,6.5587210494e-06,6.5587210494e-06,2.86944045911e-06, - 6.5587210494e-06,5.73885632302e-06,4.09920065587e-06,2.86943226071e-06,1.47571223611e-05,2.29553597049e-05, - 1.06579217053e-05,1.27075220332e-05,2.21356835417e-05,1.8856323017e-05,9.01824144292e-05,0.0001151875, - 0.0001123181,0.0001893831,0.000323017,0.0004849346,0.0006238983,0.0008153327, - 0.0015208034,0.0041299447,0.009953679,0.0196421398,0.0325476532,0.0567927854, - 0.1237909408,0.2859094077,0.5289756098,0.7716253331,0.8838040582,0.9079565485, - 0.9131461365,0.913728223,0.9224841156,0.9367083419,0.9497601968,0.9544988727, - 0.9585816766,0.9642057799,0.9705267473,0.9722648084,0.967517934,0.9589096126, - 0.9524492724,0.9524656692,0.9560483706,0.95517934,0.948989547,0.9471449067, - 0.9544496823,0.9710596434,0.9898175856,1.0,0.9953597049,0.9698216848, - 0.9253043656,0.8633244517,0.7948284485,0.7238967001,0.6453265013,0.5438524288, - 0.4170280795,0.2766706292,0.1575273622,0.0856068867,0.049225661,0.0327237549, - 0.0237934003,0.0181966796,0.0140618979,0.0099658947,0.0058454601,0.0030383275, - 0.0015355606,0.0008386965,0.0004878049,0.0003115409,0.0002074196,0.0001381439, - 9.26419348227e-05,7.00964131994e-05,6.39475302316e-05,5.41093666735e-05,4.0992e-05,7.00968231195e-05, - 4.75507276081e-05,4.71408895265e-05,6.23078499693e-05,6.72277925804e-05,0.0001483911,0.0002512826, - 0.0002992416,0.0002303743,0.0001270752,6.72265628203e-05,3.11539249846e-05,3.15638450502e-05, - 1.72166427547e-05,6.5587210494e-06,5.73888091822e-06,1.76265628203e-05,1.06579217053e-05,1.72168067227e-05, - 1.14777618364e-05,2.86946505431e-06,3.2793605247e-06,2.86941586391e-06,1.393728223e-05,1.27072760812e-05, - 1.72166427547e-05,9.83840951015e-06,7.37856118057e-06,2.41853658537e-05,3.2793605247e-05,0.0001295372, - 0.000277106,0.0001893831,0.0001237959,2.4185e-05,7.37856118057e-06,7.37870875179e-06, - 4.09920065587e-06,1.0248e-05,9.83808157409e-06,3.2793605247e-06,1.5577e-05,2.29556056569e-05, - 7.37856118057e-06,1.02477556876e-05,9.01824144292e-06,6.96851813896e-06,1.72166427547e-05,2.29553597049e-05, - 2.45952039352e-06,2.1315e-05,9.83808157409e-06,1.1887763886e-05,3.44332855093e-05,9.01856937897e-06, - 1.80364828858e-05,1.72165607706e-05,1.8856323017e-05,1.8037e-05,2.86944045911e-05,2.86944865751e-05, - 2.0496e-05,4.34515269522e-05,2.95142447223e-05,5.28796884608e-05,9.34617749539e-05,0.0001336339, - 0.000277106,0.0007050527,0.0031850789,0.0141905308,0.0083394138,0.0022443452, - 0.0009182209,0.000571841,0.0004369748,0.0004029514,0.0004181185,0.000445174, - 0.0005173191,0.0006021734,0.0007575323,0.0011108916,0.0019381021,0.0036905349, - 0.0063570404,0.0102714491,0.013107604,0.0132605042,0.0111153925,0.0083664685, - 0.0065644599,0.0056847797,0.0053797909,0.0056228653,0.0062004509,0.007239172, - 0.0089198606,0.0115101455,0.0149415864,0.0192686206,0.0234785817,0.0264402542, - 0.0270489854,0.0255453986,0.0233974175,0.0213945481,0.0199442509,0.0192531256, - 0.0190744005,0.0196892806,0.0206935848,0.0220106579,0.0232301701,0.0237573273, - 0.0229858578,0.0206595614,0.0172248412,0.01329215,0.0097815126 + {3.2793605247e-06f,3.2793605247e-06f,4.919e-06f,6.5587210494e-06f,6.5587210494e-06f,2.86944045911e-06f, + 6.5587210494e-06f,5.73885632302e-06f,4.09920065587e-06f,2.86943226071e-06f,1.47571223611e-05f,2.29553597049e-05f, + 1.06579217053e-05f,1.27075220332e-05f,2.21356835417e-05f,1.8856323017e-05f,9.01824144292e-05f,0.0001151875f, + 0.0001123181f,0.0001893831f,0.000323017f,0.0004849346f,0.0006238983f,0.0008153327f, + 0.0015208034f,0.0041299447f,0.009953679f,0.0196421398f,0.0325476532f,0.0567927854f, + 0.1237909408f,0.2859094077f,0.5289756098f,0.7716253331f,0.8838040582f,0.9079565485f, + 0.9131461365f,0.913728223f,0.9224841156f,0.9367083419f,0.9497601968f,0.9544988727f, + 0.9585816766f,0.9642057799f,0.9705267473f,0.9722648084f,0.967517934f,0.9589096126f, + 0.9524492724f,0.9524656692f,0.9560483706f,0.95517934f,0.948989547f,0.9471449067f, + 0.9544496823f,0.9710596434f,0.9898175856f,1.0f,0.9953597049f,0.9698216848f, + 0.9253043656f,0.8633244517f,0.7948284485f,0.7238967001f,0.6453265013f,0.5438524288f, + 0.4170280795f,0.2766706292f,0.1575273622f,0.0856068867f,0.049225661f,0.0327237549f, + 0.0237934003f,0.0181966796f,0.0140618979f,0.0099658947f,0.0058454601f,0.0030383275f, + 0.0015355606f,0.0008386965f,0.0004878049f,0.0003115409f,0.0002074196f,0.0001381439f, + 9.26419348227e-05f,7.00964131994e-05f,6.39475302316e-05f,5.41093666735e-05f,4.0992e-05f,7.00968231195e-05f, + 4.75507276081e-05f,4.71408895265e-05f,6.23078499693e-05f,6.72277925804e-05f,0.0001483911f,0.0002512826f, + 0.0002992416f,0.0002303743f,0.0001270752f,6.72265628203e-05f,3.11539249846e-05f,3.15638450502e-05f, + 1.72166427547e-05f,6.5587210494e-06f,5.73888091822e-06f,1.76265628203e-05f,1.06579217053e-05f,1.72168067227e-05f, + 1.14777618364e-05f,2.86946505431e-06f,3.2793605247e-06f,2.86941586391e-06f,1.393728223e-05f,1.27072760812e-05f, + 1.72166427547e-05f,9.83840951015e-06f,7.37856118057e-06f,2.41853658537e-05f,3.2793605247e-05f,0.0001295372f, + 0.000277106f,0.0001893831f,0.0001237959f,2.4185e-05f,7.37856118057e-06f,7.37870875179e-06f, + 4.09920065587e-06f,1.0248e-05f,9.83808157409e-06f,3.2793605247e-06f,1.5577e-05f,2.29556056569e-05f, + 7.37856118057e-06f,1.02477556876e-05f,9.01824144292e-06f,6.96851813896e-06f,1.72166427547e-05f,2.29553597049e-05f, + 2.45952039352e-06f,2.1315e-05f,9.83808157409e-06f,1.1887763886e-05f,3.44332855093e-05f,9.01856937897e-06f, + 1.80364828858e-05f,1.72165607706e-05f,1.8856323017e-05f,1.8037e-05f,2.86944045911e-05f,2.86944865751e-05f, + 2.0496e-05f,4.34515269522e-05f,2.95142447223e-05f,5.28796884608e-05f,9.34617749539e-05f,0.0001336339f, + 0.000277106f,0.0007050527f,0.0031850789f,0.0141905308f,0.0083394138f,0.0022443452f, + 0.0009182209f,0.000571841f,0.0004369748f,0.0004029514f,0.0004181185f,0.000445174f, + 0.0005173191f,0.0006021734f,0.0007575323f,0.0011108916f,0.0019381021f,0.0036905349f, + 0.0063570404f,0.0102714491f,0.013107604f,0.0132605042f,0.0111153925f,0.0083664685f, + 0.0065644599f,0.0056847797f,0.0053797909f,0.0056228653f,0.0062004509f,0.007239172f, + 0.0089198606f,0.0115101455f,0.0149415864f,0.0192686206f,0.0234785817f,0.0264402542f, + 0.0270489854f,0.0255453986f,0.0233974175f,0.0213945481f,0.0199442509f,0.0192531256f, + 0.0190744005f,0.0196892806f,0.0206935848f,0.0220106579f,0.0232301701f,0.0237573273f, + 0.0229858578f,0.0206595614f,0.0172248412f,0.01329215f,0.0097815126f }; //B2 red band const float b2[209] = - {0.0004536879,0.0008531472,0.000520901,0.0011945588,0.0051417966,0.0080033148, - 0.0066930427,0.0108594102,0.0246908583,0.0653593224,0.1225423328,0.0570092494, - 0.0213752702,0.0127972076,0.006277544,0.0023536016,0.0009409824,0.0005174639, - 0.0003742544,0.0003818922,0.0005155545,0.0008462731,0.0010127781,0.0006431042, - 0.0003513408,0.0002512851,0.000223025,0.000251667,0.0003551597,0.0004998969, - 0.0005262475,0.0003864772,0.0002528126,0.0001626868,0.0001069298,8.78352058781e-05, - 7.02681647025e-05,5.84297356542e-05,5.49924767237e-05,4.81185698901e-05,3.66616511491e-05,3.20791738908e-05, - 1.90946099735e-05,1.79493916457e-05,3.74254355481e-05,2.40590558097e-05,3.43702979523e-05,1.48934902656e-05, - 6.87405959046e-06,7.256e-06,3.8189219947e-06,2.29135319682e-06,9.16541278728e-06,2.94056993592e-05, - 2.36773163671e-05,2.90238071597e-05,3.8953e-05,4.5063e-05,6.95043803035e-05,8.13422747027e-05, - 0.0001038747,0.0001229693,0.0001351898,0.0001535207,0.0001833083,0.0002214967, - 0.0007454536,0.0012442124,0.0021416515,0.0038193268,0.0068045552,0.0123329031, - 0.0221780076,0.0413324983,0.0780709861,0.151934284,0.277674582,0.4510376011, - 0.6291322645,0.7625485958,0.8329450763,0.8579055504,0.8658870974,0.8692630244, - 0.8752205427,0.8857760431,0.9005934605,0.9174883714,0.9348797421,0.947810612, - 0.9569531113,0.9623301534,0.9647666257,0.9624294454,0.9613066823,0.9620246397, - 0.9699145325,0.9811574389,0.9933932649,1.0,0.9809512171,0.9522634751, - 0.9131729895,0.8694005056,0.8252079403,0.7830470415,0.7361270021,0.6734890435, - 0.5877527172,0.4804914189,0.3630068664,0.2523031919,0.1626028245,0.102221085, - 0.0641273381,0.0419155713,0.0284639532,0.0204548336,0.0153696335,0.0121174395, - 0.0098810788,0.0083168483,0.0071016673,0.0060949919,0.0051723479,0.0043142285, - 0.0034950774,0.0027713917,0.0035890229,0.0030310784,0.0023173219,0.001784208, - 0.0013312762,0.0010207978,0.0007897531,0.0006385253,0.0005079166,0.0004120624, - 0.0003788371,0.0003593606,0.0002978759,0.0002787813,0.0002810727,0.0002623607, - 0.0002856554,0.0002948208,0.0002757262,0.0003158256,0.0003750181,0.0004296295, - 0.0005186096,0.0005747478,0.0006194291,0.0006503624,0.0006515081,0.0006041535, - 0.0005369404,0.0004643817,0.0003765457,0.0003215532,0.0002841278,0.0002539583, - 0.000226844,0.0002226432,0.0001672688,0.0001978194,0.0002207337,0.000208895, - 0.0002329542,0.0002054572,0.0001871272,0.0002505213,0.0002932932,0.0002635079, - 0.0002589229,0.000449106,0.0005361766,0.000566728,0.0008210682,0.0009856638, - 0.0013075989,0.0017612792,0.0024028657,0.0032682258,0.0043635003,0.0056615366, - 0.0068900991,0.0078222979,0.0083298327,0.0084363806,0.0081854774,0.0081381228, - 0.0080006416,0.0077676873,0.0077844906,0.0079983502,0.0081518709,0.008505885, - 0.008792686,0.0093120594,0.009752763,0.0101358009,0.0103874678,0.0104061805, - 0.0101713168,0.009522482,0.008608614,0.0073373101,0.0059842508 + {0.0004536879f,0.0008531472f,0.000520901f,0.0011945588f,0.0051417966f,0.0080033148f, + 0.0066930427f,0.0108594102f,0.0246908583f,0.0653593224f,0.1225423328f,0.0570092494f, + 0.0213752702f,0.0127972076f,0.006277544f,0.0023536016f,0.0009409824f,0.0005174639f, + 0.0003742544f,0.0003818922f,0.0005155545f,0.0008462731f,0.0010127781f,0.0006431042f, + 0.0003513408f,0.0002512851f,0.000223025f,0.000251667f,0.0003551597f,0.0004998969f, + 0.0005262475f,0.0003864772f,0.0002528126f,0.0001626868f,0.0001069298f,8.78352058781e-05f, + 7.02681647025e-05f,5.84297356542e-05f,5.49924767237e-05f,4.81185698901e-05f,3.66616511491e-05f,3.20791738908e-05f, + 1.90946099735e-05f,1.79493916457e-05f,3.74254355481e-05f,2.40590558097e-05f,3.43702979523e-05f,1.48934902656e-05f, + 6.87405959046e-06f,7.256e-06f,3.8189219947e-06f,2.29135319682e-06f,9.16541278728e-06f,2.94056993592e-05f, + 2.36773163671e-05f,2.90238071597e-05f,3.8953e-05f,4.5063e-05f,6.95043803035e-05f,8.13422747027e-05f, + 0.0001038747f,0.0001229693f,0.0001351898f,0.0001535207f,0.0001833083f,0.0002214967f, + 0.0007454536f,0.0012442124f,0.0021416515f,0.0038193268f,0.0068045552f,0.0123329031f, + 0.0221780076f,0.0413324983f,0.0780709861f,0.151934284f,0.277674582f,0.4510376011f, + 0.6291322645f,0.7625485958f,0.8329450763f,0.8579055504f,0.8658870974f,0.8692630244f, + 0.8752205427f,0.8857760431f,0.9005934605f,0.9174883714f,0.9348797421f,0.947810612f, + 0.9569531113f,0.9623301534f,0.9647666257f,0.9624294454f,0.9613066823f,0.9620246397f, + 0.9699145325f,0.9811574389f,0.9933932649f,1.0f,0.9809512171f,0.9522634751f, + 0.9131729895f,0.8694005056f,0.8252079403f,0.7830470415f,0.7361270021f,0.6734890435f, + 0.5877527172f,0.4804914189f,0.3630068664f,0.2523031919f,0.1626028245f,0.102221085f, + 0.0641273381f,0.0419155713f,0.0284639532f,0.0204548336f,0.0153696335f,0.0121174395f, + 0.0098810788f,0.0083168483f,0.0071016673f,0.0060949919f,0.0051723479f,0.0043142285f, + 0.0034950774f,0.0027713917f,0.0035890229f,0.0030310784f,0.0023173219f,0.001784208f, + 0.0013312762f,0.0010207978f,0.0007897531f,0.0006385253f,0.0005079166f,0.0004120624f, + 0.0003788371f,0.0003593606f,0.0002978759f,0.0002787813f,0.0002810727f,0.0002623607f, + 0.0002856554f,0.0002948208f,0.0002757262f,0.0003158256f,0.0003750181f,0.0004296295f, + 0.0005186096f,0.0005747478f,0.0006194291f,0.0006503624f,0.0006515081f,0.0006041535f, + 0.0005369404f,0.0004643817f,0.0003765457f,0.0003215532f,0.0002841278f,0.0002539583f, + 0.000226844f,0.0002226432f,0.0001672688f,0.0001978194f,0.0002207337f,0.000208895f, + 0.0002329542f,0.0002054572f,0.0001871272f,0.0002505213f,0.0002932932f,0.0002635079f, + 0.0002589229f,0.000449106f,0.0005361766f,0.000566728f,0.0008210682f,0.0009856638f, + 0.0013075989f,0.0017612792f,0.0024028657f,0.0032682258f,0.0043635003f,0.0056615366f, + 0.0068900991f,0.0078222979f,0.0083298327f,0.0084363806f,0.0081854774f,0.0081381228f, + 0.0080006416f,0.0077676873f,0.0077844906f,0.0079983502f,0.0081518709f,0.008505885f, + 0.008792686f,0.0093120594f,0.009752763f,0.0101358009f,0.0103874678f,0.0104061805f, + 0.0101713168f,0.009522482f,0.008608614f,0.0073373101f,0.0059842508f }; //B3 nir band const float b3[209] = - {0.0001962709,0.0007612586,0.0003823311,0.0005128001,0.0016870217,0.0026649725, - 0.0012252747,0.0007391367,0.0007408374,0.0007538843,0.0007760073,0.0009904326, - 0.0015486111,0.0021799679,0.0019876678,0.001044887,0.0004923789,0.0002830611, - 0.0002144231,0.0001957036,0.0002132886,0.0002819266,0.000417501,0.0006069659, - 0.0006410002,0.000437355,0.0002654762,0.0001905983,0.0001622354,0.0001707443, - 0.0001849257,0.0002461883,0.0003834656,0.0005627165,0.0006784391,0.0006143403, - 0.0004844373,0.0003880048,0.0003596408,0.000353401,0.0003970798,0.0004623154, - 0.0005513736,0.0006410013,0.0007306268,0.0007572878,0.0007669312,0.0007192805, - 0.0006364621,0.0005706603,0.0005286833,0.0004878409,0.0004764957,0.0005519409, - 0.0007181471,0.0012241402,0.0022656237,0.0028788283,0.00204099,0.0008389819, - 0.0003789275,0.0002252021,0.0001395452,0.0001242292,9.98371972976e-05,9.70007998321e-05, - 0.0001043753,0.0001242292,0.0001724461,0.000286467,0.0005275488,0.0008208217, - 0.0006602869,0.0003221996,0.000167908,0.0001032404,6.80708163393e-05,5.72929370855e-05, - 4.76495714375e-05,3.23336377612e-05,3.63044353809e-05,4.14097466064e-05,4.4246e-05,3.91404924924e-05, - 5.78601938884e-05,6.35326484653e-05,6.2398248311e-05,9.01938316495e-05,0.0001009717,0.0001525921, - 0.0001917328,0.0001968381,0.0001860602,0.0001429487,0.0001361416,9.47317726208e-05, - 8.96265748467e-05,8.79249178896e-05,7.9416e-05,7.54452682274e-05,7.60124115788e-05,8.50885204241e-05, - 9.41646292693e-05,8.22522364099e-05,8.1685e-05,0.0001066443,0.000121393,0.0001350071, - 0.0001690425,0.0002036441,0.0002507275,0.0003187972,0.0003970798,0.000508261, - 0.0006330586,0.000795859,0.0009688746,0.0011538003,0.0013523402,0.0015542836, - 0.0017562271,0.0019888024,0.002250875,0.0025345034,0.0029032203,0.0052357916, - 0.0064009258,0.0080125023,0.0101470897,0.0131093047,0.017134559,0.0229045817, - 0.030977894,0.0426621362,0.0591898438,0.0835072354,0.1178884433,0.1663775548, - 0.2311140356,0.3159359454,0.417216244,0.528495011,0.6409593447,0.7472394448, - 0.8385519068,0.9088123344,0.9593662607,0.988113701,1.0,0.9992058405, - 0.9896418908,0.9676958596,0.9514360106,0.9374939729,0.9254715322,0.9152234708, - 0.9087828371,0.9026076795,0.8966832495,0.8924832801,0.8854912728,0.8776551873, - 0.8676385667,0.8568958573,0.8474408209,0.8360480353,0.8236977202,0.8130435029, - 0.8016268925,0.7921616455,0.7827951012,0.7769353384,0.7714647138,0.7631453255, - 0.7543403654,0.7452370283,0.734920896,0.7255123747,0.714614237,0.7030887133, - 0.6919477897,0.6816475407,0.6705202312,0.6595358705,0.6475962493,0.6291853625, - 0.611093274,0.5934323007,0.5760594939,0.5599936467,0.5448751184,0.5306142824, - 0.5154832744,0.4976759489,0.4734098374,0.4387697334,0.3934220901,0.3367690187, - 0.2742732022,0.2114336281,0.1535541475,0.1063407965,0.0704419498,0.0459120639, - 0.0295347927,0.0192753862,0.0126804586,0.0084623824,0.0057690017 + {0.0001962709f,0.0007612586f,0.0003823311f,0.0005128001f,0.0016870217f,0.0026649725f, + 0.0012252747f,0.0007391367f,0.0007408374f,0.0007538843f,0.0007760073f,0.0009904326f, + 0.0015486111f,0.0021799679f,0.0019876678f,0.001044887f,0.0004923789f,0.0002830611f, + 0.0002144231f,0.0001957036f,0.0002132886f,0.0002819266f,0.000417501f,0.0006069659f, + 0.0006410002f,0.000437355f,0.0002654762f,0.0001905983f,0.0001622354f,0.0001707443f, + 0.0001849257f,0.0002461883f,0.0003834656f,0.0005627165f,0.0006784391f,0.0006143403f, + 0.0004844373f,0.0003880048f,0.0003596408f,0.000353401f,0.0003970798f,0.0004623154f, + 0.0005513736f,0.0006410013f,0.0007306268f,0.0007572878f,0.0007669312f,0.0007192805f, + 0.0006364621f,0.0005706603f,0.0005286833f,0.0004878409f,0.0004764957f,0.0005519409f, + 0.0007181471f,0.0012241402f,0.0022656237f,0.0028788283f,0.00204099f,0.0008389819f, + 0.0003789275f,0.0002252021f,0.0001395452f,0.0001242292f,9.98371972976e-05f,9.70007998321e-05f, + 0.0001043753f,0.0001242292f,0.0001724461f,0.000286467f,0.0005275488f,0.0008208217f, + 0.0006602869f,0.0003221996f,0.000167908f,0.0001032404f,6.80708163393e-05f,5.72929370855e-05f, + 4.76495714375e-05f,3.23336377612e-05f,3.63044353809e-05f,4.14097466064e-05f,4.4246e-05f,3.91404924924e-05f, + 5.78601938884e-05f,6.35326484653e-05f,6.2398248311e-05f,9.01938316495e-05f,0.0001009717f,0.0001525921f, + 0.0001917328f,0.0001968381f,0.0001860602f,0.0001429487f,0.0001361416f,9.47317726208e-05f, + 8.96265748467e-05f,8.79249178896e-05f,7.9416e-05f,7.54452682274e-05f,7.60124115788e-05f,8.50885204241e-05f, + 9.41646292693e-05f,8.22522364099e-05f,8.1685e-05f,0.0001066443f,0.000121393f,0.0001350071f, + 0.0001690425f,0.0002036441f,0.0002507275f,0.0003187972f,0.0003970798f,0.000508261f, + 0.0006330586f,0.000795859f,0.0009688746f,0.0011538003f,0.0013523402f,0.0015542836f, + 0.0017562271f,0.0019888024f,0.002250875f,0.0025345034f,0.0029032203f,0.0052357916f, + 0.0064009258f,0.0080125023f,0.0101470897f,0.0131093047f,0.017134559f,0.0229045817f, + 0.030977894f,0.0426621362f,0.0591898438f,0.0835072354f,0.1178884433f,0.1663775548f, + 0.2311140356f,0.3159359454f,0.417216244f,0.528495011f,0.6409593447f,0.7472394448f, + 0.8385519068f,0.9088123344f,0.9593662607f,0.988113701f,1.0f,0.9992058405f, + 0.9896418908f,0.9676958596f,0.9514360106f,0.9374939729f,0.9254715322f,0.9152234708f, + 0.9087828371f,0.9026076795f,0.8966832495f,0.8924832801f,0.8854912728f,0.8776551873f, + 0.8676385667f,0.8568958573f,0.8474408209f,0.8360480353f,0.8236977202f,0.8130435029f, + 0.8016268925f,0.7921616455f,0.7827951012f,0.7769353384f,0.7714647138f,0.7631453255f, + 0.7543403654f,0.7452370283f,0.734920896f,0.7255123747f,0.714614237f,0.7030887133f, + 0.6919477897f,0.6816475407f,0.6705202312f,0.6595358705f,0.6475962493f,0.6291853625f, + 0.611093274f,0.5934323007f,0.5760594939f,0.5599936467f,0.5448751184f,0.5306142824f, + 0.5154832744f,0.4976759489f,0.4734098374f,0.4387697334f,0.3934220901f,0.3367690187f, + 0.2742732022f,0.2114336281f,0.1535541475f,0.1063407965f,0.0704419498f,0.0459120639f, + 0.0295347927f,0.0192753862f,0.0126804586f,0.0084623824f,0.0057690017f }; //Add multispectral bands to the temporary list diff --git a/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx index 4dc45688d6f3e86a3637a86ae5735456627062f8..d6f76f4c65d691d2028956e08121e492784da0a8 100644 --- a/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx @@ -28,7 +28,6 @@ namespace otb SarImageMetadataInterface ::SarImageMetadataInterface() { - } const std::string @@ -104,13 +103,9 @@ bool SarImageMetadataInterface ::HasCalibrationLookupDataFlag() const { - const ImageKeywordlist imageKeywordlist = this->GetImageKeywordlist(); + const ImageKeywordlist & imageKeywordlist = this->GetImageKeywordlist(); /* checking if the key exist is more than enough */ - if (imageKeywordlist.HasKey("support_data.calibration_lookup_flag")) - { - return true; - } - return false; + return imageKeywordlist.HasKey("support_data.calibration_lookup_flag"); } SarImageMetadataInterface::RealType diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx index daac6d7c363cabf02cf7036876653768b23144b3..2a42ba1430cd4d71b81388037a8cfc80f0bee821 100644 --- a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx @@ -22,9 +22,11 @@ #include "otbMacro.h" #include "itkMetaDataObject.h" #include "otbImageKeywordlist.h" +#include "ossimTimeUtilities.h" //useful constants #include <otbMath.h> +#include <iomanip> namespace otb { @@ -32,70 +34,75 @@ namespace otb Sentinel1ImageMetadataInterface ::Sentinel1ImageMetadataInterface() { - } bool Sentinel1ImageMetadataInterface::CanRead() const { - std::string sensorID = GetSensorID(); + const std::string sensorID = GetSensorID(); - if (sensorID.find("SENTINEL-1") != std::string::npos) - { - return true; - } - else - return false; + return sensorID.find("SENTINEL-1") != std::string::npos; } void Sentinel1ImageMetadataInterface ::CreateCalibrationLookupData(const short type) - { - bool sigmaLut = false; - bool betaLut = false; - bool gammaLut = false; - bool dnLut = false; +{ + bool sigmaLut = false; + bool betaLut = false; + bool gammaLut = false; + bool dnLut = false; - switch (type) - { - case SarCalibrationLookupData::BETA: + switch (type) + { + case SarCalibrationLookupData::BETA: { + otbMsgDevMacro("betaNought"); betaLut = true; } - break; + break; - case SarCalibrationLookupData::GAMMA: + case SarCalibrationLookupData::GAMMA: { + otbMsgDevMacro("gamma"); gammaLut = true; } - break; + break; - case SarCalibrationLookupData::DN: + case SarCalibrationLookupData::DN: { + otbMsgDevMacro("dn"); dnLut = true; } - break; + break; - case SarCalibrationLookupData::SIGMA: - default: - sigmaLut = true; - break; - } + case SarCalibrationLookupData::SIGMA: + default: + otbMsgDevMacro("sigmaNought"); + sigmaLut = true; + break; + } - const ImageKeywordlistType imageKeywordlist = this->GetImageKeywordlist(); + const ImageKeywordlistType imageKeywordlist = this->GetImageKeywordlist(); - const double firstLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.startTime"), "calibration.startTime(double)"); + // const double firstLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.startTime"), "calibration.startTime(double)"); - const double lastLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.stopTime"), "calibration.stopTime(double)"); + // const double lastLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.stopTime"), "calibration.stopTime(double)"); + using namespace ossimplugins::time; + const ModifiedJulianDate firstLineTime = toModifiedJulianDate(imageKeywordlist.GetMetadataByKey("calibration.startTime")); + const ModifiedJulianDate lastLineTime = toModifiedJulianDate(imageKeywordlist.GetMetadataByKey("calibration.stopTime")); + otbMsgDevMacro(<<"calibration.startTime: "<<std::setprecision(16) << firstLineTime); + otbMsgDevMacro(<<"calibration.stopTime : "<<std::setprecision(16) << lastLineTime); - const std::string bandPrefix = "Band[0]."; //make && use GetBandPrefix(subSwath, polarisation) + const std::string supportDataPrefix = "support_data."; //make && use GetBandPrefix(subSwath, polarisation) - const int numOfLines = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(bandPrefix + "number_lines"), bandPrefix + "number_lines(int)"); + const int numOfLines = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(supportDataPrefix + "number_lines"), supportDataPrefix + "number_lines(int)"); + otbMsgDevMacro(<<"numOfLines : " << numOfLines); const int count = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey("calibration.count"), "calibration.count"); std::vector<Sentinel1CalibrationStruct> calibrationVectorList(count); + double lastMJD = 0; for(int i = 0; i < count; i++) { @@ -103,40 +110,57 @@ Sentinel1ImageMetadataInterface std::stringstream prefix; prefix << "calibration.calibrationVector[" << i << "]."; + const std::string sPrefix = prefix.str(); - calibrationVector.line = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(prefix.str() + "line"), prefix.str() + "line"); + calibrationVector.line = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(sPrefix + "line"), sPrefix + "line"); - calibrationVector.timeMJD = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey(prefix.str() + "azimuthTime"), prefix.str() + "azimuthTime"); + // TODO: don't manipulate doubles, but ModifiedJulianDate for a better type + // safety + const std::string sAzimuth = imageKeywordlist.GetMetadataByKey(sPrefix + "azimuthTime"); + calibrationVector.timeMJD = toModifiedJulianDate(sAzimuth).as_day_frac(); + calibrationVector.deltaMJD = calibrationVector.timeMJD - lastMJD; + lastMJD = calibrationVector.timeMJD; - Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "pixel"), calibrationVector.pixels, prefix.str() + "pixel"); + otbMsgDevMacro(<<sPrefix<<"line : " << calibrationVector.line <<" ;\t"<<sPrefix<<"timeMJD: "<<std::setprecision(16) << calibrationVector.timeMJD << " (" << sAzimuth << ")"); - if (sigmaLut) { - Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "sigmaNought"), calibrationVector.vect, prefix.str() + "sigmaNought"); - } + Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(sPrefix + "pixel"), calibrationVector.pixels, sPrefix + "pixel"); - if (betaLut) { - Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "betaNought"), calibrationVector.vect, prefix.str() + "betaNought"); + // prepare deltaPixels vector + int prev_pixels = 0; + calibrationVector.deltaPixels.resize(calibrationVector.pixels.size()); + for (std::size_t p=0, N=calibrationVector.pixels.size(); p!=N ; ++p) + { + calibrationVector.deltaPixels[p] = (calibrationVector.pixels[p] - prev_pixels); + prev_pixels = calibrationVector.pixels[p]; } - if (gammaLut) { - Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "gamma"), calibrationVector.vect, prefix.str() + "gamma"); - } + if (sigmaLut) + { + Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(sPrefix + "sigmaNought"), calibrationVector.vect, sPrefix + "sigmaNought"); + } - if (dnLut) { - Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "dn"), calibrationVector.vect, prefix.str() + "dn"); - } + if (betaLut) + { + Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(sPrefix + "betaNought"), calibrationVector.vect, sPrefix + "betaNought"); + } - calibrationVectorList[i] = calibrationVector; + if (gammaLut) + { + Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(sPrefix + "gamma"), calibrationVector.vect, sPrefix + "gamma"); + } + + if (dnLut) + { + Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(sPrefix + "dn"), calibrationVector.vect, sPrefix + "dn"); + } + calibrationVectorList[i] = calibrationVector; } - Sentinel1CalibrationLookupData::Pointer sarLut; - sarLut = Sentinel1CalibrationLookupData::New(); - sarLut->InitParameters(type, firstLineTime, lastLineTime, numOfLines, count, calibrationVectorList); + Sentinel1CalibrationLookupData::Pointer sarLut = Sentinel1CalibrationLookupData::New(); + sarLut->InitParameters(type, firstLineTime.as_day_frac(), lastLineTime.as_day_frac(), numOfLines, count, calibrationVectorList); this->SetCalibrationLookupData(sarLut); - - - } +} void Sentinel1ImageMetadataInterface @@ -159,7 +183,6 @@ Sentinel1ImageMetadataInterface const std::string date_time_str = imageKeywordlist.GetMetadataByKey(key); Utils::ConvertStringToVector(date_time_str, dateFields, key, "T:-."); } - } int @@ -256,7 +279,6 @@ Sentinel1ImageMetadataInterface::GetProductionYear() const itkExceptionMacro( << "Invalid production year" ); } return value; - } int diff --git a/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx index 5a13011a0b755e18cbe565a8828f783e442e0eeb..b6d893c456a7b41bdc3c03cef812c970c2bd5327 100644 --- a/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx @@ -919,57 +919,57 @@ WorldView2ImageMetadataInterface { const float b0[301] = { - 5.53407e-06, 6.18974e-06, 6.77586e-06, 4.47741e-06, 2.18462e-06, 2.35814e-06, - 2.74394e-06, 3.35619e-06, 4.12548e-06, 3.76678e-06, 2.97253e-06, 3.87911e-06, - 4.9452e-06, 4.23503e-06, 3.35741e-06, 3.66642e-06, 4.01401e-06, 5.01097e-06, - 6.02754e-06, 5.03579e-06, 3.95097e-06, 3.61214e-06, 3.26677e-06, 3.72693e-06, - 4.18733e-06, 5.20028e-06, 6.2917e-06, 4.84978e-06, 3.39534e-06, 6.07837e-06, - 8.8389e-06, 1.04941e-05, 1.21421e-05, 4.98988e-05, 8.81089e-05, 0.000272275, - 0.000459932, 0.00169883, 0.00295147, 0.0559008, 0.109766, 0.271344, - 0.436163, 0.461822, 0.487533, 0.494856, 0.504992, 0.515215, - 0.525596, 0.529589, 0.535583, 0.529756, 0.522233, 0.527207, - 0.53366, 0.528602, 0.523089, 0.541112, 0.55728, 0.55817, - 0.558232, 0.580899, 0.605533, 0.616208, 0.626792, 0.612118, - 0.595414, 0.612008, 0.630712, 0.649153, 0.671541, 0.663704, - 0.654733, 0.672532, 0.693098, 0.691335, 0.688237, 0.67829, - 0.664973, 0.683323, 0.70156, 0.705992, 0.713576, 0.709848, - 0.709786, 0.738422, 0.765752, 0.762756, 0.757827, 0.759162, - 0.759818, 0.779983, 0.794085, 0.797935, 0.800715, 0.811351, - 0.81929, 0.820814, 0.82303, 0.829794, 0.838869, 0.848913, - 0.860802, 0.858037, 0.858462, 0.865197, 0.870285, 0.877932, - 0.889278, 0.896475, 0.909253, 0.91308, 0.917885, 0.914221, - 0.910762, 0.916979, 0.92489, 0.93683, 0.950791, 0.943998, - 0.936911, 0.932311, 0.929417, 0.938274, 0.951232, 0.960012, - 0.962781, 0.957501, 0.953865, 0.954752, 0.957376, 0.968155, - 0.977735, 0.961332, 0.949217, 0.946955, 0.953334, 0.946656, - 0.952193, 0.96247, 0.969595, 0.983968, 1, 0.99432, - 0.994003, 0.980974, 0.969563, 0.968253, 0.968397, 0.973674, - 0.978855, 0.966847, 0.963741, 0.952252, 0.946654, 0.94592, - 0.952938, 0.954759, 0.962583, 0.962142, 0.956637, 0.950381, - 0.940962, 0.936224, 0.924596, 0.923379, 0.921684, 0.933568, - 0.940831, 0.957977, 0.963832, 0.958143, 0.941297, 0.92426, - 0.903, 0.895878, 0.887152, 0.910523, 0.929402, 0.744019, - 0.553867, 0.320246, 0.0858164, 0.0514292, 0.0172983, 0.0120102, - 0.00659981, 0.00436796, 0.00213134, 0.00153565, 0.000922227, 0.000721841, - 0.000528696, 0.000489722, 0.000449662, 0.000431783, 0.000409049, 0.000407132, - 0.000396445, 0.000420259, 0.000446526, 0.000403311, 0.000361257, 0.00033034, - 0.000298026, 0.000301128, 0.000308537, 0.000286243, 0.000261497, 0.000253604, - 0.000242266, 0.000274627, 0.000307033, 0.000295007, 0.000283703, 0.000261529, - 0.000237475, 0.00024833, 0.000258997, 0.00027011, 0.000282485, 0.000261654, - 0.000240819, 0.000248561, 0.00025802, 0.000273541, 0.000287576, 0.000282785, - 0.000276218, 0.000275306, 0.000273131, 0.000256767, 0.000242183, 0.000239187, - 0.000234252, 0.000223355, 0.000213509, 0.00021573, 0.000218602, 0.000204845, - 0.000191131, 0.000179884, 0.000169031, 0.000177057, 0.000183172, 0.00016757, - 0.0001513, 0.000138821, 0.000125806, 0.000129696, 0.000133722, 0.000122536, - 0.000111436, 0.000102899, 9.41714e-05, 0.000104721, 0.000115227, 9.94755e-05, - 8.3857e-05, 8.4497e-05, 8.52612e-05, 7.76124e-05, 7.00705e-05, 7.06672e-05, - 7.1081e-05, 6.5671e-05, 6.00304e-05, 6.21262e-05, 6.42018e-05, 5.57459e-05, - 4.73181e-05, 4.33172e-05, 3.91675e-05, 3.60807e-05, 3.29177e-05, 3.41277e-05, - 3.52334e-05, 3.14413e-05, 2.76314e-05, 2.55335e-05, 2.34256e-05, 2.1133e-05, - 1.88297e-05, 1.80004e-05, 1.71146e-05, 1.51355e-05, 1.31473e-05, 1.21372e-05, - 1.11225e-05, 9.97857e-06, 8.84718e-06, 8.76091e-06, 8.67416e-06, 7.95176e-06, - 7.22607e-06, 7.06298e-06, 6.8991e-06, 6.66214e-06, 6.42406e-06, 6.36617e-06, - 6.32615e-06 + 5.53407e-06f, 6.18974e-06f, 6.77586e-06f, 4.47741e-06f, 2.18462e-06f, 2.35814e-06f, + 2.74394e-06f, 3.35619e-06f, 4.12548e-06f, 3.76678e-06f, 2.97253e-06f, 3.87911e-06f, + 4.9452e-06f, 4.23503e-06f, 3.35741e-06f, 3.66642e-06f, 4.01401e-06f, 5.01097e-06f, + 6.02754e-06f, 5.03579e-06f, 3.95097e-06f, 3.61214e-06f, 3.26677e-06f, 3.72693e-06f, + 4.18733e-06f, 5.20028e-06f, 6.2917e-06f, 4.84978e-06f, 3.39534e-06f, 6.07837e-06f, + 8.8389e-06f, 1.04941e-05f, 1.21421e-05f, 4.98988e-05f, 8.81089e-05f, 0.000272275f, + 0.000459932f, 0.00169883f, 0.00295147f, 0.0559008f, 0.109766f, 0.271344f, + 0.436163f, 0.461822f, 0.487533f, 0.494856f, 0.504992f, 0.515215f, + 0.525596f, 0.529589f, 0.535583f, 0.529756f, 0.522233f, 0.527207f, + 0.53366f, 0.528602f, 0.523089f, 0.541112f, 0.55728f, 0.55817f, + 0.558232f, 0.580899f, 0.605533f, 0.616208f, 0.626792f, 0.612118f, + 0.595414f, 0.612008f, 0.630712f, 0.649153f, 0.671541f, 0.663704f, + 0.654733f, 0.672532f, 0.693098f, 0.691335f, 0.688237f, 0.67829f, + 0.664973f, 0.683323f, 0.70156f, 0.705992f, 0.713576f, 0.709848f, + 0.709786f, 0.738422f, 0.765752f, 0.762756f, 0.757827f, 0.759162f, + 0.759818f, 0.779983f, 0.794085f, 0.797935f, 0.800715f, 0.811351f, + 0.81929f, 0.820814f, 0.82303f, 0.829794f, 0.838869f, 0.848913f, + 0.860802f, 0.858037f, 0.858462f, 0.865197f, 0.870285f, 0.877932f, + 0.889278f, 0.896475f, 0.909253f, 0.91308f, 0.917885f, 0.914221f, + 0.910762f, 0.916979f, 0.92489f, 0.93683f, 0.950791f, 0.943998f, + 0.936911f, 0.932311f, 0.929417f, 0.938274f, 0.951232f, 0.960012f, + 0.962781f, 0.957501f, 0.953865f, 0.954752f, 0.957376f, 0.968155f, + 0.977735f, 0.961332f, 0.949217f, 0.946955f, 0.953334f, 0.946656f, + 0.952193f, 0.96247f, 0.969595f, 0.983968f, 1.0f, 0.99432f, + 0.994003f, 0.980974f, 0.969563f, 0.968253f, 0.968397f, 0.973674f, + 0.978855f, 0.966847f, 0.963741f, 0.952252f, 0.946654f, 0.94592f, + 0.952938f, 0.954759f, 0.962583f, 0.962142f, 0.956637f, 0.950381f, + 0.940962f, 0.936224f, 0.924596f, 0.923379f, 0.921684f, 0.933568f, + 0.940831f, 0.957977f, 0.963832f, 0.958143f, 0.941297f, 0.92426f, + 0.903f, 0.895878f, 0.887152f, 0.910523f, 0.929402f, 0.744019f, + 0.553867f, 0.320246f, 0.0858164f, 0.0514292f, 0.0172983f, 0.0120102f, + 0.00659981f, 0.00436796f, 0.00213134f, 0.00153565f, 0.000922227f, 0.000721841f, + 0.000528696f, 0.000489722f, 0.000449662f, 0.000431783f, 0.000409049f, 0.000407132f, + 0.000396445f, 0.000420259f, 0.000446526f, 0.000403311f, 0.000361257f, 0.00033034f, + 0.000298026f, 0.000301128f, 0.000308537f, 0.000286243f, 0.000261497f, 0.000253604f, + 0.000242266f, 0.000274627f, 0.000307033f, 0.000295007f, 0.000283703f, 0.000261529f, + 0.000237475f, 0.00024833f, 0.000258997f, 0.00027011f, 0.000282485f, 0.000261654f, + 0.000240819f, 0.000248561f, 0.00025802f, 0.000273541f, 0.000287576f, 0.000282785f, + 0.000276218f, 0.000275306f, 0.000273131f, 0.000256767f, 0.000242183f, 0.000239187f, + 0.000234252f, 0.000223355f, 0.000213509f, 0.00021573f, 0.000218602f, 0.000204845f, + 0.000191131f, 0.000179884f, 0.000169031f, 0.000177057f, 0.000183172f, 0.00016757f, + 0.0001513f, 0.000138821f, 0.000125806f, 0.000129696f, 0.000133722f, 0.000122536f, + 0.000111436f, 0.000102899f, 9.41714e-05f, 0.000104721f, 0.000115227f, 9.94755e-05f, + 8.3857e-05f, 8.4497e-05f, 8.52612e-05f, 7.76124e-05f, 7.00705e-05f, 7.06672e-05f, + 7.1081e-05f, 6.5671e-05f, 6.00304e-05f, 6.21262e-05f, 6.42018e-05f, 5.57459e-05f, + 4.73181e-05f, 4.33172e-05f, 3.91675e-05f, 3.60807e-05f, 3.29177e-05f, 3.41277e-05f, + 3.52334e-05f, 3.14413e-05f, 2.76314e-05f, 2.55335e-05f, 2.34256e-05f, 2.1133e-05f, + 1.88297e-05f, 1.80004e-05f, 1.71146e-05f, 1.51355e-05f, 1.31473e-05f, 1.21372e-05f, + 1.11225e-05f, 9.97857e-06f, 8.84718e-06f, 8.76091e-06f, 8.67416e-06f, 7.95176e-06f, + 7.22607e-06f, 7.06298e-06f, 6.8991e-06f, 6.66214e-06f, 6.42406e-06f, 6.36617e-06f, + 6.32615e-06f }; //add panchromatic band to the temporary list @@ -980,442 +980,442 @@ WorldView2ImageMetadataInterface { const float b1[301] = { - 1.93924e-06, 3.33156e-06, 3.2732e-06, 2.78199e-06, 1.7488e-06, 3.34801e-06, - 3.55785e-06, 4.38919e-06, 2.94112e-06, 6.21317e-06, 5.37163e-06, 5.00497e-06, - 7.41645e-06, 1.35004e-05, 4.53797e-05, 0.000173069, 0.000634651, 0.00341498, - 0.0274284, 0.132903, 0.355988, 0.59258, 0.700719, 0.739625, - 0.765307, 0.787842, 0.817088, 0.838687, 0.86178, 0.883513, - 0.905055, 0.917072, 0.927208, 0.947658, 0.965088, 0.979304, - 0.985921, 0.989094, 0.997236, 0.974613, 0.85394, 0.588032, - 0.281577, 0.0805215, 0.00894615, 0.00133307, 0.0003609, 0.000145392, - 7.12168e-05, 3.80253e-05, 1.15412e-05, 9.59192e-06, 5.14417e-06, 1.11808e-05, - 1.09998e-05, 1.07851e-05, 9.08862e-06, 1.0105e-05, 1.17289e-05, 6.3851e-06, - 1.30646e-06, 1.3751e-06, 8.62503e-07, 6.19172e-07, 7.02247e-07, 8.87865e-07, - 9.3924e-07, 1.11657e-06, 9.84522e-07, 7.45006e-07, 8.99363e-07, 1.24448e-06, - 3.62747e-06, 1.27768e-06, 4.00518e-07, 5.21386e-07, 2.69075e-07, 4.85233e-07, - 3.69503e-07, 1.25632e-05, 0.00014168, 2.39565e-06, 3.06503e-07, 2.7473e-07, - 5.19969e-07, 4.87974e-07, 2.69412e-07, 3.10803e-07, 6.51482e-08, 1.769e-10, - 2.06764e-07, 1.56239e-06, 1.71434e-06, 3.76485e-07, 9.78272e-08, 1.07281e-07, - 5.25843e-07, 2.86289e-06, 4.49334e-06, 2.7912e-06, 9.77366e-07, 1.65592e-06, - 1.25872e-06, 1.35006e-06, 2.26827e-06, 3.08804e-06, 6.08055e-06, 1.15782e-05, - 1.00862e-05, 5.55949e-06, 3.85934e-06, 3.17286e-06, 2.67182e-06, 3.11772e-06, - 2.48961e-06, 2.56662e-06, 2.69687e-06, 2.66657e-06, 2.49631e-06, 2.07413e-06, - 2.21763e-06, 1.82216e-06, 1.73999e-06, 1.79846e-06, 1.78097e-06, 2.08078e-06, - 2.41026e-06, 2.95564e-06, 4.37817e-06, 9.26286e-06, 1.71525e-05, 1.63404e-05, - 7.76378e-06, 4.20687e-06, 4.36152e-06, 4.1979e-06, 3.60385e-06, 4.21227e-06, - 6.61165e-06, 1.85337e-05, 2.63714e-05, 1.23596e-05, 8.08582e-06, 7.62016e-06, - 8.54114e-06, 9.63216e-06, 1.21937e-05, 2.92224e-05, 9.75796e-05, 9.35745e-05, - 3.33406e-05, 2.37882e-05, 2.9829e-05, 4.42465e-05, 6.68887e-05, 0.000152608, - 0.000422651, 0.000256325, 6.52584e-05, 4.13991e-05, 5.7842e-05, 0.000264601, - 0.000711195, 0.000441052, 8.93762e-05, 3.04976e-05, 1.31372e-05, 8.13006e-06, - 5.95634e-06, 5.94402e-06, 6.95574e-06, 1.12493e-05, 1.93408e-05, 3.30614e-05, - 5.526e-05, 0.000106194, 0.000246237, 0.000245793, 0.000116183, 6.90781e-05, - 0.000121558, 0.00012478, 0.000160506, 0.000195856, 0.000163724, 0.000116846, - 9.27976e-05, 7.97493e-05, 7.30327e-05, 6.2535e-05, 7.15964e-05, 6.92402e-05, - 6.98667e-05, 7.20625e-05, 5.92742e-05, 4.73751e-05, 5.11686e-05, 3.8765e-05, - 2.87346e-05, 2.82287e-05, 4.23112e-05, 2.84265e-05, 2.76262e-05, 3.13753e-05, - 3.20692e-05, 2.54603e-05, 1.55049e-05, 1.67992e-05, 1.51677e-05, 1.72863e-05, - 1.82755e-05, 1.62912e-05, 1.63329e-05, 2.11384e-05, 1.68083e-05, 1.32225e-05, - 9.90909e-06, 9.57385e-06, 9.22475e-06, 1.59785e-05, 1.89273e-05, 1.94756e-05, - 1.68079e-05, 1.52813e-05, 1.45048e-05, 1.12089e-05, 9.50048e-06, 7.40732e-06, - 6.16214e-06, 4.66982e-06, 4.04122e-06, 3.96966e-06, 3.02326e-06, 3.30965e-06, - 2.53001e-06, 3.00426e-06, 3.01337e-06, 3.36385e-06, 3.56402e-06, 4.18688e-06, - 4.12602e-06, 5.01737e-06, 5.44329e-06, 5.985e-06, 5.40637e-06, 6.44899e-06, - 5.42357e-06, 4.91412e-06, 4.3504e-06, 3.89253e-06, 3.67736e-06, 4.08168e-06, - 3.85234e-06, 3.99802e-06, 4.60479e-06, 5.29422e-06, 4.87849e-06, 4.55674e-06, - 4.24992e-06, 3.52154e-06, 3.22953e-06, 2.58855e-06, 2.42857e-06, 2.34923e-06, - 2.36014e-06, 2.33549e-06, 2.55772e-06, 3.03473e-06, 3.14355e-06, 3.65574e-06, - 3.70734e-06, 3.68159e-06, 3.81222e-06, 3.35656e-06, 3.062e-06, 2.69374e-06, - 2.45185e-06, 2.09096e-06, 1.87615e-06, 1.59947e-06, 1.51572e-06, 1.47543e-06, - 1.5459e-06, 1.6819e-06, 1.89924e-06, 2.46062e-06, 2.89706e-06, 3.43049e-06, - 4.07493e-06, 4.31785e-06, 4.56185e-06, 4.84605e-06, 4.70059e-06, 5.04519e-06, - 5.03717e-06, 5.58133e-06, 5.772e-06, 6.2806e-06, 6.83109e-06, 7.80214e-06, - 8.13898e-06 + 1.93924e-06f, 3.33156e-06f, 3.2732e-06f, 2.78199e-06f, 1.7488e-06f, 3.34801e-06f, + 3.55785e-06f, 4.38919e-06f, 2.94112e-06f, 6.21317e-06f, 5.37163e-06f, 5.00497e-06f, + 7.41645e-06f, 1.35004e-05f, 4.53797e-05f, 0.000173069f, 0.000634651f, 0.00341498f, + 0.0274284f, 0.132903f, 0.355988f, 0.59258f, 0.700719f, 0.739625f, + 0.765307f, 0.787842f, 0.817088f, 0.838687f, 0.86178f, 0.883513f, + 0.905055f, 0.917072f, 0.927208f, 0.947658f, 0.965088f, 0.979304f, + 0.985921f, 0.989094f, 0.997236f, 0.974613f, 0.85394f, 0.588032f, + 0.281577f, 0.0805215f, 0.00894615f, 0.00133307f, 0.0003609f, 0.000145392f, + 7.12168e-05f, 3.80253e-05f, 1.15412e-05f, 9.59192e-06f, 5.14417e-06f, 1.11808e-05f, + 1.09998e-05f, 1.07851e-05f, 9.08862e-06f, 1.0105e-05f, 1.17289e-05f, 6.3851e-06f, + 1.30646e-06f, 1.3751e-06f, 8.62503e-07f, 6.19172e-07f, 7.02247e-07f, 8.87865e-07f, + 9.3924e-07f, 1.11657e-06f, 9.84522e-07f, 7.45006e-07f, 8.99363e-07f, 1.24448e-06f, + 3.62747e-06f, 1.27768e-06f, 4.00518e-07f, 5.21386e-07f, 2.69075e-07f, 4.85233e-07f, + 3.69503e-07f, 1.25632e-05f, 0.00014168f, 2.39565e-06f, 3.06503e-07f, 2.7473e-07f, + 5.19969e-07f, 4.87974e-07f, 2.69412e-07f, 3.10803e-07f, 6.51482e-08f, 1.769e-10f, + 2.06764e-07f, 1.56239e-06f, 1.71434e-06f, 3.76485e-07f, 9.78272e-08f, 1.07281e-07f, + 5.25843e-07f, 2.86289e-06f, 4.49334e-06f, 2.7912e-06f, 9.77366e-07f, 1.65592e-06f, + 1.25872e-06f, 1.35006e-06f, 2.26827e-06f, 3.08804e-06f, 6.08055e-06f, 1.15782e-05f, + 1.00862e-05f, 5.55949e-06f, 3.85934e-06f, 3.17286e-06f, 2.67182e-06f, 3.11772e-06f, + 2.48961e-06f, 2.56662e-06f, 2.69687e-06f, 2.66657e-06f, 2.49631e-06f, 2.07413e-06f, + 2.21763e-06f, 1.82216e-06f, 1.73999e-06f, 1.79846e-06f, 1.78097e-06f, 2.08078e-06f, + 2.41026e-06f, 2.95564e-06f, 4.37817e-06f, 9.26286e-06f, 1.71525e-05f, 1.63404e-05f, + 7.76378e-06f, 4.20687e-06f, 4.36152e-06f, 4.1979e-06f, 3.60385e-06f, 4.21227e-06f, + 6.61165e-06f, 1.85337e-05f, 2.63714e-05f, 1.23596e-05f, 8.08582e-06f, 7.62016e-06f, + 8.54114e-06f, 9.63216e-06f, 1.21937e-05f, 2.92224e-05f, 9.75796e-05f, 9.35745e-05f, + 3.33406e-05f, 2.37882e-05f, 2.9829e-05f, 4.42465e-05f, 6.68887e-05f, 0.000152608f, + 0.000422651f, 0.000256325f, 6.52584e-05f, 4.13991e-05f, 5.7842e-05f, 0.000264601f, + 0.000711195f, 0.000441052f, 8.93762e-05f, 3.04976e-05f, 1.31372e-05f, 8.13006e-06f, + 5.95634e-06f, 5.94402e-06f, 6.95574e-06f, 1.12493e-05f, 1.93408e-05f, 3.30614e-05f, + 5.526e-05f, 0.000106194f, 0.000246237f, 0.000245793f, 0.000116183f, 6.90781e-05f, + 0.000121558f, 0.00012478f, 0.000160506f, 0.000195856f, 0.000163724f, 0.000116846f, + 9.27976e-05f, 7.97493e-05f, 7.30327e-05f, 6.2535e-05f, 7.15964e-05f, 6.92402e-05f, + 6.98667e-05f, 7.20625e-05f, 5.92742e-05f, 4.73751e-05f, 5.11686e-05f, 3.8765e-05f, + 2.87346e-05f, 2.82287e-05f, 4.23112e-05f, 2.84265e-05f, 2.76262e-05f, 3.13753e-05f, + 3.20692e-05f, 2.54603e-05f, 1.55049e-05f, 1.67992e-05f, 1.51677e-05f, 1.72863e-05f, + 1.82755e-05f, 1.62912e-05f, 1.63329e-05f, 2.11384e-05f, 1.68083e-05f, 1.32225e-05f, + 9.90909e-06f, 9.57385e-06f, 9.22475e-06f, 1.59785e-05f, 1.89273e-05f, 1.94756e-05f, + 1.68079e-05f, 1.52813e-05f, 1.45048e-05f, 1.12089e-05f, 9.50048e-06f, 7.40732e-06f, + 6.16214e-06f, 4.66982e-06f, 4.04122e-06f, 3.96966e-06f, 3.02326e-06f, 3.30965e-06f, + 2.53001e-06f, 3.00426e-06f, 3.01337e-06f, 3.36385e-06f, 3.56402e-06f, 4.18688e-06f, + 4.12602e-06f, 5.01737e-06f, 5.44329e-06f, 5.985e-06f, 5.40637e-06f, 6.44899e-06f, + 5.42357e-06f, 4.91412e-06f, 4.3504e-06f, 3.89253e-06f, 3.67736e-06f, 4.08168e-06f, + 3.85234e-06f, 3.99802e-06f, 4.60479e-06f, 5.29422e-06f, 4.87849e-06f, 4.55674e-06f, + 4.24992e-06f, 3.52154e-06f, 3.22953e-06f, 2.58855e-06f, 2.42857e-06f, 2.34923e-06f, + 2.36014e-06f, 2.33549e-06f, 2.55772e-06f, 3.03473e-06f, 3.14355e-06f, 3.65574e-06f, + 3.70734e-06f, 3.68159e-06f, 3.81222e-06f, 3.35656e-06f, 3.062e-06f, 2.69374e-06f, + 2.45185e-06f, 2.09096e-06f, 1.87615e-06f, 1.59947e-06f, 1.51572e-06f, 1.47543e-06f, + 1.5459e-06f, 1.6819e-06f, 1.89924e-06f, 2.46062e-06f, 2.89706e-06f, 3.43049e-06f, + 4.07493e-06f, 4.31785e-06f, 4.56185e-06f, 4.84605e-06f, 4.70059e-06f, 5.04519e-06f, + 5.03717e-06f, 5.58133e-06f, 5.772e-06f, 6.2806e-06f, 6.83109e-06f, 7.80214e-06f, + 8.13898e-06f }; const float b2[301] = { - 7.50196e-07, 3.64689e-07, 3.0422e-07, 2.19926e-07, 2.95025e-07, 1.36813e-07, - 2.46454e-07, 3.07665e-07, 4.35207e-07, 4.54783e-07, 4.09999e-07, 4.6799e-07, - 4.30817e-07, 3.21329e-07, 5.14891e-07, 5.88871e-07, 7.24472e-07, 5.19291e-07, - 5.83071e-07, 7.385e-07, 2.80484e-06, 2.40132e-06, 1.65424e-06, 1.01535e-06, - 2.56678e-06, 6.15462e-06, 1.34813e-05, 2.75384e-05, 4.11764e-05, 5.15236e-05, - 7.01286e-05, 0.000133268, 0.000337419, 0.000957927, 0.00227712, 0.00543291, - 0.0197821, 0.0818229, 0.2452, 0.503309, 0.70097, 0.757605, - 0.778255, 0.788626, 0.8, 0.801737, 0.809859, 0.82107, - 0.826045, 0.830925, 0.842262, 0.862706, 0.878482, 0.876943, - 0.878267, 0.887613, 0.907576, 0.930559, 0.950192, 0.976801, - 1, 0.97894, 0.855779, 0.593873, 0.297629, 0.125661, - 0.0503684, 0.018199, 0.00573411, 0.00297352, 0.00165595, 0.000980273, - 0.000604892, 0.000391497, 0.000259234, 0.000168111, 0.00010894, 7.63081e-05, - 5.14226e-05, 5.2013e-05, 6.6689e-05, 6.23362e-05, 6.06577e-05, 5.93819e-05, - 6.25513e-05, 5.48608e-05, 5.86835e-05, 4.88126e-05, 4.93644e-05, 4.14711e-05, - 3.10164e-05, 2.97216e-05, 1.74405e-05, 1.74672e-05, 1.43447e-05, 1.09051e-05, - 1.27791e-05, 9.19063e-06, 8.62276e-06, 9.16788e-06, 8.06522e-06, 8.53885e-06, - 8.9662e-06, 7.58053e-06, 8.12959e-06, 9.11945e-06, 7.37798e-06, 7.16219e-06, - 7.98185e-06, 6.06857e-06, 5.53839e-06, 6.14124e-06, 4.19494e-06, 3.49052e-06, - 4.14312e-06, 3.83884e-06, 2.7725e-06, 3.75738e-06, 3.84359e-06, 3.23508e-06, - 4.16085e-06, 5.43268e-06, 5.65941e-06, 5.66555e-06, 1.00131e-05, 1.62239e-05, - 1.75445e-05, 2.14947e-05, 3.58956e-05, 4.56586e-05, 3.43405e-05, 2.38686e-05, - 2.4332e-05, 2.54789e-05, 1.95079e-05, 1.33965e-05, 1.25793e-05, 1.40937e-05, - 1.1979e-05, 8.63893e-06, 7.58208e-06, 8.83774e-06, 1.00948e-05, 9.00984e-06, - 7.04681e-06, 8.09797e-06, 1.08886e-05, 1.33532e-05, 1.23902e-05, 1.19507e-05, - 1.48562e-05, 2.23955e-05, 3.10266e-05, 3.26266e-05, 3.10397e-05, 3.39779e-05, - 4.5376e-05, 6.10958e-05, 6.5279e-05, 5.23129e-05, 4.14838e-05, 4.19558e-05, - 5.09964e-05, 6.37575e-05, 6.45187e-05, 4.91907e-05, 3.53937e-05, 3.00032e-05, - 3.20417e-05, 4.00312e-05, 4.4359e-05, 3.93208e-05, 2.98789e-05, 2.47787e-05, - 2.45129e-05, 2.9428e-05, 4.04968e-05, 5.068e-05, 5.14977e-05, 4.47032e-05, - 5.94662e-05, 5.43218e-05, 6.09036e-05, 7.73321e-05, 8.48403e-05, 9.27208e-05, - 9.49843e-05, 8.04592e-05, 5.70392e-05, 5.08953e-05, 5.09718e-05, 4.29127e-05, - 5.66121e-05, 6.40647e-05, 6.35005e-05, 6.45065e-05, 6.8561e-05, 6.61624e-05, - 7.80311e-05, 7.84671e-05, 7.47972e-05, 5.56929e-05, 4.48557e-05, 3.82956e-05, - 3.24203e-05, 2.64364e-05, 2.01874e-05, 2.18951e-05, 2.14424e-05, 2.35802e-05, - 2.69757e-05, 3.50803e-05, 3.50877e-05, 3.08309e-05, 2.96703e-05, 2.80215e-05, - 2.15038e-05, 2.20744e-05, 1.92407e-05, 1.75484e-05, 1.8481e-05, 1.73708e-05, - 1.80909e-05, 1.87169e-05, 1.78419e-05, 1.86544e-05, 1.83542e-05, 1.71676e-05, - 1.57509e-05, 1.42299e-05, 1.48274e-05, 1.35095e-05, 1.29937e-05, 1.31147e-05, - 1.17814e-05, 1.09442e-05, 1.06259e-05, 9.91455e-06, 8.8098e-06, 7.903e-06, - 7.02151e-06, 6.14267e-06, 6.40226e-06, 6.90937e-06, 7.40346e-06, 9.0376e-06, - 1.04649e-05, 1.20358e-05, 1.35923e-05, 1.45542e-05, 1.52353e-05, 1.4587e-05, - 1.27967e-05, 1.1387e-05, 9.40921e-06, 7.79714e-06, 6.31225e-06, 5.63816e-06, - 5.29451e-06, 5.25947e-06, 5.15346e-06, 5.42692e-06, 5.31811e-06, 4.77555e-06, - 3.83623e-06, 3.20429e-06, 2.71831e-06, 2.16288e-06, 1.99789e-06, 2.14329e-06, - 2.24263e-06, 2.42711e-06, 2.89596e-06, 2.86037e-06, 2.81914e-06, 2.48083e-06, - 2.0678e-06, 1.92076e-06, 1.53978e-06, 1.43754e-06, 1.37064e-06, 1.76234e-06, - 2.22508e-06, 2.69147e-06, 3.00682e-06, 3.16738e-06, 2.99304e-06, 2.70142e-06, - 2.48436e-06, 2.08026e-06, 1.84657e-06, 2.06456e-06, 2.72316e-06, 3.75312e-06, - 4.7306e-06, 5.55564e-06, 6.32699e-06, 5.91106e-06, 5.11932e-06, 4.25178e-06, - 3.32253e-06 + 7.50196e-07f, 3.64689e-07f, 3.0422e-07f, 2.19926e-07f, 2.95025e-07f, 1.36813e-07f, + 2.46454e-07f, 3.07665e-07f, 4.35207e-07f, 4.54783e-07f, 4.09999e-07f, 4.6799e-07f, + 4.30817e-07f, 3.21329e-07f, 5.14891e-07f, 5.88871e-07f, 7.24472e-07f, 5.19291e-07f, + 5.83071e-07f, 7.385e-07f, 2.80484e-06f, 2.40132e-06f, 1.65424e-06f, 1.01535e-06f, + 2.56678e-06f, 6.15462e-06f, 1.34813e-05f, 2.75384e-05f, 4.11764e-05f, 5.15236e-05f, + 7.01286e-05f, 0.000133268f, 0.000337419f, 0.000957927f, 0.00227712f, 0.00543291f, + 0.0197821f, 0.0818229f, 0.2452f, 0.503309f, 0.70097f, 0.757605f, + 0.778255f, 0.788626f, 0.8f, 0.801737f, 0.809859f, 0.82107f, + 0.826045f, 0.830925f, 0.842262f, 0.862706f, 0.878482f, 0.876943f, + 0.878267f, 0.887613f, 0.907576f, 0.930559f, 0.950192f, 0.976801f, + 1.0f, 0.97894f, 0.855779f, 0.593873f, 0.297629f, 0.125661f, + 0.0503684f, 0.018199f, 0.00573411f, 0.00297352f, 0.00165595f, 0.000980273f, + 0.000604892f, 0.000391497f, 0.000259234f, 0.000168111f, 0.00010894f, 7.63081e-05f, + 5.14226e-05f, 5.2013e-05f, 6.6689e-05f, 6.23362e-05f, 6.06577e-05f, 5.93819e-05f, + 6.25513e-05f, 5.48608e-05f, 5.86835e-05f, 4.88126e-05f, 4.93644e-05f, 4.14711e-05f, + 3.10164e-05f, 2.97216e-05f, 1.74405e-05f, 1.74672e-05f, 1.43447e-05f, 1.09051e-05f, + 1.27791e-05f, 9.19063e-06f, 8.62276e-06f, 9.16788e-06f, 8.06522e-06f, 8.53885e-06f, + 8.9662e-06f, 7.58053e-06f, 8.12959e-06f, 9.11945e-06f, 7.37798e-06f, 7.16219e-06f, + 7.98185e-06f, 6.06857e-06f, 5.53839e-06f, 6.14124e-06f, 4.19494e-06f, 3.49052e-06f, + 4.14312e-06f, 3.83884e-06f, 2.7725e-06f, 3.75738e-06f, 3.84359e-06f, 3.23508e-06f, + 4.16085e-06f, 5.43268e-06f, 5.65941e-06f, 5.66555e-06f, 1.00131e-05f, 1.62239e-05f, + 1.75445e-05f, 2.14947e-05f, 3.58956e-05f, 4.56586e-05f, 3.43405e-05f, 2.38686e-05f, + 2.4332e-05f, 2.54789e-05f, 1.95079e-05f, 1.33965e-05f, 1.25793e-05f, 1.40937e-05f, + 1.1979e-05f, 8.63893e-06f, 7.58208e-06f, 8.83774e-06f, 1.00948e-05f, 9.00984e-06f, + 7.04681e-06f, 8.09797e-06f, 1.08886e-05f, 1.33532e-05f, 1.23902e-05f, 1.19507e-05f, + 1.48562e-05f, 2.23955e-05f, 3.10266e-05f, 3.26266e-05f, 3.10397e-05f, 3.39779e-05f, + 4.5376e-05f, 6.10958e-05f, 6.5279e-05f, 5.23129e-05f, 4.14838e-05f, 4.19558e-05f, + 5.09964e-05f, 6.37575e-05f, 6.45187e-05f, 4.91907e-05f, 3.53937e-05f, 3.00032e-05f, + 3.20417e-05f, 4.00312e-05f, 4.4359e-05f, 3.93208e-05f, 2.98789e-05f, 2.47787e-05f, + 2.45129e-05f, 2.9428e-05f, 4.04968e-05f, 5.068e-05f, 5.14977e-05f, 4.47032e-05f, + 5.94662e-05f, 5.43218e-05f, 6.09036e-05f, 7.73321e-05f, 8.48403e-05f, 9.27208e-05f, + 9.49843e-05f, 8.04592e-05f, 5.70392e-05f, 5.08953e-05f, 5.09718e-05f, 4.29127e-05f, + 5.66121e-05f, 6.40647e-05f, 6.35005e-05f, 6.45065e-05f, 6.8561e-05f, 6.61624e-05f, + 7.80311e-05f, 7.84671e-05f, 7.47972e-05f, 5.56929e-05f, 4.48557e-05f, 3.82956e-05f, + 3.24203e-05f, 2.64364e-05f, 2.01874e-05f, 2.18951e-05f, 2.14424e-05f, 2.35802e-05f, + 2.69757e-05f, 3.50803e-05f, 3.50877e-05f, 3.08309e-05f, 2.96703e-05f, 2.80215e-05f, + 2.15038e-05f, 2.20744e-05f, 1.92407e-05f, 1.75484e-05f, 1.8481e-05f, 1.73708e-05f, + 1.80909e-05f, 1.87169e-05f, 1.78419e-05f, 1.86544e-05f, 1.83542e-05f, 1.71676e-05f, + 1.57509e-05f, 1.42299e-05f, 1.48274e-05f, 1.35095e-05f, 1.29937e-05f, 1.31147e-05f, + 1.17814e-05f, 1.09442e-05f, 1.06259e-05f, 9.91455e-06f, 8.8098e-06f, 7.903e-06f, + 7.02151e-06f, 6.14267e-06f, 6.40226e-06f, 6.90937e-06f, 7.40346e-06f, 9.0376e-06f, + 1.04649e-05f, 1.20358e-05f, 1.35923e-05f, 1.45542e-05f, 1.52353e-05f, 1.4587e-05f, + 1.27967e-05f, 1.1387e-05f, 9.40921e-06f, 7.79714e-06f, 6.31225e-06f, 5.63816e-06f, + 5.29451e-06f, 5.25947e-06f, 5.15346e-06f, 5.42692e-06f, 5.31811e-06f, 4.77555e-06f, + 3.83623e-06f, 3.20429e-06f, 2.71831e-06f, 2.16288e-06f, 1.99789e-06f, 2.14329e-06f, + 2.24263e-06f, 2.42711e-06f, 2.89596e-06f, 2.86037e-06f, 2.81914e-06f, 2.48083e-06f, + 2.0678e-06f, 1.92076e-06f, 1.53978e-06f, 1.43754e-06f, 1.37064e-06f, 1.76234e-06f, + 2.22508e-06f, 2.69147e-06f, 3.00682e-06f, 3.16738e-06f, 2.99304e-06f, 2.70142e-06f, + 2.48436e-06f, 2.08026e-06f, 1.84657e-06f, 2.06456e-06f, 2.72316e-06f, 3.75312e-06f, + 4.7306e-06f, 5.55564e-06f, 6.32699e-06f, 5.91106e-06f, 5.11932e-06f, 4.25178e-06f, + 3.32253e-06f }; const float b3[301] = { - 4.15708e-07, 2.60143e-07, 1.32494e-07, 1.5403e-07, 1.64746e-07, 9.97031e-08, - 1.50249e-07, 2.02269e-07, 2.84962e-07, 2.57269e-07, 2.49117e-07, 3.36282e-07, - 3.75568e-07, 2.16954e-07, 4.25352e-07, 4.61622e-07, 4.19126e-07, 3.82693e-07, - 3.69658e-07, 5.02627e-07, 4.42599e-07, 4.84876e-07, 4.95357e-07, 4.94213e-07, - 5.20767e-07, 3.90137e-07, 3.59035e-07, 5.27747e-07, 3.37674e-07, 4.88789e-07, - 3.74123e-07, 3.69271e-07, 3.20795e-07, 4.14981e-07, 4.61504e-07, 2.95452e-07, - 1.74563e-07, 3.27091e-07, 5.33897e-07, 3.57089e-07, 5.66046e-07, 6.04714e-07, - 4.58234e-07, 5.14316e-07, 2.30656e-06, 4.42627e-06, 8.51169e-06, 1.27751e-05, - 1.41306e-05, 1.59342e-05, 1.97713e-05, 2.12166e-05, 2.25515e-05, 2.66048e-05, - 3.56016e-05, 4.35119e-05, 6.64286e-05, 0.000143846, 0.000396291, 0.00113574, - 0.00309186, 0.0111042, 0.0405198, 0.133788, 0.35151, 0.606039, - 0.723007, 0.760026, 0.779389, 0.788811, 0.80685, 0.828035, - 0.840756, 0.842039, 0.844305, 0.846857, 0.850335, 0.859723, - 0.863516, 0.869143, 0.882571, 0.90072, 0.924469, 0.942168, - 0.962285, 0.976601, 0.985726, 0.994764, 1, 0.993053, - 0.979121, 0.907745, 0.66404, 0.301436, 0.0929241, 0.0252385, - 0.00556269, 0.0024767, 0.0011294, 0.00050847, 0.000222899, 0.00010723, - 5.39405e-05, 2.56897e-05, 6.85006e-06, 3.52589e-06, 1.71169e-06, 2.75668e-07, - 1.82902e-06, 1.67961e-06, 6.19122e-06, 8.59549e-06, 1.52263e-05, 1.60512e-05, - 2.56929e-05, 3.25443e-05, 2.91571e-05, 2.70292e-05, 2.41446e-05, 1.40807e-05, - 2.13973e-07, 1.02058e-07, 1.9749e-07, 1.75362e-07, 2.57315e-07, 4.77614e-07, - 6.77741e-07, 7.65801e-07, 9.90214e-07, 7.51558e-07, 6.2059e-07, 9.81957e-07, - 1.09702e-06, 6.25215e-07, 9.27757e-07, 1.11919e-06, 1.17872e-06, 1.14779e-06, - 8.93355e-07, 8.36189e-07, 1.05053e-06, 1.08276e-06, 1.04181e-06, 9.27774e-07, - 1.07702e-06, 9.37779e-07, 9.88439e-07, 1.13665e-06, 1.09476e-06, 1.05959e-06, - 1.04925e-06, 1.29595e-06, 9.34329e-07, 1.13077e-06, 8.30981e-07, 8.0781e-07, - 1.02709e-06, 1.16311e-06, 8.47734e-07, 9.97851e-07, 1.11274e-06, 1.33262e-06, - 1.05514e-06, 9.58995e-07, 1.08595e-06, 1.15264e-06, 1.41038e-06, 1.22922e-06, - 1.70163e-06, 3.4679e-06, 3.95449e-06, 2.72695e-06, 1.36732e-06, 9.90143e-07, - 7.54806e-07, 6.55742e-07, 2.85239e-07, 6.86364e-07, 7.71553e-07, 1.12635e-06, - 9.62279e-07, 2.59255e-06, 9.30699e-07, 1.62071e-07, 1.00889e-10, 1.00081e-10, - 0, 0, 0, 3.23471e-08, 3.49174e-08, 6.19205e-07, - 5.116e-06, 4.16041e-06, 1.78258e-06, 5.02328e-07, 2.68142e-07, 3.8522e-07, - 7.72031e-07, 2.61664e-07, 1.37503e-07, 2.31254e-06, 8.6085e-06, 4.70061e-06, - 1.69519e-06, 1.83093e-07, 1.14424e-07, 1.73792e-06, 1.25833e-06, 1.66069e-06, - 9.83103e-07, 1.83029e-07, 1.17095e-05, 9.47984e-06, 1.12401e-05, 9.14076e-06, - 9.03094e-06, 8.49106e-06, 7.68749e-06, 6.74929e-06, 7.6733e-06, 6.95369e-06, - 6.01684e-06, 5.47181e-06, 6.12431e-06, 6.94762e-06, 6.21639e-06, 6.62084e-06, - 6.59998e-06, 5.76706e-06, 6.04266e-06, 5.40722e-06, 5.40383e-06, 4.91854e-06, - 4.02118e-06, 3.62242e-06, 3.52044e-06, 3.49028e-06, 2.9236e-06, 2.56893e-06, - 2.28989e-06, 2.09968e-06, 2.91966e-06, 2.44435e-06, 2.21268e-06, 2.22573e-06, - 2.02219e-06, 1.75423e-06, 1.83833e-06, 1.72076e-06, 1.51802e-06, 1.53759e-06, - 1.24302e-06, 1.44829e-06, 1.35566e-06, 1.31717e-06, 1.18067e-06, 1.12871e-06, - 1.2687e-06, 1.33911e-06, 1.09356e-06, 1.31515e-06, 1.44675e-06, 1.55647e-06, - 1.63886e-06, 1.97263e-06, 1.86758e-06, 1.76664e-06, 1.90731e-06, 1.8888e-06, - 1.74551e-06, 1.59134e-06, 1.71152e-06, 1.35904e-06, 1.32272e-06, 1.27499e-06, - 1.1585e-06, 1.26847e-06, 1.33096e-06, 1.48891e-06, 1.66013e-06, 1.92885e-06, - 2.33777e-06, 2.98726e-06, 3.83011e-06, 5.24983e-06, 7.20736e-06, 9.73918e-06, - 1.32221e-05, 1.70002e-05, 2.10955e-05, 2.549e-05, 2.99685e-05, 3.51168e-05, - 4.07206e-05, 4.74368e-05, 5.50521e-05, 6.53211e-05, 8.10989e-05, 0.000105497, - 0.000140101 + 4.15708e-07f, 2.60143e-07f, 1.32494e-07f, 1.5403e-07f, 1.64746e-07f, 9.97031e-08f, + 1.50249e-07f, 2.02269e-07f, 2.84962e-07f, 2.57269e-07f, 2.49117e-07f, 3.36282e-07f, + 3.75568e-07f, 2.16954e-07f, 4.25352e-07f, 4.61622e-07f, 4.19126e-07f, 3.82693e-07f, + 3.69658e-07f, 5.02627e-07f, 4.42599e-07f, 4.84876e-07f, 4.95357e-07f, 4.94213e-07f, + 5.20767e-07f, 3.90137e-07f, 3.59035e-07f, 5.27747e-07f, 3.37674e-07f, 4.88789e-07f, + 3.74123e-07f, 3.69271e-07f, 3.20795e-07f, 4.14981e-07f, 4.61504e-07f, 2.95452e-07f, + 1.74563e-07f, 3.27091e-07f, 5.33897e-07f, 3.57089e-07f, 5.66046e-07f, 6.04714e-07f, + 4.58234e-07f, 5.14316e-07f, 2.30656e-06f, 4.42627e-06f, 8.51169e-06f, 1.27751e-05f, + 1.41306e-05f, 1.59342e-05f, 1.97713e-05f, 2.12166e-05f, 2.25515e-05f, 2.66048e-05f, + 3.56016e-05f, 4.35119e-05f, 6.64286e-05f, 0.000143846f, 0.000396291f, 0.00113574f, + 0.00309186f, 0.0111042f, 0.0405198f, 0.133788f, 0.35151f, 0.606039f, + 0.723007f, 0.760026f, 0.779389f, 0.788811f, 0.80685f, 0.828035f, + 0.840756f, 0.842039f, 0.844305f, 0.846857f, 0.850335f, 0.859723f, + 0.863516f, 0.869143f, 0.882571f, 0.90072f, 0.924469f, 0.942168f, + 0.962285f, 0.976601f, 0.985726f, 0.994764f, 1.0f, 0.993053f, + 0.979121f, 0.907745f, 0.66404f, 0.301436f, 0.0929241f, 0.0252385f, + 0.00556269f, 0.0024767f, 0.0011294f, 0.00050847f, 0.000222899f, 0.00010723f, + 5.39405e-05f, 2.56897e-05f, 6.85006e-06f, 3.52589e-06f, 1.71169e-06f, 2.75668e-07f, + 1.82902e-06f, 1.67961e-06f, 6.19122e-06f, 8.59549e-06f, 1.52263e-05f, 1.60512e-05f, + 2.56929e-05f, 3.25443e-05f, 2.91571e-05f, 2.70292e-05f, 2.41446e-05f, 1.40807e-05f, + 2.13973e-07f, 1.02058e-07f, 1.9749e-07f, 1.75362e-07f, 2.57315e-07f, 4.77614e-07f, + 6.77741e-07f, 7.65801e-07f, 9.90214e-07f, 7.51558e-07f, 6.2059e-07f, 9.81957e-07f, + 1.09702e-06f, 6.25215e-07f, 9.27757e-07f, 1.11919e-06f, 1.17872e-06f, 1.14779e-06f, + 8.93355e-07f, 8.36189e-07f, 1.05053e-06f, 1.08276e-06f, 1.04181e-06f, 9.27774e-07f, + 1.07702e-06f, 9.37779e-07f, 9.88439e-07f, 1.13665e-06f, 1.09476e-06f, 1.05959e-06f, + 1.04925e-06f, 1.29595e-06f, 9.34329e-07f, 1.13077e-06f, 8.30981e-07f, 8.0781e-07f, + 1.02709e-06f, 1.16311e-06f, 8.47734e-07f, 9.97851e-07f, 1.11274e-06f, 1.33262e-06f, + 1.05514e-06f, 9.58995e-07f, 1.08595e-06f, 1.15264e-06f, 1.41038e-06f, 1.22922e-06f, + 1.70163e-06f, 3.4679e-06f, 3.95449e-06f, 2.72695e-06f, 1.36732e-06f, 9.90143e-07f, + 7.54806e-07f, 6.55742e-07f, 2.85239e-07f, 6.86364e-07f, 7.71553e-07f, 1.12635e-06f, + 9.62279e-07f, 2.59255e-06f, 9.30699e-07f, 1.62071e-07f, 1.00889e-10f, 1.00081e-10f, + 0.0f, 0.0f, 0.0f, 3.23471e-08f, 3.49174e-08f, 6.19205e-07f, + 5.116e-06f, 4.16041e-06f, 1.78258e-06f, 5.02328e-07f, 2.68142e-07f, 3.8522e-07f, + 7.72031e-07f, 2.61664e-07f, 1.37503e-07f, 2.31254e-06f, 8.6085e-06f, 4.70061e-06f, + 1.69519e-06f, 1.83093e-07f, 1.14424e-07f, 1.73792e-06f, 1.25833e-06f, 1.66069e-06f, + 9.83103e-07f, 1.83029e-07f, 1.17095e-05f, 9.47984e-06f, 1.12401e-05f, 9.14076e-06f, + 9.03094e-06f, 8.49106e-06f, 7.68749e-06f, 6.74929e-06f, 7.6733e-06f, 6.95369e-06f, + 6.01684e-06f, 5.47181e-06f, 6.12431e-06f, 6.94762e-06f, 6.21639e-06f, 6.62084e-06f, + 6.59998e-06f, 5.76706e-06f, 6.04266e-06f, 5.40722e-06f, 5.40383e-06f, 4.91854e-06f, + 4.02118e-06f, 3.62242e-06f, 3.52044e-06f, 3.49028e-06f, 2.9236e-06f, 2.56893e-06f, + 2.28989e-06f, 2.09968e-06f, 2.91966e-06f, 2.44435e-06f, 2.21268e-06f, 2.22573e-06f, + 2.02219e-06f, 1.75423e-06f, 1.83833e-06f, 1.72076e-06f, 1.51802e-06f, 1.53759e-06f, + 1.24302e-06f, 1.44829e-06f, 1.35566e-06f, 1.31717e-06f, 1.18067e-06f, 1.12871e-06f, + 1.2687e-06f, 1.33911e-06f, 1.09356e-06f, 1.31515e-06f, 1.44675e-06f, 1.55647e-06f, + 1.63886e-06f, 1.97263e-06f, 1.86758e-06f, 1.76664e-06f, 1.90731e-06f, 1.8888e-06f, + 1.74551e-06f, 1.59134e-06f, 1.71152e-06f, 1.35904e-06f, 1.32272e-06f, 1.27499e-06f, + 1.1585e-06f, 1.26847e-06f, 1.33096e-06f, 1.48891e-06f, 1.66013e-06f, 1.92885e-06f, + 2.33777e-06f, 2.98726e-06f, 3.83011e-06f, 5.24983e-06f, 7.20736e-06f, 9.73918e-06f, + 1.32221e-05f, 1.70002e-05f, 2.10955e-05f, 2.549e-05f, 2.99685e-05f, 3.51168e-05f, + 4.07206e-05f, 4.74368e-05f, 5.50521e-05f, 6.53211e-05f, 8.10989e-05f, 0.000105497f, + 0.000140101f }; const float b4[301] = { - 3.12145e-07, 8.28534e-08, 9.83184e-08, 8.55079e-08, 4.71887e-08, 3.85598e-08, - 6.13263e-08, 1.09691e-07, 8.19229e-08, 8.18698e-08, 8.44374e-08, 8.18784e-08, - 7.47651e-08, 6.01096e-08, 7.12291e-08, 2.8315e-07, 6.00765e-07, 2.10864e-05, - 2.73104e-05, 4.50671e-07, 1.06402e-08, 6.94993e-08, 3.13328e-08, 1.09588e-07, - 1.74842e-07, 1.9277e-07, 1.34675e-07, 1.92847e-07, 2.02477e-07, 2.6112e-07, - 3.33295e-07, 2.31552e-07, 2.58338e-07, 3.82314e-07, 4.29747e-07, 4.01449e-07, - 1.02894e-06, 5.00318e-06, 3.23438e-06, 1.18679e-06, 5.38393e-07, 3.44446e-07, - 3.9298e-07, 3.47571e-07, 7.25503e-07, 6.40036e-07, 5.09299e-07, 4.9699e-07, - 4.32861e-07, 6.78173e-07, 7.05903e-07, 6.95095e-07, 7.07479e-07, 6.7639e-07, - 6.97946e-07, 6.43371e-07, 7.30317e-07, 5.63357e-07, 3.36905e-07, 4.48422e-07, - 1.74648e-07, 3.13465e-07, 2.23411e-07, 2.26471e-07, 1.67155e-07, 1.6068e-07, - 1.35935e-07, 2.80495e-07, 1.38627e-07, 2.43633e-07, 3.57075e-07, 3.20907e-07, - 5.0935e-07, 2.31732e-07, 2.02004e-07, 1.99908e-07, 1.24175e-07, 3.61372e-07, - 3.62811e-07, 3.75752e-06, 7.00146e-06, 6.23552e-06, 4.3711e-06, 4.90926e-06, - 3.82553e-06, 1.1127e-05, 2.66906e-05, 5.75092e-05, 0.00012712, 0.000344491, - 0.000895024, 0.0022247, 0.0058789, 0.0265572, 0.134652, 0.38922, - 0.66355, 0.848198, 0.899806, 0.920023, 0.932634, 0.940181, - 0.947026, 0.952441, 0.966412, 0.981469, 0.989723, 0.992706, - 1, 0.969368, 0.759433, 0.436651, 0.134322, 0.0308525, - 0.00738524, 0.00223674, 0.0006906, 0.000285122, 0.000157594, 9.63247e-05, - 4.43162e-05, 2.30954e-05, 1.28847e-05, 7.45056e-06, 4.97739e-06, 3.29911e-06, - 2.15753e-06, 1.42561e-06, 8.30459e-07, 9.51382e-07, 8.18661e-07, 7.03925e-07, - 9.15122e-07, 5.41677e-07, 8.31395e-07, 8.59648e-07, 6.23981e-07, 8.59012e-07, - 5.17849e-07, 6.53052e-07, 9.60845e-07, 5.49969e-07, 8.65149e-07, 8.47562e-07, - 7.28829e-07, 1.14307e-06, 9.13936e-07, 8.44814e-07, 1.18804e-06, 1.11252e-06, - 1.50364e-06, 1.29736e-06, 1.19152e-06, 1.05178e-06, 1.28277e-06, 1.31103e-06, - 1.03605e-06, 9.37231e-07, 1.12941e-06, 1.07726e-06, 1.01085e-06, 8.19055e-07, - 8.60927e-07, 8.22335e-07, 7.66233e-07, 8.69038e-07, 7.82916e-07, 7.56701e-07, - 6.00481e-07, 4.7558e-07, 5.374e-07, 6.07694e-07, 6.55254e-07, 2.03489e-07, - 3.94378e-07, 5.87726e-07, 3.09931e-07, 4.14639e-07, 5.61119e-07, 6.43642e-07, - 2.33671e-05, 1.59193e-05, 1.89268e-05, 2.13128e-05, 1.12554e-05, 1.39639e-05, - 1.88608e-05, 1.99851e-05, 1.94386e-05, 9.88685e-06, 1.82516e-05, 1.15331e-05, - 9.26691e-06, 1.352e-05, 1.06333e-05, 1.13419e-05, 1.19485e-05, 7.6223e-06, - 1.19821e-05, 1.2663e-05, 1.70876e-05, 1.1388e-05, 6.7115e-06, 8.61733e-06, - 8.92584e-06, 6.81989e-06, 4.43969e-06, 6.43896e-06, 4.89677e-06, 5.81233e-06, - 6.00927e-06, 4.89342e-06, 1.92265e-06, 3.92241e-06, 3.60834e-06, 2.9064e-06, - 3.27708e-06, 2.99611e-06, 3.11394e-06, 4.66012e-06, 3.91458e-06, 4.29283e-06, - 3.86838e-06, 3.83149e-06, 3.27398e-06, 2.83986e-06, 2.47138e-06, 2.0826e-06, - 2.02905e-06, 1.68586e-06, 1.78242e-06, 1.83929e-06, 1.04638e-06, 1.38024e-06, - 1.31731e-06, 1.31521e-06, 6.52398e-07, 7.78377e-07, 9.25714e-07, 8.67073e-07, - 8.22355e-07, 7.92099e-07, 8.62113e-07, 8.90454e-07, 6.33338e-07, 9.92124e-07, - 8.63085e-07, 7.34335e-07, 9.03921e-07, 7.04451e-07, 7.04449e-07, 7.89631e-07, - 8.61175e-07, 8.20682e-07, 1.00168e-06, 1.43427e-06, 1.54572e-06, 1.60886e-06, - 1.78755e-06, 1.77994e-06, 1.53679e-06, 1.41e-06, 1.19628e-06, 9.79616e-07, - 5.21729e-07, 4.42824e-07, 4.64902e-07, 4.29654e-07, 4.08101e-07, 4.66717e-07, - 4.10742e-07, 3.40666e-07, 3.24714e-07, 4.197e-07, 3.64468e-07, 3.65553e-07, - 3.44671e-07, 3.67198e-07, 3.12263e-07, 3.30082e-07, 1.99664e-07, 1.72882e-07, - 1.60492e-07, 1.2065e-07, 7.23715e-08, 1.43254e-07, 1.12445e-07, 8.94112e-08, - 9.22383e-08, 8.79915e-08, 1.07076e-07, 1.084e-07, 1.27328e-07, 1.69284e-07, - 2.04354e-07, 2.73764e-07, 3.37554e-07, 4.28357e-07, 4.83865e-07, 5.33671e-07, - 5.77712e-07 + 3.12145e-07f, 8.28534e-08f, 9.83184e-08f, 8.55079e-08f, 4.71887e-08f, 3.85598e-08f, + 6.13263e-08f, 1.09691e-07f, 8.19229e-08f, 8.18698e-08f, 8.44374e-08f, 8.18784e-08f, + 7.47651e-08f, 6.01096e-08f, 7.12291e-08f, 2.8315e-07f, 6.00765e-07f, 2.10864e-05f, + 2.73104e-05f, 4.50671e-07f, 1.06402e-08f, 6.94993e-08f, 3.13328e-08f, 1.09588e-07f, + 1.74842e-07f, 1.9277e-07f, 1.34675e-07f, 1.92847e-07f, 2.02477e-07f, 2.6112e-07f, + 3.33295e-07f, 2.31552e-07f, 2.58338e-07f, 3.82314e-07f, 4.29747e-07f, 4.01449e-07f, + 1.02894e-06f, 5.00318e-06f, 3.23438e-06f, 1.18679e-06f, 5.38393e-07f, 3.44446e-07f, + 3.9298e-07f, 3.47571e-07f, 7.25503e-07f, 6.40036e-07f, 5.09299e-07f, 4.9699e-07f, + 4.32861e-07f, 6.78173e-07f, 7.05903e-07f, 6.95095e-07f, 7.07479e-07f, 6.7639e-07f, + 6.97946e-07f, 6.43371e-07f, 7.30317e-07f, 5.63357e-07f, 3.36905e-07f, 4.48422e-07f, + 1.74648e-07f, 3.13465e-07f, 2.23411e-07f, 2.26471e-07f, 1.67155e-07f, 1.6068e-07f, + 1.35935e-07f, 2.80495e-07f, 1.38627e-07f, 2.43633e-07f, 3.57075e-07f, 3.20907e-07f, + 5.0935e-07f, 2.31732e-07f, 2.02004e-07f, 1.99908e-07f, 1.24175e-07f, 3.61372e-07f, + 3.62811e-07f, 3.75752e-06f, 7.00146e-06f, 6.23552e-06f, 4.3711e-06f, 4.90926e-06f, + 3.82553e-06f, 1.1127e-05f, 2.66906e-05f, 5.75092e-05f, 0.00012712f, 0.000344491f, + 0.000895024f, 0.0022247f, 0.0058789f, 0.0265572f, 0.134652f, 0.38922f, + 0.66355f, 0.848198f, 0.899806f, 0.920023f, 0.932634f, 0.940181f, + 0.947026f, 0.952441f, 0.966412f, 0.981469f, 0.989723f, 0.992706f, + 1.0f, 0.969368f, 0.759433f, 0.436651f, 0.134322f, 0.0308525f, + 0.00738524f, 0.00223674f, 0.0006906f, 0.000285122f, 0.000157594f, 9.63247e-05f, + 4.43162e-05f, 2.30954e-05f, 1.28847e-05f, 7.45056e-06f, 4.97739e-06f, 3.29911e-06f, + 2.15753e-06f, 1.42561e-06f, 8.30459e-07f, 9.51382e-07f, 8.18661e-07f, 7.03925e-07f, + 9.15122e-07f, 5.41677e-07f, 8.31395e-07f, 8.59648e-07f, 6.23981e-07f, 8.59012e-07f, + 5.17849e-07f, 6.53052e-07f, 9.60845e-07f, 5.49969e-07f, 8.65149e-07f, 8.47562e-07f, + 7.28829e-07f, 1.14307e-06f, 9.13936e-07f, 8.44814e-07f, 1.18804e-06f, 1.11252e-06f, + 1.50364e-06f, 1.29736e-06f, 1.19152e-06f, 1.05178e-06f, 1.28277e-06f, 1.31103e-06f, + 1.03605e-06f, 9.37231e-07f, 1.12941e-06f, 1.07726e-06f, 1.01085e-06f, 8.19055e-07f, + 8.60927e-07f, 8.22335e-07f, 7.66233e-07f, 8.69038e-07f, 7.82916e-07f, 7.56701e-07f, + 6.00481e-07f, 4.7558e-07f, 5.374e-07f, 6.07694e-07f, 6.55254e-07f, 2.03489e-07f, + 3.94378e-07f, 5.87726e-07f, 3.09931e-07f, 4.14639e-07f, 5.61119e-07f, 6.43642e-07f, + 2.33671e-05f, 1.59193e-05f, 1.89268e-05f, 2.13128e-05f, 1.12554e-05f, 1.39639e-05f, + 1.88608e-05f, 1.99851e-05f, 1.94386e-05f, 9.88685e-06f, 1.82516e-05f, 1.15331e-05f, + 9.26691e-06f, 1.352e-05f, 1.06333e-05f, 1.13419e-05f, 1.19485e-05f, 7.6223e-06f, + 1.19821e-05f, 1.2663e-05f, 1.70876e-05f, 1.1388e-05f, 6.7115e-06f, 8.61733e-06f, + 8.92584e-06f, 6.81989e-06f, 4.43969e-06f, 6.43896e-06f, 4.89677e-06f, 5.81233e-06f, + 6.00927e-06f, 4.89342e-06f, 1.92265e-06f, 3.92241e-06f, 3.60834e-06f, 2.9064e-06f, + 3.27708e-06f, 2.99611e-06f, 3.11394e-06f, 4.66012e-06f, 3.91458e-06f, 4.29283e-06f, + 3.86838e-06f, 3.83149e-06f, 3.27398e-06f, 2.83986e-06f, 2.47138e-06f, 2.0826e-06f, + 2.02905e-06f, 1.68586e-06f, 1.78242e-06f, 1.83929e-06f, 1.04638e-06f, 1.38024e-06f, + 1.31731e-06f, 1.31521e-06f, 6.52398e-07f, 7.78377e-07f, 9.25714e-07f, 8.67073e-07f, + 8.22355e-07f, 7.92099e-07f, 8.62113e-07f, 8.90454e-07f, 6.33338e-07f, 9.92124e-07f, + 8.63085e-07f, 7.34335e-07f, 9.03921e-07f, 7.04451e-07f, 7.04449e-07f, 7.89631e-07f, + 8.61175e-07f, 8.20682e-07f, 1.00168e-06f, 1.43427e-06f, 1.54572e-06f, 1.60886e-06f, + 1.78755e-06f, 1.77994e-06f, 1.53679e-06f, 1.41e-06f, 1.19628e-06f, 9.79616e-07f, + 5.21729e-07f, 4.42824e-07f, 4.64902e-07f, 4.29654e-07f, 4.08101e-07f, 4.66717e-07f, + 4.10742e-07f, 3.40666e-07f, 3.24714e-07f, 4.197e-07f, 3.64468e-07f, 3.65553e-07f, + 3.44671e-07f, 3.67198e-07f, 3.12263e-07f, 3.30082e-07f, 1.99664e-07f, 1.72882e-07f, + 1.60492e-07f, 1.2065e-07f, 7.23715e-08f, 1.43254e-07f, 1.12445e-07f, 8.94112e-08f, + 9.22383e-08f, 8.79915e-08f, 1.07076e-07f, 1.084e-07f, 1.27328e-07f, 1.69284e-07f, + 2.04354e-07f, 2.73764e-07f, 3.37554e-07f, 4.28357e-07f, 4.83865e-07f, 5.33671e-07f, + 5.77712e-07f }; const float b5[301] = { - 3.12286e-07, 1.21265e-07, 6.94181e-08, 3.9853e-08, 8.0826e-08, 4.04409e-08, - 9.26526e-08, 1.12003e-07, 2.00442e-07, 1.25411e-07, 1.38037e-07, 1.68875e-07, - 1.62312e-07, 9.81447e-08, 2.36616e-07, 2.99972e-07, 3.57437e-07, 1.73237e-07, - 2.51165e-07, 3.80091e-07, 2.95126e-07, 3.00839e-07, 2.8738e-07, 3.69689e-07, - 4.13567e-07, 3.59864e-07, 6.22912e-07, 5.73343e-07, 2.85253e-07, 3.05785e-07, - 2.84932e-07, 2.7333e-07, 3.14806e-07, 3.26106e-07, 1.62258e-07, 1.93473e-07, - 2.7907e-07, 1.95591e-07, 3.78068e-07, 2.19725e-07, 3.13698e-07, 2.73155e-07, - 3.05173e-07, 2.00063e-07, 1.86757e-06, 3.44125e-06, 7.95772e-07, 6.25956e-07, - 1.17606e-06, 2.40044e-06, 9.54706e-07, 9.25815e-07, 5.61706e-07, 1.3451e-06, - 1.28024e-06, 1.36027e-06, 2.94643e-06, 1.86431e-06, 2.88379e-06, 2.16267e-06, - 1.53977e-06, 2.27062e-06, 8.29005e-07, 2.30761e-07, 3.01119e-07, 2.36372e-07, - 2.45071e-07, 2.32871e-07, 1.90817e-07, 2.06172e-07, 1.14463e-07, 3.52299e-08, - 2.27043e-07, 3.45896e-08, 2.42045e-08, 1.21876e-08, 6.62187e-08, 6.09625e-08, - 1.41816e-07, 8.79884e-08, 1.19441e-07, 3.73189e-08, 7.59332e-08, 2.40439e-07, - 1.17802e-07, 6.55622e-08, 8.63856e-08, 6.44464e-08, 2.23776e-07, 1.03047e-07, - 1.32551e-07, 2.79429e-07, 2.07195e-07, 3.67864e-07, 5.11545e-07, 5.89037e-07, - 8.2924e-07, 8.56781e-07, 1.3186e-06, 9.10331e-06, 1.26163e-05, 2.68254e-05, - 4.09503e-05, 7.03781e-05, 0.000122912, 0.000268666, 0.000628092, 0.00164922, - 0.00486736, 0.0227608, 0.0955659, 0.294353, 0.596071, 0.822289, - 0.872776, 0.885335, 0.927928, 0.955695, 0.965042, 0.967095, - 0.965588, 0.957776, 0.9555, 0.952831, 0.955801, 0.965253, - 0.970358, 0.976493, 0.987526, 0.996575, 0.999085, 0.992107, - 0.983694, 0.978311, 0.88528, 0.632595, 0.291823, 0.0832547, - 0.0204412, 0.00563548, 0.00191373, 0.000843246, 0.000403589, 0.000203731, - 0.000101781, 5.6897e-05, 2.7195e-05, 1.61825e-05, 1.4231e-05, 1.68343e-05, - 1.3334e-05, 1.44383e-05, 1.32012e-05, 1.24899e-05, 1.05706e-05, 6.08328e-06, - 3.05093e-06, 3.42552e-06, 1.54743e-06, 1.36525e-06, 1.23105e-06, 4.3642e-07, - 5.81041e-07, 1.18259e-06, 3.00501e-06, 4.97549e-06, 9.51182e-06, 7.32646e-06, - 6.71037e-06, 8.93449e-06, 6.85023e-06, 4.8556e-06, 5.46221e-06, 2.19395e-06, - 1.5006e-06, 4.9089e-07, 2.22462e-06, 6.60787e-07, 6.09816e-07, 9.03731e-07, - 1.37929e-05, 1.40411e-05, 1.3406e-05, 1.63301e-05, 1.06067e-05, 1.24196e-05, - 1.08121e-05, 7.69758e-06, 8.8836e-06, 9.03241e-06, 7.87554e-06, 4.2784e-06, - 1.07825e-05, 4.51337e-06, 6.97831e-06, 6.53672e-06, 6.20341e-06, 6.41495e-06, - 8.42444e-06, 6.85528e-06, 2.70354e-06, 6.50522e-06, 6.34091e-06, 6.54655e-06, - 5.05613e-06, 7.09478e-06, 9.15616e-06, 1.08124e-05, 6.65697e-06, 7.89558e-06, - 4.14291e-06, 4.32081e-06, 8.59893e-06, 6.22021e-06, 7.2363e-06, 6.14019e-06, - 3.87893e-06, 5.4737e-06, 4.80289e-06, 5.01621e-06, 5.71604e-06, 5.0985e-06, - 4.24175e-06, 4.44819e-06, 3.97763e-06, 3.48069e-06, 3.4912e-06, 4.00016e-06, - 2.68235e-06, 3.0765e-06, 3.20229e-06, 2.41872e-06, 3.06521e-06, 2.72094e-06, - 2.13903e-06, 1.70534e-06, 1.72736e-06, 1.5771e-06, 1.31904e-06, 1.10782e-06, - 1.20611e-06, 9.60313e-07, 1.25562e-06, 9.96851e-07, 1.08323e-06, 9.27816e-07, - 7.70516e-07, 6.93097e-07, 7.47027e-07, 7.07703e-07, 8.10806e-07, 7.26741e-07, - 6.80176e-07, 6.20037e-07, 6.39881e-07, 5.95663e-07, 4.7329e-07, 5.43599e-07, - 5.47303e-07, 6.05122e-07, 5.1772e-07, 5.88033e-07, 5.45848e-07, 5.08645e-07, - 2.36035e-07, 5.84744e-07, 5.20728e-07, 4.18312e-07, 3.71858e-07, 4.39561e-07, - 3.37007e-07, 2.56984e-07, 3.79198e-07, 4.64178e-07, 5.27954e-07, 6.02129e-07, - 6.16109e-07, 8.1714e-07, 7.41506e-07, 6.23132e-07, 4.93815e-07, 3.36936e-07, - 2.6114e-07, 1.50937e-07, 1.37661e-07, 1.5674e-07, 1.21087e-07, 1.3344e-07, - 1.58735e-07, 1.86711e-07, 1.80942e-07, 2.25817e-07, 2.17427e-07, 2.35791e-07, - 2.14853e-07, 1.85285e-07, 1.48392e-07, 1.1159e-07, 8.25772e-08, 7.09923e-08, - 5.57264e-08 + 3.12286e-07f, 1.21265e-07f, 6.94181e-08f, 3.9853e-08f, 8.0826e-08f, 4.04409e-08f, + 9.26526e-08f, 1.12003e-07f, 2.00442e-07f, 1.25411e-07f, 1.38037e-07f, 1.68875e-07f, + 1.62312e-07f, 9.81447e-08f, 2.36616e-07f, 2.99972e-07f, 3.57437e-07f, 1.73237e-07f, + 2.51165e-07f, 3.80091e-07f, 2.95126e-07f, 3.00839e-07f, 2.8738e-07f, 3.69689e-07f, + 4.13567e-07f, 3.59864e-07f, 6.22912e-07f, 5.73343e-07f, 2.85253e-07f, 3.05785e-07f, + 2.84932e-07f, 2.7333e-07f, 3.14806e-07f, 3.26106e-07f, 1.62258e-07f, 1.93473e-07f, + 2.7907e-07f, 1.95591e-07f, 3.78068e-07f, 2.19725e-07f, 3.13698e-07f, 2.73155e-07f, + 3.05173e-07f, 2.00063e-07f, 1.86757e-06f, 3.44125e-06f, 7.95772e-07f, 6.25956e-07f, + 1.17606e-06f, 2.40044e-06f, 9.54706e-07f, 9.25815e-07f, 5.61706e-07f, 1.3451e-06f, + 1.28024e-06f, 1.36027e-06f, 2.94643e-06f, 1.86431e-06f, 2.88379e-06f, 2.16267e-06f, + 1.53977e-06f, 2.27062e-06f, 8.29005e-07f, 2.30761e-07f, 3.01119e-07f, 2.36372e-07f, + 2.45071e-07f, 2.32871e-07f, 1.90817e-07f, 2.06172e-07f, 1.14463e-07f, 3.52299e-08f, + 2.27043e-07f, 3.45896e-08f, 2.42045e-08f, 1.21876e-08f, 6.62187e-08f, 6.09625e-08f, + 1.41816e-07f, 8.79884e-08f, 1.19441e-07f, 3.73189e-08f, 7.59332e-08f, 2.40439e-07f, + 1.17802e-07f, 6.55622e-08f, 8.63856e-08f, 6.44464e-08f, 2.23776e-07f, 1.03047e-07f, + 1.32551e-07f, 2.79429e-07f, 2.07195e-07f, 3.67864e-07f, 5.11545e-07f, 5.89037e-07f, + 8.2924e-07f, 8.56781e-07f, 1.3186e-06f, 9.10331e-06f, 1.26163e-05f, 2.68254e-05f, + 4.09503e-05f, 7.03781e-05f, 0.000122912f, 0.000268666f, 0.000628092f, 0.00164922f, + 0.00486736f, 0.0227608f, 0.0955659f, 0.294353f, 0.596071f, 0.822289f, + 0.872776f, 0.885335f, 0.927928f, 0.955695f, 0.965042f, 0.967095f, + 0.965588f, 0.957776f, 0.9555f, 0.952831f, 0.955801f, 0.965253f, + 0.970358f, 0.976493f, 0.987526f, 0.996575f, 0.999085f, 0.992107f, + 0.983694f, 0.978311f, 0.88528f, 0.632595f, 0.291823f, 0.0832547f, + 0.0204412f, 0.00563548f, 0.00191373f, 0.000843246f, 0.000403589f, 0.000203731f, + 0.000101781f, 5.6897e-05f, 2.7195e-05f, 1.61825e-05f, 1.4231e-05f, 1.68343e-05f, + 1.3334e-05f, 1.44383e-05f, 1.32012e-05f, 1.24899e-05f, 1.05706e-05f, 6.08328e-06f, + 3.05093e-06f, 3.42552e-06f, 1.54743e-06f, 1.36525e-06f, 1.23105e-06f, 4.3642e-07f, + 5.81041e-07f, 1.18259e-06f, 3.00501e-06f, 4.97549e-06f, 9.51182e-06f, 7.32646e-06f, + 6.71037e-06f, 8.93449e-06f, 6.85023e-06f, 4.8556e-06f, 5.46221e-06f, 2.19395e-06f, + 1.5006e-06f, 4.9089e-07f, 2.22462e-06f, 6.60787e-07f, 6.09816e-07f, 9.03731e-07f, + 1.37929e-05f, 1.40411e-05f, 1.3406e-05f, 1.63301e-05f, 1.06067e-05f, 1.24196e-05f, + 1.08121e-05f, 7.69758e-06f, 8.8836e-06f, 9.03241e-06f, 7.87554e-06f, 4.2784e-06f, + 1.07825e-05f, 4.51337e-06f, 6.97831e-06f, 6.53672e-06f, 6.20341e-06f, 6.41495e-06f, + 8.42444e-06f, 6.85528e-06f, 2.70354e-06f, 6.50522e-06f, 6.34091e-06f, 6.54655e-06f, + 5.05613e-06f, 7.09478e-06f, 9.15616e-06f, 1.08124e-05f, 6.65697e-06f, 7.89558e-06f, + 4.14291e-06f, 4.32081e-06f, 8.59893e-06f, 6.22021e-06f, 7.2363e-06f, 6.14019e-06f, + 3.87893e-06f, 5.4737e-06f, 4.80289e-06f, 5.01621e-06f, 5.71604e-06f, 5.0985e-06f, + 4.24175e-06f, 4.44819e-06f, 3.97763e-06f, 3.48069e-06f, 3.4912e-06f, 4.00016e-06f, + 2.68235e-06f, 3.0765e-06f, 3.20229e-06f, 2.41872e-06f, 3.06521e-06f, 2.72094e-06f, + 2.13903e-06f, 1.70534e-06f, 1.72736e-06f, 1.5771e-06f, 1.31904e-06f, 1.10782e-06f, + 1.20611e-06f, 9.60313e-07f, 1.25562e-06f, 9.96851e-07f, 1.08323e-06f, 9.27816e-07f, + 7.70516e-07f, 6.93097e-07f, 7.47027e-07f, 7.07703e-07f, 8.10806e-07f, 7.26741e-07f, + 6.80176e-07f, 6.20037e-07f, 6.39881e-07f, 5.95663e-07f, 4.7329e-07f, 5.43599e-07f, + 5.47303e-07f, 6.05122e-07f, 5.1772e-07f, 5.88033e-07f, 5.45848e-07f, 5.08645e-07f, + 2.36035e-07f, 5.84744e-07f, 5.20728e-07f, 4.18312e-07f, 3.71858e-07f, 4.39561e-07f, + 3.37007e-07f, 2.56984e-07f, 3.79198e-07f, 4.64178e-07f, 5.27954e-07f, 6.02129e-07f, + 6.16109e-07f, 8.1714e-07f, 7.41506e-07f, 6.23132e-07f, 4.93815e-07f, 3.36936e-07f, + 2.6114e-07f, 1.50937e-07f, 1.37661e-07f, 1.5674e-07f, 1.21087e-07f, 1.3344e-07f, + 1.58735e-07f, 1.86711e-07f, 1.80942e-07f, 2.25817e-07f, 2.17427e-07f, 2.35791e-07f, + 2.14853e-07f, 1.85285e-07f, 1.48392e-07f, 1.1159e-07f, 8.25772e-08f, 7.09923e-08f, + 5.57264e-08f }; const float b6[301] = { - 1.31873e-07, 1.87926e-07, 2.81592e-07, 2.17374e-07, 1.70877e-07, 1.0562e-07, - 1.12979e-07, 2.00636e-07, 1.89536e-07, 2.42299e-07, 1.75878e-07, 1.93174e-07, - 2.64698e-07, 2.57301e-07, 3.40167e-07, 3.55343e-07, 7.60476e-07, 2.25433e-06, - 1.29749e-06, 1.29558e-06, 2.01722e-06, 1.13819e-06, 1.64078e-06, 9.96598e-07, - 9.78403e-07, 1.06118e-06, 8.77215e-07, 1.97241e-06, 1.14645e-06, 8.83069e-07, - 7.40957e-07, 1.02664e-06, 9.67904e-06, 5.091e-05, 2.50784e-06, 3.48606e-07, - 8.32043e-07, 2.39095e-05, 2.58811e-06, 2.33621e-07, 1.98094e-07, 2.85714e-07, - 1.27594e-07, 1.7327e-07, 1.82199e-07, 1.5321e-07, 1.63299e-07, 1.01052e-07, - 1.49075e-07, 5.47801e-07, 7.84427e-07, 1.65041e-06, 8.51018e-07, 5.77883e-06, - 1.38337e-05, 7.9076e-06, 3.87846e-06, 5.69445e-06, 1.53368e-05, 9.94259e-06, - 1.2e-06, 1.54553e-06, 4.22091e-06, 1.43071e-06, 2.00613e-07, 1.81045e-07, - 1.2783e-07, 1.03067e-07, 1.82997e-07, 1.10773e-07, 1.1226e-07, 1.16695e-07, - 2.16241e-07, 1.05663e-07, 1.614e-07, 1.6817e-07, 1.16441e-07, 1.15124e-07, - 6.99069e-08, 1.53185e-08, 2.72037e-08, 1.23476e-07, 1.55133e-07, 1.49846e-07, - 3.58885e-07, 2.02413e-06, 2.0841e-06, 8.13696e-07, 9.02676e-07, 2.00266e-06, - 3.1147e-06, 3.09139e-06, 4.4865e-06, 6.70102e-06, 6.05048e-06, 5.02704e-06, - 7.09114e-06, 1.13053e-05, 1.37502e-05, 1.60627e-05, 2.40093e-05, 3.44167e-05, - 3.74905e-05, 3.98343e-05, 5.38148e-05, 7.94317e-05, 8.83804e-05, 7.59032e-05, - 9.03911e-05, 0.000174361, 0.000184766, 5.17257e-05, 8.78977e-06, 4.47753e-06, - 2.69144e-06, 1.45718e-06, 1.07089e-06, 6.55321e-07, 1.38442e-06, 2.79808e-06, - 5.03238e-06, 6.41933e-06, 8.09994e-06, 1.05514e-05, 1.15504e-05, 1.14512e-05, - 1.17762e-05, 1.04862e-05, 1.12589e-05, 8.43843e-06, 8.21063e-06, 8.85197e-06, - 9.70519e-06, 1.53186e-05, 3.28e-05, 7.87273e-05, 0.000207342, 0.000759089, - 0.00312753, 0.0188368, 0.0996101, 0.346835, 0.622908, 0.853785, - 0.952792, 0.978422, 0.987634, 0.989026, 0.993901, 0.999858, - 0.99928, 0.989417, 0.986813, 0.980962, 0.977116, 0.944191, - 0.846399, 0.615837, 0.359763, 0.138813, 0.0305442, 0.00709174, - 0.00215848, 0.000729986, 0.000269875, 0.000118803, 5.53309e-05, 2.39914e-05, - 9.56683e-06, 6.93469e-06, 5.29459e-06, 3.2974e-06, 4.31265e-06, 4.03836e-06, - 5.07602e-06, 7.67396e-06, 8.34915e-06, 9.4325e-06, 6.44795e-06, 5.01789e-06, - 6.71178e-08, 3.03948e-07, 3.1684e-07, 2.65135e-07, 2.09765e-07, 3.00101e-07, - 1.67201e-07, 1.60492e-07, 2.13433e-07, 1.29106e-07, 9.71011e-08, 2.9819e-07, - 1.86975e-07, 2.30772e-07, 1.64834e-07, 6.97091e-08, 3.40321e-07, 2.85903e-07, - 2.06352e-07, 3.65446e-07, 4.38643e-07, 1.65414e-07, 8.01729e-07, 7.59196e-07, - 1.87131e-06, 3.94486e-06, 8.7793e-06, 1.12049e-05, 1.14224e-05, 7.65019e-06, - 4.71997e-06, 4.25463e-06, 1.04158e-05, 8.44869e-06, 7.60545e-06, 7.43366e-06, - 8.91167e-06, 1.17538e-05, 1.53146e-05, 1.90496e-05, 1.73994e-05, 1.71082e-05, - 1.83056e-05, 1.86976e-05, 1.80158e-05, 1.89996e-05, 1.5662e-05, 1.44995e-05, - 1.26694e-05, 1.02432e-05, 8.13754e-06, 6.21556e-06, 4.54308e-06, 3.91257e-06, - 3.1588e-06, 2.52225e-06, 2.01583e-06, 1.62728e-06, 1.47903e-06, 1.09533e-06, - 1.03503e-06, 9.97997e-07, 7.70181e-07, 7.25907e-07, 8.38991e-07, 5.98253e-07, - 7.1384e-07, 4.89317e-07, 6.07583e-07, 5.97359e-07, 7.18152e-07, 5.91987e-07, - 6.80961e-07, 3.87465e-07, 4.28846e-07, 6.08958e-07, 3.8379e-07, 5.16479e-07, - 5.35559e-07, 4.5999e-07, 4.5037e-07, 4.34943e-07, 3.90623e-07, 3.55287e-07, - 3.677e-07, 4.21178e-07, 3.62045e-07, 3.55015e-07, 2.54848e-07, 2.60974e-07, - 2.42997e-07, 1.96909e-07, 2.38909e-07, 1.73543e-07, 2.20613e-07, 1.73692e-07, - 1.66732e-07, 1.40222e-07, 1.22858e-07, 1.39263e-07, 1.49344e-07, 1.63372e-07, - 1.54912e-07, 1.45368e-07, 1.58958e-07, 1.93923e-07, 1.65487e-07, 1.60786e-07, - 1.52013e-07, 1.35784e-07, 9.24469e-08, 9.92189e-08, 7.60063e-08, 9.85175e-08, - 7.22548e-08, 4.57741e-08, 6.97201e-08, 8.69437e-08, 1.13252e-07, 2.58077e-07, - 4.68462e-07 + 1.31873e-07f, 1.87926e-07f, 2.81592e-07f, 2.17374e-07f, 1.70877e-07f, 1.0562e-07f, + 1.12979e-07f, 2.00636e-07f, 1.89536e-07f, 2.42299e-07f, 1.75878e-07f, 1.93174e-07f, + 2.64698e-07f, 2.57301e-07f, 3.40167e-07f, 3.55343e-07f, 7.60476e-07f, 2.25433e-06f, + 1.29749e-06f, 1.29558e-06f, 2.01722e-06f, 1.13819e-06f, 1.64078e-06f, 9.96598e-07f, + 9.78403e-07f, 1.06118e-06f, 8.77215e-07f, 1.97241e-06f, 1.14645e-06f, 8.83069e-07f, + 7.40957e-07f, 1.02664e-06f, 9.67904e-06f, 5.091e-05f, 2.50784e-06f, 3.48606e-07f, + 8.32043e-07f, 2.39095e-05f, 2.58811e-06f, 2.33621e-07f, 1.98094e-07f, 2.85714e-07f, + 1.27594e-07f, 1.7327e-07f, 1.82199e-07f, 1.5321e-07f, 1.63299e-07f, 1.01052e-07f, + 1.49075e-07f, 5.47801e-07f, 7.84427e-07f, 1.65041e-06f, 8.51018e-07f, 5.77883e-06f, + 1.38337e-05f, 7.9076e-06f, 3.87846e-06f, 5.69445e-06f, 1.53368e-05f, 9.94259e-06f, + 1.2e-06f, 1.54553e-06f, 4.22091e-06f, 1.43071e-06f, 2.00613e-07f, 1.81045e-07f, + 1.2783e-07f, 1.03067e-07f, 1.82997e-07f, 1.10773e-07f, 1.1226e-07f, 1.16695e-07f, + 2.16241e-07f, 1.05663e-07f, 1.614e-07f, 1.6817e-07f, 1.16441e-07f, 1.15124e-07f, + 6.99069e-08f, 1.53185e-08f, 2.72037e-08f, 1.23476e-07f, 1.55133e-07f, 1.49846e-07f, + 3.58885e-07f, 2.02413e-06f, 2.0841e-06f, 8.13696e-07f, 9.02676e-07f, 2.00266e-06f, + 3.1147e-06f, 3.09139e-06f, 4.4865e-06f, 6.70102e-06f, 6.05048e-06f, 5.02704e-06f, + 7.09114e-06f, 1.13053e-05f, 1.37502e-05f, 1.60627e-05f, 2.40093e-05f, 3.44167e-05f, + 3.74905e-05f, 3.98343e-05f, 5.38148e-05f, 7.94317e-05f, 8.83804e-05f, 7.59032e-05f, + 9.03911e-05f, 0.000174361f, 0.000184766f, 5.17257e-05f, 8.78977e-06f, 4.47753e-06f, + 2.69144e-06f, 1.45718e-06f, 1.07089e-06f, 6.55321e-07f, 1.38442e-06f, 2.79808e-06f, + 5.03238e-06f, 6.41933e-06f, 8.09994e-06f, 1.05514e-05f, 1.15504e-05f, 1.14512e-05f, + 1.17762e-05f, 1.04862e-05f, 1.12589e-05f, 8.43843e-06f, 8.21063e-06f, 8.85197e-06f, + 9.70519e-06f, 1.53186e-05f, 3.28e-05f, 7.87273e-05f, 0.000207342f, 0.000759089f, + 0.00312753f, 0.0188368f, 0.0996101f, 0.346835f, 0.622908f, 0.853785f, + 0.952792f, 0.978422f, 0.987634f, 0.989026f, 0.993901f, 0.999858f, + 0.99928f, 0.989417f, 0.986813f, 0.980962f, 0.977116f, 0.944191f, + 0.846399f, 0.615837f, 0.359763f, 0.138813f, 0.0305442f, 0.00709174f, + 0.00215848f, 0.000729986f, 0.000269875f, 0.000118803f, 5.53309e-05f, 2.39914e-05f, + 9.56683e-06f, 6.93469e-06f, 5.29459e-06f, 3.2974e-06f, 4.31265e-06f, 4.03836e-06f, + 5.07602e-06f, 7.67396e-06f, 8.34915e-06f, 9.4325e-06f, 6.44795e-06f, 5.01789e-06f, + 6.71178e-08f, 3.03948e-07f, 3.1684e-07f, 2.65135e-07f, 2.09765e-07f, 3.00101e-07f, + 1.67201e-07f, 1.60492e-07f, 2.13433e-07f, 1.29106e-07f, 9.71011e-08f, 2.9819e-07f, + 1.86975e-07f, 2.30772e-07f, 1.64834e-07f, 6.97091e-08f, 3.40321e-07f, 2.85903e-07f, + 2.06352e-07f, 3.65446e-07f, 4.38643e-07f, 1.65414e-07f, 8.01729e-07f, 7.59196e-07f, + 1.87131e-06f, 3.94486e-06f, 8.7793e-06f, 1.12049e-05f, 1.14224e-05f, 7.65019e-06f, + 4.71997e-06f, 4.25463e-06f, 1.04158e-05f, 8.44869e-06f, 7.60545e-06f, 7.43366e-06f, + 8.91167e-06f, 1.17538e-05f, 1.53146e-05f, 1.90496e-05f, 1.73994e-05f, 1.71082e-05f, + 1.83056e-05f, 1.86976e-05f, 1.80158e-05f, 1.89996e-05f, 1.5662e-05f, 1.44995e-05f, + 1.26694e-05f, 1.02432e-05f, 8.13754e-06f, 6.21556e-06f, 4.54308e-06f, 3.91257e-06f, + 3.1588e-06f, 2.52225e-06f, 2.01583e-06f, 1.62728e-06f, 1.47903e-06f, 1.09533e-06f, + 1.03503e-06f, 9.97997e-07f, 7.70181e-07f, 7.25907e-07f, 8.38991e-07f, 5.98253e-07f, + 7.1384e-07f, 4.89317e-07f, 6.07583e-07f, 5.97359e-07f, 7.18152e-07f, 5.91987e-07f, + 6.80961e-07f, 3.87465e-07f, 4.28846e-07f, 6.08958e-07f, 3.8379e-07f, 5.16479e-07f, + 5.35559e-07f, 4.5999e-07f, 4.5037e-07f, 4.34943e-07f, 3.90623e-07f, 3.55287e-07f, + 3.677e-07f, 4.21178e-07f, 3.62045e-07f, 3.55015e-07f, 2.54848e-07f, 2.60974e-07f, + 2.42997e-07f, 1.96909e-07f, 2.38909e-07f, 1.73543e-07f, 2.20613e-07f, 1.73692e-07f, + 1.66732e-07f, 1.40222e-07f, 1.22858e-07f, 1.39263e-07f, 1.49344e-07f, 1.63372e-07f, + 1.54912e-07f, 1.45368e-07f, 1.58958e-07f, 1.93923e-07f, 1.65487e-07f, 1.60786e-07f, + 1.52013e-07f, 1.35784e-07f, 9.24469e-08f, 9.92189e-08f, 7.60063e-08f, 9.85175e-08f, + 7.22548e-08f, 4.57741e-08f, 6.97201e-08f, 8.69437e-08f, 1.13252e-07f, 2.58077e-07f, + 4.68462e-07f }; const float b7[301] = { - 3.42494e-07, 5.7563e-09, 2.4306e-08, 6.23161e-08, 8.60169e-08, 6.54447e-09, - 4.9819e-08, 9.30485e-08, 5.51852e-08, 1.75292e-08, 2.87474e-08, 2.73409e-08, - 2.83316e-08, 3.82621e-09, 3.07146e-08, 4.55383e-08, 1.04778e-07, 1.23884e-09, - 8.25112e-09, 5.0621e-08, 1.79225e-07, 2.74552e-08, 1.04373e-07, 9.7114e-08, - 9.62771e-08, 1.75398e-07, 8.63102e-08, 6.84208e-08, 9.40778e-08, 5.15181e-08, - 1.02132e-07, 1.42588e-07, 8.08711e-08, 2.16959e-07, 1.03608e-07, 9.2287e-08, - 1.59861e-06, 6.11993e-06, 3.68931e-07, 9.24078e-08, 3.81349e-07, 2.64627e-07, - 3.27124e-07, 2.55578e-07, 2.87094e-07, 3.84e-07, 5.21921e-07, 6.14658e-07, - 3.75539e-07, 3.80046e-07, 7.36489e-07, 1.37786e-06, 6.07935e-07, 9.45777e-07, - 1.59554e-06, 5.68797e-07, 4.72783e-07, 5.63447e-07, 3.35752e-07, 1.70326e-07, - 3.17931e-07, 1.41325e-07, 2.49863e-07, 3.96423e-07, 2.16004e-07, 3.37582e-07, - 2.90124e-07, 3.80183e-07, 3.11457e-07, 3.98668e-07, 1.79901e-07, 1.22001e-07, - 1.13002e-07, 2.85022e-08, 4.67327e-08, 1.90183e-08, 0, 2.99103e-08, - 1.06093e-07, 1.18422e-07, 1.07083e-08, 7.91334e-08, 9.95149e-08, 1.54428e-07, - 9.12854e-08, 2.15373e-08, 7.48973e-08, 7.40942e-08, 0, 3.73909e-08, - 7.49644e-08, 0, 0, 1.92802e-08, 2.95975e-08, 7.04334e-08, - 6.50404e-08, 0, 0, 0, 2.0755e-07, 1.04836e-10, - 7.80821e-09, 1.57983e-07, 1.0595e-10, 1.13403e-07, 3.312e-10, 1.14176e-07, - 1.03109e-10, 3.76115e-09, 7.45634e-09, 1.19272e-07, 1.07481e-10, 1.10155e-10, - 1.1276e-10, 1.40161e-07, 1.16185e-10, 7.139e-08, 9.90442e-08, 3.74204e-07, - 5.05087e-07, 4.6352e-07, 5.97207e-07, 5.4384e-07, 6.81312e-07, 6.90591e-07, - 1.00825e-06, 8.18553e-07, 1.07975e-06, 8.27673e-07, 9.35167e-07, 9.64121e-07, - 1.00596e-06, 8.68247e-07, 8.97409e-07, 1.19586e-06, 1.28982e-06, 9.86575e-07, - 9.25037e-07, 2.05008e-06, 1.71977e-06, 3.51855e-06, 4.80754e-06, 6.35905e-06, - 5.22507e-06, 4.29703e-06, 3.92372e-06, 4.42103e-06, 4.97574e-06, 5.96695e-06, - 6.60085e-06, 1.11374e-05, 1.62372e-05, 2.84438e-05, 4.4002e-05, 7.0506e-05, - 0.000106141, 0.000165311, 0.000256229, 0.000412257, 0.000713036, 0.00139941, - 0.00288571, 0.00595325, 0.0126868, 0.0276938, 0.0588599, 0.123117, - 0.260204, 0.506774, 0.759967, 0.94058, 0.995805, 0.997622, - 0.988907, 0.983091, 0.972934, 0.958312, 0.941139, 0.931907, - 0.919382, 0.90908, 0.8976, 0.88212, 0.871191, 0.863054, - 0.844284, 0.836496, 0.838036, 0.841189, 0.835657, 0.833819, - 0.842548, 0.830777, 0.818604, 0.816837, 0.806711, 0.81076, - 0.794161, 0.779884, 0.767313, 0.749602, 0.739271, 0.738714, - 0.734145, 0.711833, 0.697141, 0.680462, 0.658635, 0.649781, - 0.632471, 0.619908, 0.60912, 0.598992, 0.590914, 0.566107, - 0.507112, 0.402799, 0.275174, 0.157667, 0.0738047, 0.032787, - 0.0138147, 0.00539084, 0.00262463, 0.00180863, 0.00130633, 0.00103281, - 0.000917177, 0.000891162, 0.000798344, 0.000745739, 0.000727178, 0.000783273, - 0.000701058, 0.000655311, 0.00060278, 0.000557875, 0.000281186, 0.000274231, - 4.37496e-06, 3.22571e-06, 2.88909e-06, 2.24195e-06, 1.98867e-06, 1.47066e-06, - 1.12615e-06, 1.04739e-06, 1.1344e-06, 8.90363e-07, 8.71592e-07, 7.40614e-07, - 7.19518e-07, 6.91579e-07, 7.01778e-07, 6.72029e-07, 4.36737e-07, 6.31103e-07, - 6.64941e-07, 6.02511e-07, 3.22655e-07, 5.32912e-07, 4.71662e-07, 4.99519e-07, - 3.35434e-07, 4.46158e-07, 4.48065e-07, 3.19015e-07, 2.39899e-07, 4.55294e-07, - 2.89741e-07, 2.5021e-07, 2.57359e-07, 3.5683e-07, 2.96983e-07, 2.97873e-07, - 1.88219e-07, 2.40558e-07, 2.15601e-07, 2.13278e-07, 1.40431e-07, 1.60961e-07, - 1.70122e-07, 1.10615e-07, 1.0436e-07, 1.222e-07, 1.25283e-07, 9.88137e-08, - 8.59799e-08, 9.19016e-08, 7.99614e-08, 8.73603e-08, 7.68151e-08, 6.51417e-08, - 7.38325e-08, 6.48494e-08, 5.64187e-08, 6.5542e-08, 5.90555e-08, 4.77664e-08, - 5.59409e-08 + 3.42494e-07f, 5.7563e-09f, 2.4306e-08f, 6.23161e-08f, 8.60169e-08f, 6.54447e-09f, + 4.9819e-08f, 9.30485e-08f, 5.51852e-08f, 1.75292e-08f, 2.87474e-08f, 2.73409e-08f, + 2.83316e-08f, 3.82621e-09f, 3.07146e-08f, 4.55383e-08f, 1.04778e-07f, 1.23884e-09f, + 8.25112e-09f, 5.0621e-08f, 1.79225e-07f, 2.74552e-08f, 1.04373e-07f, 9.7114e-08f, + 9.62771e-08f, 1.75398e-07f, 8.63102e-08f, 6.84208e-08f, 9.40778e-08f, 5.15181e-08f, + 1.02132e-07f, 1.42588e-07f, 8.08711e-08f, 2.16959e-07f, 1.03608e-07f, 9.2287e-08f, + 1.59861e-06f, 6.11993e-06f, 3.68931e-07f, 9.24078e-08f, 3.81349e-07f, 2.64627e-07f, + 3.27124e-07f, 2.55578e-07f, 2.87094e-07f, 3.84e-07f, 5.21921e-07f, 6.14658e-07f, + 3.75539e-07f, 3.80046e-07f, 7.36489e-07f, 1.37786e-06f, 6.07935e-07f, 9.45777e-07f, + 1.59554e-06f, 5.68797e-07f, 4.72783e-07f, 5.63447e-07f, 3.35752e-07f, 1.70326e-07f, + 3.17931e-07f, 1.41325e-07f, 2.49863e-07f, 3.96423e-07f, 2.16004e-07f, 3.37582e-07f, + 2.90124e-07f, 3.80183e-07f, 3.11457e-07f, 3.98668e-07f, 1.79901e-07f, 1.22001e-07f, + 1.13002e-07f, 2.85022e-08f, 4.67327e-08f, 1.90183e-08f, 0.0f, 2.99103e-08f, + 1.06093e-07f, 1.18422e-07f, 1.07083e-08f, 7.91334e-08f, 9.95149e-08f, 1.54428e-07f, + 9.12854e-08f, 2.15373e-08f, 7.48973e-08f, 7.40942e-08f, 0.0f, 3.73909e-08f, + 7.49644e-08f, 0.0f, 0.0f, 1.92802e-08f, 2.95975e-08f, 7.04334e-08f, + 6.50404e-08f, 0.0f, 0.0f, 0.0f, 2.0755e-07f, 1.04836e-10f, + 7.80821e-09f, 1.57983e-07f, 1.0595e-10f, 1.13403e-07f, 3.312e-10f, 1.14176e-07f, + 1.03109e-10f, 3.76115e-09f, 7.45634e-09f, 1.19272e-07f, 1.07481e-10f, 1.10155e-10f, + 1.1276e-10f, 1.40161e-07f, 1.16185e-10f, 7.139e-08f, 9.90442e-08f, 3.74204e-07f, + 5.05087e-07f, 4.6352e-07f, 5.97207e-07f, 5.4384e-07f, 6.81312e-07f, 6.90591e-07f, + 1.00825e-06f, 8.18553e-07f, 1.07975e-06f, 8.27673e-07f, 9.35167e-07f, 9.64121e-07f, + 1.00596e-06f, 8.68247e-07f, 8.97409e-07f, 1.19586e-06f, 1.28982e-06f, 9.86575e-07f, + 9.25037e-07f, 2.05008e-06f, 1.71977e-06f, 3.51855e-06f, 4.80754e-06f, 6.35905e-06f, + 5.22507e-06f, 4.29703e-06f, 3.92372e-06f, 4.42103e-06f, 4.97574e-06f, 5.96695e-06f, + 6.60085e-06f, 1.11374e-05f, 1.62372e-05f, 2.84438e-05f, 4.4002e-05f, 7.0506e-05f, + 0.000106141f, 0.000165311f, 0.000256229f, 0.000412257f, 0.000713036f, 0.00139941f, + 0.00288571f, 0.00595325f, 0.0126868f, 0.0276938f, 0.0588599f, 0.123117f, + 0.260204f, 0.506774f, 0.759967f, 0.94058f, 0.995805f, 0.997622f, + 0.988907f, 0.983091f, 0.972934f, 0.958312f, 0.941139f, 0.931907f, + 0.919382f, 0.90908f, 0.8976f, 0.88212f, 0.871191f, 0.863054f, + 0.844284f, 0.836496f, 0.838036f, 0.841189f, 0.835657f, 0.833819f, + 0.842548f, 0.830777f, 0.818604f, 0.816837f, 0.806711f, 0.81076f, + 0.794161f, 0.779884f, 0.767313f, 0.749602f, 0.739271f, 0.738714f, + 0.734145f, 0.711833f, 0.697141f, 0.680462f, 0.658635f, 0.649781f, + 0.632471f, 0.619908f, 0.60912f, 0.598992f, 0.590914f, 0.566107f, + 0.507112f, 0.402799f, 0.275174f, 0.157667f, 0.0738047f, 0.032787f, + 0.0138147f, 0.00539084f, 0.00262463f, 0.00180863f, 0.00130633f, 0.00103281f, + 0.000917177f, 0.000891162f, 0.000798344f, 0.000745739f, 0.000727178f, 0.000783273f, + 0.000701058f, 0.000655311f, 0.00060278f, 0.000557875f, 0.000281186f, 0.000274231f, + 4.37496e-06f, 3.22571e-06f, 2.88909e-06f, 2.24195e-06f, 1.98867e-06f, 1.47066e-06f, + 1.12615e-06f, 1.04739e-06f, 1.1344e-06f, 8.90363e-07f, 8.71592e-07f, 7.40614e-07f, + 7.19518e-07f, 6.91579e-07f, 7.01778e-07f, 6.72029e-07f, 4.36737e-07f, 6.31103e-07f, + 6.64941e-07f, 6.02511e-07f, 3.22655e-07f, 5.32912e-07f, 4.71662e-07f, 4.99519e-07f, + 3.35434e-07f, 4.46158e-07f, 4.48065e-07f, 3.19015e-07f, 2.39899e-07f, 4.55294e-07f, + 2.89741e-07f, 2.5021e-07f, 2.57359e-07f, 3.5683e-07f, 2.96983e-07f, 2.97873e-07f, + 1.88219e-07f, 2.40558e-07f, 2.15601e-07f, 2.13278e-07f, 1.40431e-07f, 1.60961e-07f, + 1.70122e-07f, 1.10615e-07f, 1.0436e-07f, 1.222e-07f, 1.25283e-07f, 9.88137e-08f, + 8.59799e-08f, 9.19016e-08f, 7.99614e-08f, 8.73603e-08f, 7.68151e-08f, 6.51417e-08f, + 7.38325e-08f, 6.48494e-08f, 5.64187e-08f, 6.5542e-08f, 5.90555e-08f, 4.77664e-08f, + 5.59409e-08f }; const float b8[301] = { - 2.75157e-07, 6.96359e-06, 1.9874e-05, 8.73924e-05, 7.4835e-05, 5.16098e-06, - 4.81496e-07, 6.24369e-07, 2.89158e-07, 1.33848e-07, 1.61046e-07, 2.69148e-07, - 1.41051e-07, 1.93786e-07, 2.0957e-07, 2.34628e-07, 2.36518e-07, 2.47669e-07, - 2.25346e-07, 2.01273e-07, 2.14493e-07, 1.42204e-07, 1.7784e-07, 2.29739e-07, - 4.0488e-07, 2.15782e-07, 1.58074e-07, 1.50063e-07, 7.18437e-08, 1.88801e-07, - 2.3008e-07, 1.64135e-07, 1.27638e-07, 1.9751e-07, 1.13678e-07, 7.76496e-07, - 1.1877e-06, 1.47692e-07, 2.12794e-07, 1.89394e-06, 1.22e-06, 8.28353e-07, - 5.66846e-07, 1.55612e-07, 3.89524e-08, 6.08863e-08, 4.13505e-07, 1.57781e-07, - 8.45778e-09, 9.45575e-07, 3.68309e-06, 1.1502e-06, 2.14722e-07, 1.01022e-07, - 6.8025e-07, 8.6337e-07, 3.19639e-08, 2.56285e-07, 1.35378e-07, 3.34694e-08, - 7.36246e-07, 8.36204e-07, 2.65609e-08, 8.10432e-08, 2.05826e-07, 3.69154e-07, - 8.02175e-07, 8.89483e-07, 4.4826e-07, 2.42823e-07, 2.17011e-07, 2.65704e-06, - 8.78188e-06, 7.05779e-07, 3.82597e-07, 4.04534e-06, 4.67549e-06, 9.19411e-08, - 2.98568e-07, 2.08203e-06, 1.03067e-06, 9.72367e-08, 1.50024e-07, 1.2413e-07, - 1.4876e-07, 2.35395e-08, 1.65976e-10, 1.65631e-10, 8.45577e-09, 1.59829e-10, - 1.56488e-10, 1.35137e-07, 1.26482e-06, 9.54683e-08, 2.93604e-07, 1.59714e-07, - 2.23112e-07, 5.34018e-07, 6.1337e-07, 1.72864e-07, 5.77747e-07, 4.80195e-07, - 5.14193e-07, 5.97282e-07, 1.16949e-06, 5.3439e-07, 2.8602e-07, 2.20078e-07, - 5.34755e-07, 5.51942e-07, 6.32398e-07, 1.13151e-06, 1.09476e-06, 3.24873e-07, - 3.6263e-07, 5.49154e-07, 8.32561e-08, 6.24779e-07, 6.90714e-07, 8.366e-07, - 1.2346e-06, 1.93899e-06, 2.35572e-06, 9.86481e-07, 5.4618e-07, 1.53631e-06, - 4.98064e-07, 4.68967e-08, 2.82103e-07, 1.79437e-07, 2.82801e-07, 5.47962e-07, - 7.69025e-07, 1.62521e-07, 2.32749e-07, 5.04263e-07, 8.32099e-07, 2.27261e-07, - 4.08301e-07, 3.43738e-07, 1.2715e-07, 2.36481e-07, 8.74008e-08, 3.913e-07, - 4.88832e-07, 6.9057e-07, 7.13913e-07, 8.95172e-07, 8.96901e-07, 5.53029e-07, - 1.04012e-06, 9.12699e-07, 7.19448e-07, 7.20192e-07, 8.80887e-07, 1.14393e-06, - 5.57443e-07, 9.4312e-07, 1.04838e-06, 9.98724e-07, 1.23283e-06, 8.72156e-07, - 8.03599e-07, 5.35655e-07, 8.46701e-07, 6.91104e-07, 8.55943e-07, 6.31436e-07, - 4.51508e-07, 1.11291e-06, 1.03136e-06, 4.73296e-07, 6.08156e-07, 8.62452e-07, - 9.2854e-07, 7.79087e-07, 1.22534e-06, 0.000114086, 0.000453417, 0.000504746, - 0.000779556, 0.0010461, 0.000976304, 0.00111328, 0.0010687, 0.00109088, - 0.00109552, 0.00113106, 0.00109447, 0.00108912, 0.00104157, 0.0011403, - 0.001127, 0.00117057, 0.00115094, 0.00120607, 0.00135466, 0.00130018, - 0.00149181, 0.002231, 0.00432839, 0.0105836, 0.0305957, 0.107853, - 0.313746, 0.571884, 0.789269, 0.951541, 0.987144, 0.991677, - 0.993363, 0.999691, 0.996691, 0.983327, 0.970856, 0.95236, - 0.93302, 0.922376, 0.910922, 0.899767, 0.892112, 0.878565, - 0.864645, 0.850525, 0.841298, 0.827257, 0.80818, 0.794005, - 0.774377, 0.760282, 0.746906, 0.725848, 0.708967, 0.689184, - 0.66172, 0.64063, 0.620929, 0.596457, 0.574685, 0.551871, - 0.530905, 0.51163, 0.493667, 0.474118, 0.454311, 0.437766, - 0.421449, 0.406047, 0.389741, 0.376622, 0.363517, 0.349855, - 0.336697, 0.326962, 0.31708, 0.305806, 0.29492, 0.282203, - 0.271439, 0.260807, 0.250912, 0.243373, 0.235734, 0.227658, - 0.217559, 0.208722, 0.198576, 0.188152, 0.178705, 0.168441, - 0.159032, 0.148125, 0.13777, 0.124557, 0.109612, 0.0917406, - 0.0715068, 0.0503125, 0.0328064, 0.0198817, 0.00979572, 0.00470763, - 0.00218491, 0.00102923, 0.000523709, 0.000298469, 0.000200007, 0.000145961, - 0.000114257, 0.000102038, 8.00865e-05, 7.65951e-05, 8.01237e-05, 6.45166e-05, - 7.00539e-05, 6.46441e-05, 5.37976e-05, 2.97925e-05, 2.99793e-05, 2.77311e-05, - 6.76079e-07 + 2.75157e-07f, 6.96359e-06f, 1.9874e-05f, 8.73924e-05f, 7.4835e-05f, 5.16098e-06f, + 4.81496e-07f, 6.24369e-07f, 2.89158e-07f, 1.33848e-07f, 1.61046e-07f, 2.69148e-07f, + 1.41051e-07f, 1.93786e-07f, 2.0957e-07f, 2.34628e-07f, 2.36518e-07f, 2.47669e-07f, + 2.25346e-07f, 2.01273e-07f, 2.14493e-07f, 1.42204e-07f, 1.7784e-07f, 2.29739e-07f, + 4.0488e-07f, 2.15782e-07f, 1.58074e-07f, 1.50063e-07f, 7.18437e-08f, 1.88801e-07f, + 2.3008e-07f, 1.64135e-07f, 1.27638e-07f, 1.9751e-07f, 1.13678e-07f, 7.76496e-07f, + 1.1877e-06f, 1.47692e-07f, 2.12794e-07f, 1.89394e-06f, 1.22e-06f, 8.28353e-07f, + 5.66846e-07f, 1.55612e-07f, 3.89524e-08f, 6.08863e-08f, 4.13505e-07f, 1.57781e-07f, + 8.45778e-09f, 9.45575e-07f, 3.68309e-06f, 1.1502e-06f, 2.14722e-07f, 1.01022e-07f, + 6.8025e-07f, 8.6337e-07f, 3.19639e-08f, 2.56285e-07f, 1.35378e-07f, 3.34694e-08f, + 7.36246e-07f, 8.36204e-07f, 2.65609e-08f, 8.10432e-08f, 2.05826e-07f, 3.69154e-07f, + 8.02175e-07f, 8.89483e-07f, 4.4826e-07f, 2.42823e-07f, 2.17011e-07f, 2.65704e-06f, + 8.78188e-06f, 7.05779e-07f, 3.82597e-07f, 4.04534e-06f, 4.67549e-06f, 9.19411e-08f, + 2.98568e-07f, 2.08203e-06f, 1.03067e-06f, 9.72367e-08f, 1.50024e-07f, 1.2413e-07f, + 1.4876e-07f, 2.35395e-08f, 1.65976e-10f, 1.65631e-10f, 8.45577e-09f, 1.59829e-10f, + 1.56488e-10f, 1.35137e-07f, 1.26482e-06f, 9.54683e-08f, 2.93604e-07f, 1.59714e-07f, + 2.23112e-07f, 5.34018e-07f, 6.1337e-07f, 1.72864e-07f, 5.77747e-07f, 4.80195e-07f, + 5.14193e-07f, 5.97282e-07f, 1.16949e-06f, 5.3439e-07f, 2.8602e-07f, 2.20078e-07f, + 5.34755e-07f, 5.51942e-07f, 6.32398e-07f, 1.13151e-06f, 1.09476e-06f, 3.24873e-07f, + 3.6263e-07f, 5.49154e-07f, 8.32561e-08f, 6.24779e-07f, 6.90714e-07f, 8.366e-07f, + 1.2346e-06f, 1.93899e-06f, 2.35572e-06f, 9.86481e-07f, 5.4618e-07f, 1.53631e-06f, + 4.98064e-07f, 4.68967e-08f, 2.82103e-07f, 1.79437e-07f, 2.82801e-07f, 5.47962e-07f, + 7.69025e-07f, 1.62521e-07f, 2.32749e-07f, 5.04263e-07f, 8.32099e-07f, 2.27261e-07f, + 4.08301e-07f, 3.43738e-07f, 1.2715e-07f, 2.36481e-07f, 8.74008e-08f, 3.913e-07f, + 4.88832e-07f, 6.9057e-07f, 7.13913e-07f, 8.95172e-07f, 8.96901e-07f, 5.53029e-07f, + 1.04012e-06f, 9.12699e-07f, 7.19448e-07f, 7.20192e-07f, 8.80887e-07f, 1.14393e-06f, + 5.57443e-07f, 9.4312e-07f, 1.04838e-06f, 9.98724e-07f, 1.23283e-06f, 8.72156e-07f, + 8.03599e-07f, 5.35655e-07f, 8.46701e-07f, 6.91104e-07f, 8.55943e-07f, 6.31436e-07f, + 4.51508e-07f, 1.11291e-06f, 1.03136e-06f, 4.73296e-07f, 6.08156e-07f, 8.62452e-07f, + 9.2854e-07f, 7.79087e-07f, 1.22534e-06f, 0.000114086f, 0.000453417f, 0.000504746f, + 0.000779556f, 0.0010461f, 0.000976304f, 0.00111328f, 0.0010687f, 0.00109088f, + 0.00109552f, 0.00113106f, 0.00109447f, 0.00108912f, 0.00104157f, 0.0011403f, + 0.001127f, 0.00117057f, 0.00115094f, 0.00120607f, 0.00135466f, 0.00130018f, + 0.00149181f, 0.002231f, 0.00432839f, 0.0105836f, 0.0305957f, 0.107853f, + 0.313746f, 0.571884f, 0.789269f, 0.951541f, 0.987144f, 0.991677f, + 0.993363f, 0.999691f, 0.996691f, 0.983327f, 0.970856f, 0.95236f, + 0.93302f, 0.922376f, 0.910922f, 0.899767f, 0.892112f, 0.878565f, + 0.864645f, 0.850525f, 0.841298f, 0.827257f, 0.80818f, 0.794005f, + 0.774377f, 0.760282f, 0.746906f, 0.725848f, 0.708967f, 0.689184f, + 0.66172f, 0.64063f, 0.620929f, 0.596457f, 0.574685f, 0.551871f, + 0.530905f, 0.51163f, 0.493667f, 0.474118f, 0.454311f, 0.437766f, + 0.421449f, 0.406047f, 0.389741f, 0.376622f, 0.363517f, 0.349855f, + 0.336697f, 0.326962f, 0.31708f, 0.305806f, 0.29492f, 0.282203f, + 0.271439f, 0.260807f, 0.250912f, 0.243373f, 0.235734f, 0.227658f, + 0.217559f, 0.208722f, 0.198576f, 0.188152f, 0.178705f, 0.168441f, + 0.159032f, 0.148125f, 0.13777f, 0.124557f, 0.109612f, 0.0917406f, + 0.0715068f, 0.0503125f, 0.0328064f, 0.0198817f, 0.00979572f, 0.00470763f, + 0.00218491f, 0.00102923f, 0.000523709f, 0.000298469f, 0.000200007f, 0.000145961f, + 0.000114257f, 0.000102038f, 8.00865e-05f, 7.65951e-05f, 8.01237e-05f, 6.45166e-05f, + 7.00539e-05f, 6.46441e-05f, 5.37976e-05f, 2.97925e-05f, 2.99793e-05f, 2.77311e-05f, + 6.76079e-07f }; //Add multispectral bands to the temporary list diff --git a/Modules/Core/ObjectList/include/otbImageList.h b/Modules/Core/ObjectList/include/otbImageList.h index c828838a04ee6793eda3befa6470c5ead3849708..d99c42ed2c9ee761bf0b8e7958a4054da69e40eb 100644 --- a/Modules/Core/ObjectList/include/otbImageList.h +++ b/Modules/Core/ObjectList/include/otbImageList.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageList_h -#define __otbImageList_h +#ifndef otbImageList_h +#define otbImageList_h #include "otbObjectList.h" @@ -60,18 +60,18 @@ public: /** * Update images in the list. */ - virtual void UpdateOutputInformation(void); - virtual void PropagateRequestedRegion(void) - throw (itk::InvalidRequestedRegionError); - virtual void UpdateOutputData(void); + void UpdateOutputInformation(void) ITK_OVERRIDE; + void PropagateRequestedRegion(void) + throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; + void UpdateOutputData(void) ITK_OVERRIDE; protected: /** Constructor */ ImageList() {}; /** Destructor */ - virtual ~ImageList() {} + ~ImageList() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/ObjectList/include/otbImageList.txx b/Modules/Core/ObjectList/include/otbImageList.txx index 8c0db0ae08496fdd0a9c5235b72d5761962473b8..175e8ddcce5206488cd9b11e9560da713b7d180b 100644 --- a/Modules/Core/ObjectList/include/otbImageList.txx +++ b/Modules/Core/ObjectList/include/otbImageList.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageList_txx -#define __otbImageList_txx +#ifndef otbImageList_txx +#define otbImageList_txx +#include "otbImageList.h" #include "otbMacro.h" namespace otb diff --git a/Modules/Core/ObjectList/include/otbImageListSource.h b/Modules/Core/ObjectList/include/otbImageListSource.h index 2e2b02b0b96302e2662d71161696375f2522aaf9..bdd164831c4a8d49e0a36dac3d3b65827f414d93 100644 --- a/Modules/Core/ObjectList/include/otbImageListSource.h +++ b/Modules/Core/ObjectList/include/otbImageListSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListSource_h -#define __otbImageListSource_h +#ifndef otbImageListSource_h +#define otbImageListSource_h #include "itkProcessObject.h" #include "otbImageList.h" @@ -62,9 +62,9 @@ protected: /** Constructor */ ImageListSource(); /** Destructor */ - virtual ~ImageListSource() {} + ~ImageListSource() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListSource(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListSource.txx b/Modules/Core/ObjectList/include/otbImageListSource.txx index 507e1df87ea4374fb5edd3f30555aecf598d2523..5cf7009ea4a535dd3261262b2e1191b23c2a708a 100644 --- a/Modules/Core/ObjectList/include/otbImageListSource.txx +++ b/Modules/Core/ObjectList/include/otbImageListSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListSource_txx -#define __otbImageListSource_txx +#ifndef otbImageListSource_txx +#define otbImageListSource_txx #include "otbImageListSource.h" @@ -43,7 +43,7 @@ ImageListSource<TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageListType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Core/ObjectList/include/otbImageListToImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageFilter.h index a43ee7437af326a0f0caf59ed342da43bef36b73..738894599c07004789a881976a35bec94aee703e 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageFilter_h -#define __otbImageListToImageFilter_h +#ifndef otbImageListToImageFilter_h +#define otbImageListToImageFilter_h #include "itkImageSource.h" #include "otbImageList.h" @@ -72,9 +72,9 @@ protected: /** Constructor */ ImageListToImageFilter(); /** Destructor */ - virtual ~ImageListToImageFilter() {} + ~ImageListToImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageFilter.txx b/Modules/Core/ObjectList/include/otbImageListToImageFilter.txx index 8e5c4a538fcdf517a0b2f1984a098a692a235270..c264a457f0666d63c6c1e30448119811f6c1538c 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageListToImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageFilter_txx -#define __otbImageListToImageFilter_txx +#ifndef otbImageListToImageFilter_txx +#define otbImageListToImageFilter_txx #include "otbImageListToImageFilter.h" @@ -56,7 +56,7 @@ ImageListToImageFilter<TInputImage, TOutputImage> if (this->GetNumberOfInputs() < 1) { // exit - return 0; + return ITK_NULLPTR; } // else return the first input return static_cast<InputImageListType *> diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h index 8ed1dd401e474f7e1f1dcb85c51bdb7e9c838827..ca911d846447242b024efe09131f57f908bbf719 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageListApplyFilter_h -#define __otbImageListToImageListApplyFilter_h +#ifndef otbImageListToImageListApplyFilter_h +#define otbImageListToImageListApplyFilter_h #include "otbImageListToImageListFilter.h" @@ -78,20 +78,20 @@ public: /** Generate output information for the ImageList and for each image in the list. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region for each image in the list. */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ ImageListToImageListApplyFilter(); /** Destructor */ - virtual ~ImageListToImageListApplyFilter() {} + ~ImageListToImageListApplyFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListToImageListApplyFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.txx b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.txx index 66556e2e58044e6f4f83a44fbabd0d982568fc77..c1b795e06267dab2c9d4150d1e3f8a7fbb05fd0a 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageListApplyFilter_txx -#define __otbImageListToImageListApplyFilter_txx +#ifndef otbImageListToImageListApplyFilter_txx +#define otbImageListToImageListApplyFilter_txx #include "otbImageListToImageListApplyFilter.h" diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h index 54d940b4f1badea9aff46a9f1c368f2640ade3c9..72a7ddd92316edd2bbdf266a7123d1c16ea172d5 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageListFilter_h -#define __otbImageListToImageListFilter_h +#ifndef otbImageListToImageListFilter_h +#define otbImageListToImageListFilter_h #include "otbImageListSource.h" @@ -70,9 +70,9 @@ protected: /** Constructor */ ImageListToImageListFilter(); /** Destructor */ - virtual ~ImageListToImageListFilter() {} + ~ImageListToImageListFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.txx b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.txx index c714b378659e25b0bcc93a00bb99b69cf23ef883..d9cf8cb16b7d911ec2cf38ad7103f968eb424d66 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToImageListFilter_txx -#define __otbImageListToImageListFilter_txx +#ifndef otbImageListToImageListFilter_txx +#define otbImageListToImageListFilter_txx #include "otbImageListToImageListFilter.h" @@ -56,7 +56,7 @@ ImageListToImageListFilter<TInputImage, TOutputImage> if (this->GetNumberOfInputs() < 1) { // exit - return 0; + return ITK_NULLPTR; } // else return the first input return static_cast<InputImageListType *> diff --git a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h index 259224ae17ec8fdefe19ad2e7e83af16c3ee3c62..d1e33432b2fbe5d496a807176a9e8b711f2b3724 100644 --- a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToSingleImageFilter_h -#define __otbImageListToSingleImageFilter_h +#ifndef otbImageListToSingleImageFilter_h +#define otbImageListToSingleImageFilter_h #include "otbImageListToImageFilter.h" @@ -70,13 +70,13 @@ protected: /** Constructor */ ImageListToSingleImageFilter(); /** Destructor */ - virtual ~ImageListToSingleImageFilter() {} + ~ImageListToSingleImageFilter() ITK_OVERRIDE {} /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.txx b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.txx index fa0271f0d81de22f9e60c38170eece0897a8b4ab..e833202b7994c56b9cf24ba0c01a8e7faa9d926e 100644 --- a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageListToSingleImageFilter_txx -#define __otbImageListToSingleImageFilter_txx +#ifndef otbImageListToSingleImageFilter_txx +#define otbImageListToSingleImageFilter_txx #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionIteratorWithIndex.h" @@ -47,7 +47,7 @@ ImageListToSingleImageFilter<TImageType> if (this->GetNumberOfInputs() != 1) { // exit - return 0; + return ITK_NULLPTR; } // else return the first input return static_cast<OutputImagePointerType>( diff --git a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h index 5c37ea17bb660912cdea2ec8194a4c4210c043e3..6a9bb591b5792b146cd3d59e637cab66909be501 100644 --- a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToVectorImageFilter_h -#define __otbImageListToVectorImageFilter_h +#ifndef otbImageListToVectorImageFilter_h +#define otbImageListToVectorImageFilter_h #include "otbImageListToImageFilter.h" @@ -64,26 +64,26 @@ public: protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** * GenerateInputRequestedRegion * Set the requested region of each image in the list. */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Constructor */ ImageListToVectorImageFilter() {}; /** Destructor */ - virtual ~ImageListToVectorImageFilter() {} + ~ImageListToVectorImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListToVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.txx b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.txx index d8ae323ea8cd558b0080217dba4f136bef788796..e7f29ec279c429bbf993354d7085ebf038eeca0a 100644 --- a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToVectorImageFilter_txx -#define __otbImageListToVectorImageFilter_txx +#ifndef otbImageListToVectorImageFilter_txx +#define otbImageListToVectorImageFilter_txx #include "otbImageListToVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Core/ObjectList/include/otbImageToImageListFilter.h b/Modules/Core/ObjectList/include/otbImageToImageListFilter.h index b2d67466d94d82d90f0aef205bcc4fe81aa425fc..fbb77912084ca22d956b7512ff4c6551d6fec487 100644 --- a/Modules/Core/ObjectList/include/otbImageToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbImageToImageListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToImageListFilter_h -#define __otbImageToImageListFilter_h +#ifndef otbImageToImageListFilter_h +#define otbImageToImageListFilter_h #include "otbImageListSource.h" @@ -68,9 +68,9 @@ protected: /** Constructor */ ImageToImageListFilter(); /** Destructor */ - virtual ~ImageToImageListFilter() {} + ~ImageToImageListFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageToImageListFilter.txx b/Modules/Core/ObjectList/include/otbImageToImageListFilter.txx index 2edba9c5f6070282b0735d270a972114a10c9d8b..5e82a124b73573d5c0efea66cfd44da06d7f6f78 100644 --- a/Modules/Core/ObjectList/include/otbImageToImageListFilter.txx +++ b/Modules/Core/ObjectList/include/otbImageToImageListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToImageListFilter_txx -#define __otbImageToImageListFilter_txx +#ifndef otbImageToImageListFilter_txx +#define otbImageToImageListFilter_txx #include "otbImageToImageListFilter.h" @@ -56,7 +56,7 @@ ImageToImageListFilter<TInputImage, TOutputImage> if (this->GetNumberOfInputs() < 1) { // exit - return 0; + return ITK_NULLPTR; } // else return the first input return static_cast<TInputImage *> diff --git a/Modules/Core/ObjectList/include/otbObjectList.h b/Modules/Core/ObjectList/include/otbObjectList.h index eb7781e5beb0ec84770325406c487e026c08e443..b4fd91dd7a9b1a66068004d19daebe16f6a36db8 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.h +++ b/Modules/Core/ObjectList/include/otbObjectList.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectList_h -#define __otbObjectList_h +#ifndef otbObjectList_h +#define otbObjectList_h #include <vector> #include "itkDataObject.h" @@ -584,9 +584,9 @@ protected: /** Constructor */ ObjectList(); /** Destructor */ - ~ObjectList() {} + ~ObjectList() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ObjectList(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbObjectList.txx b/Modules/Core/ObjectList/include/otbObjectList.txx index e48d0f0a9d24a3e2882a9c4f2f72af1674f07b67..2dc7fef3ae7389929b55fcf05ed4795b1d4df4a6 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.txx +++ b/Modules/Core/ObjectList/include/otbObjectList.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectList_txx -#define __otbObjectList_txx +#ifndef otbObjectList_txx +#define otbObjectList_txx #include "otbObjectList.h" #include "itkMacro.h" diff --git a/Modules/Core/ObjectList/include/otbObjectListSource.h b/Modules/Core/ObjectList/include/otbObjectListSource.h index 858a4f377b7c5c394eab37aad4297b90ee04da41..1db920c4913a148d7c82bfaec6e234d14c6fc1e4 100644 --- a/Modules/Core/ObjectList/include/otbObjectListSource.h +++ b/Modules/Core/ObjectList/include/otbObjectListSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectListSource_h -#define __otbObjectListSource_h +#ifndef otbObjectListSource_h +#define otbObjectListSource_h #include "itkProcessObject.h" #include "otbObjectList.h" @@ -76,7 +76,7 @@ public: * SmartPointer to a DataObject. If a subclass of ImageSource has * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Graft the specified DataObject onto this ProcessObject's output. @@ -170,9 +170,9 @@ protected: /** Constructor */ ObjectListSource(); /** Destructor */ - virtual ~ObjectListSource() {} + ~ObjectListSource() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Ensure that the output lists are cleared before processing */ virtual void AllocateOutputs(); @@ -187,7 +187,7 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: ObjectListSource(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbObjectListSource.txx b/Modules/Core/ObjectList/include/otbObjectListSource.txx index e23e1aa5af897587a38acfa81f9f785abd8c435b..29142c6d49c0c322a4138634da717c1dc1703e45 100644 --- a/Modules/Core/ObjectList/include/otbObjectListSource.txx +++ b/Modules/Core/ObjectList/include/otbObjectListSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectListSource_txx -#define __otbObjectListSource_txx +#ifndef otbObjectListSource_txx +#define otbObjectListSource_txx #include "otbObjectListSource.h" #include "itkProgressReporter.h" @@ -62,7 +62,7 @@ ObjectListSource<TOutputList> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputList*> @@ -142,7 +142,7 @@ void ObjectListSource<TOutputList> ::GenerateData(void) { - itkExceptionMacro("subclass should override this method!!!"); + itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); } /** diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h index 5956404d7d368d810b34b166c8c4ab074c1cd827..8ab945b84173af86ee4165c110ee3b18424ff3d7 100644 --- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h +++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectListToObjectListFilter_h -#define __otbObjectListToObjectListFilter_h +#ifndef otbObjectListToObjectListFilter_h +#define otbObjectListToObjectListFilter_h #include "otbObjectListSource.h" @@ -74,11 +74,11 @@ protected: /** Constructor */ ObjectListToObjectListFilter(); /** Destructor */ - virtual ~ObjectListToObjectListFilter() {} + ~ObjectListToObjectListFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Multi-threading implementation */ diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx index d0e73b6f70a9d97f89d43247f76c6c2549a83ffd..99edfd1302d6445698e3887a84e5b2164f0d53b7 100644 --- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx +++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectListToObjectListFilter_txx -#define __otbObjectListToObjectListFilter_txx +#ifndef otbObjectListToObjectListFilter_txx +#define otbObjectListToObjectListFilter_txx #include "otbObjectListToObjectListFilter.h" #include "itkProgressReporter.h" @@ -51,7 +51,7 @@ ObjectListToObjectListFilter<TInputList, TOutputList> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputList *> @@ -131,12 +131,12 @@ ObjectListToObjectListFilter<TInputList, TOutputList> ::ThreadedGenerateData(unsigned int /*startIndex*/, unsigned int /*stopIndex*/, itk::ThreadIdType /*threadId*/) { // The following code is equivalent to: - // itkExceptionMacro("subclass should override this method!!!"); + // itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); // The ExceptionMacro is not used because gcc warns that a // 'noreturn' function does return std::ostringstream message; message << "itk::ERROR: " << this->GetNameOfClass() - << "(" << this << "): " << "Subclass should override this method!!!"; + << "(" << this << "): " << "Subclass should ITK_OVERRIDE this method!!!"; itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); throw e_; diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h index 2555e22d1c4cf66f53982f6cd03c8bbc22d5f4e7..b54215377a9d604338c2db16b11944566411dcba 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorObjectListBooleanFilter_h -#define __otbUnaryFunctorObjectListBooleanFilter_h +#ifndef otbUnaryFunctorObjectListBooleanFilter_h +#define otbUnaryFunctorObjectListBooleanFilter_h #include "otbObjectListToObjectListFilter.h" @@ -90,15 +90,15 @@ public: protected: UnaryFunctorObjectListBooleanFilter(); - virtual ~UnaryFunctorObjectListBooleanFilter() {} + ~UnaryFunctorObjectListBooleanFilter() ITK_OVERRIDE {} /** Multi-threading implementation */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** startIndex and stopIndex represent the indices of the Objects to examine in thread threadId */ - virtual void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId); + void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Internal structure used for passing image data into the threading library */ struct ThreadStruct diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.txx b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.txx index e468fa09cad7dc5e4f1209873736b545442f652b..5898fe70d41a57aa9536a39b7aad1f7165e7d3f9 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.txx +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorObjectListBooleanFilter_txx -#define __otbUnaryFunctorObjectListBooleanFilter_txx +#ifndef otbUnaryFunctorObjectListBooleanFilter_txx +#define otbUnaryFunctorObjectListBooleanFilter_txx #include "otbUnaryFunctorObjectListBooleanFilter.h" #include "itkProgressReporter.h" diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h index ac644bdede8ddb2f3caffbe4bb90bb8ede71926d..ae1cf1e01cd72d280f7f9e87c261e796a6d1c258 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorObjectListFilter_h -#define __otbUnaryFunctorObjectListFilter_h +#ifndef otbUnaryFunctorObjectListFilter_h +#define otbUnaryFunctorObjectListFilter_h #include "otbObjectListToObjectListFilter.h" @@ -91,15 +91,15 @@ public: protected: UnaryFunctorObjectListFilter(); - virtual ~UnaryFunctorObjectListFilter() {} + ~UnaryFunctorObjectListFilter() ITK_OVERRIDE {} /** Multi-threading implementation */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** startIndex and stopIndex represent the indices of the Objects to examine in thread threadId */ - virtual void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId); + void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) ITK_OVERRIDE; /** End Multi-threading implementation */ diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.txx b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.txx index cba8ecfaa72cdc60379ef20e11cc36d58d1dfd48..ba03a138b6c508e6d36f1e246a0c53c1bca7ded0 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.txx +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorObjectListFilter_txx -#define __otbUnaryFunctorObjectListFilter_txx +#ifndef otbUnaryFunctorObjectListFilter_txx +#define otbUnaryFunctorObjectListFilter_txx #include "otbUnaryFunctorObjectListFilter.h" #include "itkProgressReporter.h" diff --git a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h index 20761f261bd1e2f9c15f4b990b8325cfea603087..db1d3b20c90fdf3133faf9e663bfbd9901105a73 100644 --- a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToImageListFilter_h -#define __otbVectorImageToImageListFilter_h +#ifndef otbVectorImageToImageListFilter_h +#define otbVectorImageToImageListFilter_h #include "otbImageToImageListFilter.h" @@ -64,22 +64,22 @@ public: typedef typename OutputImageType::Pointer OutputImagePointerType; /** Generate the input requested region from the first element in the list. */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Generate the output information by building the output list. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ VectorImageToImageListFilter() {}; /** Destructor */ - virtual ~VectorImageToImageListFilter() {} + ~VectorImageToImageListFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorImageToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.txx b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.txx index 46e1ddbb8eadac5d5bd1e24da6d9d37dcbc92ed6..777d256019ad64cac90c6aa32de7961035c1f7ac 100644 --- a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.txx +++ b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToImageListFilter_txx -#define __otbVectorImageToImageListFilter_txx +#ifndef otbVectorImageToImageListFilter_txx +#define otbVectorImageToImageListFilter_txx #include "otbVectorImageToImageListFilter.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h index c272fca339df3268b31bd1c7f6a3300112a2d06e..2aa69a0039727e304dc842bc9be44ae9f25a2b1c 100644 --- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPointSetFilter_h -#define __otbImageToPointSetFilter_h +#ifndef otbImageToPointSetFilter_h +#define otbImageToPointSetFilter_h #include "otbPointSetSource.h" #include "otbRAMDrivenAdaptativeStreamingManager.h" @@ -76,14 +76,14 @@ public: const InputImageType * GetInput(); /** Prepare the output */ - void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; protected: ImageToPointSetFilter(); - virtual ~ImageToPointSetFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageToPointSetFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Multi-threading implementation */ diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx b/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx index a454869c67a05873c513931d6ba3cfc7c70d4fbd..d79425d3661068272dd853c9d146af89c908ba66 100644 --- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx +++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPointSetFilter_txx -#define __otbImageToPointSetFilter_txx +#ifndef otbImageToPointSetFilter_txx +#define otbImageToPointSetFilter_txx #include "otbImageToPointSetFilter.h" @@ -94,7 +94,7 @@ const typename ImageToPointSetFilter<TInputImage, TOutputPointSet>::InputImageTy ImageToPointSetFilter<TInputImage, TOutputPointSet> ::GetInput(void) { - if (this->GetNumberOfInputs() < 1) return 0; + if (this->GetNumberOfInputs() < 1) return ITK_NULLPTR; return dynamic_cast<const InputImageType*> (this->ProcessObjectType::GetInput(0)); @@ -256,12 +256,12 @@ ImageToPointSetFilter<TInputImage, TOutputPointSet> ::ThreadedGenerateData(const InputImageRegionType&, itk::ThreadIdType) { // The following code is equivalent to: - // itkExceptionMacro("subclass should override this method!!!"); + // itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); // The ExceptionMacro is not used because gcc warns that a // 'noreturn' function does return std::ostringstream message; message << "itk::ERROR: " << this->GetNameOfClass() - << "(" << this << "): " << "Subclass should override this method!!!"; + << "(" << this << "): " << "Subclass should ITK_OVERRIDE this method!!!"; itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); throw e_; diff --git a/Modules/Core/PointSet/include/otbPointSetAndValuesFunction.h b/Modules/Core/PointSet/include/otbPointSetAndValuesFunction.h index 72865167f44d6fb42bb0f378f9d99c1e808f10d6..c6348a18e277cb114622ac6bb40fe5ae10a151fa 100644 --- a/Modules/Core/PointSet/include/otbPointSetAndValuesFunction.h +++ b/Modules/Core/PointSet/include/otbPointSetAndValuesFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetAndValuesFunction_h -#define __otbPointSetAndValuesFunction_h +#ifndef otbPointSetAndValuesFunction_h +#define otbPointSetAndValuesFunction_h #include "itkFunctionBase.h" #include "itkContinuousIndex.h" diff --git a/Modules/Core/PointSet/include/otbPointSetExtractROI.h b/Modules/Core/PointSet/include/otbPointSetExtractROI.h index ffb7a76c8376092baf93e87d658a41543119fc2d..f43667b271fa4cfcacdf3fea99d56aa5d651ee4a 100644 --- a/Modules/Core/PointSet/include/otbPointSetExtractROI.h +++ b/Modules/Core/PointSet/include/otbPointSetExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetExtractROI_h -#define __otbPointSetExtractROI_h +#ifndef otbPointSetExtractROI_h +#define otbPointSetExtractROI_h #include "otbPointSetToPointSetFilter.h" #include "itkTransform.h" @@ -75,11 +75,11 @@ public: protected: PointSetExtractROI(); - virtual ~PointSetExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PointSetExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate Requested Data */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: PointSetExtractROI(const PointSetExtractROI &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetExtractROI.txx b/Modules/Core/PointSet/include/otbPointSetExtractROI.txx index cca471af42f17b1de1551ab603418ff88224cdd5..03a525f3e8f7e9a0becf0601fe2ec78d74e87ff8 100644 --- a/Modules/Core/PointSet/include/otbPointSetExtractROI.txx +++ b/Modules/Core/PointSet/include/otbPointSetExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetExtractROI_txx -#define __otbPointSetExtractROI_txx +#ifndef otbPointSetExtractROI_txx +#define otbPointSetExtractROI_txx #include "otbPointSetExtractROI.h" #include "itkMacro.h" diff --git a/Modules/Core/PointSet/include/otbPointSetFunction.h b/Modules/Core/PointSet/include/otbPointSetFunction.h index 784c4a5c4c6c56620b8ffb72d7111570b5b79d94..1c9cd58f6818f445453bdb9db61901cac839b0c0 100644 --- a/Modules/Core/PointSet/include/otbPointSetFunction.h +++ b/Modules/Core/PointSet/include/otbPointSetFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetFunction_h -#define __otbPointSetFunction_h +#ifndef otbPointSetFunction_h +#define otbPointSetFunction_h #include "itkSpatialFunction.h" #include "itkProcessObject.h" @@ -68,9 +68,9 @@ public: protected: PointSetFunction(); - ~PointSetFunction() {} + ~PointSetFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetFunction(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetFunction.txx b/Modules/Core/PointSet/include/otbPointSetFunction.txx index 81e8dcc52dfe08e43fb954b3921b6e24ccaecff2..5fc40ad50972e57298a9a471d554b14c6f28e148 100644 --- a/Modules/Core/PointSet/include/otbPointSetFunction.txx +++ b/Modules/Core/PointSet/include/otbPointSetFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetFunction_txx -#define __otbPointSetFunction_txx +#ifndef otbPointSetFunction_txx +#define otbPointSetFunction_txx #include "otbPointSetFunction.h" diff --git a/Modules/Core/PointSet/include/otbPointSetSource.h b/Modules/Core/PointSet/include/otbPointSetSource.h index e731e9adf9b4e768fbb7cb664ea3b4ded77b4b26..08bf3d6fa1f71256474afea91babaee56852b591 100644 --- a/Modules/Core/PointSet/include/otbPointSetSource.h +++ b/Modules/Core/PointSet/include/otbPointSetSource.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbPointSetSource_h -#define __otbPointSetSource_h +#ifndef otbPointSetSource_h +#define otbPointSetSource_h #include "itkProcessObject.h" @@ -122,18 +122,18 @@ public: * SmartPointer to a DataObject. If a subclass of MeshSource has * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; protected: PointSetSource(); - virtual ~PointSetSource() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PointSetSource() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Requested region of Point Set is specified as i of N unstructured regions. * Since all DataObjects should be able to set the requested region in * unstructured form, just copy output->RequestedRegion all inputs. */ - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; private: PointSetSource(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetSource.txx b/Modules/Core/PointSet/include/otbPointSetSource.txx index 9bb4cc19c1b0982c050e55a8b3c975bc533ba702..c5f0dc68428b28badc3fa349dd08dc175c3f6d6e 100644 --- a/Modules/Core/PointSet/include/otbPointSetSource.txx +++ b/Modules/Core/PointSet/include/otbPointSetSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetSource_txx -#define __otbPointSetSource_txx +#ifndef otbPointSetSource_txx +#define otbPointSetSource_txx #include "otbPointSetSource.h" @@ -63,7 +63,7 @@ PointSetSource<TOutputPointSet> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputPointSet*> diff --git a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h index de123b11c9c7ea8a0b02b91b4cb9df9b48e594d1..0726a32c85bdd64d10c187b5d47f642e3cb6dd3a 100644 --- a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToPointSetFilter_h -#define __otbPointSetToPointSetFilter_h +#ifndef otbPointSetToPointSetFilter_h +#define otbPointSetToPointSetFilter_h #include "otbPointSetSource.h" #include "otbStreamingTraits.h" @@ -70,8 +70,8 @@ public: protected: PointSetToPointSetFilter(); - virtual ~PointSetToPointSetFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PointSetToPointSetFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetToPointSetFilter(const PointSetToPointSetFilter &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.txx b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.txx index 2433cab447239cfcde2b7ee063bd32270c36f677..358a274e234f1803e23fa3e21d48614f03ef112a 100644 --- a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.txx +++ b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToPointSetFilter_txx -#define __otbPointSetToPointSetFilter_txx +#ifndef otbPointSetToPointSetFilter_txx +#define otbPointSetToPointSetFilter_txx #include "otbPointSetToPointSetFilter.h" @@ -85,7 +85,7 @@ typename PointSetToPointSetFilter<TInputPointSet, TOutputPointSet>::InputPointSe PointSetToPointSetFilter<TInputPointSet, TOutputPointSet> ::GetInput(void) { - if (this->GetNumberOfInputs() < 1) return 0; + if (this->GetNumberOfInputs() < 1) return ITK_NULLPTR; return static_cast<InputPointSetType*> (this->ProcessObjectType::GetInput(0)); diff --git a/Modules/Core/PointSet/include/otbRandomPointSetSource.h b/Modules/Core/PointSet/include/otbRandomPointSetSource.h index 553dbd40416f4e5cc793f5dc8c8257226bbf1c4f..f967199dd3d560cbf595335982710973a8ab7d6c 100644 --- a/Modules/Core/PointSet/include/otbRandomPointSetSource.h +++ b/Modules/Core/PointSet/include/otbRandomPointSetSource.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbRandomPointSetSource_h -#define __otbRandomPointSetSource_h +#ifndef otbRandomPointSetSource_h +#define otbRandomPointSetSource_h #include "otbPointSetSource.h" #include "itkMersenneTwisterRandomVariateGenerator.h" @@ -84,9 +84,9 @@ public: protected: RandomPointSetSource(); - virtual ~RandomPointSetSource() {} + ~RandomPointSetSource() ITK_OVERRIDE {} - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: RandomPointSetSource(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbRandomPointSetSource.txx b/Modules/Core/PointSet/include/otbRandomPointSetSource.txx index 28b81afd20260f3c95afb01524d84e34abc4e6d2..2b6f944e4ac3ee2c3b7a98f41bb63ac4ef398c1a 100644 --- a/Modules/Core/PointSet/include/otbRandomPointSetSource.txx +++ b/Modules/Core/PointSet/include/otbRandomPointSetSource.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbRandomPointSetSource_txx -#define __otbRandomPointSetSource_txx +#ifndef otbRandomPointSetSource_txx +#define otbRandomPointSetSource_txx #include "otbRandomPointSetSource.h" diff --git a/Modules/Core/PointSet/include/otbSimplePointCountStrategy.h b/Modules/Core/PointSet/include/otbSimplePointCountStrategy.h index d2f443f09122deb4fe985e76a33f33e299bd5751..b1b83f2f6bb9af193067804a57fd8a2586c28a48 100644 --- a/Modules/Core/PointSet/include/otbSimplePointCountStrategy.h +++ b/Modules/Core/PointSet/include/otbSimplePointCountStrategy.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSimplePointCountStrategy_h -#define __otbSimplePointCountStrategy_h +#ifndef otbSimplePointCountStrategy_h +#define otbSimplePointCountStrategy_h #include "otbMath.h" diff --git a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h index 91227d388176336f0e66e156fed8bdb2fe5707f4..258d92aef260b6998fc0bc4842a12dcb8e4cd8f2 100644 --- a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbThresholdImageToPointSetFilter_h -#define __otbThresholdImageToPointSetFilter_h +#ifndef otbThresholdImageToPointSetFilter_h +#define otbThresholdImageToPointSetFilter_h #include "otbImageToPointSetFilter.h" #include "itkPointSet.h" @@ -81,11 +81,11 @@ public: protected: ThresholdImageToPointSetFilter(); - virtual ~ThresholdImageToPointSetFilter() {} + ~ThresholdImageToPointSetFilter() ITK_OVERRIDE {} - virtual void ThreadedGenerateData(const InputImageRegionType& inputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const InputImageRegionType& inputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ThresholdImageToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.txx b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.txx index 4bb531d8edfccf94a8876c223cbb6fbf53cd2c51..e12d4cb41a75ba8eebf49bf1431b2ad5c8f9b747 100644 --- a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.txx +++ b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbThresholdImageToPointSetFilter_txx -#define __otbThresholdImageToPointSetFilter_txx +#ifndef otbThresholdImageToPointSetFilter_txx +#define otbThresholdImageToPointSetFilter_txx #include "otbThresholdImageToPointSetFilter.h" #include "itkImageRegionConstIterator.h" diff --git a/Modules/Core/PointSet/include/otbTransformPointSetFilter.h b/Modules/Core/PointSet/include/otbTransformPointSetFilter.h index 620a06086b30d4f8baa4d111413a48c0243a84d5..2512dd3370cce08a497c9bcc364496349d56aa7b 100644 --- a/Modules/Core/PointSet/include/otbTransformPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbTransformPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTransformPointSetFilter_h -#define __otbTransformPointSetFilter_h +#ifndef otbTransformPointSetFilter_h +#define otbTransformPointSetFilter_h #include "otbPointSetToPointSetFilter.h" @@ -72,11 +72,11 @@ public: protected: TransformPointSetFilter(); - virtual ~TransformPointSetFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~TransformPointSetFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate Requested Data */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Transform to apply to all the PointSet points. */ typename TransformType::Pointer m_Transform; diff --git a/Modules/Core/PointSet/include/otbTransformPointSetFilter.txx b/Modules/Core/PointSet/include/otbTransformPointSetFilter.txx index 5658d1fe1a3c99bfe485c68e3b99a6615c620f9d..4530bfababd4bef96753a2982669e28f92f4e823 100644 --- a/Modules/Core/PointSet/include/otbTransformPointSetFilter.txx +++ b/Modules/Core/PointSet/include/otbTransformPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTransformPointSetFilter_txx -#define __otbTransformPointSetFilter_txx +#ifndef otbTransformPointSetFilter_txx +#define otbTransformPointSetFilter_txx #include "otbTransformPointSetFilter.h" #include "itkMacro.h" diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h index 5fd838de308f22350f856fb9803304c541260154..1024dfc0427a5ae3d4bf2106d50471fff0238af7 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawLineSpatialObjectFilter_h -#define __otbDrawLineSpatialObjectFilter_h +#ifndef otbDrawLineSpatialObjectFilter_h +#define otbDrawLineSpatialObjectFilter_h #include "itkSpatialObjectToImageFilter.h" #include "otbDrawLineSpatialObjectListFilter.h" @@ -98,10 +98,10 @@ public: protected: DrawLineSpatialObjectFilter(); - virtual ~DrawLineSpatialObjectFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DrawLineSpatialObjectFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: DrawLineSpatialObjectFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.txx b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.txx index 0f25a3268e021cff340b27cfaed7873ef148d37f..8a9fc656d3c955721abc53862c570647e5e38cfc 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawLineSpatialObjectFilter_txx -#define __otbDrawLineSpatialObjectFilter_txx +#ifndef otbDrawLineSpatialObjectFilter_txx +#define otbDrawLineSpatialObjectFilter_txx #include "otbDrawLineSpatialObjectFilter.h" diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h index 7563d8552e7906ee20b439a393027a7384de11cb..27e11f013b5abd8015ade4209e3e5a39e0d3dce3 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawLineSpatialObjectListFilter_h -#define __otbDrawLineSpatialObjectListFilter_h +#ifndef otbDrawLineSpatialObjectListFilter_h +#define otbDrawLineSpatialObjectListFilter_h #include "itkImageToImageFilter.h" #include "otbLineSpatialObjectList.h" @@ -89,10 +89,10 @@ public: protected: DrawLineSpatialObjectListFilter(); - virtual ~DrawLineSpatialObjectListFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DrawLineSpatialObjectListFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * compute the intersection of the segment to draw with the region diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.txx b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.txx index df8feaac3db870eddd9ede2c1940bd4a7549cdc2..b632705b16a1f4100eb879af8dd854ae7254f775 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawLineSpatialObjectListFilter_txx -#define __otbDrawLineSpatialObjectListFilter_txx +#ifndef otbDrawLineSpatialObjectListFilter_txx +#define otbDrawLineSpatialObjectListFilter_txx #include "otbDrawLineSpatialObjectListFilter.h" diff --git a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h index 793cadc98ed87bce117e279f23c62929fe749a63..ff3dcd4f415b27c3029e7e76eb1c11c6033aad15 100644 --- a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h +++ b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToLineSpatialObjectListFilter_h -#define __otbImageToLineSpatialObjectListFilter_h +#ifndef otbImageToLineSpatialObjectListFilter_h +#define otbImageToLineSpatialObjectListFilter_h #include "itkProcessObject.h" @@ -82,8 +82,8 @@ public: protected: ImageToLineSpatialObjectListFilter(); - virtual ~ImageToLineSpatialObjectListFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageToLineSpatialObjectListFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToLineSpatialObjectListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.txx b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.txx index ab31f0586841bcc3ea6c52ef9857aa98fb671b28..3fdd1ef5ccbbe94921dfa6a70843fe7fbc99f380 100644 --- a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToLineSpatialObjectListFilter_txx -#define __otbImageToLineSpatialObjectListFilter_txx +#ifndef otbImageToLineSpatialObjectListFilter_txx +#define otbImageToLineSpatialObjectListFilter_txx #include "otbImageToLineSpatialObjectListFilter.h" diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h index c65adda4ce3f8e6cf4b3aec1e6b9f146eb4fd4a2..05601adfbd98cfed48a4716bee769961ba8215c3 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObject_h -#define __otbLineSpatialObject_h +#ifndef otbLineSpatialObject_h +#define otbLineSpatialObject_h #include "itkPointBasedSpatialObject.h" #include "itkLineSpatialObjectPoint.h" @@ -69,19 +69,19 @@ public: void SetPoints(PointListType& newPoints); /** Return a point in the list given the index */ - const SpatialObjectPointType* GetPoint(unsigned long id) const + const SpatialObjectPointType* GetPoint(unsigned long id) const ITK_OVERRIDE { return &(m_Points[id]); } /** Return a point in the list given the index */ - SpatialObjectPointType* GetPoint(unsigned long id) + SpatialObjectPointType* GetPoint(unsigned long id) ITK_OVERRIDE { return &(m_Points[id]); } /** Return the number of points in the list */ - unsigned long GetNumberOfPoints(void) const + unsigned long GetNumberOfPoints(void) const ITK_OVERRIDE { return m_Points.size(); } @@ -89,18 +89,18 @@ public: /** Returns true if the line is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType& point, - unsigned int depth = 0, char * name = NULL) const; + unsigned int depth = 0, char * name = ITK_NULLPTR) const ITK_OVERRIDE; /** Returns the value of the line at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Lines. */ bool ValueAt(const PointType& point, double& value, - unsigned int depth = 0, char * name = NULL) const; + unsigned int depth = 0, char * name = ITK_NULLPTR) const ITK_OVERRIDE; /** Returns true if the point is inside the line, false otherwise. */ bool IsInside(const PointType& point, - unsigned int depth, char * name) const; + unsigned int depth, char * name) const ITK_OVERRIDE; /** Test whether a point is inside or outside the object * For computational speed purposes, it is faster if the method does not @@ -108,15 +108,15 @@ public: virtual bool IsInside(const PointType& point) const; /** Compute the boundaries of the line.*/ - bool ComputeLocalBoundingBox() const; + bool ComputeLocalBoundingBox() const ITK_OVERRIDE; protected: /** Constructor */ LineSpatialObject(); /** Destructor */ - virtual ~LineSpatialObject(); + ~LineSpatialObject() ITK_OVERRIDE; /** Method to print the object. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LineSpatialObject(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.txx b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.txx index 06a46be370ae826474c5438dc71d01ca3289fb0b..e6cf4a154690b7ec9ee655fd233159992683b36f 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.txx +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObject_txx -#define __otbLineSpatialObject_txx +#ifndef otbLineSpatialObject_txx +#define otbLineSpatialObject_txx #include "otbLineSpatialObject.h" @@ -223,7 +223,7 @@ LineSpatialObject<VDimension> { // otbMsgDevMacro( "Checking the point [" << point << "] is on the Line" ); - if (name == NULL) + if (name == ITK_NULLPTR) { if (IsInside(point)) { diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h index a41adde25156107958539ca742b8a8149c526c54..8ab58d187ab7cdb7b7b8ac2343330c0ff3346926 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObjectList_h -#define __otbLineSpatialObjectList_h +#ifndef otbLineSpatialObjectList_h +#define otbLineSpatialObjectList_h #include "itkDataObject.h" @@ -55,7 +55,7 @@ public: protected: LineSpatialObjectList() {}; - ~LineSpatialObjectList() {} + ~LineSpatialObjectList() ITK_OVERRIDE {} private: LineSpatialObjectList(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h index 04bb8441ef522e44d7ee4f39fd3450ac7a388533..73dfae6847ac622df337a81ae15b82667b0b454c 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObjectListToPointSetFilter_h -#define __otbLineSpatialObjectListToPointSetFilter_h +#ifndef otbLineSpatialObjectListToPointSetFilter_h +#define otbLineSpatialObjectListToPointSetFilter_h #include "itkProcessObject.h" @@ -71,8 +71,8 @@ public: protected: LineSpatialObjectListToPointSetFilter(); - virtual ~LineSpatialObjectListToPointSetFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LineSpatialObjectListToPointSetFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LineSpatialObjectListToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.txx b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.txx index 8bd5bf634c42e4bf8e740582c2aecf29bf8e7930..38dd85c1fb7850c0502f4916da065badd6bebca9 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObjectListToPointSetFilter_txx -#define __otbLineSpatialObjectListToPointSetFilter_txx +#ifndef otbLineSpatialObjectListToPointSetFilter_txx +#define otbLineSpatialObjectListToPointSetFilter_txx #include "otbLineSpatialObjectListToPointSetFilter.h" diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h index 76803062b31043a37ed6eec1a8d9e759400365e3..cad8ae979ddc10211626430c22ccfa3b1a0a40da 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpatialObjectSource_h -#define __otbSpatialObjectSource_h +#ifndef otbSpatialObjectSource_h +#define otbSpatialObjectSource_h #include "otbMacro.h" #include "itkProcessObject.h" @@ -64,9 +64,9 @@ protected: /** Constructor */ SpatialObjectSource(); /** Destructor */ - virtual ~SpatialObjectSource() {} + ~SpatialObjectSource() ITK_OVERRIDE {} /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SpatialObjectSource(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.txx b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.txx index e35e738bd26a397635ad692d7801bb6cfc54971c..a2faa58a69b77d2968db5bae7a26725e421d83d4 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.txx +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpatialObjectSource_txx -#define __otbSpatialObjectSource_txx +#ifndef otbSpatialObjectSource_txx +#define otbSpatialObjectSource_txx #include "otbSpatialObjectSource.h" @@ -43,7 +43,7 @@ SpatialObjectSource<TSpatialObject> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<SpatialObjectType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h index 8287affd5b8e1f08922c181c55dad348f14d34c1..28aad546ae6aad1312900a078e7839aa4504ab67 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpatialObjectToImageDrawingFilter_h -#define __otbSpatialObjectToImageDrawingFilter_h +#ifndef otbSpatialObjectToImageDrawingFilter_h +#define otbSpatialObjectToImageDrawingFilter_h #include "itkImageSource.h" #include "itkConceptChecking.h" @@ -137,10 +137,10 @@ public: protected: SpatialObjectToImageDrawingFilter(); - virtual ~SpatialObjectToImageDrawingFilter(); + ~SpatialObjectToImageDrawingFilter() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); // do nothing - virtual void GenerateData(); + void GenerateOutputInformation() ITK_OVERRIDE; // do nothing + void GenerateData() ITK_OVERRIDE; SizeType m_Size; double m_Spacing[OutputImageDimension]; @@ -150,7 +150,7 @@ protected: ValueType m_OutsideValue; bool m_UseObjectValue; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SpatialObjectToImageDrawingFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx index 7501ba32cbe0383192c269b420080160f5b5819d..197c7048366324753a21b235b3d0627fc82bf8bb 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpatialObjectToImageDrawingFilter_txx -#define __otbSpatialObjectToImageDrawingFilter_txx +#ifndef otbSpatialObjectToImageDrawingFilter_txx +#define otbSpatialObjectToImageDrawingFilter_txx #include "otbSpatialObjectToImageDrawingFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -82,7 +82,7 @@ SpatialObjectToImageDrawingFilter<TInputSpatialObject, TOutputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputSpatialObject *> diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h index eab1aa67a8095ec7e88f36eb311da59ebb1ddcd4..053c77d54ed87f7855d14719ceb8d4507224630e 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfDivisionsStrippedStreamingManager_h -#define __otbNumberOfDivisionsStrippedStreamingManager_h +#ifndef otbNumberOfDivisionsStrippedStreamingManager_h +#define otbNumberOfDivisionsStrippedStreamingManager_h #include "otbStreamingManager.h" #include "itkImageRegionSplitterSlowDimension.h" @@ -65,11 +65,11 @@ public: itkGetMacro(NumberOfDivisions, unsigned int); /** Actually computes the stream divisions given a DataObject and its region to write */ - virtual void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) ITK_OVERRIDE; protected: NumberOfDivisionsStrippedStreamingManager(); - virtual ~NumberOfDivisionsStrippedStreamingManager(); + ~NumberOfDivisionsStrippedStreamingManager() ITK_OVERRIDE; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitterSlowDimension SplitterType; diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.txx b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.txx index 6a1ef3748f354e2f07086218755078a9afdb46a2..60f5a5ff67eeb1021553cfd5747da18e8b3fa538 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfDivisionsStrippedStreamingManager_txx -#define __otbNumberOfDivisionsStrippedStreamingManager_txx +#ifndef otbNumberOfDivisionsStrippedStreamingManager_txx +#define otbNumberOfDivisionsStrippedStreamingManager_txx #include "otbNumberOfDivisionsStrippedStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h index e8498fd0c993b19d6329c89537f8832f3b579f2a..3f91fc038387e02031ce7ab49053d0abb685274a 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfDivisionsTiledStreamingManager_h -#define __otbNumberOfDivisionsTiledStreamingManager_h +#ifndef otbNumberOfDivisionsTiledStreamingManager_h +#define otbNumberOfDivisionsTiledStreamingManager_h #include "otbStreamingManager.h" @@ -64,11 +64,11 @@ public: itkGetMacro(NumberOfDivisions, unsigned int); /** Actually computes the stream divisions given a DataObject and its region to write */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; protected: NumberOfDivisionsTiledStreamingManager(); - virtual ~NumberOfDivisionsTiledStreamingManager(); + ~NumberOfDivisionsTiledStreamingManager() ITK_OVERRIDE; /** The number of lines per strip desired by the user. * This may be different than the one computed by the Splitter */ diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.txx b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.txx index b948e55ba95a2f0a1b15af9b5def8ad99b90037b..4a5e36c0eeda79aceb6b20c1a8bff2eee36cd747 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfDivisionsTiledStreamingManager_txx -#define __otbNumberOfDivisionsTiledStreamingManager_txx +#ifndef otbNumberOfDivisionsTiledStreamingManager_txx +#define otbNumberOfDivisionsTiledStreamingManager_txx #include "otbNumberOfDivisionsTiledStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h index 1c539cf143bc2ff56fc2de63fe7000809c6e6877..7efc0456dba3c32cf0099a33144de96c36fc071f 100644 --- a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfLinesStrippedStreamingManager_h -#define __otbNumberOfLinesStrippedStreamingManager_h +#ifndef otbNumberOfLinesStrippedStreamingManager_h +#define otbNumberOfLinesStrippedStreamingManager_h #include "otbStreamingManager.h" #include "itkImageRegionSplitter.h" @@ -66,11 +66,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) ITK_OVERRIDE; protected: NumberOfLinesStrippedStreamingManager(); - virtual ~NumberOfLinesStrippedStreamingManager(); + ~NumberOfLinesStrippedStreamingManager() ITK_OVERRIDE; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitter<itkGetStaticConstMacro(ImageDimension)> SplitterType; diff --git a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.txx b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.txx index 1d8c366db83f1184c8a11e33d076e4834456a75e..bf501b83b6fa4737e3dc462b8bb5d177c3ad4bcd 100644 --- a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNumberOfLinesStrippedStreamingManager_txx -#define __otbNumberOfLinesStrippedStreamingManager_txx +#ifndef otbNumberOfLinesStrippedStreamingManager_txx +#define otbNumberOfLinesStrippedStreamingManager_txx #include "otbNumberOfLinesStrippedStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h index 9c04b81c12ba5af8681ca4f1384196f280a5b5a8..904ecd3bcdff3b94f61c90ff5cd5b79cb945eea9 100644 --- a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h +++ b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentFilterStreamingDecorator_h -#define __otbPersistentFilterStreamingDecorator_h +#ifndef otbPersistentFilterStreamingDecorator_h +#define otbPersistentFilterStreamingDecorator_h #include "otbStreamingImageVirtualWriter.h" #include "itkProcessObject.h" @@ -70,17 +70,17 @@ public: itkGetConstObjectMacro(Filter, FilterType); itkGetObjectMacro(Streamer, StreamerType); - virtual void Update(void); + void Update(void) ITK_OVERRIDE; protected: /** Constructor */ PersistentFilterStreamingDecorator(); /** Destructor */ - virtual ~PersistentFilterStreamingDecorator() {} + ~PersistentFilterStreamingDecorator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /// Object responsible for streaming StreamerPointerType m_Streamer; diff --git a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.txx b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.txx index d3a1704cb684e37bd54c6f6985602efaf51210d4..006ce75aef5a76138ad87f7120e7c99367bc9c20 100644 --- a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.txx +++ b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentFilterStreamingDecorator_txx -#define __otbPersistentFilterStreamingDecorator_txx +#ifndef otbPersistentFilterStreamingDecorator_txx +#define otbPersistentFilterStreamingDecorator_txx #include "otbPersistentFilterStreamingDecorator.h" diff --git a/Modules/Core/Streaming/include/otbPersistentImageFilter.h b/Modules/Core/Streaming/include/otbPersistentImageFilter.h index 894ad10d690e16f93db41edddc68c08ff177caa6..4784812f847c45c17e573f96b49d4f2e8c92dcbd 100644 --- a/Modules/Core/Streaming/include/otbPersistentImageFilter.h +++ b/Modules/Core/Streaming/include/otbPersistentImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageFilter_h -#define __otbPersistentImageFilter_h +#ifndef otbPersistentImageFilter_h +#define otbPersistentImageFilter_h #include "itkImageToImageFilter.h" @@ -70,9 +70,9 @@ protected: /** Constructor */ PersistentImageFilter() {} /** Destructor */ - virtual ~PersistentImageFilter() {} + ~PersistentImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h index b3555bccd8ae54f38f76d80a9a9b6f4963227cb2..b623f29e9b07de0232a0b63157c370fff5c858da 100644 --- a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h +++ b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPipelineMemoryPrintCalculator_h -#define __otbPipelineMemoryPrintCalculator_h +#ifndef otbPipelineMemoryPrintCalculator_h +#define otbPipelineMemoryPrintCalculator_h #include "itkProcessObject.h" #if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8) @@ -123,10 +123,10 @@ protected: PipelineMemoryPrintCalculator(); /** Destructor */ - virtual ~PipelineMemoryPrintCalculator(); + ~PipelineMemoryPrintCalculator() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Recursive method to evaluate memory print in bytes */ MemoryPrintType EvaluateProcessObjectPrintRecursive(ProcessObjectType * process); diff --git a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h index 42f8e9f5867bea954f74a17b6bf5b553dc331796..40f5ed6c2f26b1c55451541f579a4b42a3be4072 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenAdaptativeStreamingManager_h -#define __otbRAMDrivenAdaptativeStreamingManager_h +#ifndef otbRAMDrivenAdaptativeStreamingManager_h +#define otbRAMDrivenAdaptativeStreamingManager_h #include "otbStreamingManager.h" @@ -80,11 +80,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; protected: RAMDrivenAdaptativeStreamingManager(); - virtual ~RAMDrivenAdaptativeStreamingManager(); + ~RAMDrivenAdaptativeStreamingManager() ITK_OVERRIDE; /** The number of MegaBytes of RAM available */ unsigned int m_AvailableRAMInMB; diff --git a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx index fc82561f25c96115fedffbe150fdc92dcb362f20..d4179545afbbd06e39737b33da85e4ac0124008e 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenAdaptativeStreamingManager_txx -#define __otbRAMDrivenAdaptativeStreamingManager_txx +#ifndef otbRAMDrivenAdaptativeStreamingManager_txx +#define otbRAMDrivenAdaptativeStreamingManager_txx #include "otbRAMDrivenAdaptativeStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h index c787dcf4d3ee09448da25b78222d2c9ce4c17d72..0b091239ba4c60dd018e3d29ec6a62b22a6a2423 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenStrippedStreamingManager_h -#define __otbRAMDrivenStrippedStreamingManager_h +#ifndef otbRAMDrivenStrippedStreamingManager_h +#define otbRAMDrivenStrippedStreamingManager_h #include "itkImageRegionSplitter.h" #include "otbStreamingManager.h" @@ -75,11 +75,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; protected: RAMDrivenStrippedStreamingManager(); - virtual ~RAMDrivenStrippedStreamingManager(); + ~RAMDrivenStrippedStreamingManager() ITK_OVERRIDE; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitter<itkGetStaticConstMacro(ImageDimension)> SplitterType; diff --git a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.txx b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.txx index 76928f49f5a4340502c0dbd211610ae4f77a2098..05c0c46be3c4af8e74e7e2a7aff369b997e7b026 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenStrippedStreamingManager_txx -#define __otbRAMDrivenStrippedStreamingManager_txx +#ifndef otbRAMDrivenStrippedStreamingManager_txx +#define otbRAMDrivenStrippedStreamingManager_txx #include "otbRAMDrivenStrippedStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h index 5ff6a46655b086057db18df97f5eb429f7ac975e..f60a01598afd160b0eb3114bc9b2f50467f64468 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenTiledStreamingManager_h -#define __otbRAMDrivenTiledStreamingManager_h +#ifndef otbRAMDrivenTiledStreamingManager_h +#define otbRAMDrivenTiledStreamingManager_h #include "otbStreamingManager.h" @@ -74,11 +74,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; protected: RAMDrivenTiledStreamingManager(); - virtual ~RAMDrivenTiledStreamingManager(); + ~RAMDrivenTiledStreamingManager() ITK_OVERRIDE; /** The number of MegaBytes of RAM available */ unsigned int m_AvailableRAMInMB; diff --git a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.txx b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.txx index 80258b477b86f17bc16e49ff385cab5cae4b2adb..626aa9a6f5d17f77f6f7ba2073fbc1a0f5b33583 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAMDrivenTiledStreamingManager_txx -#define __otbRAMDrivenTiledStreamingManager_txx +#ifndef otbRAMDrivenTiledStreamingManager_txx +#define otbRAMDrivenTiledStreamingManager_txx #include "otbRAMDrivenTiledStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h index c69fb3f685577ed15e45339c2cdb517384b9e9a8..ef4121a624bc9c88e85caba3e303adbf7d4389b6 100644 --- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h +++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingImageVirtualWriter_h -#define __otbStreamingImageVirtualWriter_h +#ifndef otbStreamingImageVirtualWriter_h +#define otbStreamingImageVirtualWriter_h #include "itkMacro.h" #include "itkImageToImageFilter.h" @@ -137,18 +137,18 @@ public: /** Override Update() from ProcessObject * This filter does not produce an output */ - virtual void Update(); + void Update() ITK_OVERRIDE; protected: StreamingImageVirtualWriter(); - virtual ~StreamingImageVirtualWriter(); + ~StreamingImageVirtualWriter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; private: StreamingImageVirtualWriter(const StreamingImageVirtualWriter &); //purposely not implemented diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx index f4d5259f6338cccad5f76d9c3734dd9edd03b1f9..dc2d1819242ff06cc3c5ce91a95e50abe2f94d75 100644 --- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx +++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingImageVirtualWriter_txx -#define __otbStreamingImageVirtualWriter_txx +#ifndef otbStreamingImageVirtualWriter_txx +#define otbStreamingImageVirtualWriter_txx #include "otbStreamingImageVirtualWriter.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/include/otbStreamingManager.h b/Modules/Core/Streaming/include/otbStreamingManager.h index 107d9fbf37bec6dbba57f8d5499e1d5f18533384..f940e79bad14440bb3d42a459086c20f9e57b588 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.h +++ b/Modules/Core/Streaming/include/otbStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingManager_h -#define __otbStreamingManager_h +#ifndef otbStreamingManager_h +#define otbStreamingManager_h #include "otbMacro.h" @@ -87,7 +87,7 @@ public: protected: StreamingManager(); - virtual ~StreamingManager(); + ~StreamingManager() ITK_OVERRIDE; virtual unsigned int EstimateOptimalNumberOfDivisions(itk::DataObject * input, const RegionType ®ion, MemoryPrintType availableRAMInMB, diff --git a/Modules/Core/Streaming/include/otbStreamingManager.txx b/Modules/Core/Streaming/include/otbStreamingManager.txx index ff34779ebae2154d9c572a1d897b08f0154a3079..172d34436fbb2c1cfde6345d714a932c242b7d99 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingManager_txx -#define __otbStreamingManager_txx +#ifndef otbStreamingManager_txx +#define otbStreamingManager_txx #include "otbStreamingManager.h" #include "otbConfigurationManager.h" diff --git a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h index 7c579ba232d8e3ede8a85bf62dc53f97fa99dd9b..f9a1bd68ad223cdd1f78eda617fd8c26905c5119 100644 --- a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileDimensionTiledStreamingManager_h -#define __otbTileDimensionTiledStreamingManager_h +#ifndef otbTileDimensionTiledStreamingManager_h +#define otbTileDimensionTiledStreamingManager_h #include "otbStreamingManager.h" @@ -69,11 +69,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; protected: TileDimensionTiledStreamingManager(); - virtual ~TileDimensionTiledStreamingManager(); + ~TileDimensionTiledStreamingManager() ITK_OVERRIDE; /** The number of lines per strip desired by the user. * This may be different than the one computed by the Splitter */ diff --git a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.txx b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.txx index eda7ba295853667d081841f87370ead145c692b5..4555afb0efdfea6599b4538a6bc2b5fd645e3437 100644 --- a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileDimensionTiledStreamingManager_txx -#define __otbTileDimensionTiledStreamingManager_txx +#ifndef otbTileDimensionTiledStreamingManager_txx +#define otbTileDimensionTiledStreamingManager_txx #include "otbTileDimensionTiledStreamingManager.h" #include "otbMacro.h" diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index 8b0dce603df2d2da4333ff6c0ee1421cedb976e7..757d339e50d8cf62250dfdaf507df771a3399e83 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -33,7 +33,7 @@ const double PipelineMemoryPrintCalculator::MegabyteToByte = vcl_pow(2.0, 20); PipelineMemoryPrintCalculator ::PipelineMemoryPrintCalculator() : m_MemoryPrint(0), - m_DataToWrite(NULL), + m_DataToWrite(ITK_NULLPTR), m_BiasCorrectionFactor(1.), m_VisitedProcessObjects() {} diff --git a/Modules/Core/Transform/include/otbCompositeTransform.h b/Modules/Core/Transform/include/otbCompositeTransform.h index 48f09faa36c64b532f61b7d3ab167d0c00152a77..eaf20365def921645c2c39750e6abba8a858f392 100644 --- a/Modules/Core/Transform/include/otbCompositeTransform.h +++ b/Modules/Core/Transform/include/otbCompositeTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCompositeTransform_h -#define __otbCompositeTransform_h +#ifndef otbCompositeTransform_h +#define otbCompositeTransform_h #include <iostream> #include <sstream> @@ -115,7 +115,7 @@ public: itkGetConstReferenceMacro(SecondTransform, SecondTransformPointerType); /** Method to transform a point. */ - virtual SecondTransformOutputPointType TransformPoint(const FirstTransformInputPointType&) const; + SecondTransformOutputPointType TransformPoint(const FirstTransformInputPointType&) const ITK_OVERRIDE; /** Method to transform a vector. */ // virtual OutputVectorType TransformVector(const InputVectorType &) const; @@ -128,7 +128,7 @@ public: protected: CompositeTransform(); - virtual ~CompositeTransform(); + ~CompositeTransform() ITK_OVERRIDE; FirstTransformPointerType m_FirstTransform; SecondTransformPointerType m_SecondTransform; diff --git a/Modules/Core/Transform/include/otbCompositeTransform.txx b/Modules/Core/Transform/include/otbCompositeTransform.txx index b2dd67f5926a626e5964eb53c4b67fd98336eba1..01464e4f2cddb268dd59a4a427fa4d3ff9bc8f67 100644 --- a/Modules/Core/Transform/include/otbCompositeTransform.txx +++ b/Modules/Core/Transform/include/otbCompositeTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCompositeTransform_txx -#define __otbCompositeTransform_txx +#ifndef otbCompositeTransform_txx +#define otbCompositeTransform_txx #include "otbCompositeTransform.h" @@ -40,8 +40,8 @@ CompositeTransform<TFirstTransform, NOutputDimensions> ::CompositeTransform() : Superclass(ParametersDimension) { - m_FirstTransform = 0; - m_SecondTransform = 0; + m_FirstTransform = ITK_NULLPTR; + m_SecondTransform = ITK_NULLPTR; } template<class TFirstTransform, diff --git a/Modules/Core/Transform/include/otbForwardSensorModel.h b/Modules/Core/Transform/include/otbForwardSensorModel.h index a58c21a9adecbb1209240a8af4bc7bcafa637d22..4e0eb56964bcf5921866526668f5d30d89715a16 100644 --- a/Modules/Core/Transform/include/otbForwardSensorModel.h +++ b/Modules/Core/Transform/include/otbForwardSensorModel.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbForwardSensorModel_h -#define __otbForwardSensorModel_h +#ifndef otbForwardSensorModel_h +#define otbForwardSensorModel_h #include "otbSensorModelBase.h" #include "itkMacro.h" @@ -71,14 +71,14 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); /** Compute the world coordinates. */ - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; protected: ForwardSensorModel(); - virtual ~ForwardSensorModel(); + ~ForwardSensorModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Core/Transform/include/otbForwardSensorModel.txx b/Modules/Core/Transform/include/otbForwardSensorModel.txx index 5f0e63ba53538533232d3af3ed886ef177d4fc91..8dbe18af6a5e5410ff5ad0dc2689a172395501e9 100644 --- a/Modules/Core/Transform/include/otbForwardSensorModel.txx +++ b/Modules/Core/Transform/include/otbForwardSensorModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbForwardSensorModel_txx -#define __otbForwardSensorModel_txx +#ifndef otbForwardSensorModel_txx +#define otbForwardSensorModel_txx #include "otbForwardSensorModel.h" #include "otbMacro.h" diff --git a/Modules/Core/Transform/include/otbGenericMapProjection.h b/Modules/Core/Transform/include/otbGenericMapProjection.h index d3796f80d497083a41f0d33a693dbd412dbbb81d..eb89c86bb4f953b03278b9021a40fbe4e17f2201 100644 --- a/Modules/Core/Transform/include/otbGenericMapProjection.h +++ b/Modules/Core/Transform/include/otbGenericMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericMapProjection_h -#define __otbGenericMapProjection_h +#ifndef otbGenericMapProjection_h +#define otbGenericMapProjection_h #include <iostream> #include <sstream> @@ -95,7 +95,7 @@ public: virtual void PrintMap() const; - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; virtual bool InstanciateProjection(); @@ -108,9 +108,9 @@ public: protected: GenericMapProjection(); - virtual ~GenericMapProjection(); + ~GenericMapProjection() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; MapProjectionAdapter::Pointer m_MapProjection; diff --git a/Modules/Core/Transform/include/otbGenericMapProjection.txx b/Modules/Core/Transform/include/otbGenericMapProjection.txx index 6ff02835017ce8155f0242966a826921f4104b7f..11df836313dc0243f412aa58d20f0d9b58153ac0 100644 --- a/Modules/Core/Transform/include/otbGenericMapProjection.txx +++ b/Modules/Core/Transform/include/otbGenericMapProjection.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericMapProjection_txx -#define __otbGenericMapProjection_txx +#ifndef otbGenericMapProjection_txx +#define otbGenericMapProjection_txx #include "otbGenericMapProjection.h" #include "otbMacro.h" @@ -130,7 +130,7 @@ bool GenericMapProjection<TDirectionOfMapping, TScalarType, NInputDimensions, NOutputDimensions> ::IsProjectionDefined() const { - return (m_MapProjection->GetMapProjection() != NULL); + return (m_MapProjection->GetMapProjection() != ITK_NULLPTR); } template<TransformDirection::TransformationDirection TDirectionOfMapping, class TScalarType, unsigned int NInputDimensions, diff --git a/Modules/Core/Transform/include/otbGenericRSTransform.h b/Modules/Core/Transform/include/otbGenericRSTransform.h index 5db6fa1bc581b9d1bb5f47d61210d5e703821096..5137aef08a1824a27a5218da5ad76989b8d09ecf 100644 --- a/Modules/Core/Transform/include/otbGenericRSTransform.h +++ b/Modules/Core/Transform/include/otbGenericRSTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRSTransform_h -#define __otbGenericRSTransform_h +#ifndef otbGenericRSTransform_h +#define otbGenericRSTransform_h #include "otbCompositeTransform.h" @@ -165,31 +165,31 @@ public: /** Methods prototypes */ virtual const TransformType * GetTransform() const; - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; virtual void InstanciateTransform(); // Get inverse methods bool GetInverse(Self * inverseTransform) const; - virtual InverseTransformBasePointer GetInverseTransform() const; + InverseTransformBasePointer GetInverseTransform() const ITK_OVERRIDE; // Dummy set parameter method - virtual void SetParameters(const typename Superclass::ParametersType &) {} + void SetParameters(const typename Superclass::ParametersType &) ITK_OVERRIDE {} // Dummy ComputeJacobianWithRespectToParameters method - virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const {} + void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const ITK_OVERRIDE {} protected: GenericRSTransform(); - virtual ~GenericRSTransform() {} + ~GenericRSTransform() ITK_OVERRIDE {} - virtual void Modified() const + void Modified() const ITK_OVERRIDE { this->Superclass::Modified(); m_TransformUpToDate = false; } - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GenericRSTransform(const Self &); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbGenericRSTransform.txx b/Modules/Core/Transform/include/otbGenericRSTransform.txx index 58ca3171ff6d2adbd7ec8022fd1101d9032820b5..4d000da9f4cbcc624207f516eef288c16ca2797e 100644 --- a/Modules/Core/Transform/include/otbGenericRSTransform.txx +++ b/Modules/Core/Transform/include/otbGenericRSTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRSTransform_txx -#define __otbGenericRSTransform_txx +#ifndef otbGenericRSTransform_txx +#define otbGenericRSTransform_txx #include "otbGenericRSTransform.h" #include "otbMacro.h" @@ -43,9 +43,9 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> m_OutputSpacing.Fill(1); m_OutputOrigin.Fill(0); - m_Transform = NULL; - m_InputTransform = NULL; - m_OutputTransform = NULL; + m_Transform = ITK_NULLPTR; + m_InputTransform = ITK_NULLPTR; + m_OutputTransform = ITK_NULLPTR; m_TransformUpToDate = false; m_TransformAccuracy = Projection::UNKNOWN; } @@ -96,8 +96,8 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> otbMsgDevMacro(<< " * Output Spacing: " << m_OutputSpacing); //Make sure that the state is clean: - m_InputTransform = NULL; - m_OutputTransform = NULL; + m_InputTransform = ITK_NULLPTR; + m_OutputTransform = ITK_NULLPTR; bool firstTransformGiveGeo = true; bool inputTransformIsSensor = false; @@ -158,8 +158,8 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> m_InputTransform = itk::IdentityTransform<double, NInputDimensions>::New(); // firstTransformGiveGeo = false; - OGRSpatialReferenceH hSRS = NULL; - hSRS = OSRNewSpatialReference(NULL); + OGRSpatialReferenceH hSRS = ITK_NULLPTR; + hSRS = OSRNewSpatialReference(ITK_NULLPTR); const char * wktString = m_InputProjectionRef.c_str(); if (OSRImportFromWkt(hSRS, (char **) &wktString) != OGRERR_NONE) { @@ -283,7 +283,7 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> ::GetInverse(Self * inverseTransform) const { // Test the inverseTransform pointer - if (inverseTransform == NULL) + if (inverseTransform == ITK_NULLPTR) { return false; } diff --git a/Modules/Core/Transform/include/otbGeoInformationConversion.h b/Modules/Core/Transform/include/otbGeoInformationConversion.h index c004e32fe3a9f586f75b26b31791b099a5111094..37a141e5ef10f3eaab3fc95858cfccd8950a7549 100644 --- a/Modules/Core/Transform/include/otbGeoInformationConversion.h +++ b/Modules/Core/Transform/include/otbGeoInformationConversion.h @@ -16,12 +16,11 @@ =========================================================================*/ -#ifndef __otbGeoInformationConversion_h -#define __otbGeoInformationConversion_h +#ifndef otbGeoInformationConversion_h +#define otbGeoInformationConversion_h #include <string> - namespace otb { diff --git a/Modules/Core/Transform/include/otbGeocentricTransform.h b/Modules/Core/Transform/include/otbGeocentricTransform.h index ec9562c3244e46e2032d7d3ec5a2a0da2de61b07..30703f96c413fa1728dde758564b3ebad712a2a1 100644 --- a/Modules/Core/Transform/include/otbGeocentricTransform.h +++ b/Modules/Core/Transform/include/otbGeocentricTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeocentricTransform_h -#define __otbGeocentricTransform_h +#ifndef otbGeocentricTransform_h +#define otbGeocentricTransform_h #include "otbGenericMapProjection.h" #include "otbEllipsoidAdapter.h" @@ -63,11 +63,11 @@ public: itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1)); - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; protected: GeocentricTransform(); - virtual ~GeocentricTransform(); + ~GeocentricTransform() ITK_OVERRIDE; EllipsoidAdapter::Pointer m_Ellipsoid; private: diff --git a/Modules/Core/Transform/include/otbGeocentricTransform.txx b/Modules/Core/Transform/include/otbGeocentricTransform.txx index 72ed6f297b42a7179ca27da44d8eb6c204432030..ef67c46c70bb0ee0b22c6cce44b8344eeb2ed136 100644 --- a/Modules/Core/Transform/include/otbGeocentricTransform.txx +++ b/Modules/Core/Transform/include/otbGeocentricTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeocentricTransform_txx -#define __otbGeocentricTransform_txx +#ifndef otbGeocentricTransform_txx +#define otbGeocentricTransform_txx #include "otbGeocentricTransform.h" diff --git a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h index d9956c78a57757a1e340171fa100b2c6571e653a..03ebe634a73fbf8d0c5fef21b91c0ef5b2974619 100644 --- a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h +++ b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToGenericRSOutputParameters_h -#define __otbImageToGenericRSOutputParameters_h +#ifndef otbImageToGenericRSOutputParameters_h +#define otbImageToGenericRSOutputParameters_h #include "itkObject.h" #include "otbGenericRSTransform.h" @@ -160,7 +160,7 @@ public: protected: ImageToGenericRSOutputParameters(); - virtual ~ImageToGenericRSOutputParameters() {} + ~ImageToGenericRSOutputParameters() ITK_OVERRIDE {} private: ImageToGenericRSOutputParameters(const Self&); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.txx b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.txx index 54a8997afa51547c18e23fabf6ac9beccddcf7fd..e9806efe5fe882c9de3eaed974f1636e3bbf567e 100644 --- a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.txx +++ b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToGenericRSOutputParameters_txx -#define __otbImageToGenericRSOutputParameters_txx +#ifndef otbImageToGenericRSOutputParameters_txx +#define otbImageToGenericRSOutputParameters_txx #include "otbImageToGenericRSOutputParameters.h" @@ -185,7 +185,7 @@ ImageToGenericRSOutputParameters<TImage> // Compute the output size double sizeCartoX = vcl_abs(m_OutputExtent.maxX - m_OutputExtent.minX); double sizeCartoY = vcl_abs(m_OutputExtent.minY - m_OutputExtent.maxY); - + PointType o, oX, oY; o[0] = m_OutputExtent.minX; o[1] = m_OutputExtent.maxY; @@ -194,7 +194,7 @@ ImageToGenericRSOutputParameters<TImage> oY = o; oX[0] += sizeCartoX; - oY[1] += sizeCartoY; + oY[1] -= sizeCartoY; // Transform back into the input image PointType io = m_Transform->TransformPoint(o); @@ -215,7 +215,7 @@ ImageToGenericRSOutputParameters<TImage> OyLength = vcl_sqrt(vcl_pow((double) ioIndex[0] - (double) ioYIndex[0], 2) + vcl_pow((double) ioIndex[1] - (double) ioYIndex[1], 2)); - + // Evaluate spacing SpacingType outputSpacing; diff --git a/Modules/Core/Transform/include/otbInverseLogPolarTransform.h b/Modules/Core/Transform/include/otbInverseLogPolarTransform.h index 7cc4447bb86a74e7078a69c6059db067ed706143..ffe29c86b6b9e558c1b73ef301c5f3b003ce9181 100644 --- a/Modules/Core/Transform/include/otbInverseLogPolarTransform.h +++ b/Modules/Core/Transform/include/otbInverseLogPolarTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInverseLogPolarTransform_h -#define __otbInverseLogPolarTransform_h +#ifndef otbInverseLogPolarTransform_h +#define otbInverseLogPolarTransform_h #include "otbTransform.h" @@ -80,50 +80,50 @@ public: * Set the transform parameters through the standard interface. * \param parameters The parameters of the transform. */ - void SetParameters(const ParametersType& parameters); + void SetParameters(const ParametersType& parameters) ITK_OVERRIDE; /** * Get the transform parameters through the standard interface. * \return The parameters of the transform. */ - virtual ParametersType& GetParameters(void) const; + ParametersType& GetParameters(void) const ITK_OVERRIDE; /** * Set the Fixed Parameters * \param param The fixed parameters of the transform. */ - virtual void SetFixedParameters( const ParametersType & param) + void SetFixedParameters( const ParametersType & param) ITK_OVERRIDE { this->m_FixedParameters = param; } /** * Get the Fixed Parameters * \return The Fixed parameters of the transform. */ - virtual const ParametersType& GetFixedParameters(void) const{return this->m_FixedParameters; } + const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE{return this->m_FixedParameters; } /** * Transform a point. * \param point The point to transform. * \return The transformed point. */ using Superclass::TransformVector; - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; /** * Transform a vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVectorType TransformVector(const InputVectorType& vector) const; + OutputVectorType TransformVector(const InputVectorType& vector) const ITK_OVERRIDE; /** * Transform a vnl vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const; + OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const ITK_OVERRIDE; protected: /** Constructor */ InverseLogPolarTransform(); /** Destructor */ - virtual ~InverseLogPolarTransform(); + ~InverseLogPolarTransform() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: InverseLogPolarTransform(const Self &); // purposely not implemented diff --git a/Modules/Core/Transform/include/otbInverseLogPolarTransform.txx b/Modules/Core/Transform/include/otbInverseLogPolarTransform.txx index bdb4eb65afa32eacbadf9ec7e479764dd7afcccb..ddbb8fd16190c1512debb4ff994ff643e7336cd9 100644 --- a/Modules/Core/Transform/include/otbInverseLogPolarTransform.txx +++ b/Modules/Core/Transform/include/otbInverseLogPolarTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInverseLogPolarTransform_txx -#define __otbInverseLogPolarTransform_txx +#ifndef otbInverseLogPolarTransform_txx +#define otbInverseLogPolarTransform_txx #include "otbInverseLogPolarTransform.h" #include "otbMacro.h" diff --git a/Modules/Core/Transform/include/otbInverseSensorModel.h b/Modules/Core/Transform/include/otbInverseSensorModel.h index fb4238fb07e698c1bb2ff675824a18e7c2393c85..bc869e42602e2d897a06cccc60942014620176fe 100644 --- a/Modules/Core/Transform/include/otbInverseSensorModel.h +++ b/Modules/Core/Transform/include/otbInverseSensorModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInverseSensorModel_h -#define __otbInverseSensorModel_h +#ifndef otbInverseSensorModel_h +#define otbInverseSensorModel_h #include "otbSensorModelBase.h" @@ -71,16 +71,16 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); // Transform of geographic point in image sensor index - virtual OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; // Transform of geographic point in image sensor index -- Backward Compatibility // OutputPointType TransformPoint(const InputPointType &point, double height) const; protected: InverseSensorModel(); - virtual ~InverseSensorModel(); + ~InverseSensorModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Core/Transform/include/otbInverseSensorModel.txx b/Modules/Core/Transform/include/otbInverseSensorModel.txx index 3433b33d7a4587077c7a2d674ffd03c9c35cbf16..2516a4d54bab0e44ab9463dca68947274b358848 100644 --- a/Modules/Core/Transform/include/otbInverseSensorModel.txx +++ b/Modules/Core/Transform/include/otbInverseSensorModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInverseSensorModel_txx -#define __otbInverseSensorModel_txx +#ifndef otbInverseSensorModel_txx +#define otbInverseSensorModel_txx #include "otbInverseSensorModel.h" #include "otbMacro.h" diff --git a/Modules/Core/Transform/include/otbLogPolarTransform.h b/Modules/Core/Transform/include/otbLogPolarTransform.h index e0e8278fba2d8500f60ffd59299b7990e8153336..9785b0af630848a21e9f708406390f75993b212b 100644 --- a/Modules/Core/Transform/include/otbLogPolarTransform.h +++ b/Modules/Core/Transform/include/otbLogPolarTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLogPolarTransform_h -#define __otbLogPolarTransform_h +#ifndef otbLogPolarTransform_h +#define otbLogPolarTransform_h #include "otbTransform.h" @@ -81,53 +81,53 @@ public: * Set the transform parameters through the standard interface. * \param parameters The parameters of the transform. */ - void SetParameters(const ParametersType& parameters); + void SetParameters(const ParametersType& parameters) ITK_OVERRIDE; /** * Get the transform parameters through the standard interface. * \return The parameters of the transform. */ - virtual ParametersType& GetParameters(void) const; + ParametersType& GetParameters(void) const ITK_OVERRIDE; /** * Set the Fixed Parameters * \param param The fixed parameters of the transform. */ - virtual void SetFixedParameters( const ParametersType & param) + void SetFixedParameters( const ParametersType & param) ITK_OVERRIDE { this->m_FixedParameters = param; } /** * Get the Fixed Parameters * \return The Fixed parameters of the transform. */ - virtual const ParametersType& GetFixedParameters(void) const{return this->m_FixedParameters; } + const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE{return this->m_FixedParameters; } /** * Transform a point. * \param point The point to transform. * \return The transformed point. */ - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; /** * Transform a vector representing a point. * \param vector The point to transform. * \return The transformed point. */ using Superclass::TransformVector; - OutputVectorType TransformVector(const InputVectorType& vector) const; + OutputVectorType TransformVector(const InputVectorType& vector) const ITK_OVERRIDE; /** * Transform a vnl vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const; + OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const ITK_OVERRIDE; protected: /** Constructor */ LogPolarTransform(); /** Destructor */ - virtual ~LogPolarTransform(); + ~LogPolarTransform() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LogPolarTransform(const Self &); // purposely not implemented diff --git a/Modules/Core/Transform/include/otbLogPolarTransform.txx b/Modules/Core/Transform/include/otbLogPolarTransform.txx index 0475c671e2b41bab3ab40e5434b420c1eb504fdc..d6ad8a6548132a8fab1098e80143c120dbdf892b 100644 --- a/Modules/Core/Transform/include/otbLogPolarTransform.txx +++ b/Modules/Core/Transform/include/otbLogPolarTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLogPolarTransform_txx -#define __otbLogPolarTransform_txx +#ifndef otbLogPolarTransform_txx +#define otbLogPolarTransform_txx #include "otbLogPolarTransform.h" #include "otbMacro.h" diff --git a/Modules/Core/Transform/include/otbSensorModelBase.h b/Modules/Core/Transform/include/otbSensorModelBase.h index 429b08f1f97b68f1a43d4d7d7e0003872e1555b3..84e0eb02a9ccac43ecc71bc9b5e91e3740a12e27 100644 --- a/Modules/Core/Transform/include/otbSensorModelBase.h +++ b/Modules/Core/Transform/include/otbSensorModelBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSensorModelBase_h -#define __otbSensorModelBase_h +#ifndef otbSensorModelBase_h +#define otbSensorModelBase_h #include <iostream> @@ -89,10 +89,10 @@ public: protected: SensorModelBase(); - virtual ~SensorModelBase(); + ~SensorModelBase() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ImageKeywordlist */ ImageKeywordlist m_ImageKeywordlist; diff --git a/Modules/Core/Transform/include/otbSensorModelBase.txx b/Modules/Core/Transform/include/otbSensorModelBase.txx index fe12a75e72a077d695368d5d16c8e20c823649ca..bf6ba624f8b6bd98cb26496155b6dad40e7fa292 100644 --- a/Modules/Core/Transform/include/otbSensorModelBase.txx +++ b/Modules/Core/Transform/include/otbSensorModelBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSensorModelBase_txx -#define __otbSensorModelBase_txx +#ifndef otbSensorModelBase_txx +#define otbSensorModelBase_txx #include "otbSensorModelBase.h" diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h index 3b44ec0bedd6295fc0491fec6942d03ba10b9d87..813a4440bfebbf3b1dd0f2920cc013365a1c16a5 100644 --- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h +++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingWarpImageFilter_h -#define __otbStreamingWarpImageFilter_h +#ifndef otbStreamingWarpImageFilter_h +#define otbStreamingWarpImageFilter_h #include "otbWarpImageFilter.h" #include "otbStreamingTraits.h" @@ -84,22 +84,22 @@ protected: /** Constructor */ StreamingWarpImageFilter(); /** Destructor */ - virtual ~StreamingWarpImageFilter() {} + ~StreamingWarpImageFilter() ITK_OVERRIDE {} /** PrintSelf */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * This filters requires only a part of the input and of the displacement field to * produce its output. As such, we need to overload the GenerateInputRequestedRegion() method. */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** * Re-implement the method ThreadedGenerateData to mask area outside the deformation grid */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ); + itk::ThreadIdType threadId ) ITK_OVERRIDE; private: StreamingWarpImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx index 19ba9ff358c2f35ac314090048b0605b6a08e66f..08cb65dae08726b2c4d3dcc90b04e016cbeed7ee 100644 --- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx +++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingWarpImageFilter_txx -#define __otbStreamingWarpImageFilter_txx +#ifndef otbStreamingWarpImageFilter_txx +#define otbStreamingWarpImageFilter_txx #include "otbStreamingWarpImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Core/Transform/include/otbTransform.h b/Modules/Core/Transform/include/otbTransform.h index 87a215db60a35161cbe8b2de7a034dfa99ae1b6f..167a739b6ef1d509e28822238eed77b4da24e356 100644 --- a/Modules/Core/Transform/include/otbTransform.h +++ b/Modules/Core/Transform/include/otbTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTransform_h -#define __otbTransform_h +#ifndef otbTransform_h +#define otbTransform_h #include "itkTransform.h" #include "vnl/vnl_vector_fixed.h" @@ -55,10 +55,10 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); /** Get the size of the input space */ - unsigned int GetInputSpaceDimension(void) const { return NInputDimensions; } + unsigned int GetInputSpaceDimension(void) const ITK_OVERRIDE { return NInputDimensions; } /** Get the size of the output space */ - unsigned int GetOutputSpaceDimension(void) const { return NOutputDimensions; } + unsigned int GetOutputSpaceDimension(void) const ITK_OVERRIDE { return NOutputDimensions; } /** Type of the scalar representing coordinate and vector elements. */ typedef TScalarType ScalarType; @@ -95,12 +95,12 @@ public: /** Method to transform a point. */ - virtual OutputPointType TransformPoint(const InputPointType & ) const + OutputPointType TransformPoint(const InputPointType & ) const ITK_OVERRIDE { return OutputPointType(); } using Superclass::TransformVector; /** Method to transform a vector. */ - virtual OutputVectorType TransformVector(const InputVectorType &) const + OutputVectorType TransformVector(const InputVectorType &) const ITK_OVERRIDE { return OutputVectorType(); } /** Method to transform a vnl_vector. */ @@ -109,8 +109,8 @@ public: using Superclass::TransformCovariantVector; /** Method to transform a CovariantVector. */ - virtual OutputCovariantVectorType TransformCovariantVector( - const InputCovariantVectorType &) const + OutputCovariantVectorType TransformCovariantVector( + const InputCovariantVectorType &) const ITK_OVERRIDE { return OutputCovariantVectorType(); } @@ -121,12 +121,12 @@ public: * SetParametersByValue. * \sa SetParametersByValue */ - virtual void SetParameters( const ParametersType & ) - { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) } + void SetParameters( const ParametersType & ) ITK_OVERRIDE + { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetParameters)" ) } - virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const + void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const ITK_OVERRIDE { - itkExceptionMacro(<< "Subclasses should override this method (ComputeJacobianWithRespectToParamters)" ); + itkExceptionMacro(<< "Subclasses should ITK_OVERRIDE this method (ComputeJacobianWithRespectToParamters)" ); } /** Set the transformation parameters and update internal transformation. @@ -136,23 +136,23 @@ public: * by keeping a reference to the parameters. * \sa SetParameters */ - virtual void SetParametersByValue(const ParametersType & p) + void SetParametersByValue(const ParametersType & p) ITK_OVERRIDE { this->SetParameters (p); } /** Get the Transformation Parameters. */ - virtual const ParametersType & GetParameters(void) const + const ParametersType & GetParameters(void) const ITK_OVERRIDE { return m_Parameters; } /** Set the fixed parameters and update internal transformation. */ - virtual void SetFixedParameters( const ParametersType & ) - { itkExceptionMacro( << "Subclasses should override this method (SetFixedParameters)" ) } + void SetFixedParameters( const ParametersType & ) ITK_OVERRIDE + { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetFixedParameters)" ) } /** Get the Fixed Parameters. */ - virtual const ParametersType& GetFixedParameters(void) const + const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE { - itkExceptionMacro( << "Subclasses should override this method (GetFixedParameters)" ); + itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (GetFixedParameters)" ); // Next line is needed to avoid errors due to: // "function must return a value". return this->m_FixedParameters; @@ -187,14 +187,14 @@ public: * */ virtual const JacobianType & GetJacobian(const InputPointType &) const { - itkExceptionMacro( << "Subclass should override this method (GetJacobian)" ); + itkExceptionMacro( << "Subclass should ITK_OVERRIDE this method (GetJacobian)" ); // Next line is needed to avoid errors due to: // "function must return a value" . return this->m_Jacobian; } /** Return the number of parameters that completely define the Transfom */ - virtual NumberOfParametersType GetNumberOfParameters(void) const + NumberOfParametersType GetNumberOfParameters(void) const ITK_OVERRIDE { return this->m_Parameters.Size(); } protected: @@ -205,9 +205,9 @@ protected: : Superclass::Transform(numberOfParameters) {} - virtual ~Transform() {} + ~Transform() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); #if 0 diff --git a/Modules/Core/Transform/src/otbGeoInformationConversion.cxx b/Modules/Core/Transform/src/otbGeoInformationConversion.cxx index 1d1f5e14aae16c5ca9986db84b04200645455ff0..bd1cef971aad66e43761cfc02a1c310c2930c829 100644 --- a/Modules/Core/Transform/src/otbGeoInformationConversion.cxx +++ b/Modules/Core/Transform/src/otbGeoInformationConversion.cxx @@ -22,19 +22,19 @@ #include "cpl_conv.h" #include "boost/lexical_cast.hpp" - +#include "itkMacro.h" namespace otb { std::string GeoInformationConversion::ToWKT(int srid) { - char * wkt = NULL; + char * wkt = ITK_NULLPTR; std::string ret; // Build the srs from the epsg number - OGRSpatialReferenceH hSRS = NULL; - hSRS = OSRNewSpatialReference(NULL); + OGRSpatialReferenceH hSRS = ITK_NULLPTR; + hSRS = OSRNewSpatialReference(ITK_NULLPTR); if (OSRImportFromEPSG(hSRS, srid ) == OGRERR_NONE) { diff --git a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx index 4fad71c80ee774803766728bbba71491c327a87a..80b94814ecebcc55352f4393543565f9b595e18d 100644 --- a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx +++ b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx @@ -82,9 +82,9 @@ int otbCreateProjectionWithOSSIM(int argc, char* argv[]) ossimGpt ossimGPoint(0, 0); ossimDpt ossimDPoint; otbGenericMsgDebugMacro(<< "Creating projection..."); - ossimProjection * model = NULL; + ossimProjection * model = ITK_NULLPTR; model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); - if (model == NULL) + if (model == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Invalid Model * == NULL !"); } diff --git a/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx b/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx index ef4ab4c021f28ca816d2cdcb86c770d33f6ffec6..8b7d5a4694f86f839ae7ea665a2e6d99706470c2 100644 --- a/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx +++ b/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx @@ -87,10 +87,10 @@ int otbCreateProjectionWithOTB(int argc, char* argv[]) ossimGpt ossimGPoint(0, 0); ossimDpt ossimDPoint; - ossimProjection * model = NULL; + ossimProjection * model = ITK_NULLPTR; otbGenericMsgDebugMacro(<< "Creating projection..."); model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); - if (model == NULL) + if (model == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Invalid Model * == NULL !"); } diff --git a/Modules/Core/Transform/test/otbGenericRSTransform.cxx b/Modules/Core/Transform/test/otbGenericRSTransform.cxx index 44bd55b12c39767092d45846d665cc0c88da8374..2899c5e20f71b8ed6aa9399b0ec767f23cf8b33c 100644 --- a/Modules/Core/Transform/test/otbGenericRSTransform.cxx +++ b/Modules/Core/Transform/test/otbGenericRSTransform.cxx @@ -38,13 +38,13 @@ int otbGenericRSTransform(int itkNotUsed(argc), char* argv[]) // Build wgs ref oSRS.SetWellKnownGeogCS("WGS84"); - char * wgsRef = NULL; + char * wgsRef = ITK_NULLPTR; oSRS.exportToWkt(&wgsRef); // Build UTM ref oSRS.SetProjCS("UTM"); oSRS.SetUTM(31, true); - char * utmRef = NULL; + char * utmRef = ITK_NULLPTR; oSRS.exportToWkt(&utmRef); // Build Lambert II ref @@ -56,7 +56,7 @@ int otbGenericRSTransform(int itkNotUsed(argc), char* argv[]) double falseNorthingL2 = 2200000; oSRS.SetProjCS("Lambert II "); oSRS.SetLCC(stdParallel1, stdParallel2, originLatL2, originLongL2, falseEastingL2, falseNorthingL2); - char * lambertRef = NULL; + char * lambertRef = ITK_NULLPTR; oSRS.exportToWkt(&lambertRef); // Build the Transmercator ref @@ -66,7 +66,7 @@ int otbGenericRSTransform(int itkNotUsed(argc), char* argv[]) oSRS.SetProjCS("Transmercator "); oSRS.SetWellKnownGeogCS("WGS84"); oSRS.SetTM(originLatTmt, originLongTmt, 1, 0, 0); - char * tmtRef = NULL; + char * tmtRef = ITK_NULLPTR; oSRS.exportToWkt(&tmtRef); TransformType::Pointer wgs2utm = TransformType::New(); diff --git a/Modules/Core/Transform/test/otbGenericRSTransformWithSRID.cxx b/Modules/Core/Transform/test/otbGenericRSTransformWithSRID.cxx index 811e32d1b483177c4ede4dee563bedfb3c840752..40474c4bedbdf5c638efd801ba4e633319007a55 100644 --- a/Modules/Core/Transform/test/otbGenericRSTransformWithSRID.cxx +++ b/Modules/Core/Transform/test/otbGenericRSTransformWithSRID.cxx @@ -50,7 +50,7 @@ int otbGenericRSTransformWithSRID(int itkNotUsed(argc), char* argv[]) double falseNorthingL2 = 2200000; oSRS.SetProjCS("Lambert II "); oSRS.SetLCC(stdParallel1, stdParallel2, originLatL2, originLongL2, falseEastingL2, falseNorthingL2); - char * lambertRef = NULL; + char * lambertRef = ITK_NULLPTR; oSRS.exportToWkt(&lambertRef); // Build the Transmercator ref @@ -60,7 +60,7 @@ int otbGenericRSTransformWithSRID(int itkNotUsed(argc), char* argv[]) oSRS.SetProjCS("Transmercator "); oSRS.SetWellKnownGeogCS("WGS84"); oSRS.SetTM(originLatTmt, originLongTmt, 1, 0, 0); - char * tmtRef = NULL; + char * tmtRef = ITK_NULLPTR; oSRS.exportToWkt(&tmtRef); TransformType::Pointer wgs2utm = TransformType::New(); diff --git a/Modules/Core/VectorDataBase/include/otbDataNode.h b/Modules/Core/VectorDataBase/include/otbDataNode.h index ba6ba788f2a997bee02ae0d718763cc7a625d870..1b21a3b624c949ae1b58331ae9d1a150d175ba5e 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNode.h +++ b/Modules/Core/VectorDataBase/include/otbDataNode.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNode_h -#define __otbDataNode_h +#ifndef otbDataNode_h +#define otbDataNode_h #include "itkPoint.h" #include "otbPolygon.h" @@ -287,9 +287,9 @@ protected: /** Constructor */ DataNode(); /** Destructor */ - virtual ~DataNode() {} + ~DataNode() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; OGRGeometry* ConvertDataNodeToOGRGeometry(const DataNode* dataNode); diff --git a/Modules/Core/VectorDataBase/include/otbDataNode.txx b/Modules/Core/VectorDataBase/include/otbDataNode.txx index 4d7402f2914fdd54b0b6dc0b4cb540a8b69a5cee..191ba431a0058195c3e8538436fcfd1c1ea33db0 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNode.txx +++ b/Modules/Core/VectorDataBase/include/otbDataNode.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNode_txx -#define __otbDataNode_txx +#ifndef otbDataNode_txx +#define otbDataNode_txx #include "otbDataNode.h" #include "otbMetaDataKey.h" @@ -602,7 +602,7 @@ DataNode<TPrecision, VDimension, TValuePrecision> default: break; } - return NULL; + return ITK_NULLPTR; } template <class TPrecision, unsigned int VDimension, class TValuePrecision> diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h b/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h index afbb478f3fe9e72f18938479316972d7630dcdd6..c3ef784249228a16dbb9b376033a040ac08679cf 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNodeFunctionBase_h -#define __otbDataNodeFunctionBase_h +#ifndef otbDataNodeFunctionBase_h +#define otbDataNodeFunctionBase_h #include "itkFunctionBase.h" @@ -29,7 +29,7 @@ namespace otb * the abstract method Evaluate() maps a DataNode from the input space to a element * in the output space. * - * Subclasses must override Evaluate(). + * Subclasses must ITK_OVERRIDE Evaluate(). * * This class is template over the input DataNode type and * the output (range) type. @@ -63,11 +63,11 @@ public: typedef TOutput OutputType; /** Evaluate at the specified input position */ - virtual OutputType Evaluate( const DataNodeType& node ) const = 0; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; protected: DataNodeFunctionBase(){}; - ~DataNodeFunctionBase(){}; + ~DataNodeFunctionBase() ITK_OVERRIDE{}; private: DataNodeFunctionBase(const Self& ); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h index 5234c09b40ecadcdd78e587965cafaafd3725ad5..30a5f273da250061bb63d9de610a83d34211fb45 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNodeImageFunction_h -#define __otbDataNodeImageFunction_h +#ifndef otbDataNodeImageFunction_h +#define otbDataNodeImageFunction_h #include "otbDataNodeFunctionBase.h" #include "otbDataNode.h" @@ -104,7 +104,7 @@ public: /** Evaluate the function at specified DataNode position. * Subclasses must provide this method. */ - virtual TOutput Evaluate( const DataNodeType& node ) const = 0; + TOutput Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; /** Check if an index is inside the image buffer. * we take into account the fact that each voxel has its @@ -183,8 +183,8 @@ public: protected: DataNodeImageFunction(); - ~DataNodeImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DataNodeImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Const pointer to the input image. */ InputImageConstPointer m_Image; diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.txx b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.txx index d94a5def24b4c9c0e139074fcb6366b25ed1bf02..22746aa1fef1ef6e72e652e65ed38ef054d52265 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.txx +++ b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNodeImageFunction_txx -#define __otbDataNodeImageFunction_txx +#ifndef otbDataNodeImageFunction_txx +#define otbDataNodeImageFunction_txx #include "otbDataNodeImageFunction.h" @@ -30,7 +30,7 @@ template <class TImage, class TOutput, class TCoordRep, class TPrecision> DataNodeImageFunction<TImage, TOutput, TCoordRep, TPrecision> ::DataNodeImageFunction() { - m_Image = NULL; + m_Image = ITK_NULLPTR; m_StartIndex.Fill(0); m_EndIndex.Fill(0); m_StartContinuousIndex.Fill(0.0f); diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h index 2e10601596e806a930a9c506f0b5cd891f51a681..9084abed3073d7beb331cdf35546dbf27624e1bf 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNodeVectorDataFunction_h -#define __otbDataNodeVectorDataFunction_h +#ifndef otbDataNodeVectorDataFunction_h +#define otbDataNodeVectorDataFunction_h #include "otbDataNodeFunctionBase.h" #include "otbVectorDataProperties.h" @@ -85,12 +85,12 @@ public: /** Evaluate the function at specified DataNode position. * Subclasses must provide this method. */ - virtual TOutput Evaluate( const DataNodeType& node ) const = 0; + TOutput Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; protected: DataNodeVectorDataFunction(); - ~DataNodeVectorDataFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DataNodeVectorDataFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Const pointer to the input VectorData. */ VectorDataConstPointerType m_VectorData; diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.txx b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.txx index f57b2558c0a1eec8604f1e859a9d37d13b1f7dab..64c338b4490f82f4e13fe6be6b0aaeed8c9285c3 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.txx +++ b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDataNodeVectorDataFunction_txx -#define __otbDataNodeVectorDataFunction_txx +#ifndef otbDataNodeVectorDataFunction_txx +#define otbDataNodeVectorDataFunction_txx #include "otbDataNodeVectorDataFunction.h" @@ -30,7 +30,7 @@ template <class TOutput, class TCoordRep, class TPrecision> DataNodeVectorDataFunction<TOutput, TCoordRep, TPrecision> ::DataNodeVectorDataFunction() { - m_VectorData = NULL; + m_VectorData = ITK_NULLPTR; } diff --git a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h index 33c81ef6a8981a5428758032bf8c758cfa796402..6e29a2ff6276cdc763ba0521a726257e3344ae55 100644 --- a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h +++ b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGISConnectionImplementation_h -#define __otbGISConnectionImplementation_h +#ifndef otbGISConnectionImplementation_h +#define otbGISConnectionImplementation_h #include "itkDataObject.h" #include "itkObjectFactory.h" diff --git a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h index 0c0da9eef9d7b98b2ab45e3c2d54bbb6f5d2d0c2..f067b5c6eee874f3d6a66e0af880c2fa54cd2ca8 100644 --- a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h +++ b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolyLineParametricPathWithValue_h -#define __otbPolyLineParametricPathWithValue_h +#ifndef otbPolyLineParametricPathWithValue_h +#define otbPolyLineParametricPathWithValue_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -114,13 +114,13 @@ protected: /** Constructor */ PolyLineParametricPathWithValue(); /** Destructor */ - virtual ~PolyLineParametricPathWithValue() {} + ~PolyLineParametricPathWithValue() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; virtual void ComputeLength() const; virtual void ComputeBoundingRegion() const; - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: PolyLineParametricPathWithValue(const Self &); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.txx b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.txx index 3104714f10a99d3b383d13d038f6770ef596b8f9..739550e4f3235c321dfec81197bcc10f43f263bb 100644 --- a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.txx +++ b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolyLineParametricPathWithValue_txx -#define __otbPolyLineParametricPathWithValue_txx +#ifndef otbPolyLineParametricPathWithValue_txx +#define otbPolyLineParametricPathWithValue_txx #include "otbPolyLineParametricPathWithValue.h" diff --git a/Modules/Core/VectorDataBase/include/otbPolygon.h b/Modules/Core/VectorDataBase/include/otbPolygon.h index 6f57b94fef836e455be083e1ec0141c3eddf988b..a16b1f9172f719fa0969fd4710535756840f4502 100644 --- a/Modules/Core/VectorDataBase/include/otbPolygon.h +++ b/Modules/Core/VectorDataBase/include/otbPolygon.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygon_h -#define __otbPolygon_h +#ifndef otbPolygon_h +#define otbPolygon_h #include "otbPolyLineParametricPathWithValue.h" @@ -133,9 +133,9 @@ public: * Return the polygon length (perimeter). * \return The length. */ - virtual double GetLength() const; + double GetLength() const ITK_OVERRIDE; - void AddVertex(const ContinuousIndexType& vertex); + void AddVertex(const ContinuousIndexType& vertex) ITK_OVERRIDE; protected: /** Constructor */ @@ -147,13 +147,13 @@ protected: }; /** Destructor */ - virtual ~Polygon() {} + ~Polygon() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; virtual void ComputeArea() const; - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: Polygon(const Self &); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbPolygon.txx b/Modules/Core/VectorDataBase/include/otbPolygon.txx index fcc72e470e984070a2c216683e6dde559e9269a4..526d87610514cde663ef7ed94ebeb05f4fe794cc 100644 --- a/Modules/Core/VectorDataBase/include/otbPolygon.txx +++ b/Modules/Core/VectorDataBase/include/otbPolygon.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygon_txx -#define __otbPolygon_txx +#ifndef otbPolygon_txx +#define otbPolygon_txx #include "otbPolygon.h" diff --git a/Modules/Core/VectorDataBase/include/otbVectorData.h b/Modules/Core/VectorDataBase/include/otbVectorData.h index 3be1c89cbcbd6b87b5c5f7753b76a40776bae7fa..fd9705d48697827e273248aa01fb47f1794cbecc 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorData.h +++ b/Modules/Core/VectorDataBase/include/otbVectorData.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorData_h -#define __otbVectorData_h +#ifndef otbVectorData_h +#define otbVectorData_h #include "itkTreeContainer.h" #include "itkDataObject.h" @@ -126,15 +126,15 @@ public: * SmartPointers to the same VectorData since separate DataObjects are * still maintained. This method is similar to * VectorDataSource::GraftOutput(). */ - virtual void Graft(const itk::DataObject *data); + void Graft(const itk::DataObject *data) ITK_OVERRIDE; protected: /** Constructor */ VectorData(); /** Destructor */ - virtual ~VectorData() {} + ~VectorData() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorData(const Self&); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbVectorData.txx b/Modules/Core/VectorDataBase/include/otbVectorData.txx index eaf630653891b17485e07c96be99e27979b7602e..c1e5504e5631346b419cd83845d365827206572d 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorData.txx +++ b/Modules/Core/VectorDataBase/include/otbVectorData.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorData_txx -#define __otbVectorData_txx +#ifndef otbVectorData_txx +#define otbVectorData_txx #include "otbVectorData.h" #include "itkPreOrderTreeIterator.h" diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h b/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h index c6ed12cce984e2a9c907353d2f5e21fee2fdabbe..ae857e67d78a9c84f8c211152ee3bd6975ec6061 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataIOBase_h -#define __otbVectorDataIOBase_h +#ifndef otbVectorDataIOBase_h +#define otbVectorDataIOBase_h #include <string> @@ -144,13 +144,13 @@ public: /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegions has been set properly. The buffer is cast to a * pointer to the beginning of the image data. */ - virtual void Write(const itk::DataObject* data, char ** papszOptions = NULL) = 0; + virtual void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) = 0; protected: VectorDataIOBase(); - virtual ~VectorDataIOBase(); + ~VectorDataIOBase() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Big or Little Endian, and the type of the file. (May be ignored.) */ ByteOrder m_ByteOrder; @@ -172,4 +172,4 @@ private: } // end namespace otb -#endif // __otbVectorDataIOBase_h +#endif // otbVectorDataIOBase_h diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h b/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h index 10fd9a7147ce468c5b0facdcc7bfb9a109705225..7f86a6db70255145b93fcd39787762643d09c973 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataKeywordlist_h -#define __otbVectorDataKeywordlist_h +#ifndef otbVectorDataKeywordlist_h +#define otbVectorDataKeywordlist_h #include "itkLightObject.h" #include "itkObjectFactory.h" diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h index cdbddf728146d028927b2b4213f0b857e579468d..3a0b71ee0b5448ffd1bc13a47e3991a4e839448b 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataProperties_h -#define __otbVectorDataProperties_h +#ifndef otbVectorDataProperties_h +#define otbVectorDataProperties_h #include "itkObjectFactory.h" @@ -81,11 +81,11 @@ public: void ComputeBoundingRegion(); protected: /** Constructor */ - VectorDataProperties() : m_VectorDataObject(NULL) {}; + VectorDataProperties() : m_VectorDataObject(ITK_NULLPTR) {}; /** Destructor */ - virtual ~VectorDataProperties() {} + ~VectorDataProperties() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; void ProcessNode(InternalTreeNodeType * source); bool IsBoundingRegionNull(); diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.txx b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.txx index a624b0cd269a19308f9464e022ba6354019fd14c..33de79d46183b606611d4749e114a17c513acfd7 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.txx +++ b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataProperties_txx -#define __otbVectorDataProperties_txx +#ifndef otbVectorDataProperties_txx +#define otbVectorDataProperties_txx #include "otbVectorDataProperties.h" #include <algorithm> diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataSource.h b/Modules/Core/VectorDataBase/include/otbVectorDataSource.h index 4db33e36f35e580155b42db3688ce0554cd46a28..029c85993874ded1f89cff299673bc20745a07d3 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataSource.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataSource.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataSource_h -#define __otbVectorDataSource_h +#ifndef otbVectorDataSource_h +#define otbVectorDataSource_h #include "itkProcessObject.h" @@ -80,9 +80,9 @@ public: protected: VectorDataSource(); - virtual ~VectorDataSource(); + ~VectorDataSource() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Ensure that the output vector data are cleared before processing */ virtual void AllocateOutputs(); @@ -99,4 +99,4 @@ private: #include "otbVectorDataSource.txx" #endif -#endif // __otbVectorDataSource_h +#endif // otbVectorDataSource_h diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataSource.txx b/Modules/Core/VectorDataBase/include/otbVectorDataSource.txx index 614d53d2cc76c86d758b1a0d1c0416f04d68df8b..ea56e45eb2dab09952d33e097b3b4d272e5750d5 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataSource.txx +++ b/Modules/Core/VectorDataBase/include/otbVectorDataSource.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataSource_txx -#define __otbVectorDataSource_txx +#ifndef otbVectorDataSource_txx +#define otbVectorDataSource_txx #include "otbVectorDataSource.h" @@ -107,7 +107,7 @@ VectorDataSource<TOutputVectorData> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputVectorDataType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx index 90737a9d85b63de77b119a7d9a1e2685f6367e78..c90712c0f18b8a502965c21a33f796e81d93ed20 100644 --- a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx +++ b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx @@ -458,7 +458,7 @@ VectorDataKeywordlist } case OFTString: { - if (field.second.String != NULL) + if (field.second.String != ITK_NULLPTR) { output << field.second.String; } @@ -522,7 +522,7 @@ VectorDataKeywordlist } case OFTString: { - if (field.second.String != NULL) + if (field.second.String != ITK_NULLPTR) { CPLFree(outField.second.String); outField.second.String = CPLStrdup(field.second.String); diff --git a/Modules/Core/VectorDataBase/test/otbPolygon.cxx b/Modules/Core/VectorDataBase/test/otbPolygon.cxx index 73b5639e27e9e22de6f146247430350531b746e7..19068b6c18ae3802b7d86a22b98b9956f46684c9 100644 --- a/Modules/Core/VectorDataBase/test/otbPolygon.cxx +++ b/Modules/Core/VectorDataBase/test/otbPolygon.cxx @@ -37,7 +37,7 @@ int otbPolygon(int itkNotUsed(argc), char * argv[]) // Reading vertices from command line int cpt = 2; bool first = true; - while (argv[cpt] != NULL && argv[cpt + 1] != NULL) + while (argv[cpt] != ITK_NULLPTR && argv[cpt + 1] != ITK_NULLPTR) { if (argv[cpt][0] == 'n') { diff --git a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h index 41530eb4a7375d8a6421dff071c4b813d1560701..56e7cc302de41880d67bad55b578012c37143385 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h +++ b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudDetectionFilter_h -#define __otbCloudDetectionFilter_h +#ifndef otbCloudDetectionFilter_h +#define otbCloudDetectionFilter_h #include "otbCloudDetectionFunctor.h" #include "itkUnaryFunctorImageFilter.h" @@ -68,11 +68,11 @@ public: protected: CloudDetectionFilter(); - virtual ~CloudDetectionFilter() {} + ~CloudDetectionFilter() ITK_OVERRIDE {} - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: CloudDetectionFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.txx b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.txx index a5ca3bc469b30f155aed18df9b6a41113f2ac544..99db7c1bc22c3e311785343497652764b7cb0d25 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.txx +++ b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudDetectionFilter_txx -#define __otbCloudDetectionFilter_txx +#ifndef otbCloudDetectionFilter_txx +#define otbCloudDetectionFilter_txx #include "otbCloudDetectionFilter.h" diff --git a/Modules/Detection/CloudDetection/include/otbCloudDetectionFunctor.h b/Modules/Detection/CloudDetection/include/otbCloudDetectionFunctor.h index 1487c20dbfa9ffee01c6f3061255dcc548153526..1f875c0a68512ed1d7012892f668c90761757f4b 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudDetectionFunctor.h +++ b/Modules/Detection/CloudDetection/include/otbCloudDetectionFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudDetectionFunctor_h -#define __otbCloudDetectionFunctor_h +#ifndef otbCloudDetectionFunctor_h +#define otbCloudDetectionFunctor_h #include "otbCloudEstimatorFunctor.h" diff --git a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h index 89260e2b2d38f99ac08dd7f6237a8dd8f5f9bc64..9e59818a75624e9a5b4e5779509db7c852ef620e 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h +++ b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudEstimatorFilter_h -#define __otbCloudEstimatorFilter_h +#ifndef otbCloudEstimatorFilter_h +#define otbCloudEstimatorFilter_h #include "otbSpectralAngleFunctor.h" #include "itkUnaryFunctorImageFilter.h" @@ -70,11 +70,11 @@ public: protected: CloudEstimatorFilter(); - virtual ~CloudEstimatorFilter() {} + ~CloudEstimatorFilter() ITK_OVERRIDE {} - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: CloudEstimatorFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.txx b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.txx index 1e58afd1685a8881611528a5ee7f328a512465e6..73290d94caa5c413f03550727c4bff6020cefe00 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.txx +++ b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudEstimatorFilter_txx -#define __otbCloudEstimatorFilter_txx +#ifndef otbCloudEstimatorFilter_txx +#define otbCloudEstimatorFilter_txx #include "otbCloudEstimatorFilter.h" diff --git a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFunctor.h b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFunctor.h index 9eaa4ab785b1bde78f980a1d23ee1e52c54ef290..f63940f5ed38970067d76093b1dd34e48fb691a3 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFunctor.h +++ b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCloudEstimatorFunctor_h -#define __otbCloudEstimatorFunctor_h +#ifndef otbCloudEstimatorFunctor_h +#define otbCloudEstimatorFunctor_h #include "otbSpectralAngleFunctor.h" diff --git a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h index 3d3462bce6d579680a1ac0aefc2d037cc97a828c..9e4ca7572bdf70e5086f63d68fecf2ea42baffa1 100644 --- a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h +++ b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDescriptorsListSampleGenerator_h -#define __otbDescriptorsListSampleGenerator_h +#ifndef otbDescriptorsListSampleGenerator_h +#define otbDescriptorsListSampleGenerator_h #include <vector> @@ -148,31 +148,31 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx); + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - void AllocateOutputs(); - void GenerateOutputInformation(); - void Reset(void); - void Synthetize(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; - void AddInput(itk::DataObject * dataObject) + void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE { Superclass::AddInput(dataObject); } protected: PersistentDescriptorsListSampleGenerator(); - virtual ~PersistentDescriptorsListSampleGenerator(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentDescriptorsListSampleGenerator() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentDescriptorsListSampleGenerator(const Self &); //purposely not implemented @@ -300,7 +300,7 @@ public: return this->GetFilter()->GetInput(); } - void AddInput(itk::DataObject * dataObject) + void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE { this->GetFilter()->AddInput(dataObject); } @@ -360,7 +360,7 @@ public: DescriptorsListSampleGenerator(); /** Destructor */ - virtual ~DescriptorsListSampleGenerator(); + ~DescriptorsListSampleGenerator() ITK_OVERRIDE; private: DescriptorsListSampleGenerator(const Self &); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx index b79108e24c2b830a462a8aa11071b5973bb879df..0f9b7b680ba817197df2e9791085bdc108d0bb9e 100644 --- a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx +++ b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDescriptorsListSampleGenerator_txx -#define __otbDescriptorsListSampleGenerator_txx +#ifndef otbDescriptorsListSampleGenerator_txx +#define otbDescriptorsListSampleGenerator_txx #include "otbDescriptorsListSampleGenerator.h" diff --git a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h index 88dc5df298f153e9b97982343240254994f32bfa..77f6ff87439770fe7f703127003d9cee156f3e39 100644 --- a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserMomentsIFFactory_h -#define __otbFlusserMomentsIFFactory_h +#ifndef otbFlusserMomentsIFFactory_h +#define otbFlusserMomentsIFFactory_h #include "itkLightObject.h" @@ -79,8 +79,8 @@ public: protected: FlusserMomentsIFFactory(){} - ~FlusserMomentsIFFactory(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FlusserMomentsIFFactory() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FlusserMomentsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.txx b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.txx index b6ba84393117ea1d2a9d04b4d6f8188aa42f5408..b1ea7207ec09d32736cfc91013c80776ea424bf0 100644 --- a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.txx +++ b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserMomentsIFFactory_txx -#define __otbFlusserMomentsIFFactory_txx +#ifndef otbFlusserMomentsIFFactory_txx +#define otbFlusserMomentsIFFactory_txx #include "otbFlusserMomentsIFFactory.h" diff --git a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h index 80e4af8bcdb291fba2cddf3e89d787d9ed7d0846..53f7b8d1d188eed89af9de01c99f4da5a66fd7bf 100644 --- a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFourierMellinDescriptorsIFFactory_h -#define __otbFourierMellinDescriptorsIFFactory_h +#ifndef otbFourierMellinDescriptorsIFFactory_h +#define otbFourierMellinDescriptorsIFFactory_h #include "itkLightObject.h" @@ -78,8 +78,8 @@ public: protected: FourierMellinDescriptorsIFFactory(){} - ~FourierMellinDescriptorsIFFactory(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FourierMellinDescriptorsIFFactory() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FourierMellinDescriptorsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.txx b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.txx index a45e7603fe28a2b09333c327b5c62e3c8d1fb07b..bc0b270724db4fd3e7ff7179957ce387d4d40801 100644 --- a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.txx +++ b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFourierMellinDescriptorsIFFactory_txx -#define __otbFourierMellinDescriptorsIFFactory_txx +#ifndef otbFourierMellinDescriptorsIFFactory_txx +#define otbFourierMellinDescriptorsIFFactory_txx #include "otbFourierMellinDescriptorsIFFactory.h" diff --git a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h index a8c4a2fe2d4c4808a0494ae988d8030b0f859f59..c1e5f01ae486d8a229274dbe71a654438a2eb411 100644 --- a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHaralickTexturesIFFactory_h -#define __otbHaralickTexturesIFFactory_h +#ifndef otbHaralickTexturesIFFactory_h +#define otbHaralickTexturesIFFactory_h #include "itkLightObject.h" @@ -80,8 +80,8 @@ public: protected: HaralickTexturesIFFactory(){} - ~HaralickTexturesIFFactory(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HaralickTexturesIFFactory() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HaralickTexturesIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.txx b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.txx index 53dde8a84ea3b8cb1817d395fbeb08e8d59565d0..f16b85c7f53f5c9f13e552ef18cf5f3b05ffc1f7 100644 --- a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.txx +++ b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHaralickTexturesIFFactory_txx -#define __otbHaralickTexturesIFFactory_txx +#ifndef otbHaralickTexturesIFFactory_txx +#define otbHaralickTexturesIFFactory_txx #include "otbHaralickTexturesIFFactory.h" diff --git a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h index d074abeeecde80f8ab0365528002848d00563238..b376be12bac464450d99a4f63d676ccb704d82ed 100644 --- a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h +++ b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabeledSampleLocalizationGenerator_h -#define __otbLabeledSampleLocalizationGenerator_h +#ifndef otbLabeledSampleLocalizationGenerator_h +#define otbLabeledSampleLocalizationGenerator_h #include "otbVectorDataSource.h" #include "otbVectorData.h" @@ -113,11 +113,11 @@ public: protected: LabeledSampleLocalizationGenerator(); - virtual ~LabeledSampleLocalizationGenerator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabeledSampleLocalizationGenerator() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Triggers the Computation of the sample list */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; PointVectorType RandomPointsGenerator(DataNodeType * node); diff --git a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.txx b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.txx index e97b24cc2a27430f7136f06e83f877cf1d361400..03e8e300818fd607260825df72dbda8ca96dda33 100644 --- a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.txx +++ b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabeledSampleLocalizationGenerator_txx -#define __otbLabeledSampleLocalizationGenerator_txx +#ifndef otbLabeledSampleLocalizationGenerator_txx +#define otbLabeledSampleLocalizationGenerator_txx #include "otbLabeledSampleLocalizationGenerator.h" @@ -69,7 +69,7 @@ LabeledSampleLocalizationGenerator<TVectorData> { if (this->GetNumberOfInputs() < idx) { - return 0; + return ITK_NULLPTR; } return static_cast<const VectorDataType *>(this->Superclass::GetInput(idx)); diff --git a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h index ab8c43ee5885068188bf28bd2754f979208e02f8..e7aa76913a2898150ef2fa05cd89f0ed84e00903 100644 --- a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHistogramIFFactory_h -#define __otbLocalHistogramIFFactory_h +#ifndef otbLocalHistogramIFFactory_h +#define otbLocalHistogramIFFactory_h #include "itkLightObject.h" @@ -79,8 +79,8 @@ public: protected: LocalHistogramIFFactory(){} - ~LocalHistogramIFFactory(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LocalHistogramIFFactory() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LocalHistogramIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.txx b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.txx index b590bd53cb51e8774118b2ce4cd02ca4cd474d0b..e748c6a62d099e1cbb49dfd59f57c44e2da0edb2 100644 --- a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.txx +++ b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHistogramIFFactory_txx -#define __otbLocalHistogramIFFactory_txx +#ifndef otbLocalHistogramIFFactory_txx +#define otbLocalHistogramIFFactory_txx #include "otbLocalHistogramIFFactory.h" diff --git a/Modules/Detection/ObjectDetection/include/otbMultiChannelIFFactory.h b/Modules/Detection/ObjectDetection/include/otbMultiChannelIFFactory.h index f4751363284bc73c2722bef84edd6d7e1de61949..964a87b30aaa03f3a39a41a7042212a6a6ac0950 100644 --- a/Modules/Detection/ObjectDetection/include/otbMultiChannelIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbMultiChannelIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelIFFactory_h -#define __otbMultiChannelIFFactory_h +#ifndef otbMultiChannelIFFactory_h +#define otbMultiChannelIFFactory_h #include "otbVectorImageToImageListFilter.h" #include "otbVectorImage.h" diff --git a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h index 9de74d093f397f3c960232771f5ce9f30580590e..489d50d6cfc99c41e3f513a63fc3f89838f5e154 100644 --- a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsIFFactory_h -#define __otbRadiometricMomentsIFFactory_h +#ifndef otbRadiometricMomentsIFFactory_h +#define otbRadiometricMomentsIFFactory_h #include "itkLightObject.h" @@ -79,8 +79,8 @@ public: protected: RadiometricMomentsIFFactory(){} - ~RadiometricMomentsIFFactory(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~RadiometricMomentsIFFactory() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RadiometricMomentsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.txx b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.txx index 9cf59780fd2ec6c5d7abe3e94fbb888cfc0eadab..dd1327f3c1ca8c9a6f56dee9a8023b93045680fe 100644 --- a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.txx +++ b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsIFFactory_txx -#define __otbRadiometricMomentsIFFactory_txx +#ifndef otbRadiometricMomentsIFFactory_txx +#define otbRadiometricMomentsIFFactory_txx #include "otbRadiometricMomentsIFFactory.h" diff --git a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h index 5252070600e78706111e2cc9cdb16cd0f8b18aa5..fb59aa2ba1c9a6c62e76a5e2192eb52dd674dabf 100644 --- a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h +++ b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardMetaImageFunctionBuilder_h -#define __otbStandardMetaImageFunctionBuilder_h +#ifndef otbStandardMetaImageFunctionBuilder_h +#define otbStandardMetaImageFunctionBuilder_h #include "itkVariableLengthVector.h" @@ -167,8 +167,8 @@ public: protected: StandardMetaImageFunctionBuilder(); - ~StandardMetaImageFunctionBuilder(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~StandardMetaImageFunctionBuilder() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StandardMetaImageFunctionBuilder(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.txx b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.txx index bee36354ebc27e4eb66b6c4f815fe1a9113510f3..4126fd86446a6b21ff862561e8673e0573a30183 100644 --- a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.txx +++ b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardMetaImageFunctionBuilder_txx -#define __otbStandardMetaImageFunctionBuilder_txx +#ifndef otbStandardMetaImageFunctionBuilder_txx +#define otbStandardMetaImageFunctionBuilder_txx #include "otbStandardMetaImageFunctionBuilder.h" diff --git a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h index 23eb36eaa3bea330b2f21036cc1c0f7e7e54e251..0782446ac8d8c9d75278820a70e13e787605e0c5 100644 --- a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBreakAngularPathListFilter_h -#define __otbBreakAngularPathListFilter_h +#ifndef otbBreakAngularPathListFilter_h +#define otbBreakAngularPathListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -64,11 +64,11 @@ protected: /** Constructor */ BreakAngularPathListFilter(); /** Destructor */ - virtual ~BreakAngularPathListFilter() {} + ~BreakAngularPathListFilter() ITK_OVERRIDE {} /** GenerateData method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BreakAngularPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.txx b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.txx index af9e2988ebd6fe118a73dbfbb57445c6dc7f7e3a..a122f6be6c719b6fc6d627a2386e4050f560c5e6 100644 --- a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBreakAngularPathListFilter_txx -#define __otbBreakAngularPathListFilter_txx +#ifndef otbBreakAngularPathListFilter_txx +#define otbBreakAngularPathListFilter_txx #include "otbBreakAngularPathListFilter.h" #include "otbMath.h" diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h index 623ad4b2cf53bc23544e6cc7d71a50a86e18673a..6f5b324b13380b3f95c60fb544f7a4abec4389a8 100644 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRoadExtractionFilter_h -#define __otbGenericRoadExtractionFilter_h +#ifndef otbGenericRoadExtractionFilter_h +#define otbGenericRoadExtractionFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkGradientRecursiveGaussianImageFilter.h" @@ -186,7 +186,7 @@ protected: /** Constructor */ GenericRoadExtractionFilter(); /** Destructor */ - ~GenericRoadExtractionFilter() {} + ~GenericRoadExtractionFilter() ITK_OVERRIDE {} /** Prepare main computation method * Note : this function isn't called @@ -194,9 +194,9 @@ protected: void BeforeGenerateData(void); /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx index 6ed3e03127b19973aba1dccf5867c09179a5815f..9927a9fb62b92e98747c3593d50c5e209c009e1d 100644 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRoadExtractionFilter_txx -#define __otbGenericRoadExtractionFilter_txx +#ifndef otbGenericRoadExtractionFilter_txx +#define otbGenericRoadExtractionFilter_txx #include "otbGenericRoadExtractionFilter.h" #include "otbMath.h" diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h index f144fdbaab6038d920865913ea6ad4ca0f17d069..1bf6173998f8ec9d748973323f18602920843b84 100644 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPathListAlignFilter_h -#define __otbImageToPathListAlignFilter_h +#ifndef otbImageToPathListAlignFilter_h +#define otbImageToPathListAlignFilter_h #include "itkImageSource.h" #include "itkConceptChecking.h" @@ -118,10 +118,10 @@ public: protected: ImageToPathListAlignFilter(); - virtual ~ImageToPathListAlignFilter(); + ~ImageToPathListAlignFilter() ITK_OVERRIDE; - virtual void GenerateOutputInformation() {} // do nothing - virtual void GenerateData(); + void GenerateOutputInformation() ITK_OVERRIDE {} // do nothing + void GenerateData() ITK_OVERRIDE; virtual std::vector<double> tab(int n, double p, double m); virtual void AngleCalculate(const InputImageType* InputImageIn); @@ -131,7 +131,7 @@ protected: ValueType m_PathValue; ValueType m_BackgroundValue; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToPathListAlignFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx index 3db9a7dfac7da78698ccf7db2e69ab1d92e49384..e8f98e7f10e901cc39de1167dd9a6d95291d3b94 100644 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPathListAlignFilter_txx -#define __otbImageToPathListAlignFilter_txx +#ifndef otbImageToPathListAlignFilter_txx +#define otbImageToPathListAlignFilter_txx #include "otbImageToPathListAlignFilter.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h index 53e02888ec1c792b03589bef3be33a0864f09856..26a4f8d794c646d1f839905d01f659a5dedaec76 100644 --- a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLikelihoodPathListFilter_h -#define __otbLikelihoodPathListFilter_h +#ifndef otbLikelihoodPathListFilter_h +#define otbLikelihoodPathListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -82,11 +82,11 @@ protected: /** Constructor */ LikelihoodPathListFilter(); /** Destructor */ - virtual ~LikelihoodPathListFilter() {} + ~LikelihoodPathListFilter() ITK_OVERRIDE {} /** GenerateData method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LikelihoodPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.txx b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.txx index fd2482e60bddd0cb6f1b99567855c8f2baf0a87a..d2b03ac77bce37a420bf8da4b8a49245b9052d01 100644 --- a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLikelihoodPathListFilter_txx -#define __otbLikelihoodPathListFilter_txx +#ifndef otbLikelihoodPathListFilter_txx +#define otbLikelihoodPathListFilter_txx #include "otbLikelihoodPathListFilter.h" #include "otbPolyLineImageConstIterator.h" @@ -50,7 +50,7 @@ LikelihoodPathListFilter<TPath, TImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h index ac84cda4baffa0689eb87f02c4ea2f402dad9285..a9e5a1cef0e9662cc2f4ccf147d9b3ee5bda76b7 100644 --- a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLinkPathListFilter_h -#define __otbLinkPathListFilter_h +#ifndef otbLinkPathListFilter_h +#define otbLinkPathListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -81,11 +81,11 @@ protected: /** Constructor */ LinkPathListFilter(); /** Destructor */ - virtual ~LinkPathListFilter() {} + ~LinkPathListFilter() ITK_OVERRIDE {} /** GenerateData method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Verify the angular condition to link a path. diff --git a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.txx b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.txx index bfb025c31f5d7b254c57951799ae0cf7597ba615..d102babf3288e809b2a8e45de01bfa603401d9cc 100644 --- a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLinkPathListFilter_txx -#define __otbLinkPathListFilter_txx +#ifndef otbLinkPathListFilter_txx +#define otbLinkPathListFilter_txx #include "otbLinkPathListFilter.h" #include "otbMath.h" diff --git a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h index 532bf5559d81d5faac50cdab208471bcc73a0019..77f36674838c409a2920e76f6370a7412979d15d 100644 --- a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbModulusAndDirectionImageToImageFilter_h -#define __otbModulusAndDirectionImageToImageFilter_h +#ifndef otbModulusAndDirectionImageToImageFilter_h +#define otbModulusAndDirectionImageToImageFilter_h #include "itkImageToImageFilter.h" @@ -67,15 +67,15 @@ public: /** Set/Get the image input of this process object. */ using Superclass::SetInput; - virtual void SetInput(const InputImageType *input); + void SetInput(const InputImageType *input) ITK_OVERRIDE; virtual void SetInputDirection(const InputImageDirectionType *direction); const InputImageType * GetInput(void); const InputImageDirectionType * GetInputDirection(void); protected: ModulusAndDirectionImageToImageFilter(); - virtual ~ModulusAndDirectionImageToImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ModulusAndDirectionImageToImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ModulusAndDirectionImageToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.txx b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.txx index 63a95cbf226a51c84b781eed2fe18da1c9c8782a..6d9cbf320d75dc9fd3b8ae2f46b4602723881013 100644 --- a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbModulusAndDirectionImageToImageFilter_txx -#define __otbModulusAndDirectionImageToImageFilter_txx +#ifndef otbModulusAndDirectionImageToImageFilter_txx +#define otbModulusAndDirectionImageToImageFilter_txx #include "otbModulusAndDirectionImageToImageFilter.h" #include "itkProcessObject.h" @@ -67,7 +67,7 @@ GetInput(void) { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *> @@ -83,7 +83,7 @@ GetInputDirection(void) { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImageDirection *> diff --git a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h index d207d34c2f8e1d0d1000d1fa8a9b6fddfd08fef7..958f4ee35ff2cba58bd84f679c0af7593988bfd4 100644 --- a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeighborhoodScalarProductFilter_h -#define __otbNeighborhoodScalarProductFilter_h +#ifndef otbNeighborhoodScalarProductFilter_h +#define otbNeighborhoodScalarProductFilter_h #include "otbImageToModulusAndDirectionImageFilter.h" @@ -81,9 +81,9 @@ protected: /** Constructor */ NeighborhoodScalarProductFilter(); /** Destructor */ - virtual ~NeighborhoodScalarProductFilter() {} + ~NeighborhoodScalarProductFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** NeighborhoodScalarProductImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -95,7 +95,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: NeighborhoodScalarProductFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.txx b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.txx index e1d1c6afe9b6dbe269f63cb3731840dfe40fea39..ec95e1d49816736bf81ec8cd5c4de390b550f9df 100644 --- a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeighborhoodScalarProductFilter_txx -#define __otbNeighborhoodScalarProductFilter_txx +#ifndef otbNeighborhoodScalarProductFilter_txx +#define otbNeighborhoodScalarProductFilter_txx #include "otbNeighborhoodScalarProductFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h index 3f632bcd2a896d67be4c412d7f2695a9d035192a..487a92af895de97f38c7bcc13f2e60ba326bbd84 100644 --- a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNonMaxRemovalByDirectionFilter_h -#define __otbNonMaxRemovalByDirectionFilter_h +#ifndef otbNonMaxRemovalByDirectionFilter_h +#define otbNonMaxRemovalByDirectionFilter_h #include "otbModulusAndDirectionImageToImageFilter.h" #include "otbBinaryFunctorNeighborhoodImageFilter.h" @@ -133,14 +133,14 @@ protected: /** Constructor */ NonMaxRemovalByDirectionFilter() {}; /** Destructor */ - virtual ~NonMaxRemovalByDirectionFilter() {} + ~NonMaxRemovalByDirectionFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } /** Main computation method */ - virtual void GenerateData(void) + void GenerateData(void) ITK_OVERRIDE { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h index 928f9f0e51ceca8da7ac7ab7ed91b74f82f17f9d..815e43f6b676b57e6804820632e1e41333f8a36d 100644 --- a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParallelLinePathListFilter_h -#define __otbParallelLinePathListFilter_h +#ifndef otbParallelLinePathListFilter_h +#define otbParallelLinePathListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -87,11 +87,11 @@ protected: /** Constructor */ ParallelLinePathListFilter(); /** Destructor */ - virtual ~ParallelLinePathListFilter() {} + ~ParallelLinePathListFilter() ITK_OVERRIDE {} /** GenerateData method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Verify the angular condition to find parallel lines. diff --git a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.txx b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.txx index a59883455f5108b3199a26e9013ac09070635e69..e117e47194ec5d3771056777c41d8034c426196a 100644 --- a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParallelLinePathListFilter_txx -#define __otbParallelLinePathListFilter_txx +#ifndef otbParallelLinePathListFilter_txx +#define otbParallelLinePathListFilter_txx #include "otbParallelLinePathListFilter.h" #include "otbMath.h" diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h index 60a84bf77b3080763a3038a28b0e59315d80498f..29bb49d6838425b5891be23c76d87c16adcb0f7c 100644 --- a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRemoveIsolatedByDirectionFilter_h -#define __otbRemoveIsolatedByDirectionFilter_h +#ifndef otbRemoveIsolatedByDirectionFilter_h +#define otbRemoveIsolatedByDirectionFilter_h #include "otbModulusAndDirectionImageToImageFilter.h" #include "otbBinaryFunctorNeighborhoodImageFilter.h" @@ -106,14 +106,14 @@ protected: /** Constructor */ RemoveIsolatedByDirectionFilter() {}; /** Destructor */ - virtual ~RemoveIsolatedByDirectionFilter() {} + ~RemoveIsolatedByDirectionFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } /** Main computation method */ - virtual void GenerateData(void) + void GenerateData(void) ITK_OVERRIDE { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h index 5cbc16273948e9b5252a4ec36aab7bb0ee309433..9e3282d9f8719be17f5502fe02c3ae9383c5c8cd 100644 --- a/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRemoveTortuousPathListFilter_h -#define __otbRemoveTortuousPathListFilter_h +#ifndef otbRemoveTortuousPathListFilter_h +#define otbRemoveTortuousPathListFilter_h #include "otbUnaryFunctorObjectListBooleanFilter.h" #include "otbPathMeanDistanceFunctor.h" diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h index 297410b3189289ff6efc233a43155c642be2f55d..bada4bfc1ff197cbdef4d6bea2ddae38edbc95af 100644 --- a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRemoveWrongDirectionFilter_h -#define __otbRemoveWrongDirectionFilter_h +#ifndef otbRemoveWrongDirectionFilter_h +#define otbRemoveWrongDirectionFilter_h #include "otbModulusAndDirectionImageToImageFilter.h" #include "itkBinaryFunctorImageFilter.h" @@ -101,14 +101,14 @@ protected: /** Constructor */ RemoveWrongDirectionFilter() {}; /** Destructor */ - virtual ~RemoveWrongDirectionFilter() {} + ~RemoveWrongDirectionFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } /** Main computation method */ - virtual void GenerateData(void) + void GenerateData(void) ITK_OVERRIDE { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h index c934227476d1d15439da17630980d02989e0dc5a..bc1f020c6782013749d9b1f6efb82a3d2522ee7b 100644 --- a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRoadExtractionFilter_h -#define __otbRoadExtractionFilter_h +#ifndef otbRoadExtractionFilter_h +#define otbRoadExtractionFilter_h #include "otbSpectralAngleDistanceImageFilter.h" @@ -138,15 +138,15 @@ protected: /** Constructor */ RoadExtractionFilter(); /** Destructor */ - ~RoadExtractionFilter() {} + ~RoadExtractionFilter() ITK_OVERRIDE {} /** Prepare main computation method */ void BeforeGenerateData(void); /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.txx b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.txx index 3b5ddde2e88170239a6d07026882d764cf057820..caa0351b483e5e592549b9c42cda0b70904a7e1f 100644 --- a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRoadExtractionFilter_txx -#define __otbRoadExtractionFilter_txx +#ifndef otbRoadExtractionFilter_txx +#define otbRoadExtractionFilter_txx #include "otbRoadExtractionFilter.h" #include "otbMath.h" diff --git a/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h index b4bc6c9881a2e7c443657eeb9f9f46cef2fd261c..847004511a0e6285d6c3c4fd6c202da682a6c648 100644 --- a/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSimplifyPathListFilter_h -#define __otbSimplifyPathListFilter_h +#ifndef otbSimplifyPathListFilter_h +#define otbSimplifyPathListFilter_h #include "otbUnaryFunctorObjectListFilter.h" #include "otbSimplifyPathFunctor.h" diff --git a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h index 7545483e5c749ac3bf05241d25fb521d0fbac01b..628457b7a388326200054d921e3e43aeecd4f73f 100644 --- a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRoadDescriptionFilter_h -#define __otbVectorDataToRoadDescriptionFilter_h +#ifndef otbVectorDataToRoadDescriptionFilter_h +#define otbVectorDataToRoadDescriptionFilter_h #include "otbVectorDataToSpecificDescriptionFilterBase.h" #include "otbVectorData.h" @@ -113,11 +113,11 @@ protected: /** Constructor */ VectorDataToRoadDescriptionFilter(); /** Destructor */ - virtual ~VectorDataToRoadDescriptionFilter() {} + ~VectorDataToRoadDescriptionFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Triggers the Computation of the Descriptors */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: VectorDataToRoadDescriptionFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.txx b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.txx index f5df76a11e18eacc4f26aeb7929db1fd535e31c3..87ae91a2211b5946be44b5a12fdb4ed135df8d22 100644 --- a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRoadDescriptionFilter_txx -#define __otbVectorDataToRoadDescriptionFilter_txx +#ifndef otbVectorDataToRoadDescriptionFilter_txx +#define otbVectorDataToRoadDescriptionFilter_txx #include "otbVectorDataToRoadDescriptionFilter.h" diff --git a/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx b/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx index 2f0998969c3c47991e4605d769d1a2cd79f7f7aa..9a36942b3f1deb28633e8c59540b06fa7b017af3 100644 --- a/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx +++ b/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx @@ -108,7 +108,7 @@ int otbAlignImageToPath(int itkNotUsed(argc), char * argv[]) otbGenericMsgDebugMacro(<< "Writing :"); FILE *file = fopen(outputFilename, "w"); - if (file == NULL) + if (file == ITK_NULLPTR) { fprintf(stderr, "Error, can't open file"); exit(-1); diff --git a/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx index f523961ba4db29c1160c0b3d239ea3bd58941594..c6426993e3328acebc39f6d023fd0b143b3a7e78 100644 --- a/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx +++ b/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx @@ -45,7 +45,7 @@ int otbBreakAngularPathListFilter(int itkNotUsed(argc), char * argv[]) ++cpt; ListPoints.clear(); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { if (argv[cpt][0] == '|') { diff --git a/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx index 6a7334b1fb0e149f7c66763ccdfc13f7ba404d1d..c9b6e495c23a07c79e3465492f480ef5b8d9e717 100644 --- a/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx +++ b/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx @@ -39,7 +39,7 @@ int otbLikelihoodPathListFilter(int itkNotUsed(argc), char * argv[]) int cpt = 3; ListPoints.clear(); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { if (argv[cpt][0] == '|') { diff --git a/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx index d9d571980317afe648795065862a212a8c29a2b3..5cdee745edeaaf5769baa2ed6778c21c07187dc0 100644 --- a/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx +++ b/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx @@ -40,7 +40,7 @@ int otbLinkPathListFilter(int itkNotUsed(argc), char * argv[]) int cpt = 4; ListPoints.clear(); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { if (argv[cpt][0] == '|') { diff --git a/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx index 0e9f47db6d8d52d27098f6ef10d66038bd8e8876..388a709c0b0e9fe4be923f7eebaef40e13fdc813 100644 --- a/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx +++ b/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx @@ -35,7 +35,7 @@ int otbRemoveTortuousPathListFilter(int itkNotUsed(argc), char * argv[]) int cpt = 3; ListPoints.clear(); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { if (argv[cpt][0] == '|') { diff --git a/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx index 52db85ed5bb92d4cb68b9777cdee7849351f9a36..a5265309a4ccc6d7e640c3cabd00898acf04b024 100644 --- a/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx +++ b/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx @@ -35,7 +35,7 @@ int otbSimplifyPathListFilter(int itkNotUsed(argc), char * argv[]) int cpt = 3; ListPoints.clear(); - while (argv[cpt] != NULL) + while (argv[cpt] != ITK_NULLPTR) { if (argv[cpt][0] == '|') { diff --git a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h index 867af0a779f7f943ef6204f6ced4bec701016305..48e92d541b59df415b2c18b525605cd22f86029a 100644 --- a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h +++ b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUrbanAreaDetectionImageFilter_h -#define __otbUrbanAreaDetectionImageFilter_h +#ifndef otbUrbanAreaDetectionImageFilter_h +#define otbUrbanAreaDetectionImageFilter_h #include "otbImage.h" #include "otbWaterIndicesFunctor.h" @@ -229,11 +229,11 @@ public: itkSetMacro(SobelUpperThreshold, double); /** Methods */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: UrbanAreaDetectionImageFilter(); - virtual ~UrbanAreaDetectionImageFilter(){} + ~UrbanAreaDetectionImageFilter() ITK_OVERRIDE{} private: UrbanAreaDetectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.txx b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.txx index aad11939a72ecd5768d7eff71f9092f9334a0e03..a263dfcf74e52089b58de14cbf548d6848e4805e 100644 --- a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.txx +++ b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUrbanAreaDetectionImageFilter_txx -#define __otbUrbanAreaDetectionImageFilter_txx +#ifndef otbUrbanAreaDetectionImageFilter_txx +#define otbUrbanAreaDetectionImageFilter_txx #include "otbUrbanAreaDetectionImageFilter.h" #include "itkProgressAccumulator.h" diff --git a/Modules/Feature/Corner/include/otbHarrisImageFilter.h b/Modules/Feature/Corner/include/otbHarrisImageFilter.h index c066f5d904ed47cc9baa20ee1e4676c414ecc49d..9d2f5ebdb5c5c9f56004dd4a52caf05f4a2e6047 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageFilter.h +++ b/Modules/Feature/Corner/include/otbHarrisImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHarrisImageFilter_h -#define __otbHarrisImageFilter_h +#ifndef otbHarrisImageFilter_h +#define otbHarrisImageFilter_h #include "itkImageToImageFilter.h" #include "itkHessianRecursiveGaussianImageFilter.h" @@ -101,11 +101,11 @@ public: protected: HarrisImageFilter(); - virtual ~HarrisImageFilter() {} + ~HarrisImageFilter() ITK_OVERRIDE {} - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HarrisImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Corner/include/otbHarrisImageFilter.txx b/Modules/Feature/Corner/include/otbHarrisImageFilter.txx index 4e6a0d68f25eb735aa37aacd04b30b48b5a159d7..a9044d9c1cfc5993abbf4c200bfdf89270390a94 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageFilter.txx +++ b/Modules/Feature/Corner/include/otbHarrisImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHarrisImageFilter_txx -#define __otbHarrisImageFilter_txx +#ifndef otbHarrisImageFilter_txx +#define otbHarrisImageFilter_txx #include "otbHarrisImageFilter.h" diff --git a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h index 2c2d8d91b0973bf6af6b722b2207a697e2852134..9e52c0b3dba3be1ba277b440d7bb16c24e9db8f0 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h +++ b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHarrisImageToPointSetFilter_h -#define __otbHarrisImageToPointSetFilter_h +#ifndef otbHarrisImageToPointSetFilter_h +#define otbHarrisImageToPointSetFilter_h #include "otbThresholdImageToPointSetFilter.h" #include "otbHarrisImageFilter.h" @@ -75,11 +75,11 @@ public: protected: HarrisImageToPointSetFilter(); - virtual ~HarrisImageToPointSetFilter() {} + ~HarrisImageToPointSetFilter() ITK_OVERRIDE {} - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HarrisImageToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.txx b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.txx index 9dff206431505ee45d396c808dab7a609977da04..f8266e163461de13c2dcd78b39176c536b8a0710 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.txx +++ b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHarrisImageToPointSetFilter_txx -#define __otbHarrisImageToPointSetFilter_txx +#ifndef otbHarrisImageToPointSetFilter_txx +#define otbHarrisImageToPointSetFilter_txx #include "otbHarrisImageToPointSetFilter.h" diff --git a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h index c4da86c681a5e3e93b495ad542101a96d6749541..17b142a0e19175e0cf553f7189f48e6c92260d42 100644 --- a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h +++ b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObjectListToRightAnglePointSetFilter_h -#define __otbLineSpatialObjectListToRightAnglePointSetFilter_h +#ifndef otbLineSpatialObjectListToRightAnglePointSetFilter_h +#define otbLineSpatialObjectListToRightAnglePointSetFilter_h #include "itkPointSet.h" #include "otbLineSpatialObjectListToPointSetFilter.h" @@ -103,7 +103,7 @@ protected: * */ - virtual void GenerateOutputInformation(){} + void GenerateOutputInformation() ITK_OVERRIDE{} /** * Constructor. @@ -112,15 +112,15 @@ protected: /** * Destructor. */ - virtual ~LineSpatialObjectListToRightAnglePointSetFilter(){} + ~LineSpatialObjectListToRightAnglePointSetFilter() ITK_OVERRIDE{} /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** * Angle computation */ diff --git a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.txx b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.txx index a241052f34bae42e73b2e83a89e209e787bb2493..fc396e5965e7c30b479c2e6a4b10733cf820d217 100644 --- a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.txx +++ b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSpatialObjectListToRightAnglePointSetFilter_txx -#define __otbLineSpatialObjectListToRightAnglePointSetFilter_txx +#ifndef otbLineSpatialObjectListToRightAnglePointSetFilter_txx +#define otbLineSpatialObjectListToRightAnglePointSetFilter_txx #include "otbLineSpatialObjectListToRightAnglePointSetFilter.h" #include "itkLineIterator.h" diff --git a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h index db6c0dcca4865b92cda0c6d94a5d953e42b0ad39..db552a54751e2bb8d203f26f600cd0b2d6649190 100644 --- a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h +++ b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRightAngleVectorDataFilter_h -#define __otbVectorDataToRightAngleVectorDataFilter_h +#ifndef otbVectorDataToRightAngleVectorDataFilter_h +#define otbVectorDataToRightAngleVectorDataFilter_h #include "otbVectorDataToVectorDataFilter.h" @@ -84,11 +84,11 @@ protected: /** Constructor.*/ VectorDataToRightAngleVectorDataFilter(); /**Destructor.*/ - virtual ~VectorDataToRightAngleVectorDataFilter(){} + ~VectorDataToRightAngleVectorDataFilter() ITK_OVERRIDE{} /** Standard PrintSelf method.*/ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /**Main computation method.*/ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /**Angle computation.*/ virtual double ComputeAngleFormedBySegments(LineType * lineDst, LineType * lineSrc); /** When we find a right angle, one compute the coordinate of the segments intersection.*/ diff --git a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.txx b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.txx index 661c4ff3323f61cb09abe496d020c3a65e396f88..1b2f56845893d51b43e465b0d18093870ae83a39 100644 --- a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.txx +++ b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRightAngleVectorDataFilter_txx -#define __otbVectorDataToRightAngleVectorDataFilter_txx +#ifndef otbVectorDataToRightAngleVectorDataFilter_txx +#define otbVectorDataToRightAngleVectorDataFilter_txx #include "otbVectorDataToRightAngleVectorDataFilter.h" #include "otbVectorData.h" diff --git a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h index f8e3c53f44ec06a951674abb465efd3ede4390ad..296d6063f2636e869db8bda077c07294d9932065 100644 --- a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h +++ b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKeyPointDensityImageFilter_h -#define __otbKeyPointDensityImageFilter_h +#ifndef otbKeyPointDensityImageFilter_h +#define otbKeyPointDensityImageFilter_h #include "itkImageToImageFilter.h" #include "otbPointSetToDensityImageFilter.h" @@ -98,16 +98,16 @@ protected: /** * Destructor. */ - virtual ~KeyPointDensityImageFilter(); + ~KeyPointDensityImageFilter() ITK_OVERRIDE; /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ //virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx index be946a3c75739f8d0facd321f4729f95a6a70407..bc03afbe8d7b8cc1863db3ccf29faf6f8c52df4f 100644 --- a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx +++ b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKeyPointDensityImageFilter_txx -#define __otbKeyPointDensityImageFilter_txx +#ifndef otbKeyPointDensityImageFilter_txx +#define otbKeyPointDensityImageFilter_txx #include "otbKeyPointDensityImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h index e124e78626fa003ecfb2b3d06866d591673779a9..7070b51ddd4cbab51be99ecffb081ed14066580a 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityEpanechnikovFunction_h -#define __otbPointSetDensityEpanechnikovFunction_h +#ifndef otbPointSetDensityEpanechnikovFunction_h +#define otbPointSetDensityEpanechnikovFunction_h #include "otbPointSetFunction.h" #include "itkPoint.h" @@ -62,13 +62,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - virtual OutputType Evaluate(const InputType& input) const; + OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; protected: PointSetDensityEpanechnikovFunction() : m_Radius(1) {}; - virtual ~PointSetDensityEpanechnikovFunction() {} + ~PointSetDensityEpanechnikovFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetDensityEpanechnikovFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.txx b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.txx index 63af5cffe5a281591c96b6bf844f41b9abbc0a5e..ff6c98d575d38d3614710e8a1a1a5bb5da2d7e09 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.txx +++ b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityEpanechnikovFunction_txx -#define __otbPointSetDensityEpanechnikovFunction_txx +#ifndef otbPointSetDensityEpanechnikovFunction_txx +#define otbPointSetDensityEpanechnikovFunction_txx #include "otbPointSetDensityEpanechnikovFunction.h" #include "otbMath.h" diff --git a/Modules/Feature/Density/include/otbPointSetDensityFunction.h b/Modules/Feature/Density/include/otbPointSetDensityFunction.h index 971e0436f984e5f16dcd13745780150448ccbb5e..1cd07753d586285aafe43e6d78650af3ff7a8308 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityFunction_h -#define __otbPointSetDensityFunction_h +#ifndef otbPointSetDensityFunction_h +#define otbPointSetDensityFunction_h #include "otbPointSetFunction.h" @@ -61,13 +61,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - virtual OutputType Evaluate(const InputType& input) const; + OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; protected: PointSetDensityFunction() : m_Radius(1) {}; - virtual ~PointSetDensityFunction() {} + ~PointSetDensityFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetDensityFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetDensityFunction.txx b/Modules/Feature/Density/include/otbPointSetDensityFunction.txx index 8cf53d478671b5f71293adce663b6dffd0df713f..d6aff829dba683f95571b1fa7c32ad009b7124d1 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityFunction.txx +++ b/Modules/Feature/Density/include/otbPointSetDensityFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityFunction_txx -#define __otbPointSetDensityFunction_txx +#ifndef otbPointSetDensityFunction_txx +#define otbPointSetDensityFunction_txx #include "otbPointSetDensityFunction.h" #include "otbMath.h" diff --git a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h index 1415469f759549559237f1cc8dbf2fdcd403576d..a9d1061f872e481da9727e6e6643af97d36dfd2d 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityGaussianFunction_h -#define __otbPointSetDensityGaussianFunction_h +#ifndef otbPointSetDensityGaussianFunction_h +#define otbPointSetDensityGaussianFunction_h #include "otbPointSetFunction.h" #include "itkPoint.h" @@ -62,13 +62,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - virtual OutputType Evaluate(const InputType& input) const; + OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; protected: PointSetDensityGaussianFunction() : m_Radius(1) {}; - virtual ~PointSetDensityGaussianFunction() {} + ~PointSetDensityGaussianFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetDensityGaussianFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.txx b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.txx index c4de669a3c1084def97cb7f20ed9b54861d73541..423e4650011cefcb5e2e30ffa6a17e50f9a690ba 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.txx +++ b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetDensityGaussianFunction_txx -#define __otbPointSetDensityGaussianFunction_txx +#ifndef otbPointSetDensityGaussianFunction_txx +#define otbPointSetDensityGaussianFunction_txx #include "otbPointSetDensityGaussianFunction.h" #include "otbMath.h" diff --git a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h index b8c5ff591a4d113eda0b054d5bfec1b188c428b7..d7ad151f9a77ff479ac1e69c66b795cf2dab2d4a 100644 --- a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h +++ b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToDensityImageFilter_h -#define __otbPointSetToDensityImageFilter_h +#ifndef otbPointSetToDensityImageFilter_h +#define otbPointSetToDensityImageFilter_h #include "itkProcessObject.h" #include "itkPointSet.h" @@ -81,27 +81,27 @@ protected: /** * Destructor. */ - virtual ~PointSetToDensityImageFilter() {} + ~PointSetToDensityImageFilter() ITK_OVERRIDE {} /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Call the ImageSource::GenerateData which handle multithreading */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** * Main computation method. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: diff --git a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx index 0f491f242232c733a892ebaccbedf9087e8f4c8d..6f62393352e2f4803e5eba864ef1782601a5946e 100644 --- a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx +++ b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToDensityImageFilter_txx -#define __otbPointSetToDensityImageFilter_txx +#ifndef otbPointSetToDensityImageFilter_txx +#define otbPointSetToDensityImageFilter_txx #include "otbPointSetToDensityImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h index 01ae83efe0d2145e35347985519a5f42a59e307e..7f267b7cdb34fc1e523864d4de27db879f660d72 100644 --- a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbForwardFourierMellinTransformImageFilter_h -#define __otbForwardFourierMellinTransformImageFilter_h +#ifndef otbForwardFourierMellinTransformImageFilter_h +#define otbForwardFourierMellinTransformImageFilter_h #include "otbImage.h" #include "itkForwardFFTImageFilter.h" @@ -126,15 +126,15 @@ public: protected: ForwardFourierMellinTransformImageFilter(); - virtual ~ForwardFourierMellinTransformImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ForwardFourierMellinTransformImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Main Computation Method */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: ForwardFourierMellinTransformImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx index c2f92e929579a0c93c0254a7d8a0ed5f4971439b..9445ff2f2726ca5e1da9c576051678dce7c05c7a 100644 --- a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx +++ b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbForwardFourierMellinTransformImageFilter_txx -#define __otbForwardFourierMellinTransformImageFilter_txx +#ifndef otbForwardFourierMellinTransformImageFilter_txx +#define otbForwardFourierMellinTransformImageFilter_txx #include "otbForwardFourierMellinTransformImageFilter.h" #include "itkImageDuplicator.h" diff --git a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h index 88ee4305610211f1af20db20695a5c176aa792ba..14b107c9c0cd8d45ea71224d1ee86afca3e4eaa1 100644 --- a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h +++ b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFourierMellinDescriptorsImageFunction_h -#define __otbFourierMellinDescriptorsImageFunction_h +#ifndef otbFourierMellinDescriptorsImageFunction_h +#define otbFourierMellinDescriptorsImageFunction_h #include "itkImageFunction.h" @@ -98,17 +98,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -128,8 +128,8 @@ public: protected: FourierMellinDescriptorsImageFunction(); - virtual ~FourierMellinDescriptorsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FourierMellinDescriptorsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FourierMellinDescriptorsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.txx b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.txx index fe457666e1124f6706bb2e3f1f8a2cb503afe26f..b09664aa84a46554cf431e8b4f53268dad9dbafb 100644 --- a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.txx +++ b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFourierMellinDescriptorsImageFunction_txx -#define __otbFourierMellinDescriptorsImageFunction_txx +#ifndef otbFourierMellinDescriptorsImageFunction_txx +#define otbFourierMellinDescriptorsImageFunction_txx #include "otbFourierMellinDescriptorsImageFunction.h" #include "itkConstNeighborhoodIterator.h" @@ -112,12 +112,12 @@ FourierMellinDescriptorsImageFunction<TInputImage, TCoordRep> for (unsigned int q= 0; q <= m_Qmax; q++) { ScalarComplexType power(double(p-2.0+m_Sigma)/2.0, -double(q)/2.0); - - if (x!=0 || y!=0) // vcl_pow limitations - { - coefs.at(p).at(q) += vcl_pow(xplusiy, -p) * vcl_pow(x2plusy2, power) * value; - } - } + + if(x!=0 || y !=0) // vcl_pow limitation + { + coefs.at(p).at(q) += vcl_pow(xplusiy, -static_cast<double>(p)) * vcl_pow(x2plusy2, power) * value; + } + } } } diff --git a/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h b/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h index 06de52a3f39a9df37769bb6029b3ea09fdf7b2dc..b3645a8cced98d4532625b607f62a20a3be5b71e 100644 --- a/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHessianToScalarImageFilter_h -#define __otbHessianToScalarImageFilter_h +#ifndef otbHessianToScalarImageFilter_h +#define otbHessianToScalarImageFilter_h #include "itkUnaryFunctorImageFilter.h" @@ -104,7 +104,7 @@ public: } protected: HessianToScalarImageFilter() {} - virtual ~HessianToScalarImageFilter() {} + ~HessianToScalarImageFilter() ITK_OVERRIDE {} private: HessianToScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h index 1dba5813fb688b88beeba0cabc96594ae33787c8..0fbcf8725b6fa7f3aad14828c58edf1afd877879 100644 --- a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h +++ b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHistogramOfOrientedGradientCovariantImageFunction_h -#define __otbHistogramOfOrientedGradientCovariantImageFunction_h +#ifndef otbHistogramOfOrientedGradientCovariantImageFunction_h +#define otbHistogramOfOrientedGradientCovariantImageFunction_h #include "itkImageFunction.h" #include "itkFixedArray.h" @@ -100,17 +100,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -131,8 +131,8 @@ public: protected: HistogramOfOrientedGradientCovariantImageFunction(); - virtual ~HistogramOfOrientedGradientCovariantImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HistogramOfOrientedGradientCovariantImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HistogramOfOrientedGradientCovariantImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.txx b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.txx index fbefccd4297f066c6828ebfa58f4bae23d50b291..7e344c53cf05a6d34e7bbd7521491f5473dcd24e 100644 --- a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.txx +++ b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHistogramOfOrientedGradientCovariantImageFunction_txx -#define __otbHistogramOfOrientedGradientCovariantImageFunction_txx +#ifndef otbHistogramOfOrientedGradientCovariantImageFunction_txx +#define otbHistogramOfOrientedGradientCovariantImageFunction_txx #include "otbHistogramOfOrientedGradientCovariantImageFunction.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h index 59c6748426ae11e5d2e2cba8d6287d9fccb848d8..747074bb810653a2a99f05af1c7892859b8bf57f 100644 --- a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToHessianDeterminantImageFilter_h -#define __otbImageToHessianDeterminantImageFilter_h +#ifndef otbImageToHessianDeterminantImageFilter_h +#define otbImageToHessianDeterminantImageFilter_h #include "itkProcessObject.h" #include "itkImageToImageFilter.h" @@ -51,7 +51,7 @@ public: /* * - * \param input : A symetric Hessian Matrix + * \param input : A symmetric Hessian Matrix * \return Determinant of the Hessian Matrix */ inline TOutput operator ()(const TInput& input) @@ -132,15 +132,15 @@ protected: /** * Destructor. */ - virtual ~ImageToHessianDeterminantImageFilter(); + ~ImageToHessianDeterminantImageFilter() ITK_OVERRIDE; /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.txx b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.txx index 52740ff58c8997db81bcb9f84fe847c682d5029b..3b1e4010f2328ac91065864fd5ad44e0da0da571 100644 --- a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.txx +++ b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbImageToHessianDeterminantImageFilter_txx -#define __otbImageToHessianDeterminantImageFilter_txx +#ifndef otbImageToHessianDeterminantImageFilter_txx +#define otbImageToHessianDeterminantImageFilter_txx #include "otbImageToHessianDeterminantImageFilter.h" diff --git a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h index 211c7f9fd274385cfc075ad7f0140f887cd7226d..a93007c055b7f7cb07e9278eb6afdf29837d2ecd 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToSIFTKeyPointSetFilter_h -#define __otbImageToSIFTKeyPointSetFilter_h +#ifndef otbImageToSIFTKeyPointSetFilter_h +#define otbImageToSIFTKeyPointSetFilter_h #include <vector> @@ -224,16 +224,16 @@ public: protected: /** Actually process the input */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Constructor */ ImageToSIFTKeyPointSetFilter(); /** Destructor */ - virtual ~ImageToSIFTKeyPointSetFilter() {} + ~ImageToSIFTKeyPointSetFilter() ITK_OVERRIDE {} /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Initialize input image */ void InitializeInputImage(); diff --git a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx index b59e23134a599e926998f5d15aed3ae5790ce749..91a67e06913990c8dd7d57b7ac48825a3008c91b 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx +++ b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToSIFTKeyPointSetFilter_txx -#define __otbImageToSIFTKeyPointSetFilter_txx +#ifndef otbImageToSIFTKeyPointSetFilter_txx +#define otbImageToSIFTKeyPointSetFilter_txx #include "otbImageToSIFTKeyPointSetFilter.h" diff --git a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h index 9531c7abac1aa2ec9dc48669c40ff1b87f8fcd38..5805abc9ad65933514296d69e0eac3871cd2d02f 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToSURFKeyPointSetFilter_h -#define __otbImageToSURFKeyPointSetFilter_h +#ifndef otbImageToSURFKeyPointSetFilter_h +#define otbImageToSURFKeyPointSetFilter_h #include "itkConstNeighborhoodIterator.h" #include "otbImageToHessianDeterminantImageFilter.h" @@ -133,15 +133,15 @@ protected: /** * Destructor. */ - virtual ~ImageToSURFKeyPointSetFilter(); + ~ImageToSURFKeyPointSetFilter() ITK_OVERRIDE; /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Check local extremum for 8 neighbors (current) * diff --git a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx index 87c264ec9a6628d37c49bbebaede7badce4e5ab4..f274b78da002c3ce3c93ec919b64240a82d4565f 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx +++ b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToSURFKeyPointSetFilter_txx -#define __otbImageToSURFKeyPointSetFilter_txx +#ifndef otbImageToSURFKeyPointSetFilter_txx +#define otbImageToSURFKeyPointSetFilter_txx #include "otbImageToSURFKeyPointSetFilter.h" #include "itkCenteredRigid2DTransform.h" diff --git a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h index 39f5f54bcd1e7e15b0cde95ffd9c7db7c8c8eedb..9e656a483d5d0b88d1e1578aafc21d8adfac9141 100644 --- a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h +++ b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKeyPointSetsMatchingFilter_h -#define __otbKeyPointSetsMatchingFilter_h +#ifndef otbKeyPointSetsMatchingFilter_h +#define otbKeyPointSetsMatchingFilter_h #include "otbObjectListSource.h" #include "otbLandmark.h" @@ -99,12 +99,12 @@ protected: /// Constructor KeyPointSetsMatchingFilter(); /// Destructor - virtual ~KeyPointSetsMatchingFilter() {} + ~KeyPointSetsMatchingFilter() ITK_OVERRIDE {} /// PrintSelf method - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /// Generate Data - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** * Find the nearest neighbor of data1 in pointset. diff --git a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.txx b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.txx index e4f0c3c1325b5b782f861ebda2ff32cc084803ee..ce00e79649908d2183f8c809c0252f385996208f 100644 --- a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.txx +++ b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKeyPointSetsMatchingFilter_txx -#define __otbKeyPointSetsMatchingFilter_txx +#ifndef otbKeyPointSetsMatchingFilter_txx +#define otbKeyPointSetsMatchingFilter_txx #include "otbKeyPointSetsMatchingFilter.h" diff --git a/Modules/Feature/Descriptors/include/otbLandmark.h b/Modules/Feature/Descriptors/include/otbLandmark.h index 75552969d9149cfb4c0dc724b1199a11f3cefc52..f93d0c38397f39bd9ee1665828dd5fa59d34564d 100644 --- a/Modules/Feature/Descriptors/include/otbLandmark.h +++ b/Modules/Feature/Descriptors/include/otbLandmark.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLandmark_h -#define __otbLandmark_h +#ifndef otbLandmark_h +#define otbLandmark_h #include "itkDataObject.h" #include "otbMacro.h" @@ -69,9 +69,9 @@ protected: /// Constructor Landmark() {} /// Destructor - virtual ~Landmark() {} + ~Landmark() ITK_OVERRIDE {} /// PrintSelf method - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Landmark: P1= " << m_Point1 << " P2= " << m_Point2 << std::endl; diff --git a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h index 8ab518caf8aa18f3d28ae27cd4c15dfacd48c308..41062e2fc1bc9b36a44593084ef3e9087180030f 100644 --- a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSiftFastImageFilter_h -#define __otbSiftFastImageFilter_h +#ifndef otbSiftFastImageFilter_h +#define otbSiftFastImageFilter_h #include "otbImageToPointSetFilter.h" #include "otbImage.h" diff --git a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.txx b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.txx index 8ec23f6143f2c37958dd14f234292255f4fe3599..e9bf2b5e4e52995f10f8bbfc16a5c96aa7cdf1ed 100644 --- a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.txx +++ b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSiftFastImageFilter_txx -#define __otbSiftFastImageFilter_txx +#ifndef otbSiftFastImageFilter_txx +#define otbSiftFastImageFilter_txx #include "otbSiftFastImageFilter.h" diff --git a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx index 5747f57e4fcbb3915166ec5425dc3152df5157a4..2e81edd548a04f7ef6026fb00fa1ad753d13f00a 100644 --- a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx +++ b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx @@ -66,7 +66,7 @@ int otbImageToSIFTKeyPointSetFilterOutputAscii(int itkNotUsed(argc), char * argv filter->Update(); PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); - if (filter->GetOutput()->GetPointData() == NULL) + if (filter->GetOutput()->GetPointData() == ITK_NULLPTR) { std::cerr << "No sift point found!" << std::endl; return EXIT_FAILURE; //Avoid the subsequent segfault, but need to check if that what the test want to do diff --git a/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h b/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h index ab9f09cba63cd4a2908f3c7ef8c5f8808703ab3a..9211f0baf55936b36819135d2d752c299573ceb7 100644 --- a/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h +++ b/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAssociativeSymmetricalSumImageFilter_h -#define __otbAssociativeSymmetricalSumImageFilter_h +#ifndef otbAssociativeSymmetricalSumImageFilter_h +#define otbAssociativeSymmetricalSumImageFilter_h #include "itkBinaryFunctorImageFilter.h" @@ -24,7 +24,7 @@ namespace otb { /** \class AssociativeSymmetricalSumImageFilter - * \brief Implements an assymetric fusion of line detector image filter. + * \brief Implements an asymmetric fusion of line detector image filter. * * This class implements a fusion of the output images of * otb::LineRatioDetector and otb::LineCorrelationDetector @@ -91,7 +91,7 @@ public: protected: AssociativeSymmetricalSumImageFilter() {} - virtual ~AssociativeSymmetricalSumImageFilter() {} + ~AssociativeSymmetricalSumImageFilter() ITK_OVERRIDE {} private: AssociativeSymmetricalSumImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.h b/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.h index c6c4c16265b705c63dd40aaacc3a9d0f5a1c3db4..01b90d78620666180eacfdcbe47367f4b21ca04d 100644 --- a/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAssymmetricFusionOfLineDetectorImageFilter_h -#define __otbAssymmetricFusionOfLineDetectorImageFilter_h +#ifndef otbAssymmetricFusionOfLineDetectorImageFilter_h +#define otbAssymmetricFusionOfLineDetectorImageFilter_h #include "itkImageToImageFilter.h" @@ -78,7 +78,7 @@ public: protected: AssymmetricFusionOfLineDetectorImageFilter(); - virtual ~AssymmetricFusionOfLineDetectorImageFilter() {} + ~AssymmetricFusionOfLineDetectorImageFilter() ITK_OVERRIDE {} typedef otb::LineRatioDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType> LineRatioType; @@ -87,9 +87,9 @@ protected: typedef otb::AssociativeSymmetricalSumImageFilter<InputImageType1, InputImageType2, OutputImageType> AssSymSumType; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: AssymmetricFusionOfLineDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.txx index 931a993d715c409246190bf696156717cea85015..56e5a656b8d09c4e7f694ea013da10d98a1ecf81 100644 --- a/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAssymmetricFusionOfLineDetectorImageFilter_txx -#define __otbAssymmetricFusionOfLineDetectorImageFilter_txx +#ifndef otbAssymmetricFusionOfLineDetectorImageFilter_txx +#define otbAssymmetricFusionOfLineDetectorImageFilter_txx #include "otbAssymmetricFusionOfLineDetectorImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h index 7aebf96e79bc964ccf765c601a8401e470787727..318f3546f016b072ed8281089f78266b3317faa1 100644 --- a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h +++ b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEdgeDensityImageFilter_h -#define __otbEdgeDensityImageFilter_h +#ifndef otbEdgeDensityImageFilter_h +#define otbEdgeDensityImageFilter_h #include "otbBinaryImageToDensityImageFilter.h" #include "itkProcessObject.h" @@ -103,15 +103,15 @@ protected: /** * Destructor. */ - virtual ~EdgeDensityImageFilter(); + ~EdgeDensityImageFilter() ITK_OVERRIDE; /** * Standard PrintSelf method. */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.txx b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.txx index 3726bd9a323b8c5c696bc740f116032b20ff68ff..314e4959be63c087c67f6a9a18ed2cb4af050ce6 100644 --- a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.txx +++ b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEdgeDensityImageFilter_txx -#define __otbEdgeDensityImageFilter_txx +#ifndef otbEdgeDensityImageFilter_txx +#define otbEdgeDensityImageFilter_txx #include "otbEdgeDensityImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h index a4955334bcd65db8b1b250e1012a26f858cbe877..7c0b090bc763efe3857b0622af3de3dcd51576a3 100644 --- a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEdgeDetectorImageFilter_h -#define __otbEdgeDetectorImageFilter_h +#ifndef otbEdgeDetectorImageFilter_h +#define otbEdgeDetectorImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkImageToImageFilter.h" @@ -109,9 +109,9 @@ public: protected: EdgeDetectorImageFilter(); - virtual ~EdgeDetectorImageFilter(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateData(); + ~EdgeDetectorImageFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.txx index 61d8135eda9e75587d14ebfb9118912fc756355f..2da68b0eb12f17d042796a0a3e9dadc6d721ea86 100644 --- a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEdgeDetectorImageFilter_txx -#define __otbEdgeDetectorImageFilter_txx +#ifndef otbEdgeDetectorImageFilter_txx +#define otbEdgeDetectorImageFilter_txx #include "otbEdgeDetectorImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h index 04d6c3d0c3b9e39f5a61150f01caf5fced574f19..709f2f740e9a33ffd276cd38c9f0d399f1be3057 100644 --- a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h +++ b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractSegmentsImageFilter_h -#define __otbExtractSegmentsImageFilter_h +#ifndef otbExtractSegmentsImageFilter_h +#define otbExtractSegmentsImageFilter_h #include "otbPixelSuppressionByDirectionImageFilter.h" @@ -126,16 +126,16 @@ public: protected: ExtractSegmentsImageFilter(); - virtual ~ExtractSegmentsImageFilter() {} + ~ExtractSegmentsImageFilter() ITK_OVERRIDE {} typedef PixelSuppressionByDirectionImageFilter<InputImageType, PSOutputImageType> PixelSuppressionType; typedef LocalHoughFilter<InputImageType> LocalHoughType; typedef FillGapsFilter FillGapsType; typedef DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> DrawLineListType; typedef itk::RescaleIntensityImageFilter<TInputImage, TInputImage> RescaleType; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ExtractSegmentsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.txx b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.txx index 18d6146c7d65cb19161542a314f5011851d44a18..41e59cc3e50db27d9655acd6eab5b505ece2d1bf 100644 --- a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.txx +++ b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtractSegmentsImageFilter_txx -#define __otbExtractSegmentsImageFilter_txx +#ifndef otbExtractSegmentsImageFilter_txx +#define otbExtractSegmentsImageFilter_txx #include "otbExtractSegmentsImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbFillGapsFilter.h b/Modules/Feature/Edge/include/otbFillGapsFilter.h index 229bd5abda23e6d07468dacb4f99ad4661fb1406..2041fecea0d5ab8645a21854a8d3b2cfddbec93a 100644 --- a/Modules/Feature/Edge/include/otbFillGapsFilter.h +++ b/Modules/Feature/Edge/include/otbFillGapsFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFillGapsFilter_h -#define __otbFillGapsFilter_h +#ifndef otbFillGapsFilter_h +#define otbFillGapsFilter_h #include "itkProcessObject.h" @@ -68,11 +68,11 @@ public: protected: FillGapsFilter(); - virtual ~FillGapsFilter() {} + ~FillGapsFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: FillGapsFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h index 2458433b08e3014ac3de133702cce4b0e18a3019..6788cf97ae9930cfdb90f63990dd6802a6148f2b 100644 --- a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHorizontalSobelVectorImageFilter_h -#define __otbHorizontalSobelVectorImageFilter_h +#ifndef otbHorizontalSobelVectorImageFilter_h +#define otbHorizontalSobelVectorImageFilter_h #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" @@ -88,7 +88,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - virtual ~HorizontalSobelVectorImageFilter() { } + ~HorizontalSobelVectorImageFilter() ITK_OVERRIDE { } private: HorizontalSobelVectorImageFilter( const Self & ); // Not implemented @@ -98,4 +98,4 @@ private: } // end of namespace otb -#endif // __otbHorizontalSobelVectorImageFilter_h +#endif // otbHorizontalSobelVectorImageFilter_h diff --git a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h index 74e3a2e13bbfdd30a149d49882e126880afe8733..08814360e9a0276b61758038c0aa790a535073fe 100644 --- a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h +++ b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHoughTransform2DLinesImageFilter_h -#define __otbHoughTransform2DLinesImageFilter_h +#ifndef otbHoughTransform2DLinesImageFilter_h +#define otbHoughTransform2DLinesImageFilter_h #include "itkImageToImageFilter.h" @@ -105,7 +105,7 @@ public: itkNewMacro(Self); /** Method for evaluating the implicit function over the image. */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Accessors for the threshold above which the filter should consider the point as a valid point */ @@ -181,17 +181,17 @@ public: protected: HoughTransform2DLinesImageFilter(); - virtual ~HoughTransform2DLinesImageFilter() {} + ~HoughTransform2DLinesImageFilter() ITK_OVERRIDE {} HoughTransform2DLinesImageFilter(const Self &) {} void operator =(const Self&) {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** HoughTransform2DLinesImageFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). * \sa ProcessObject::GenerateInputRequestedRegion(). */ - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** HoughTransform2DLinesImageFilter's output is the accumulator * array. The size of the output is a function of the size of the @@ -199,10 +199,10 @@ protected: * has a different size than the input, it must provide an implementation * of GenerateOutputInformation. * \sa ProcessObject::GenerateOutputRequestedRegion() */ - void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** HoughTransform2DLinesImageFilter must produce the entire output */ - void EnlargeOutputRequestedRegion(itk::DataObject *output); + void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; int GetAngleIndex(double); diff --git a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx index 8f1baac483579a2037903dbbb72635875fc22168..c832c542901b735d35b73428e8856b2ff827002f 100644 --- a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx +++ b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHoughTransform2DLinesImageFilter_txx -#define __otbHoughTransform2DLinesImageFilter_txx +#ifndef otbHoughTransform2DLinesImageFilter_txx +#define otbHoughTransform2DLinesImageFilter_txx #include "otbHoughTransform2DLinesImageFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -50,7 +50,7 @@ HoughTransform2DLinesImageFilter<TInputPixelType, TOutputPixelType> m_Variance = 5; m_OldModifiedTime = 0; m_OldNumberOfLines = 0; - m_SimplifyAccumulator = NULL; + m_SimplifyAccumulator = ITK_NULLPTR; } template<typename TInputPixelType, typename TOutputPixelType> diff --git a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h index 3b4c2939831ebe9ec3dbd28a2a00f1d327c2bf87..569da730b00e6fb74346025b5c81d4420bdb646f 100644 --- a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineCorrelationDetectorImageFilter_h -#define __otbLineCorrelationDetectorImageFilter_h +#ifndef otbLineCorrelationDetectorImageFilter_h +#define otbLineCorrelationDetectorImageFilter_h #include "otbLineDetectorImageFilterBase.h" @@ -82,11 +82,11 @@ public: protected: LineCorrelationDetectorImageFilter(); - virtual ~LineCorrelationDetectorImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LineCorrelationDetectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Compute the measure */ - virtual double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3); + double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) ITK_OVERRIDE; private: LineCorrelationDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.txx index 8cab7d6e3503a7ca34e0567a2dd4e6bc15cf8196..54968c4e6d9d8e0a786888990ee41045d7e502d7 100644 --- a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineCorrelationDetectorImageFilter_txx -#define __otbLineCorrelationDetectorImageFilter_txx +#ifndef otbLineCorrelationDetectorImageFilter_txx +#define otbLineCorrelationDetectorImageFilter_txx #include "otbLineCorrelationDetectorImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h index e16bccbee2194deac29fbb450e223e62f3c6ebc9..b97292eeeaebdf9bea3e4f1dcc4f5323631f6409 100644 --- a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h +++ b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineDetectorImageFilterBase_h -#define __otbLineDetectorImageFilterBase_h +#ifndef otbLineDetectorImageFilterBase_h +#define otbLineDetectorImageFilterBase_h #include "itkNearestNeighborInterpolateImageFunction.h" #include "itkLinearInterpolateImageFunction.h" @@ -128,15 +128,15 @@ public: /** Get the numbero of drections for line detection. */ itkGetConstReferenceMacro(NumberOfDirections, unsigned int); - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: LineDetectorImageFilterBase(); - virtual ~LineDetectorImageFilterBase() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LineDetectorImageFilterBase() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** LineDetectorImageFilterBase can be implemented for a treatment of filter multithreaded. * Thus, the ThreadedGenerateData() method is called for each thread process. @@ -148,7 +148,7 @@ protected: * \sa ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; virtual double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3); diff --git a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.txx b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.txx index d53e7d5e2271891a117c82f66c2b7fa5cb9403ca..c9454462870c8c709c0c8d88e8f4adabfa85a72f 100644 --- a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.txx +++ b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineDetectorImageFilterBase_txx -#define __otbLineDetectorImageFilterBase_txx +#ifndef otbLineDetectorImageFilterBase_txx +#define otbLineDetectorImageFilterBase_txx #include "otbLineDetectorImageFilterBase.h" @@ -290,11 +290,11 @@ LineDetectorImageFilterBase<TInputImage, TOutputImage, TOutputImageDirection, In // Contains for the 4 directions the the pixels belonging to each zone //std::vector<double> PixelValues[NB_DIR][NB_ZONE]; // ROMAIN - std::vector<double>** PixelValues = NULL; + std::vector<double>** PixelValues = ITK_NULLPTR; PixelValues = new std::vector<double>*[NB_DIR]; for (unsigned int i = 0; i < NB_DIR; ++i) { - PixelValues[i] = NULL; + PixelValues[i] = ITK_NULLPTR; PixelValues[i] = new std::vector<double>[NB_ZONE]; } //otbMsgDevMacro( << "\tCentre Xc/Yc="<<Xc<<" "<<Yc<<" Yc12/Yc13="<<Yc12<<" "<<Yc13); @@ -377,10 +377,10 @@ LineDetectorImageFilterBase<TInputImage, TOutputImage, TOutputImageDirection, In for (unsigned int i = 0; i < NB_DIR; ++i) { delete[] PixelValues[i]; - PixelValues[i] = NULL; + PixelValues[i] = ITK_NULLPTR; } delete[] PixelValues; - PixelValues = NULL; + PixelValues = ITK_NULLPTR; } } diff --git a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h index ee9553d2b0b19c312c72a01a9676f3dfc2b7ac59..d66aa2f910749ad48237c3a56003378a10125a56 100644 --- a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineRatioDetectorImageFilter_h -#define __otbLineRatioDetectorImageFilter_h +#ifndef otbLineRatioDetectorImageFilter_h +#define otbLineRatioDetectorImageFilter_h #include "otbLineDetectorImageFilterBase.h" @@ -111,10 +111,10 @@ public: protected: LineRatioDetectorImageFilter(); - virtual ~LineRatioDetectorImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LineRatioDetectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3); + double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) ITK_OVERRIDE; private: LineRatioDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.txx index 41715bdc3e1c55a012ed0bd1806ebbf9cf9801c6..ade18d25bad612e924a1834a9b3792e8454be74e 100644 --- a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineRatioDetectorImageFilter_txx -#define __otbLineRatioDetectorImageFilter_txx +#ifndef otbLineRatioDetectorImageFilter_txx +#define otbLineRatioDetectorImageFilter_txx #include "otbLineRatioDetectorImageFilter.h" #include "otbMacro.h" diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.h b/Modules/Feature/Edge/include/otbLineSegmentDetector.h index 3e4b2822b329cea6cff6a08d481130649f227142..0edfde1beaa02d19cb542f2d7b8d9d1c21b27e51 100644 --- a/Modules/Feature/Edge/include/otbLineSegmentDetector.h +++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSegmentDetector_h -#define __otbLineSegmentDetector_h +#ifndef otbLineSegmentDetector_h +#define otbLineSegmentDetector_h #include "otbImage.h" #include "otbVectorDataSource.h" @@ -189,12 +189,12 @@ public: protected: LineSegmentDetector(); - virtual ~LineSegmentDetector() {} + ~LineSegmentDetector() ITK_OVERRIDE {} - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Generate Data method*/ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Sort the image and store the coordinates in a histogram * this method is used to determine the seeds where to begin the search segments @@ -254,7 +254,7 @@ protected: virtual void CopyRectangle(RectangleType& rDst, RectangleType& rSrc) const; /** Printself method*/ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LineSegmentDetector(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx index 3fa0bc5a90ba45ee01b34e29d3a6abb7c2ebdfd5..e3eea277d01cd1d7570f97403b36f611fe92c535 100644 --- a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx +++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineSegmentDetector_txx -#define __otbLineSegmentDetector_txx +#ifndef otbLineSegmentDetector_txx +#define otbLineSegmentDetector_txx #include "otbLineSegmentDetector.h" #include "itkImageRegionIterator.h" @@ -77,7 +77,7 @@ LineSegmentDetector<TInputImage, TPrecision> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(0)); diff --git a/Modules/Feature/Edge/include/otbLocalHoughFilter.h b/Modules/Feature/Edge/include/otbLocalHoughFilter.h index f2fd23860940bec432031ce6029fa39c83eff3fb..79546f146b5ea401d36e2969653002b8c7d65eed 100644 --- a/Modules/Feature/Edge/include/otbLocalHoughFilter.h +++ b/Modules/Feature/Edge/include/otbLocalHoughFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHoughFilter_h -#define __otbLocalHoughFilter_h +#ifndef otbLocalHoughFilter_h +#define otbLocalHoughFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkHoughTransform2DLinesImageFilter.h" @@ -127,13 +127,13 @@ public: protected: LocalHoughFilter(); - virtual ~LocalHoughFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LocalHoughFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Definition of the Hough Filter. */ typedef itk::HoughTransform2DLinesImageFilter<InputPixelType, AccumulatorPixelType> HoughFilterType; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: LocalHoughFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx index 830d82f1393cafc877f33e6592e781521d2908b0..6e2430c3e859120c6e4fb63674441fe90e7e6caa 100644 --- a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx +++ b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHoughFilter_txx -#define __otbLocalHoughFilter_txx +#ifndef otbLocalHoughFilter_txx +#define otbLocalHoughFilter_txx #include "otbLocalHoughFilter.h" #include "otbImage.h" diff --git a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h index 08d394fa2868f30fcd99d8ef3c89cc80f1cd0f0e..78e311febb68f3e1ae66579764e2802d51e21dfa 100644 --- a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h +++ b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentVectorizationImageFilter_h -#define __otbPersistentVectorizationImageFilter_h +#ifndef otbPersistentVectorizationImageFilter_h +#define otbPersistentVectorizationImageFilter_h #include "otbPersistentImageFilter.h" @@ -81,16 +81,16 @@ public: typedef otb::ImageToEdgePathFilter<ImageType, PathType> ImageToEdgePathFilterType; typedef typename ImageToEdgePathFilterType::Pointer ImageToEdgePathFilterPointerType; - virtual void Reset(void); - virtual void Synthetize(void); + void Reset(void) ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; itkGetObjectMacro(PathList, PathListType); protected: PersistentVectorizationImageFilter(); - virtual ~PersistentVectorizationImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateData(); + ~PersistentVectorizationImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: PersistentVectorizationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.txx b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.txx index 07b00d06759508c6b8f1c3850b1f04bb378f904d..d9b10cada55ab588277fd9a7cc92a21d70399077 100644 --- a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.txx +++ b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentVectorizationImageFilter_txx -#define __otbPersistentVectorizationImageFilter_txx +#ifndef otbPersistentVectorizationImageFilter_txx +#define otbPersistentVectorizationImageFilter_txx #include "otbPersistentVectorizationImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h index f24598f7cf8ff0468f707adf088403527cacc04e..e8c63bc4cb29e15fa63acb49349e25af9f6e6c64 100644 --- a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h +++ b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPixelSuppressionByDirectionImageFilter_h -#define __otbPixelSuppressionByDirectionImageFilter_h +#ifndef otbPixelSuppressionByDirectionImageFilter_h +#define otbPixelSuppressionByDirectionImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -99,16 +99,16 @@ public: void SetInputImageDirection(const InputImageType *image); const InputImageType * GetInputImageDirection(void); - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: PixelSuppressionByDirectionImageFilter(); - virtual ~PixelSuppressionByDirectionImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PixelSuppressionByDirectionImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: PixelSuppressionByDirectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.txx b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.txx index b617bdb3b3852203ea816e7eeb4f92348b4f896a..42864f631b376417b92247d2ec8459f717e7496b 100644 --- a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.txx +++ b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPixelSuppressionByDirectionImageFilter_txx -#define __otbPixelSuppressionByDirectionImageFilter_txx +#ifndef otbPixelSuppressionByDirectionImageFilter_txx +#define otbPixelSuppressionByDirectionImageFilter_txx #include "otbPixelSuppressionByDirectionImageFilter.h" @@ -69,7 +69,7 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *> @@ -84,7 +84,7 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *> diff --git a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h index b1e985b97f7382c01200afb9def53269e0022844..aac4016ae623d4b4c29c71b10c72442f83befbca 100644 --- a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSobelVectorImageFilter_h -#define __otbSobelVectorImageFilter_h +#ifndef otbSobelVectorImageFilter_h +#define otbSobelVectorImageFilter_h #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" @@ -97,7 +97,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - virtual ~SobelVectorImageFilter() { } + ~SobelVectorImageFilter() ITK_OVERRIDE { } private: SobelVectorImageFilter( const Self & ); // Not implemented @@ -107,4 +107,4 @@ private: } // end of namespace otb -#endif // __otbSobelVectorImageFilter_h +#endif // otbSobelVectorImageFilter_h diff --git a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h index 9ac7b3afd15a8ac48c93b95db713beeed6013218..0ea09e3b7719db8f42e3dde94a00df2bf335e305 100644 --- a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h +++ b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingLineSegmentDetector_h -#define __otbStreamingLineSegmentDetector_h +#ifndef otbStreamingLineSegmentDetector_h +#define otbStreamingLineSegmentDetector_h #include <vector> @@ -76,15 +76,15 @@ public: protected: PersistentStreamingLineSegmentDetector(); - virtual ~PersistentStreamingLineSegmentDetector(); + ~PersistentStreamingLineSegmentDetector() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; private: PersistentStreamingLineSegmentDetector(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - virtual OutputVectorDataPointerType ProcessTile(); + OutputVectorDataPointerType ProcessTile() ITK_OVERRIDE; }; template <class TImageType> diff --git a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.txx b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.txx index ff9a1a7d48be13eb85c456868dce6d0b37e0a62f..c9d4abf782fa22b2efe0b89c139e566b4899884d 100644 --- a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.txx +++ b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingLineSegmentDetector_txx -#define __otbStreamingLineSegmentDetector_txx +#ifndef otbStreamingLineSegmentDetector_txx +#define otbStreamingLineSegmentDetector_txx #include "otbStreamingLineSegmentDetector.h" diff --git a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h index a4f06b19e9c6f4f9b2dec1313df7501ef8f280dd..1cabe791fb136e6a2f3ca3e142f543db8e472a81 100644 --- a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTouziEdgeDetectorImageFilter_h -#define __otbTouziEdgeDetectorImageFilter_h +#ifndef otbTouziEdgeDetectorImageFilter_h +#define otbTouziEdgeDetectorImageFilter_h #include "otbImageToModulusAndDirectionImageFilter.h" #include "otbImage.h" @@ -97,15 +97,15 @@ public: * a treatment input area larger than the output one. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: TouziEdgeDetectorImageFilter(); - virtual ~TouziEdgeDetectorImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~TouziEdgeDetectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** TouziEdgeDetectorImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -116,7 +116,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: TouziEdgeDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx index 5fb8cf880dfcae64d6515dc078492ecd95c2987f..c93ffb50bed8f05956ab2d2bc5acb59078a865ed 100644 --- a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTouziEdgeDetectorImageFilter_txx -#define __otbTouziEdgeDetectorImageFilter_txx +#ifndef otbTouziEdgeDetectorImageFilter_txx +#define otbTouziEdgeDetectorImageFilter_txx #include "otbTouziEdgeDetectorImageFilter.h" diff --git a/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h index 2983377272b7796be25ce0bd369b5c9f3553e93c..db5f3167b07a482e438935f18c7cc5a49337dc1c 100644 --- a/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVerticalSobelVectorImageFilter_h -#define __otbVerticalSobelVectorImageFilter_h +#ifndef otbVerticalSobelVectorImageFilter_h +#define otbVerticalSobelVectorImageFilter_h #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" @@ -88,7 +88,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - virtual ~VerticalSobelVectorImageFilter() { } + ~VerticalSobelVectorImageFilter() ITK_OVERRIDE { } private: VerticalSobelVectorImageFilter( const Self & ); // Not implemented @@ -98,4 +98,4 @@ private: } // end of namespace otb -#endif // __otbVerticalSobelVectorImageFilter_h +#endif // otbVerticalSobelVectorImageFilter_h diff --git a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h index 18ad7e351a85d42cdfd69f0ba98c5f21c6e57094..671b12813f59e26d58406707b369e4e35bc0e682 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexMomentPathFunction_h -#define __otbComplexMomentPathFunction_h +#ifndef otbComplexMomentPathFunction_h +#define otbComplexMomentPathFunction_h #include "otbGeometricMomentPathFunction.h" #include "itkVectorContainer.h" @@ -89,7 +89,7 @@ public: typedef std::complex<PrecisionType> ComplexPrecisionType; /** Evalulate the function */ - virtual OutputType Evaluate(const PathType& path) const; + OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; virtual OutputType Evaluate() const; itkSetMacro(P, unsigned int); @@ -99,8 +99,8 @@ public: protected: ComplexMomentPathFunction(); - virtual ~ComplexMomentPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ComplexMomentPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ComplexMomentPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.txx b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.txx index 52d381ab88e2edb17ecc64d3f1e526571509fa2c..1bbf4fef5e8e070548163df7157d99382a0ded73 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.txx +++ b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexMomentPathFunction_txx -#define __otbComplexMomentPathFunction_txx +#ifndef otbComplexMomentPathFunction_txx +#define otbComplexMomentPathFunction_txx #include "otbComplexMomentPathFunction.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h index 46b36263650bc19663976e3a4244b88b6141e57d..d9b2e9da38eb9cc18c7f5ae091360258fcbf0d25 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexMomentsImageFunction_h -#define __otbComplexMomentsImageFunction_h +#ifndef otbComplexMomentsImageFunction_h +#define otbComplexMomentsImageFunction_h #include "itkImageFunction.h" @@ -89,17 +89,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -119,8 +119,8 @@ public: protected: ComplexMomentsImageFunction(); - virtual ~ComplexMomentsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ComplexMomentsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ComplexMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.txx b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.txx index 019834ab9ad3558a7b17266b94bc28ba162186f8..e42e2842044af01e07857234dee094ec51810a26 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.txx +++ b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComplexMomentsImageFunction_txx -#define __otbComplexMomentsImageFunction_txx +#ifndef otbComplexMomentsImageFunction_txx +#define otbComplexMomentsImageFunction_txx #include "otbComplexMomentsImageFunction.h" #include "itkConstNeighborhoodIterator.h" @@ -60,10 +60,10 @@ ComplexMomentsImageFunction<TInputImage, TCoordRep> // Initialize moments for (unsigned int p = 0; p <= m_Pmax; p++) { - moments.at(p).resize(m_Qmax+1); + moments[p].resize(m_Qmax+1); for (unsigned int q = 0; q <= m_Qmax; q++) { - moments.at(p).at(q) = ScalarComplexType(0.0, 0.0); + moments[p][q] = ScalarComplexType(0.0, 0.0); } } @@ -106,7 +106,19 @@ ComplexMomentsImageFunction<TInputImage, TCoordRep> { for (unsigned int q= 0; q <= m_Qmax; q++) { - moments.at(p).at(q) += vcl_pow(xpy, p) * vcl_pow(xqy, q) * value; + ScalarComplexType pow1(1,0); + ScalarComplexType pow2(1,0); + if(p!=0 || x!=0 || y != 0) + { + pow1=vcl_pow(xpy,p); + } + if(q!=0 || x!=0 || y != 0) + { + pow2=vcl_pow(xqy,q); + } + + moments[p][q] += pow1 * pow2 * value; + } } } @@ -116,7 +128,7 @@ ComplexMomentsImageFunction<TInputImage, TCoordRep> { for (int q= m_Qmax; q >= 0; q--) { - moments.at(p).at(q) /= moments.at(0).at(0); + moments[p][q] /= moments[0][0]; } } diff --git a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h index 1ed4926e351915a9cfb5bada1b2df90836ea862b..9049796fab3aa18e7cd6753fdb8be4c32163fd76 100644 --- a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserMomentsImageFunction_h -#define __otbFlusserMomentsImageFunction_h +#ifndef otbFlusserMomentsImageFunction_h +#define otbFlusserMomentsImageFunction_h #include "itkImageFunction.h" #include "itkFixedArray.h" @@ -105,17 +105,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -130,8 +130,8 @@ public: protected: FlusserMomentsImageFunction(); - virtual ~FlusserMomentsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FlusserMomentsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FlusserMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.txx b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.txx index e96c00ae2b737f85ba74e7c44faf24b728e14058..6ae90ae9da8600e7659fef52c79e9d78425d4669 100644 --- a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.txx +++ b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserMomentsImageFunction_txx -#define __otbFlusserMomentsImageFunction_txx +#ifndef otbFlusserMomentsImageFunction_txx +#define otbFlusserMomentsImageFunction_txx #include "otbFlusserMomentsImageFunction.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Feature/Moments/include/otbFlusserPathFunction.h b/Modules/Feature/Moments/include/otbFlusserPathFunction.h index 0d63785e6a7b602aa04cb5a21739b6251e0b4b08..c471f578c7c271a905e43c6c5beb0877f37ad594 100644 --- a/Modules/Feature/Moments/include/otbFlusserPathFunction.h +++ b/Modules/Feature/Moments/include/otbFlusserPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserPathFunction_h -#define __otbFlusserPathFunction_h +#ifndef otbFlusserPathFunction_h +#define otbFlusserPathFunction_h #include "otbRealMomentPathFunction.h" @@ -90,7 +90,7 @@ public: typedef typename Superclass::PrecisionType PrecisionType; /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate(const PathType& path) const; + RealType Evaluate(const PathType& path) const ITK_OVERRIDE; virtual RealType Evaluate() const; /** Get/Set the radius of the neighborhood over which the statistics are evaluated */ @@ -99,8 +99,8 @@ public: protected: FlusserPathFunction(); - virtual ~FlusserPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FlusserPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: FlusserPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbFlusserPathFunction.txx b/Modules/Feature/Moments/include/otbFlusserPathFunction.txx index 328aef48dbd8ebb52f6effc593b878ae18996a17..ae63ee887bf0a81befab18418869c1af7b7a5c0e 100644 --- a/Modules/Feature/Moments/include/otbFlusserPathFunction.txx +++ b/Modules/Feature/Moments/include/otbFlusserPathFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFlusserPathFunction_txx -#define __otbFlusserPathFunction_txx +#ifndef otbFlusserPathFunction_txx +#define otbFlusserPathFunction_txx #include "otbFlusserPathFunction.h" #include "otbComplexMomentPathFunction.h" diff --git a/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h b/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h index 504b28c77a7f88d186457b639e3269f5c24703a4..7701a062f7a35f53fe6d51ca7ee6bc46d14739c7 100644 --- a/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometricMomentPathFunction_h -#define __otbGeometricMomentPathFunction_h +#ifndef otbGeometricMomentPathFunction_h +#define otbGeometricMomentPathFunction_h #include "otbPathFunction.h" @@ -60,8 +60,8 @@ public: protected: GeometricMomentPathFunction() {}; - ~GeometricMomentPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~GeometricMomentPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h index 3583aaf8f063fe9a811b996e5b5c670509590d89..fcf4962da4a42bea7e95a3c76f5d1da96961dad4 100644 --- a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHuMomentsImageFunction_h -#define __otbHuMomentsImageFunction_h +#ifndef otbHuMomentsImageFunction_h +#define otbHuMomentsImageFunction_h #include "itkImageFunction.h" #include "itkFixedArray.h" @@ -101,17 +101,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -126,8 +126,8 @@ public: protected: HuMomentsImageFunction(); - virtual ~HuMomentsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HuMomentsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HuMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.txx b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.txx index c7668f1626a6bfc9987598481f3eb7b701a9c06f..8be5f719326c2b8d8a68fdd085ed83fd6d64bbbc 100644 --- a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.txx +++ b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHuMomentsImageFunction_txx -#define __otbHuMomentsImageFunction_txx +#ifndef otbHuMomentsImageFunction_txx +#define otbHuMomentsImageFunction_txx #include "otbHuMomentsImageFunction.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Feature/Moments/include/otbHuPathFunction.h b/Modules/Feature/Moments/include/otbHuPathFunction.h index d855bd526145ec6297becdd49a7813e05f07ba49..9bdc25b0d50f6dfec2fec6861b0e366650e7feb4 100644 --- a/Modules/Feature/Moments/include/otbHuPathFunction.h +++ b/Modules/Feature/Moments/include/otbHuPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHuPathFunction_h -#define __otbHuPathFunction_h +#ifndef otbHuPathFunction_h +#define otbHuPathFunction_h #include "otbRealMomentPathFunction.h" @@ -87,7 +87,7 @@ public: typedef typename Superclass::PrecisionType PrecisionType; /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate(const PathType& path) const; + RealType Evaluate(const PathType& path) const ITK_OVERRIDE; virtual RealType Evaluate() const; /** Get/Set the radius of the neighborhood over which the statistics are evaluated */ @@ -96,8 +96,8 @@ public: protected: HuPathFunction(); - virtual ~HuPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HuPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HuPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbHuPathFunction.txx b/Modules/Feature/Moments/include/otbHuPathFunction.txx index 1d9d5856d1d992c5764b3c1586b27708031b5616..e3753f84f20d72d09dea2d9e0644571600a01ed8 100644 --- a/Modules/Feature/Moments/include/otbHuPathFunction.txx +++ b/Modules/Feature/Moments/include/otbHuPathFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHuPathFunction_txx -#define __otbHuPathFunction_txx +#ifndef otbHuPathFunction_txx +#define otbHuPathFunction_txx #include "otbHuPathFunction.h" #include "otbComplexMomentPathFunction.h" diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsFunctor.h b/Modules/Feature/Moments/include/otbRadiometricMomentsFunctor.h index 3f29154a7da6ad0745042ded13382adf6821e474..666e95a9bb7dea9597841078d89ada9a43d61c7d 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsFunctor.h +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsFunctor_h -#define __otbRadiometricMomentsFunctor_h +#ifndef otbRadiometricMomentsFunctor_h +#define otbRadiometricMomentsFunctor_h #include "itkVariableLengthVector.h" #include "otbMath.h" diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h index cf9702b0366f248e2c8576947ab2ff1b061dc9b4..8b718f79970b5c914e92e5ae7b1f7c6a5f414bdb 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsImageFilter_h -#define __otbRadiometricMomentsImageFilter_h +#ifndef otbRadiometricMomentsImageFilter_h +#define otbRadiometricMomentsImageFilter_h #include "itkImageToImageFilter.h" #include "otbRadiometricMomentsFunctor.h" @@ -89,10 +89,10 @@ public: protected: RadiometricMomentsImageFilter(); - virtual ~RadiometricMomentsImageFilter() {} - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); - virtual void GenerateInputRequestedRegion(void); - virtual void GenerateOutputInformation(void); + ~RadiometricMomentsImageFilter() ITK_OVERRIDE {} + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) ITK_OVERRIDE; private: RadiometricMomentsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.txx b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.txx index 574880893651babe26957b85bbc6a007e620a297..6d8798b7e79b016fe89363092094bff863780ba7 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.txx +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsImageFilter_txx -#define __otbRadiometricMomentsImageFilter_txx +#ifndef otbRadiometricMomentsImageFilter_txx +#define otbRadiometricMomentsImageFilter_txx #include "otbRadiometricMomentsImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h index 97d8ef27637889fdce75c2da2d724acfc80efee2..58634e23f733d1b3bf7326f3b22196db3027510a 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsImageFunction_h -#define __otbRadiometricMomentsImageFunction_h +#ifndef otbRadiometricMomentsImageFunction_h +#define otbRadiometricMomentsImageFunction_h #include "itkImageFunction.h" #include "otbRadiometricMomentsFunctor.h" @@ -86,17 +86,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -111,8 +111,8 @@ public: protected: RadiometricMomentsImageFunction(); - virtual ~RadiometricMomentsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~RadiometricMomentsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RadiometricMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.txx b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.txx index 5d0b44bf9ffaed8600a6303d476b06706c243171..8983ddf6b9288e4fb08ad5104486ae68e8d60a40 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.txx +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometricMomentsImageFunction_txx -#define __otbRadiometricMomentsImageFunction_txx +#ifndef otbRadiometricMomentsImageFunction_txx +#define otbRadiometricMomentsImageFunction_txx #include "otbRadiometricMomentsImageFunction.h" #include "itkMacro.h" diff --git a/Modules/Feature/Moments/include/otbRealMomentPathFunction.h b/Modules/Feature/Moments/include/otbRealMomentPathFunction.h index 59429902f8ac208b5c37e781cb34636a6ec5bd75..204bdf8bfb217144e159f56cae215ec2c8208433 100644 --- a/Modules/Feature/Moments/include/otbRealMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbRealMomentPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRealMomentPathFunction_h -#define __otbRealMomentPathFunction_h +#ifndef otbRealMomentPathFunction_h +#define otbRealMomentPathFunction_h #include "otbGeometricMomentPathFunction.h" #include "itkVectorContainer.h" @@ -64,8 +64,8 @@ public: protected: RealMomentPathFunction() {} - ~RealMomentPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~RealMomentPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h index 2451b080ad4ac187eded30a7fb5a0499363b58c4..64d54107e61d69a451a5960dc304c16d25495c4c 100644 --- a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRealMomentsImageFunction_h -#define __otbRealMomentsImageFunction_h +#ifndef otbRealMomentsImageFunction_h +#define otbRealMomentsImageFunction_h #include "itkImageFunction.h" @@ -76,17 +76,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -106,8 +106,8 @@ public: protected: RealMomentsImageFunction(); - virtual ~RealMomentsImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~RealMomentsImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RealMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.txx b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.txx index cc2966b052c9a0b9379aa0cb42701c1df71641f8..ed29827f25435be8f0ebe7909585c54706244a55 100644 --- a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.txx +++ b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRealMomentsImageFunction_txx -#define __otbRealMomentsImageFunction_txx +#ifndef otbRealMomentsImageFunction_txx +#define otbRealMomentsImageFunction_txx #include "otbRealMomentsImageFunction.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h index 2235ed6be03f1e85fed0599f1c7f7eea94e3f21e..a961fc11b6696a65a9c804ea43488e64b3f57b31 100644 --- a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAddCarvingPathFilter_h -#define __otbAddCarvingPathFilter_h +#ifndef otbAddCarvingPathFilter_h +#define otbAddCarvingPathFilter_h #include "itkImageAndPathToImageFilter.h" #include "itkImageSliceIteratorWithIndex.h" @@ -111,15 +111,15 @@ public: itkSetMacro(Direction, unsigned int); itkGetConstMacro(Direction, unsigned int); - virtual void GenerateOutputInformation(); - virtual void GenerateInputRequestedRegion(); + void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateInputRequestedRegion() ITK_OVERRIDE; protected: AddCarvingPathFilter(); - virtual ~AddCarvingPathFilter() {} + ~AddCarvingPathFilter() ITK_OVERRIDE {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateData(); + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: AddCarvingPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx index 8b1724c69f37ef2738ecbdf510ddc314c6a858d9..5ea7356a1056ae76929ce69e05aa6a8ee9e6cb5f 100644 --- a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx +++ b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbAddCarvingPathFilter_txx -#define __otbAddCarvingPathFilter_txx +#ifndef otbAddCarvingPathFilter_txx +#define otbAddCarvingPathFilter_txx #include "otbAddCarvingPathFilter.h" #include "itkMacro.h" diff --git a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h index 988a3e5b11943afd5ca831eedf5cb5fd788d9755..17a721948002f7e13c00db32306caaeead8a4148 100644 --- a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToCarvingPathFilter_h -#define __otbImageToCarvingPathFilter_h +#ifndef otbImageToCarvingPathFilter_h +#define otbImageToCarvingPathFilter_h #include "otbImageToPathFilter.h" #include "itkImageSliceConstIteratorWithIndex.h" @@ -90,10 +90,10 @@ public: protected: ImageToCarvingPathFilter(); - virtual ~ImageToCarvingPathFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateOutputInformation() {} //does nothing - virtual void GenerateData(); + ~ImageToCarvingPathFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE {} //does nothing + void GenerateData() ITK_OVERRIDE; private: ImageToCarvingPathFilter(const Self &); // purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.txx b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.txx index e7b4d748c6340850a9655945b9a554e9fad9a193..64e15c4dd4de59c824eff8210dbbd779fbf6e1fb 100644 --- a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.txx +++ b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToCarvingPathFilter_txx -#define __otbImageToCarvingPathFilter_txx +#ifndef otbImageToCarvingPathFilter_txx +#define otbImageToCarvingPathFilter_txx #include "otbImageToCarvingPathFilter.h" #include "otbMacro.h" diff --git a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h index c0068f0e328eef859bd4f3186658e308de50f76a..e5b870163fe02bf98fd275a402b641ba36574492 100644 --- a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRemoveCarvingPathFilter_h -#define __otbRemoveCarvingPathFilter_h +#ifndef otbRemoveCarvingPathFilter_h +#define otbRemoveCarvingPathFilter_h #include "itkImageAndPathToImageFilter.h" #include "itkImageSliceIteratorWithIndex.h" @@ -112,14 +112,14 @@ public: itkSetMacro(Direction, unsigned int); itkGetConstMacro(Direction, unsigned int); - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; protected: RemoveCarvingPathFilter(); - virtual ~RemoveCarvingPathFilter() {} + ~RemoveCarvingPathFilter() ITK_OVERRIDE {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateData(); + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: RemoveCarvingPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx index 026319e2fc68e1a57c434409ba0dcef15684ef70..d8b0f9df3d82e947241f5de9abf7a37f12b9df8a 100644 --- a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx +++ b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbRemoveCarvingPathFilter_txx -#define __otbRemoveCarvingPathFilter_txx +#ifndef otbRemoveCarvingPathFilter_txx +#define otbRemoveCarvingPathFilter_txx #include "otbRemoveCarvingPathFilter.h" #include "itkMacro.h" diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h index aee9615e959893f9c8722de36d9078e8b06fc48b..7c030567d59bf75a7905bac500ea5e26873cd99c 100644 --- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h +++ b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGreyLevelCooccurrenceIndexedList_h -#define __otbGreyLevelCooccurrenceIndexedList_h +#ifndef otbGreyLevelCooccurrenceIndexedList_h +#define otbGreyLevelCooccurrenceIndexedList_h #include "itkNumericTraits.h" #include "itkObjectFactory.h" @@ -135,7 +135,7 @@ public: protected: GreyLevelCooccurrenceIndexedList(); - ~GreyLevelCooccurrenceIndexedList() { } + ~GreyLevelCooccurrenceIndexedList() ITK_OVERRIDE { } /** create a cooccurrence pair with given index and frequency = 1 * value. Next occurrence of same index is checked via m_LookupArray and the @@ -152,7 +152,7 @@ protected: /** Get index of the pixelPair combination and save the result in index **/ bool GetIndex(const PixelPairType & pixelPair, IndexType & index) const; - void PrintSelf(std::ostream & os, itk::Indent indent) const; + void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.txx b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.txx index 07b1e5c37d0bc320841c790d4eb498859ac4d31e..8738d5f7f822c3c69561d8a1bc467de5a7e21741 100644 --- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.txx +++ b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.txx @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGreyLevelCooccurrenceIndexedList_txx -#define __otbGreyLevelCooccurrenceIndexedList_txx +#ifndef otbGreyLevelCooccurrenceIndexedList_txx +#define otbGreyLevelCooccurrenceIndexedList_txx #include "otbGreyLevelCooccurrenceIndexedList.h" diff --git a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h index e02961472390f03563e8d928bfff241994ef513c..8ce63a71466254efeec82e33ff87018d3971af4a 100644 --- a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h +++ b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHaralickTexturesImageFunction_h -#define __otbHaralickTexturesImageFunction_h +#ifndef otbHaralickTexturesImageFunction_h +#define otbHaralickTexturesImageFunction_h #include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" @@ -146,17 +146,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -200,8 +200,8 @@ public: protected: HaralickTexturesImageFunction(); - virtual ~HaralickTexturesImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HaralickTexturesImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: HaralickTexturesImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.txx b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.txx index 63a06d3afadcd668ceb1854a1da79bcaa5a6d307..f88081c9b8249b16b0206bdb677c385d6f303924 100644 --- a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.txx +++ b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHaralickTexturesImageFunction_txx -#define __otbHaralickTexturesImageFunction_txx +#ifndef otbHaralickTexturesImageFunction_txx +#define otbHaralickTexturesImageFunction_txx #include "otbHaralickTexturesImageFunction.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Feature/Textures/include/otbSFSTexturesFunctor.h b/Modules/Feature/Textures/include/otbSFSTexturesFunctor.h index 8ab7ab1b437e6368936b3eb041c724ba0335f0ac..335d22e8f62037c37c9371b31029c9e2e2d0439a 100644 --- a/Modules/Feature/Textures/include/otbSFSTexturesFunctor.h +++ b/Modules/Feature/Textures/include/otbSFSTexturesFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSFSTexturesFunctor_h -#define __otbSFSTexturesFunctor_h +#ifndef otbSFSTexturesFunctor_h +#define otbSFSTexturesFunctor_h #include "otbMath.h" #include "itkNumericTraits.h" diff --git a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h index 19a6a5debd510242e3b8039c772ed389d26f908b..e90caecb1b4690031136a528d4f1891212721ec1 100644 --- a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h +++ b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSFSTexturesImageFilter_h -#define __otbSFSTexturesImageFilter_h +#ifndef otbSFSTexturesImageFilter_h +#define otbSFSTexturesImageFilter_h #include "otbSFSTexturesFunctor.h" #include "itkImageToImageFilter.h" @@ -210,18 +210,18 @@ public: const OutputImageType * GetSDOutput() const; OutputImageType * GetSDOutput(); - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; std::vector<FunctorType> m_FunctorList; protected: SFSTexturesImageFilter(); - virtual ~SFSTexturesImageFilter(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SFSTexturesImageFilter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Pad the input requested region by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; private: SFSTexturesImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.txx b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.txx index fc2f974692358666dcb21abbf38cff2ca136c64b..670e5c643cbe169b848a8594587f5c75a5560864 100644 --- a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.txx +++ b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSFSTexturesImageFilter_txx -#define __otbSFSTexturesImageFilter_txx +#ifndef otbSFSTexturesImageFilter_txx +#define otbSFSTexturesImageFilter_txx #include "otbSFSTexturesImageFilter.h" @@ -76,7 +76,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[0] == false) { @@ -108,7 +108,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[1] == false) { @@ -140,7 +140,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 3) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[2] == false) { @@ -173,7 +173,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 4) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[3] == false) { @@ -205,7 +205,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 5) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[4] == false) { @@ -237,7 +237,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 6) { - return 0; + return ITK_NULLPTR; } if (this->GetTexturesStatus()[5] == false) { diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h index fa8910fdccdf21f7635b7f58efea838854726c50..cb04ff9ff40b8f20b7d50d247a87d1b8d0de0dd1 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToAdvancedTexturesFilter_h -#define __otbScalarImageToAdvancedTexturesFilter_h +#ifndef otbScalarImageToAdvancedTexturesFilter_h +#define otbScalarImageToAdvancedTexturesFilter_h #include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" @@ -198,13 +198,13 @@ protected: /** Constructor */ ScalarImageToAdvancedTexturesFilter(); /** Destructor */ - ~ScalarImageToAdvancedTexturesFilter(); + ~ScalarImageToAdvancedTexturesFilter() ITK_OVERRIDE; /** Generate the input requested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before Parallel textures extraction */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Parallel textures extraction */ - virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; private: ScalarImageToAdvancedTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx index a4ac9746afcc14943df203cd53696c3b1d044789..e0463ab5c888f97a007d5ad62ba27d7a596dfbd1 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToAdvancedTexturesFilter_txx -#define __otbScalarImageToAdvancedTexturesFilter_txx +#ifndef otbScalarImageToAdvancedTexturesFilter_txx +#define otbScalarImageToAdvancedTexturesFilter_txx #include "otbScalarImageToAdvancedTexturesFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -66,7 +66,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(0)); } @@ -79,7 +79,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(1)); } @@ -92,7 +92,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 3) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(2)); } @@ -105,7 +105,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 4) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(3)); } @@ -118,7 +118,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 5) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(4)); } @@ -131,7 +131,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 6) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(5)); } @@ -144,7 +144,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 7) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(6)); } @@ -157,7 +157,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 8) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(7)); } @@ -170,7 +170,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 9) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(8)); } @@ -183,7 +183,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 10) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(9)); } diff --git a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h index 4e343fc963a37070e7569f79968aa8d14a4ed7fe..4879c7565a03a992d317e22b03d9e7b25e3bd184 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToHigherOrderTexturesFilter_h -#define __otbScalarImageToHigherOrderTexturesFilter_h +#ifndef otbScalarImageToHigherOrderTexturesFilter_h +#define otbScalarImageToHigherOrderTexturesFilter_h #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthFeaturesFilter.h" @@ -185,11 +185,11 @@ protected: /** Constructor */ ScalarImageToHigherOrderTexturesFilter(); /** Destructor */ - ~ScalarImageToHigherOrderTexturesFilter(); + ~ScalarImageToHigherOrderTexturesFilter() ITK_OVERRIDE; /** Generate the input requested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Parallel textures extraction */ - virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; private: ScalarImageToHigherOrderTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx index 2ef488a92f625c6916878eb2465725e39621df3d..66d4a4b65a75403e3c66805807f7e0d475868452 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToHigherOrderTexturesFilter_txx -#define __otbScalarImageToHigherOrderTexturesFilter_txx +#ifndef otbScalarImageToHigherOrderTexturesFilter_txx +#define otbScalarImageToHigherOrderTexturesFilter_txx #include "otbScalarImageToHigherOrderTexturesFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -86,7 +86,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(0)); } @@ -99,7 +99,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(1)); } @@ -112,7 +112,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 3) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(2)); } @@ -125,7 +125,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 4) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(3)); } @@ -138,7 +138,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 5) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(4)); } @@ -151,7 +151,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 6) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(5)); } @@ -164,7 +164,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 7) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(6)); } @@ -177,7 +177,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 8) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(7)); } @@ -190,7 +190,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 9) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(8)); } @@ -203,7 +203,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 10) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(9)); } @@ -216,7 +216,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 11) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(10)); } diff --git a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h index 028c46ab8eab1c01e56551573d8d0e350139744c..5e0ca7bd7a70ba7f7af23d6fe2a1f139e2d92f0f 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToPanTexTextureFilter_h -#define __otbScalarImageToPanTexTextureFilter_h +#ifndef otbScalarImageToPanTexTextureFilter_h +#define otbScalarImageToPanTexTextureFilter_h #include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" @@ -111,11 +111,11 @@ protected: /** Constructor */ ScalarImageToPanTexTextureFilter(); /** Destructor */ - ~ScalarImageToPanTexTextureFilter(); + ~ScalarImageToPanTexTextureFilter() ITK_OVERRIDE; /** Generate the input requested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Parallel textures extraction */ - virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; private: ScalarImageToPanTexTextureFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.txx index 4647a2cea3da7c914384ed50b2fb4551def1390f..c355964fe1d760ca4907fe5278cb03ef1a43fec9 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToPanTexTextureFilter_txx -#define __otbScalarImageToPanTexTextureFilter_txx +#ifndef otbScalarImageToPanTexTextureFilter_txx +#define otbScalarImageToPanTexTextureFilter_txx #include "otbScalarImageToPanTexTextureFilter.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h index 02f8a230056e2317719760e16d545fe661e6f3bd..3c02adec5fbf28eee63214a3798d1487c6601c51 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToTexturesFilter_h -#define __otbScalarImageToTexturesFilter_h +#ifndef otbScalarImageToTexturesFilter_h +#define otbScalarImageToTexturesFilter_h #include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" @@ -194,13 +194,13 @@ protected: /** Constructor */ ScalarImageToTexturesFilter(); /** Destructor */ - ~ScalarImageToTexturesFilter(); + ~ScalarImageToTexturesFilter() ITK_OVERRIDE; /** Generate the input requested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before Parallel textures extraction */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Parallel textures extraction */ - virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; private: ScalarImageToTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx index e8587d9234e2b383e2f7eba739a1614dd12f5e96..7607041871d61f8c447782bea6563db62fbbd35d 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarImageToTexturesFilter_txx -#define __otbScalarImageToTexturesFilter_txx +#ifndef otbScalarImageToTexturesFilter_txx +#define otbScalarImageToTexturesFilter_txx #include "otbScalarImageToTexturesFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -67,7 +67,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(0)); } @@ -80,7 +80,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(1)); } @@ -93,7 +93,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 3) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(2)); } @@ -106,7 +106,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 4) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(3)); } @@ -119,7 +119,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 5) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(4)); } @@ -132,7 +132,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 6) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(5)); } @@ -145,7 +145,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 7) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(6)); } @@ -158,7 +158,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 8) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->GetOutput(7)); } diff --git a/Modules/Feature/Textures/include/otbTextureImageFunction.h b/Modules/Feature/Textures/include/otbTextureImageFunction.h index 31517f4bbed41001682ea098e1113719b7f02001..3f0548d42aa948ac564459f107683a01f5532df0 100644 --- a/Modules/Feature/Textures/include/otbTextureImageFunction.h +++ b/Modules/Feature/Textures/include/otbTextureImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTextureImageFunction_h -#define __otbTextureImageFunction_h +#ifndef otbTextureImageFunction_h +#define otbTextureImageFunction_h #include "itkImageFunction.h" #include "itkConstNeighborhoodIterator.h" @@ -74,17 +74,17 @@ public: itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual RealType EvaluateAtIndex(const IndexType& index) const; + RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate(const PointType& point) const + RealType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + RealType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -117,8 +117,8 @@ public: protected: TextureImageFunction(); - virtual ~TextureImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~TextureImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: TextureImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbTextureImageFunction.txx b/Modules/Feature/Textures/include/otbTextureImageFunction.txx index 0a90a831e446980474f118e340c339ffc44feb27..b121ff9ba3229b214ffb75a280156f2c157c4d51 100644 --- a/Modules/Feature/Textures/include/otbTextureImageFunction.txx +++ b/Modules/Feature/Textures/include/otbTextureImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTextureImageFunction_txx -#define __otbTextureImageFunction_txx +#ifndef otbTextureImageFunction_txx +#define otbTextureImageFunction_txx #include "otbTextureImageFunction.h" diff --git a/Modules/Feature/Textures/test/otbScalarImageToHigherOrderTexturesFilter.cxx b/Modules/Feature/Textures/test/otbScalarImageToHigherOrderTexturesFilter.cxx index a72f059f04a478643a44965ffe05577e95f07226..8f120fa87e543f913de6de24431dc42e21e0995e 100644 --- a/Modules/Feature/Textures/test/otbScalarImageToHigherOrderTexturesFilter.cxx +++ b/Modules/Feature/Textures/test/otbScalarImageToHigherOrderTexturesFilter.cxx @@ -218,15 +218,15 @@ int otbScalarImageToHigherOrderTexturesFilter(int argc, char * argv[]) std::cout << "Testing radius = " << radius << " and default offsets" << std::endl; ImageType::Pointer inputImage = ReadInputImage(infname); - std::vector<ImageType::Pointer> results = Compute(inputImage, nbBins, radius, 0); + std::vector<ImageType::Pointer> results = Compute(inputImage, nbBins, radius, ITK_NULLPTR); - if ( ValidateAt(inputImage, results, nbBins, radius, 0, 7, 11) == EXIT_FAILURE ) + if ( ValidateAt(inputImage, results, nbBins, radius, ITK_NULLPTR, 7, 11) == EXIT_FAILURE ) return EXIT_FAILURE; - if ( ValidateAt(inputImage, results, nbBins, radius, 0, 5, 5) == EXIT_FAILURE ) + if ( ValidateAt(inputImage, results, nbBins, radius, ITK_NULLPTR, 5, 5) == EXIT_FAILURE ) return EXIT_FAILURE; - if ( ValidateAt(inputImage, results, nbBins, radius, 0, 7, 11) == EXIT_FAILURE ) + if ( ValidateAt(inputImage, results, nbBins, radius, ITK_NULLPTR, 7, 11) == EXIT_FAILURE ) return EXIT_FAILURE; - if ( ValidateAt(inputImage, results, nbBins, radius, 0, 10, 5) == EXIT_FAILURE ) + if ( ValidateAt(inputImage, results, nbBins, radius, ITK_NULLPTR, 10, 5) == EXIT_FAILURE ) return EXIT_FAILURE; } diff --git a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h index df99c4979f2fdcd216f45b0ada68dbb74c5d2ddc..beb6850070a6bd33f8cd57e60a0191e52d89f172 100644 --- a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_h -#define __otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_h +#ifndef otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_h +#define otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_h #include "itkBinaryFunctorImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -145,9 +145,9 @@ public: protected: BinaryFunctorNeighborhoodJoinHistogramImageFilter(); - virtual ~BinaryFunctorNeighborhoodJoinHistogramImageFilter() {} + ~BinaryFunctorNeighborhoodJoinHistogramImageFilter() ITK_OVERRIDE {} - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** BinaryFunctorNeighborhoodJoinHistogramImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -159,13 +159,13 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the inputs requested regions by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx index edfa33fd8258439e9dc11b7a2c1f3dd58d7abff9..101b289b5783404d3e94362db462835719d43a61 100644 --- a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx +++ b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_txx -#define __otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_txx +#ifndef otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_txx +#define otbBinaryFunctorNeighborhoodJoinHistogramImageFilter_txx #include "otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h" #include "itkImageRegionIterator.h" @@ -74,7 +74,7 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1, TInputImage2, TO { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage1 *>(this->itk::ProcessObject::GetInput(0)); } @@ -87,7 +87,7 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1, TInputImage2, TO { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage2 *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/ChangeDetection/include/otbCBAMI.h b/Modules/Filtering/ChangeDetection/include/otbCBAMI.h index 01d528d0acb51746e0a568724ec7e3affd107bd1..0b2c46e651c7b0a75d161ab2196f963123fe1a85 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCBAMI.h +++ b/Modules/Filtering/ChangeDetection/include/otbCBAMI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCBAMI_h -#define __otbCBAMI_h +#ifndef otbCBAMI_h +#define otbCBAMI_h #include <vector> #include "itkMath.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h index 0af665394b87f7b7d69f8ce5caf414792585ee84..99d7f06af8138a27c0c7de4e8743c256984b3904 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCBAMIChangeDetector_h -#define __otbCBAMIChangeDetector_h +#ifndef otbCBAMIChangeDetector_h +#define otbCBAMIChangeDetector_h #include "otbBinaryFunctorNeighborhoodImageFilter.h" #include "otbCBAMI.h" @@ -81,7 +81,7 @@ public: protected: CBAMIChangeDetector() {} - virtual ~CBAMIChangeDetector() {} + ~CBAMIChangeDetector() ITK_OVERRIDE {} private: CBAMIChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h index c9a896537e104295e179f14a654d6b2c0dd18b13..c40da8de76e60a86a291ae528003421ccc79583e 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCorrelationChangeDetector_h -#define __otbCorrelationChangeDetector_h +#ifndef otbCorrelationChangeDetector_h +#define otbCorrelationChangeDetector_h #include "otbBinaryFunctorNeighborhoodImageFilter.h" #include "otbCrossCorrelation.h" @@ -80,7 +80,7 @@ public: protected: CorrelationChangeDetector() {} - virtual ~CorrelationChangeDetector() {} + ~CorrelationChangeDetector() ITK_OVERRIDE {} private: CorrelationChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbCrossCorrelation.h b/Modules/Filtering/ChangeDetection/include/otbCrossCorrelation.h index 63112445a7a947f1b6a0eae31df414b7c68e66c4..45b534c70f05e72d6fb10708a1c44004d1bccef4 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCrossCorrelation.h +++ b/Modules/Filtering/ChangeDetection/include/otbCrossCorrelation.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCrossCorrelation_h -#define __otbCrossCorrelation_h +#ifndef otbCrossCorrelation_h +#define otbCrossCorrelation_h #include "itkMath.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMI.h b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMI.h index 559cebc6d5331aaf0d5e88ac9ae598f91618f617..26a0c29ffb0feffd7074d659b793ad808c732b63 100644 --- a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMI.h +++ b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJoinHistogramMI_h -#define __otbJoinHistogramMI_h +#ifndef otbJoinHistogramMI_h +#define otbJoinHistogramMI_h #include "itkHistogram.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h index d6d08dddb32b3395867e90ec2149b8d2fe0a9dc6..dafe9a8329eb52de58e0634e817cec4bb5944ca3 100644 --- a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJoinHistogramMIImageFilter_h -#define __otbJoinHistogramMIImageFilter_h +#ifndef otbJoinHistogramMIImageFilter_h +#define otbJoinHistogramMIImageFilter_h #include "otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h" #include "otbJoinHistogramMI.h" @@ -81,7 +81,7 @@ public: protected: JoinHistogramMIImageFilter() {} - virtual ~JoinHistogramMIImageFilter() {} + ~JoinHistogramMIImageFilter() ITK_OVERRIDE {} private: JoinHistogramMIImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h index cba75ee655fa111f68e62e2583aa81c98a471a20..c29c3457ad7dbe00f1db3be21eb9f2012953a2d4 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKullbackLeiblerDistanceImageFilter_h -#define __otbKullbackLeiblerDistanceImageFilter_h +#ifndef otbKullbackLeiblerDistanceImageFilter_h +#define otbKullbackLeiblerDistanceImageFilter_h #include "itkVariableLengthVector.h" #include "otbBinaryFunctorNeighborhoodImageFilter.h" @@ -168,7 +168,7 @@ public: protected: KullbackLeiblerDistanceImageFilter() {} - virtual ~KullbackLeiblerDistanceImageFilter() {} + ~KullbackLeiblerDistanceImageFilter() ITK_OVERRIDE {} private: KullbackLeiblerDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx index b309f580dd3a8f64474af61c138c8931bfbc27c7..8b881b46792afaa61bd00fa1c4c0c41518529f9f 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx @@ -17,9 +17,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKullbackLeiblerDistanceImageFilter_txx -#define __otbKullbackLeiblerDistanceImageFilter_txx +#ifndef otbKullbackLeiblerDistanceImageFilter_txx +#define otbKullbackLeiblerDistanceImageFilter_txx +#include "otbKullbackLeiblerDistanceImageFilter.h" #include <vector> #include "itkImageRegionConstIterator.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h index d4a5e93c7fbd588e8837e1e98b9d5a924ae9c44c..96fe2260ae16c398e116ef34a948f3e0babb9295 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKullbackLeiblerProfileImageFilter_h -#define __otbKullbackLeiblerProfileImageFilter_h +#ifndef otbKullbackLeiblerProfileImageFilter_h +#define otbKullbackLeiblerProfileImageFilter_h #include <vector> @@ -186,7 +186,7 @@ public: protected: KullbackLeiblerProfileImageFilter() {} - virtual ~KullbackLeiblerProfileImageFilter() {} + ~KullbackLeiblerProfileImageFilter() ITK_OVERRIDE {} private: KullbackLeiblerProfileImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx index 1620df7cd64f5851eb1d7a7c8f4e1aee8976738e..fa10d4f89f5096982d11be4ae46c6e35fc711678 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKullbackLeiblerProfileImageFilter_txx -#define __otbKullbackLeiblerProfileImageFilter_txx +#ifndef otbKullbackLeiblerProfileImageFilter_txx +#define otbKullbackLeiblerProfileImageFilter_txx #include <vector> diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h index 5498cc9cac67f24a45db362f15a7db469054ac5d..a6a52b68ec30eafacd69115d630357e0e406c30f 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbKullbackLeiblerSupervizedDistanceImageFilter_h -#define __otbKullbackLeiblerSupervizedDistanceImageFilter_h +#ifndef otbKullbackLeiblerSupervizedDistanceImageFilter_h +#define otbKullbackLeiblerSupervizedDistanceImageFilter_h #include "otbKullbackLeiblerDistanceImageFilter.h" @@ -144,13 +144,13 @@ public: void SetTrainingArea(const TInputROIImage * trainingImage); protected: - virtual void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; KullbackLeiblerSupervizedDistanceImageFilter() { this->SetNumberOfRequiredInputs(3); } - virtual ~KullbackLeiblerSupervizedDistanceImageFilter() {} + ~KullbackLeiblerSupervizedDistanceImageFilter() ITK_OVERRIDE {} private: KullbackLeiblerSupervizedDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx index 4b1cf715ae38018b13f7526c7f00cc7f924d12a0..3c454f851d481cc5f1381253496f4e6b0c1f5305 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbKullbackLeiblerSupervizedDistanceImageFilter_txx -#define __otbKullbackLeiblerSupervizedDistanceImageFilter_txx +#ifndef otbKullbackLeiblerSupervizedDistanceImageFilter_txx +#define otbKullbackLeiblerSupervizedDistanceImageFilter_txx #include "otbKullbackLeiblerSupervizedDistanceImageFilter.h" @@ -33,8 +33,8 @@ template <class TInput1, class TInput2, class TInputROIImage, class TOutput> KullbackLeiblerSupervizedDistance<TInput1, TInput2, TInputROIImage, TOutput> ::KullbackLeiblerSupervizedDistance () { - m_CumROI1 = NULL; - m_CumROI2 = NULL; + m_CumROI1 = ITK_NULLPTR; + m_CumROI2 = ITK_NULLPTR; } template <class TInput1, class TInput2, class TInputROIImage, class TOutput> @@ -42,10 +42,10 @@ KullbackLeiblerSupervizedDistance<TInput1, TInput2, TInputROIImage, TOutput> ::~KullbackLeiblerSupervizedDistance () { delete m_CumROI1; - m_CumROI1 = NULL; + m_CumROI1 = ITK_NULLPTR; delete m_CumROI2; - m_CumROI2 = NULL; + m_CumROI2 = ITK_NULLPTR; } template <class TInput1, class TInput2, class TInputROIImage, class TOutput> @@ -66,7 +66,7 @@ KullbackLeiblerSupervizedDistance<TInput1, TInput2, TInputROIImage, TOutput> conversion1->SetROIImage(imgROI); conversion1->Update(); - if (m_CumROI1 != NULL) delete m_CumROI1; + if (m_CumROI1 != ITK_NULLPTR) delete m_CumROI1; m_CumROI1 = new CumulantsForEdgeworth<ROIInputType1> (conversion1->GetOutput()); @@ -89,7 +89,7 @@ KullbackLeiblerSupervizedDistance<TInput1, TInput2, TInputROIImage, TOutput> conversion2->SetROIImage(imgROI); conversion2->Update(); - if (m_CumROI2 != NULL) delete m_CumROI2; + if (m_CumROI2 != ITK_NULLPTR) delete m_CumROI2; m_CumROI2 = new CumulantsForEdgeworth<ROIInputType2> (conversion2->GetOutput()); diff --git a/Modules/Filtering/ChangeDetection/include/otbLHMI.h b/Modules/Filtering/ChangeDetection/include/otbLHMI.h index e61ae24116d25d6ae4096e9b40e6aceea02224ce..e2f296d2dd208ef6668bc4ef19cbfd0bcc27146d 100644 --- a/Modules/Filtering/ChangeDetection/include/otbLHMI.h +++ b/Modules/Filtering/ChangeDetection/include/otbLHMI.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLHMI_h -#define __otbLHMI_h +#ifndef otbLHMI_h +#define otbLHMI_h #include <vector> #include "itkHistogram.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h index c397eba14e309d3291cc0308d4af9b866f2cf8bf..b2a3c1e4e7d1c54bf593d0d49bee21dbc43ec4cf 100644 --- a/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLHMIChangeDetector_h -#define __otbLHMIChangeDetector_h +#ifndef otbLHMIChangeDetector_h +#define otbLHMIChangeDetector_h #include "otbBinaryFunctorNeighborhoodImageFilter.h" #include "otbLHMI.h" @@ -81,7 +81,7 @@ public: protected: LHMIChangeDetector() {} - virtual ~LHMIChangeDetector() {} + ~LHMIChangeDetector() ITK_OVERRIDE {} private: LHMIChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanDifference.h b/Modules/Filtering/ChangeDetection/include/otbMeanDifference.h index 0f29f742c2f0ad02adea838f73c9c1c5c96cc966..830d2b0bee928f16148aaccdbf6bdc8dba94dea8 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanDifference.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanDifference.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanDifference_h -#define __otbMeanDifference_h +#ifndef otbMeanDifference_h +#define otbMeanDifference_h namespace otb { diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h index 02448bc2aa8126db1cbdc8d175f8a6f906c9be60..1801b6df2582731303359d81ce5b7a051894288f 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanDifferenceImageFilter_h -#define __otbMeanDifferenceImageFilter_h +#ifndef otbMeanDifferenceImageFilter_h +#define otbMeanDifferenceImageFilter_h #include "otbBinaryFunctorNeighborhoodImageFilter.h" #include "otbMeanDifference.h" @@ -79,7 +79,7 @@ public: protected: MeanDifferenceImageFilter() {} - virtual ~MeanDifferenceImageFilter() {} + ~MeanDifferenceImageFilter() ITK_OVERRIDE {} private: MeanDifferenceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanRatio.h b/Modules/Filtering/ChangeDetection/include/otbMeanRatio.h index 431c9b7cf4ada51954b6760667bc36ed269b9332..06f760de75760436d4cfabaee135e00bbff3c190 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanRatio.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanRatio.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanRatio_h -#define __otbMeanRatio_h +#ifndef otbMeanRatio_h +#define otbMeanRatio_h #include "otbBinaryFunctorNeighborhoodImageFilter.h" diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h index 9010d7db27008b1a7a65bf4e250f995e763bd9b9..fa3890d9636ae491d69fec92055465bed5244e37 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanRatioImageFilter_h -#define __otbMeanRatioImageFilter_h +#ifndef otbMeanRatioImageFilter_h +#define otbMeanRatioImageFilter_h #include "otbMeanRatio.h" @@ -77,7 +77,7 @@ public: protected: MeanRatioImageFilter() {} - virtual ~MeanRatioImageFilter() {} + ~MeanRatioImageFilter() ITK_OVERRIDE {} private: MeanRatioImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h index d77801a8ddab9602bf2731e9d2ea8bc524199b03..32c92bd126a92c37bff57d3c600f111280f8351c 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultivariateAlterationDetectorImageFilter_h -#define __otbMultivariateAlterationDetectorImageFilter_h +#ifndef otbMultivariateAlterationDetectorImageFilter_h +#define otbMultivariateAlterationDetectorImageFilter_h #include "otbStreamingStatisticsVectorImageFilter.h" @@ -152,11 +152,11 @@ public: protected: MultivariateAlterationDetectorImageFilter(); - virtual ~MultivariateAlterationDetectorImageFilter() {} + ~MultivariateAlterationDetectorImageFilter() ITK_OVERRIDE {} - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: MultivariateAlterationDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.txx index 666ae3e0fe7b94f5cdd5a415154a11792d3ec3f9..6080c210dc1968d7bf8eb1404df85e0d8fa0c00b 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.txx +++ b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultivariateAlterationDetectorImageFilter_txx -#define __otbMultivariateAlterationDetectorImageFilter_txx +#ifndef otbMultivariateAlterationDetectorImageFilter_txx +#define otbMultivariateAlterationDetectorImageFilter_txx #include "otbMultivariateAlterationDetectorImageFilter.h" #include "otbMath.h" @@ -54,7 +54,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -76,7 +76,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h index f4842f0d0f3404f9ca19108ab518ed75278d6c5f..b0a3b5ad00b51c190fe76f6ddd355599a8436d3f 100644 --- a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h +++ b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReliefColormapFunctor_h -#define __otbReliefColormapFunctor_h +#ifndef otbReliefColormapFunctor_h +#define otbReliefColormapFunctor_h #include "itkColormapFunction.h" @@ -55,11 +55,11 @@ public: typedef typename Superclass::ScalarType ScalarType; typedef typename Superclass::RealType RealType; - virtual RGBPixelType operator ()(const TScalar&) const; + RGBPixelType operator ()(const TScalar&) const ITK_OVERRIDE; protected: ReliefColormapFunctor(){}; - ~ReliefColormapFunctor() {} + ~ReliefColormapFunctor() ITK_OVERRIDE {} private: ReliefColormapFunctor(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.txx b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.txx index fc7958c96909668361b3a2e11a9ed491ec90c32d..4134e5d87dc3698506de57e756de13fb62c74fdb 100644 --- a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.txx +++ b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReliefColormapFunctor_txx -#define __otbReliefColormapFunctor_txx +#ifndef otbReliefColormapFunctor_txx +#define otbReliefColormapFunctor_txx #include "otbReliefColormapFunctor.h" diff --git a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h index 901e41a56868b833ec6d683d462d4b421483c474..1aae8c050bcef092df5dbaf98c342390fec3901b 100644 --- a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h +++ b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbScalarToRainbowRGBPixelFunctor_h -#define __otbScalarToRainbowRGBPixelFunctor_h +#ifndef otbScalarToRainbowRGBPixelFunctor_h +#define otbScalarToRainbowRGBPixelFunctor_h #include "itkColormapFunction.h" @@ -136,7 +136,7 @@ class ITK_EXPORT ScalarToRainbowRGBPixelFunctor { public: ScalarToRainbowRGBPixelFunctor(); - ~ScalarToRainbowRGBPixelFunctor() {} + ~ScalarToRainbowRGBPixelFunctor() ITK_OVERRIDE {} typedef ScalarToRainbowRGBPixelFunctor Self; typedef itk::Function::ColormapFunction<TScalar, TRGBPixel> Superclass; @@ -151,7 +151,7 @@ public: typedef TScalar ScalarType; typedef HSVToRGBFunctor<RGBPixelType> HSVToRGBFunctorType; - RGBPixelType operator ()(const TScalar&) const; + RGBPixelType operator ()(const TScalar&) const ITK_OVERRIDE; /** Set the input maximum to be mapped to red * \deprecated use SetMaximumInputValue() */ diff --git a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.txx b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.txx index 82e300375be6172a1e406caddd9ff39c7f901472..616ccb2021e699f8bfbbc7bbde34458d035a1c6f 100644 --- a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.txx +++ b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbScalarToRainbowRGBPixelFunctor_txx -#define __otbScalarToRainbowRGBPixelFunctor_txx +#ifndef otbScalarToRainbowRGBPixelFunctor_txx +#define otbScalarToRainbowRGBPixelFunctor_txx #include "otbScalarToRainbowRGBPixelFunctor.h" diff --git a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h index 579c16d999eb354947e415f4ef2b925130c70f4c..2b097f6043955f7b7c2b8a5f15370dc73bfd620e 100644 --- a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h +++ b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConvolutionImageFilter_h -#define __otbConvolutionImageFilter_h +#ifndef otbConvolutionImageFilter_h +#define otbConvolutionImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -154,8 +154,8 @@ public: protected: ConvolutionImageFilter(); - virtual ~ConvolutionImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ConvolutionImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ConvolutionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -168,7 +168,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; /** ConvolutionImageFilter needs a larger input requested region than * the output requested region. As such, ConvolutionImageFilter needs @@ -176,8 +176,8 @@ protected: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; private: ConvolutionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.txx b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.txx index 076b28225e2dd2124a7b7c77a7170af24e44c74c..ae9e501cd70dad17bee1e80ee0f0365ae9ec7208 100644 --- a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.txx +++ b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConvolutionImageFilter_txx -#define __otbConvolutionImageFilter_txx +#ifndef otbConvolutionImageFilter_txx +#define otbConvolutionImageFilter_txx #include "otbConvolutionImageFilter.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h index e380ed588f3b223576251c3747454355c35c513f..9871761a6f05d38ecf47ad6c4bfdcaeaa5467762 100644 --- a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h +++ b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaborFilterGenerator_h -#define __otbGaborFilterGenerator_h +#ifndef otbGaborFilterGenerator_h +#define otbGaborFilterGenerator_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -111,17 +111,17 @@ protected: /** constructor */ GaborFilterGenerator(); /** destructor */ - virtual ~GaborFilterGenerator() {} + ~GaborFilterGenerator() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate the filter coefficients */ void GenerateFilter(); /** Reimplement the Modified() method *to set the NeedToGenerateFilter to true */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: GaborFilterGenerator(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.txx b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.txx index 31904ba5489c739889351b27500637ae88051dcc..15fbc0ba0818dec3222b8ac49d092df5f412a1de 100644 --- a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.txx +++ b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.txx @@ -18,9 +18,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaborFilterGenerator_txx -#define __otbGaborFilterGenerator_txx +#ifndef otbGaborFilterGenerator_txx +#define otbGaborFilterGenerator_txx +#include "otbGaborFilterGenerator.h" #include "otbMath.h" namespace otb diff --git a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h index fdd5b4954867f2a5401bc31a7f2a9f9d4af6370e..af427086ba246a2189f7d3440bf39e1fe4ef62b6 100644 --- a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h +++ b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOverlapSaveConvolutionImageFilter_h -#define __otbOverlapSaveConvolutionImageFilter_h +#ifndef otbOverlapSaveConvolutionImageFilter_h +#define otbOverlapSaveConvolutionImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -138,8 +138,8 @@ public: /** Since this filter implements a neighborhood operation, it requests a largest input * region than the output region. */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -151,13 +151,13 @@ protected: /** Constructor */ OverlapSaveConvolutionImageFilter(); /** destructor */ - virtual ~OverlapSaveConvolutionImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~OverlapSaveConvolutionImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /* TODO For the moment this class provide only a GenerateData(), * due to limited thread-safety of FFTW plan creation. */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; // void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); private: diff --git a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.txx b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.txx index b19a1919f173d843771a8dbef9de7ef6cf7035e0..8b3126aa4a90eda0bc73ce1503fc9dc26b855863 100644 --- a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.txx +++ b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOverlapSaveConvolutionImageFilter_txx -#define __otbOverlapSaveConvolutionImageFilter_txx +#ifndef otbOverlapSaveConvolutionImageFilter_txx +#define otbOverlapSaveConvolutionImageFilter_txx #include "itkConfigure.h" diff --git a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h index 42368ea14dfa84ce8be23126357f1d3498f63ab3..0e60ee63f22063c3567456a466c25ef7fb341ca4 100644 --- a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h +++ b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDEMCaracteristicsExtractor_h -#define __otbDEMCaracteristicsExtractor_h +#ifndef otbDEMCaracteristicsExtractor_h +#define otbDEMCaracteristicsExtractor_h #include "otbImage.h" #include "otbVectorImage.h" @@ -143,11 +143,11 @@ public: protected: DEMCaracteristicsExtractor(); - virtual ~DEMCaracteristicsExtractor(); + ~DEMCaracteristicsExtractor() ITK_OVERRIDE; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: /** Angle parameters*/ diff --git a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.txx b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.txx index 717437a8c3011392e6ee276f0999c291bcecc397..de13743ed31362b7b1e95864ad90a69289a772b9 100644 --- a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.txx +++ b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDEMCaracteristicsExtractor_txx -#define __otbDEMCaracteristicsExtractor_txx +#ifndef otbDEMCaracteristicsExtractor_txx +#define otbDEMCaracteristicsExtractor_txx #include "otbDEMCaracteristicsExtractor.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h index 963e6eadbf3445ac3e09dd85ee88146d093d3f96..e6d579018a442c491820db21afca3ea8ad868086 100644 --- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h +++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDEMToImageGenerator_h -#define __otbDEMToImageGenerator_h +#ifndef otbDEMToImageGenerator_h +#define otbDEMToImageGenerator_h #include <iostream> #include <stdio.h> @@ -173,13 +173,13 @@ public: protected: DEMToImageGenerator(); - virtual ~DEMToImageGenerator(){} + ~DEMToImageGenerator() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - void BeforeThreadedGenerateData(); + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void BeforeThreadedGenerateData() ITK_OVERRIDE; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); - virtual void GenerateOutputInformation(); + itk::ThreadIdType threadId) ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; DEMHandlerType::Pointer m_DEMHandler; PointType m_OutputOrigin; diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx index e07bdf6cbad27a16a73a3833ebd380f519cf6a81..3d80be2dc105e7f1d9596054ee4447de9d07179f 100644 --- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx +++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDEMToImageGenerator_txx -#define __otbDEMToImageGenerator_txx +#ifndef otbDEMToImageGenerator_txx +#define otbDEMToImageGenerator_txx #include "otbDEMToImageGenerator.h" #include "otbMacro.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h index 6a9aa40b56a27a9cf9b5b5ee45111d586628d6cd..c1df1d7ddbfbe9b105bef09ae6dbd2c7ed06fed3 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionBinaryImageFilter_h -#define __otbAngularProjectionBinaryImageFilter_h +#ifndef otbAngularProjectionBinaryImageFilter_h +#define otbAngularProjectionBinaryImageFilter_h #include <vector> @@ -86,10 +86,10 @@ public: protected: AngularProjectionBinaryImageFilter(); - virtual ~AngularProjectionBinaryImageFilter() { } + ~AngularProjectionBinaryImageFilter() ITK_OVERRIDE { } - virtual void GenerateOutputInformation(); - virtual void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ); + void GenerateOutputInformation() ITK_OVERRIDE; + void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) ITK_OVERRIDE; private: AngularProjectionBinaryImageFilter(const Self&); // not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.txx index c8b62a6f13a460f08858f1ef6b109628d2a9b4f0..8e1d2702bd61f86c1427277838a922571eb018ca 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionBinaryImageFilter_txx -#define __otbAngularProjectionBinaryImageFilter_txx +#ifndef otbAngularProjectionBinaryImageFilter_txx +#define otbAngularProjectionBinaryImageFilter_txx #include "otbAngularProjectionBinaryImageFilter.h" #include <vnl/vnl_math.h> @@ -56,7 +56,7 @@ AngularProjectionBinaryImageFilter< TInputImage, TOutputImage, TPrecision > { if ( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage * > (this->itk::ProcessObject::GetInput(0) ); @@ -69,7 +69,7 @@ AngularProjectionBinaryImageFilter< TInputImage, TOutputImage, TPrecision > { if ( this->GetNumberOfInputs() < 2 ) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage * > (this->itk::ProcessObject::GetInput(1)); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h index add14b8782df9fb27cbd5b71ecda73d50595a5f1..30d2463a6030534eb901a8009f43a895b9c17d4e 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionImageFilter_h -#define __otbAngularProjectionImageFilter_h +#ifndef otbAngularProjectionImageFilter_h +#define otbAngularProjectionImageFilter_h #include "itkImageRegionConstIterator.h" #include "itkProgressReporter.h" @@ -81,7 +81,7 @@ public: itkGetMacro(AngleArray, AngleArrayType); itkSetMacro(AngleArray, AngleArrayType); - void SetInput ( unsigned int i, const InputImageType * ); + void SetInput ( unsigned int i, const InputImageType * ) ITK_OVERRIDE; using Superclass::SetInput; const InputImageType * GetInput( unsigned int i ) const; @@ -89,9 +89,9 @@ public: protected: AngularProjectionImageFilter(); - virtual ~AngularProjectionImageFilter() { } + ~AngularProjectionImageFilter() ITK_OVERRIDE { } - virtual void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ); + void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) ITK_OVERRIDE; virtual OutputImagePixelType InternalGenerateData ( const ImageRegionConstIteratorVectorType & ) const; private: diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.txx index 8074e09a6bf67e1888dc8ee472dac63e73ceb9d0..a6ce735a8388ba7a9000b70ec96f276a45d6460b 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionImageFilter_txx -#define __otbAngularProjectionImageFilter_txx +#ifndef otbAngularProjectionImageFilter_txx +#define otbAngularProjectionImageFilter_txx #include "otbAngularProjectionImageFilter.h" #include <vnl/vnl_math.h> @@ -50,7 +50,7 @@ AngularProjectionImageFilter< TInputImage, TOutputImage, TAngleArray, TPrecision { if ( i >= this->GetNumberOfInputs() ) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType * > diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h index 9402edcd3fa63a32ec07b63fb1c0a52992f3ba6f..44caad873dbfcd29a291d0f622bc166e98b1d25a 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionSetImageFilter_h -#define __otbAngularProjectionSetImageFilter_h +#ifndef otbAngularProjectionSetImageFilter_h +#define otbAngularProjectionSetImageFilter_h #include "otbAngularProjectionImageFilter.h" #include "otbImageToImageListFilter.h" @@ -123,9 +123,9 @@ public: protected: AngularProjectionSetImageFilter(); - virtual ~AngularProjectionSetImageFilter() { } + ~AngularProjectionSetImageFilter() ITK_OVERRIDE { } - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: AngularProjectionSetImageFilter(const Self&); // not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.txx index feb9a4f0295db130543bc30a1b593b15b99800d3..5b138d768fd83fbcaf5f55f14162cb47a11f1c22 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAngularProjectionSetImageFilter_txx -#define __otbAngularProjectionSetImageFilter_txx +#ifndef otbAngularProjectionSetImageFilter_txx +#define otbAngularProjectionSetImageFilter_txx #include "otbAngularProjectionSetImageFilter.h" #include <vnl/vnl_math.h> @@ -53,7 +53,7 @@ AngularProjectionSetImageFilter< TInputImage, TOutputImage, TAngleList, TPrecisi { if ( i >= this->GetNumberOfInputs() ) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType * > diff --git a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h index 518196e15b30929c22f12dd50307daf4ab3a3c48..cc0ce6a0c5be8f172ec6f26dd737bfa713054ac5 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEstimateInnerProductPCAImageFilter_h -#define __otbEstimateInnerProductPCAImageFilter_h +#ifndef otbEstimateInnerProductPCAImageFilter_h +#define otbEstimateInnerProductPCAImageFilter_h #include "itkImageToImageFilter.h" #include "otbStreamingInnerProductVectorImageFilter.h" @@ -75,21 +75,21 @@ public: protected: EstimateInnerProductPCAImageFilter(); - virtual ~EstimateInnerProductPCAImageFilter() {} + ~EstimateInnerProductPCAImageFilter() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** * BeforeThreadedGenerateData **/ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: EstimateInnerProductPCAImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.txx index f080e863edb349432c87ef38652a979a6e642bda..f66c181c8152dbbc500140f037e8d8621777c371 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEstimateInnerProductPCAImageFilter_txx -#define __otbEstimateInnerProductPCAImageFilter_txx +#ifndef otbEstimateInnerProductPCAImageFilter_txx +#define otbEstimateInnerProductPCAImageFilter_txx #include "otbEstimateInnerProductPCAImageFilter.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h index c7c02acc61f45d0481150481f1f546159483b946..bd40d84ac8d2e1fa53c99feca55ebd9375f6f4d1 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFastICAImageFilter_h -#define __otbFastICAImageFilter_h +#ifndef otbFastICAImageFilter_h +#define otbFastICAImageFilter_h #include "itkImageToImageFilter.h" #include "otbPCAImageFilter.h" @@ -146,7 +146,7 @@ public: protected: FastICAImageFilter (); - virtual ~FastICAImageFilter() { } + ~FastICAImageFilter() ITK_OVERRIDE { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -156,12 +156,12 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** GenerateData * Through a filter of filter structure */ - virtual void GenerateData (); + void GenerateData () ITK_OVERRIDE; /** Internal methods */ void ForwardGenerateOutputInformation(); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx index 6aab3f19c581547e809300b5700c1cca717953ad..28661f01dbe18c2c87ab1a41f4f4b987255b5d9b 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFastICAImageFilter_txx -#define __otbFastICAImageFilter_txx +#ifndef otbFastICAImageFilter_txx +#define otbFastICAImageFilter_txx #include "otbFastICAImageFilter.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h index 3866a549b46c3cad9b355667ba0baf549edc7a46..3403ba13fafbae9273e83dd643b4c9a0b436c810 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFastICAInternalOptimizerVectorImageFilter_h -#define __otbFastICAInternalOptimizerVectorImageFilter_h +#ifndef otbFastICAInternalOptimizerVectorImageFilter_h +#define otbFastICAInternalOptimizerVectorImageFilter_h #include "otbMacro.h" #include "otbMatrixImageFilter.h" @@ -93,12 +93,12 @@ public: protected: FastICAInternalOptimizerVectorImageFilter(); - virtual ~FastICAInternalOptimizerVectorImageFilter() { } + ~FastICAInternalOptimizerVectorImageFilter() ITK_OVERRIDE { } - virtual void GenerateOutputInformation(); - virtual void BeforeThreadedGenerateData (); - virtual void ThreadedGenerateData ( const OutputRegionType &, itk::ThreadIdType ); - virtual void AfterThreadedGenerateData(); + void GenerateOutputInformation() ITK_OVERRIDE; + void BeforeThreadedGenerateData () ITK_OVERRIDE; + void ThreadedGenerateData ( const OutputRegionType &, itk::ThreadIdType ) ITK_OVERRIDE; + void AfterThreadedGenerateData() ITK_OVERRIDE; unsigned int m_CurrentBandForLoop; diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.txx index f3ada7eb7b58394c5547b5ba12624ba7aff66b97..eb4876fc1c2980de2f852a625a90564f6df15e4c 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFastICAInternalOptimizerVectorImageFilter_txx -#define __otbFastICAInternalOptimizerVectorImageFilter_txx +#ifndef otbFastICAInternalOptimizerVectorImageFilter_txx +#define otbFastICAInternalOptimizerVectorImageFilter_txx #include "otbFastICAInternalOptimizerVectorImageFilter.h" #include <itkMacro.h> diff --git a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h index fe918f5865befa97c9098752c585a116166e5396..4e556f975e733a8e03dd94aa1dce6b2a9523c0e6 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInnerProductPCAImageFilter_h -#define __otbInnerProductPCAImageFilter_h +#ifndef otbInnerProductPCAImageFilter_h +#define otbInnerProductPCAImageFilter_h #include "otbImage.h" #include "otbMacro.h" @@ -118,13 +118,13 @@ public: protected: /** GenerateData */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ InnerProductPCAImageFilter(); /** Destructor */ - virtual ~InnerProductPCAImageFilter() {} + ~InnerProductPCAImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** NormalizeInnerProductPCAImageFilter can produce an image which is a different * resolution than its input image. As such, NormalizeInnerProductPCAImageFilter @@ -134,7 +134,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: InnerProductPCAImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.txx index c6b03cec8df376e27069d4d2b18de8ab019ee50b..834fc5a129bb51331013bd3f95fc5e0f80399aa5 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbInnerProductPCAImageFilter_txx -#define __otbInnerProductPCAImageFilter_txx +#ifndef otbInnerProductPCAImageFilter_txx +#define otbInnerProductPCAImageFilter_txx #include "otbInnerProductPCAImageFilter.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h index 1c0b552dfe39d8aadbfe7093bc3272d99d6a39df..388a81e4caf6566528a0e2d7ccc9fe32a6483642 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalActivityVectorImageFilter_h -#define __otbLocalActivityVectorImageFilter_h +#ifndef otbLocalActivityVectorImageFilter_h +#define otbLocalActivityVectorImageFilter_h #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" @@ -106,7 +106,7 @@ public: protected: LocalActivityVectorImageFilter() { } - virtual ~LocalActivityVectorImageFilter() { } + ~LocalActivityVectorImageFilter() ITK_OVERRIDE { } private: LocalActivityVectorImageFilter( const Self & ); // Not implemented @@ -116,4 +116,4 @@ private: } // end of namespace otb -#endif // __otbLocalActivityVectorImageFilter_h +#endif // otbLocalActivityVectorImageFilter_h diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h index 27c2f2f5737bac0d6bb45479782539e2f5d578f1..6f132355cabb1ff5df78086c82bcab353089e2b0 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMNFImageFilter_h -#define __otbMNFImageFilter_h +#ifndef otbMNFImageFilter_h +#define otbMNFImageFilter_h #include "otbPCAImageFilter.h" @@ -146,7 +146,7 @@ public: protected: MNFImageFilter(); - virtual ~MNFImageFilter() { } + ~MNFImageFilter() ITK_OVERRIDE { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -156,14 +156,14 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** GenerateData * Through a filter of filter structure */ - virtual void GenerateData (); + void GenerateData () ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Internal methods */ void ForwardGenerateOutputInformation(); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx index 3308074e3772738a12187a164246f4b13ee921ff..89854b10c0a4acc39b8125e8d5b01a4496e21f6e 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMNFImageFilter_txx -#define __otbMNFImageFilter_txx +#ifndef otbMNFImageFilter_txx +#define otbMNFImageFilter_txx #include "otbMNFImageFilter.h" #include "itkMacro.h" @@ -497,6 +497,6 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf } // end of namespace otb -#endif // __otbMNFImageFilter_txx +#endif // otbMNFImageFilter_txx diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h index c5fb71c8cada543079f33e9281286fc0139e9291..579675c711ac1b2e2d7e37896815e5dbd00fdc00 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMaximumAutocorrelationFactorImageFilter_h -#define __otbMaximumAutocorrelationFactorImageFilter_h +#ifndef otbMaximumAutocorrelationFactorImageFilter_h +#define otbMaximumAutocorrelationFactorImageFilter_h #include "otbStreamingStatisticsVectorImageFilter.h" @@ -131,11 +131,11 @@ public: protected: MaximumAutocorrelationFactorImageFilter(); - virtual ~MaximumAutocorrelationFactorImageFilter() {} + ~MaximumAutocorrelationFactorImageFilter() ITK_OVERRIDE {} - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: MaximumAutocorrelationFactorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.txx index 1963ebb2e8424a342a90194630811e252c69a43e..3b86aa0003e54c04de7641fd09365163fa10fa40 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMaximumAutocorrelationFactorImageFilter_txx -#define __otbMaximumAutocorrelationFactorImageFilter_txx +#ifndef otbMaximumAutocorrelationFactorImageFilter_txx +#define otbMaximumAutocorrelationFactorImageFilter_txx #include "otbMaximumAutocorrelationFactorImageFilter.h" #include "otbMultiChannelExtractROI.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h index 54faab6f56a43ae26066d91259a304290c4c4017..5380f1368c136dc2430c35ea0376907fc063f9e5 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNAPCAImageFilter_h -#define __otbNAPCAImageFilter_h +#ifndef otbNAPCAImageFilter_h +#define otbNAPCAImageFilter_h #include "otbMNFImageFilter.h" @@ -86,10 +86,10 @@ public: protected: NAPCAImageFilter() { } - virtual ~NAPCAImageFilter () { } + ~NAPCAImageFilter () ITK_OVERRIDE { } /** Specific functionality of NAPCA */ - virtual void GenerateTransformationMatrix(); + void GenerateTransformationMatrix() ITK_OVERRIDE; }; // end of class } // end of namespace otb diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.txx index d7797ed1122013b62960a5a3889947ed31c7d7a0..e7539acabda3d9c50996ed217e8c35b5a51cbf4b 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNAPCAImageFilter_txx -#define __otbNAPCAImageFilter_txx +#ifndef otbNAPCAImageFilter_txx +#define otbNAPCAImageFilter_txx #include "otbNAPCAImageFilter.h" #include "itkMacro.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h index becc1d390e33cf237a0439e24ba320179fb519cc..bcfa3e4bffdd32c7a96bae7a5e086a03d486bb29 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeInnerProductPCAImageFilter_h -#define __otbNormalizeInnerProductPCAImageFilter_h +#ifndef otbNormalizeInnerProductPCAImageFilter_h +#define otbNormalizeInnerProductPCAImageFilter_h #include "itkInPlaceImageFilter.h" #include "otbStreamingStatisticsVectorImageFilter.h" @@ -81,7 +81,7 @@ public: protected: NormalizeInnerProductPCAImageFilter(); - virtual ~NormalizeInnerProductPCAImageFilter() {} + ~NormalizeInnerProductPCAImageFilter() ITK_OVERRIDE {} /** NormalizeInnerProductPCAImageFilter can produce an image which is a different * resolution than its input image. As such, NormalizeInnerProductPCAImageFilter @@ -91,7 +91,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** NormalizeInnerProductPCAImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -103,12 +103,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** BeforeThreadedGenerateData method */ - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.txx index 46eabc8d37970cefa72a33d416bc4cd8f07d8fa4..a141b76474cbf90ee0c092f5ab62a6c891b86b71 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeInnerProductPCAImageFilter_txx -#define __otbNormalizeInnerProductPCAImageFilter_txx +#ifndef otbNormalizeInnerProductPCAImageFilter_txx +#define otbNormalizeInnerProductPCAImageFilter_txx #include "otbNormalizeInnerProductPCAImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h index 5ef212dc848e40ed40fd7e16299355ba8df84f77..4c992e02d2f9329ac82021894c70b066783354da 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPCAImageFilter_h -#define __otbPCAImageFilter_h +#ifndef otbPCAImageFilter_h +#define otbPCAImageFilter_h #include "otbMacro.h" #include "otbMatrixImageFilter.h" @@ -158,7 +158,7 @@ public: protected: PCAImageFilter(); - virtual ~PCAImageFilter() { } + ~PCAImageFilter() ITK_OVERRIDE { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -168,14 +168,14 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** GenerateData * Through a filter of filter structure */ - virtual void GenerateData (); + void GenerateData () ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Internal methods */ virtual void ForwardGenerateOutputInformation(); @@ -216,4 +216,4 @@ private: #include "otbPCAImageFilter.txx" #endif -#endif // __otbPCAImageFilter_h +#endif // otbPCAImageFilter_h diff --git a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx index 69d298cd1236a192455963754db86a79d4aaacf9..8a37fd98d97fc4946207ad566ad8b2937c8d929b 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPCAImageFilter_txx -#define __otbPCAImageFilter_txx +#ifndef otbPCAImageFilter_txx +#define otbPCAImageFilter_txx #include "otbPCAImageFilter.h" #include "itkMacro.h" @@ -478,6 +478,6 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > } // end of namespace otb -#endif // __otbPCAImageFilter_txx +#endif // otbPCAImageFilter_txx diff --git a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h index 7cdee419e59024fa1d45f3d6caaf7b657b80035f..ee7b9da200022cdca7c1fd5233492e05b7761a51 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSparseWvltToAngleMapperListFilter_h -#define __otbSparseWvltToAngleMapperListFilter_h +#ifndef otbSparseWvltToAngleMapperListFilter_h +#define otbSparseWvltToAngleMapperListFilter_h #include "otbMath.h" #include "otbImageList.h" @@ -105,16 +105,16 @@ public: protected: SparseWvltToAngleMapperListFilter(); - virtual ~SparseWvltToAngleMapperListFilter() { } + ~SparseWvltToAngleMapperListFilter() ITK_OVERRIDE { } /** Standard itk::ProcessObject subclass method. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /* Internal functions */ virtual bool IsToGenerate ( const ImageConstIteratorVectorType & ) const; diff --git a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.txx index 21e21a0f776c78f808eb027575769f57d12198f2..35c966a414010a0810c9a1c2b3d98ae35e7439d6 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.txx +++ b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSparseWvltToAngleMapperListFilter_txx -#define __otbSparseWvltToAngleMapperListFilter_txx +#ifndef otbSparseWvltToAngleMapperListFilter_txx +#define otbSparseWvltToAngleMapperListFilter_txx #include "otbSparseWvltToAngleMapperListFilter.h" #include <vnl/vnl_math.h> @@ -55,7 +55,7 @@ SparseWvltToAngleMapperListFilter< TInputImageList, TOutputSampleList, VNbInputI { if ( i >= this->GetNumberOfInputs() ) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageListType * > diff --git a/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h b/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h index 22a4c138dd3ba8c6f78698eadef3cbf5dc0d7157..d26cb4c3a03c8830909bc94e1624d48736102822 100644 --- a/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbAffineFunctor_h -#define __otbAffineFunctor_h +#ifndef otbAffineFunctor_h +#define otbAffineFunctor_h namespace otb { diff --git a/Modules/Filtering/ImageManipulation/include/otbAlphaBlendingFunctor.h b/Modules/Filtering/ImageManipulation/include/otbAlphaBlendingFunctor.h index 5201c34ccaef6096e382ab014c13c7d1a71d01fb..5a3e56d0e0e14b6c6dc1066364b6960e7e1f4f91 100644 --- a/Modules/Filtering/ImageManipulation/include/otbAlphaBlendingFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbAlphaBlendingFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAlphaBlendingFunctor_h -#define __otbAlphaBlendingFunctor_h +#ifndef otbAlphaBlendingFunctor_h +#define otbAlphaBlendingFunctor_h #include "itkRGBAPixel.h" namespace otb diff --git a/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h b/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h index b6706bbe4ef9321d84fa17ef3422d28f955035c2..baa08411d89eef7c6da7c03e77629c1da33e5ce8 100644 --- a/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAmplitudeFunctor_h -#define __otbAmplitudeFunctor_h +#ifndef otbAmplitudeFunctor_h +#define otbAmplitudeFunctor_h #include "otbChannelSelectorFunctor.h" @@ -67,17 +67,17 @@ public: } /** Destructor */ - virtual ~AmplitudeFunctor() {} + ~AmplitudeFunctor() ITK_OVERRIDE {} const char *GetDescription() const {return "Amplitude"; } - virtual unsigned int GetOutputSize() const + unsigned int GetOutputSize() const ITK_OVERRIDE { return 1; } - virtual OutputPixelType operator ()(const VectorPixelType& inPixel) const + OutputPixelType operator ()(const VectorPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); @@ -88,13 +88,13 @@ public: return outPixel; } - virtual OutputPixelType operator ()(ScalarType) const + OutputPixelType operator ()(ScalarType) const ITK_OVERRIDE { //FIXME we don't handle the std::complex<> yet itkExceptionMacro(<< "Can't compute amplitude from a scalar value"); } - virtual OutputPixelType operator ()(const RGBPixelType& inPixel) const + OutputPixelType operator ()(const RGBPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); @@ -107,7 +107,7 @@ public: return outPixel; } - virtual OutputPixelType operator ()(const RGBAPixelType& inPixel) const + OutputPixelType operator ()(const RGBAPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h index c2eb3ffbb2c61348f43e1c82e0e8713c8bd06f15..b28324838f3ff2cfe3f654738d84619ed713f056 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodImageFilter_h -#define __otbBinaryFunctorNeighborhoodImageFilter_h +#ifndef otbBinaryFunctorNeighborhoodImageFilter_h +#define otbBinaryFunctorNeighborhoodImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -127,7 +127,7 @@ public: protected: BinaryFunctorNeighborhoodImageFilter(); - virtual ~BinaryFunctorNeighborhoodImageFilter() {} + ~BinaryFunctorNeighborhoodImageFilter() ITK_OVERRIDE {} /** BinaryFunctorNeighborhoodImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -139,13 +139,13 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the inputs requested regions by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.txx index 97fde0633e478757555e1992b4f5307efe8f44c4..b3169949d80a3f289732714706f0b09cccbeed33 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodImageFilter_txx -#define __otbBinaryFunctorNeighborhoodImageFilter_txx +#ifndef otbBinaryFunctorNeighborhoodImageFilter_txx +#define otbBinaryFunctorNeighborhoodImageFilter_txx #include "otbBinaryFunctorNeighborhoodImageFilter.h" #include "itkImageRegionIterator.h" @@ -72,7 +72,7 @@ BinaryFunctorNeighborhoodImageFilter<TInputImage1, TInputImage2, TOutputImage, T { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage1 *>(this->itk::ProcessObject::GetInput(0)); } @@ -85,7 +85,7 @@ BinaryFunctorNeighborhoodImageFilter<TInputImage1, TInputImage2, TOutputImage, T { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage2 *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h index c52e658d07e8960ec9c82436787c68ea2d73ca55..ccd6497f24b6c1f79b91dc2bd7382b37b70d6157 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodVectorImageFilter_h -#define __otbBinaryFunctorNeighborhoodVectorImageFilter_h +#ifndef otbBinaryFunctorNeighborhoodVectorImageFilter_h +#define otbBinaryFunctorNeighborhoodVectorImageFilter_h #include "itkInPlaceImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -116,7 +116,7 @@ public: protected: BinaryFunctorNeighborhoodVectorImageFilter(); - virtual ~BinaryFunctorNeighborhoodVectorImageFilter() {} + ~BinaryFunctorNeighborhoodVectorImageFilter() ITK_OVERRIDE {} /** BinaryFunctorNeighborhoodVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -128,14 +128,14 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.txx index afcbfcce165b6f39edfb5613257cfdc095b086e5..f0519c0a2a930bf3f21839104b9bf0d4e75fb36a 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryFunctorNeighborhoodVectorImageFilter_txx -#define __otbBinaryFunctorNeighborhoodVectorImageFilter_txx +#ifndef otbBinaryFunctorNeighborhoodVectorImageFilter_txx +#define otbBinaryFunctorNeighborhoodVectorImageFilter_txx #include "otbBinaryFunctorNeighborhoodVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h index a327a6bcaa8154be56ef3f328e6e836b60d3cbf8..510bde9e3296895eda8594adc8daaba835e7cdca 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryImageDensityFunction_h -#define __otbBinaryImageDensityFunction_h +#ifndef otbBinaryImageDensityFunction_h +#define otbBinaryImageDensityFunction_h #include "itkImageFunction.h" #include "itkNumericTraits.h" @@ -77,17 +77,17 @@ public: RealType; /** Evalulate the function at specified index */ - virtual RealType EvaluateAtIndex(const IndexType& index) const; + RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate(const PointType& point) const + RealType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + RealType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -106,8 +106,8 @@ public: protected: BinaryImageDensityFunction(); - virtual ~BinaryImageDensityFunction(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BinaryImageDensityFunction() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BinaryImageDensityFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.txx index 332adbdd10cd04351ad48eb6cf418a7d09b32b70..28131a2659a2f667aa169279b39cc987a6ffeada 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.txx @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbBinaryImageDensityFunction_txx -#define __otbBinaryImageDensityFunction_txx +#ifndef otbBinaryImageDensityFunction_txx +#define otbBinaryImageDensityFunction_txx #include "otbBinaryImageDensityFunction.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h index 0f4862f8a315ea5cd918b2460da94d8aa2950c43..c5e5ee56aeda6dc1f7b0b8453784665795a341e1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryImageMinimalBoundingRegionCalculator_h -#define __otbBinaryImageMinimalBoundingRegionCalculator_h +#ifndef otbBinaryImageMinimalBoundingRegionCalculator_h +#define otbBinaryImageMinimalBoundingRegionCalculator_h #include "itkImageToImageFilter.h" #include "itkObjectFactory.h" @@ -67,11 +67,11 @@ protected: /** Constructor */ BinaryImageMinimalBoundingRegionCalculator(); /** Destructor */ - virtual ~BinaryImageMinimalBoundingRegionCalculator() {} + ~BinaryImageMinimalBoundingRegionCalculator() ITK_OVERRIDE {} /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BinaryImageMinimalBoundingRegionCalculator(const Self &); // purposely not implemented void operator =(const Self&); // purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx index c97db4063a32729af7c71b7d3decc4fc46bc303a..a518ebde8b07a461606c1304289dec9ad8e6fa4e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryImageMinimalBoundingRegionCalculator_txx -#define __otbBinaryImageMinimalBoundingRegionCalculator_txx +#ifndef otbBinaryImageMinimalBoundingRegionCalculator_txx +#define otbBinaryImageMinimalBoundingRegionCalculator_txx #include "otbBinaryImageMinimalBoundingRegionCalculator.h" #include "itkImageSliceConstIteratorWithIndex.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h index 79bfe9c030eefec689e15fcf7b053865439dd894..da268eec5416bc061cee8579af0497990b0dec23 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryImageToDensityImageFilter_h -#define __otbBinaryImageToDensityImageFilter_h +#ifndef otbBinaryImageToDensityImageFilter_h +#define otbBinaryImageToDensityImageFilter_h #include "itkImageToImageFilter.h" #include "itkDataObject.h" @@ -74,17 +74,17 @@ public: } /** Main computation method */ - virtual void ThreadedGenerateData(const InputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); - virtual void BeforeThreadedGenerateData(); - virtual void GenerateInputRequestedRegion(); + void ThreadedGenerateData(const InputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void GenerateInputRequestedRegion() ITK_OVERRIDE; protected: /** Constructor */ BinaryImageToDensityImageFilter(); /** Destructor */ - virtual ~BinaryImageToDensityImageFilter(); + ~BinaryImageToDensityImageFilter() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BinaryImageToDensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.txx index 48ef72e5c65c138c5d28888fcd3b72091ae8bc30..d0bef89f06de73221383950ea124ea1562c04a6b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinaryImageToDensityImageFilter_txx -#define __otbBinaryImageToDensityImageFilter_txx +#ifndef otbBinaryImageToDensityImageFilter_txx +#define otbBinaryImageToDensityImageFilter_txx #include "otbBinaryImageToDensityImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbBinarySpectralAngleFunctor.h b/Modules/Filtering/ImageManipulation/include/otbBinarySpectralAngleFunctor.h index b56db8e7c9530c240b59093499f78d68cdf94c3b..be4bfefdc675f3cd978daaa7ddcea31d5374c15d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinarySpectralAngleFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinarySpectralAngleFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBinarySpectralAngleFunctor_h -#define __otbBinarySpectralAngleFunctor_h +#ifndef otbBinarySpectralAngleFunctor_h +#define otbBinarySpectralAngleFunctor_h #include <algorithm> #include "otbMath.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h index 7836509dd106b9d7a231c641c08946bb8bae2fe9..78e32f8c002070ceb44daf5d5aef394347f3b5f6 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoxAndWhiskerImageFilter_h -#define __otbBoxAndWhiskerImageFilter_h +#ifndef otbBoxAndWhiskerImageFilter_h +#define otbBoxAndWhiskerImageFilter_h #include "itkMacro.h" #include "itkUnaryFunctorImageFilter.h" @@ -93,12 +93,12 @@ public: protected: BoxAndWhiskerImageFilter (); - virtual ~BoxAndWhiskerImageFilter () {} + ~BoxAndWhiskerImageFilter () ITK_OVERRIDE {} /** Main computation method implemented as a multithreaded filter */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); - virtual void GenerateOutputInformation(); - virtual void AllocateOutputs(); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void AllocateOutputs() ITK_OVERRIDE; /** Perform the outlier detection */ PixelType PerformBoxAndWhiskerDetection(const PixelType& pixel); diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx index f15af8aef16fbf0764a3f9d9b561276898ddadf6..6c7b62d8b55d11c83720457e5fbefa7a1cdfa569 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoxAndWhiskerImageFilter_txx -#define __otbBoxAndWhiskerImageFilter_txx +#ifndef otbBoxAndWhiskerImageFilter_txx +#define otbBoxAndWhiskerImageFilter_txx #include <vector> #include <algorithm> diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h index b38b428bdf596f029981f2145a7ffc13fea92400..29b2abf7a9439a5a567fb44beb7a477ec5171385 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChangeInformationImageFilter_h -#define __otbChangeInformationImageFilter_h +#ifndef otbChangeInformationImageFilter_h +#define otbChangeInformationImageFilter_h #include "itkChangeInformationImageFilter.h" #include "otbMetaDataKey.h" @@ -66,10 +66,10 @@ public: protected: ChangeInformationImageFilter() {} - virtual ~ChangeInformationImageFilter() {} + ~ChangeInformationImageFilter() ITK_OVERRIDE {} /** Apply changes to the output image metadata. */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: ChangeInformationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx index 319684064c4caf4a83c8be8b7fd460cae13d920d..6f694fccc86de223a0c60d3b296844f575314161 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChangeInformationImageFilter_txx -#define __otbChangeInformationImageFilter_txx +#ifndef otbChangeInformationImageFilter_txx +#define otbChangeInformationImageFilter_txx #include "otbChangeInformationImageFilter.h" #include "itkMetaDataObject.h" @@ -75,7 +75,7 @@ ChangeInformationImageFilter<TInputImage> // enable this key for metadata change m_ChangedKeys.insert(key); itk::MetaDataDictionary &dict = this->GetMetaDataDictionary(); - if (value == NULL) + if (value == ITK_NULLPTR) { // Remove meta-data from dictionary this->RemoveKeyFromDictionary(dict,key); diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h index d0c779983caa77795bdd6153f754f9c0dd8b9c32..5cdf24dec3dbd351b84cd3503e045accbee4956c 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChangeLabelImageFilter_h -#define __otbChangeLabelImageFilter_h +#ifndef otbChangeLabelImageFilter_h +#define otbChangeLabelImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkConceptChecking.h" @@ -162,11 +162,11 @@ public: protected: ChangeLabelImageFilter(); - virtual ~ChangeLabelImageFilter() {} + ~ChangeLabelImageFilter() ITK_OVERRIDE {} /** Generate the output information missing */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ChangeLabelImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.txx index 4d3700309118d20c16a9d1016af5c1fa3436897e..dc5438737b6ad71b39a981de477694b9c868886d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChangeLabelImageFilter_txx -#define __otbChangeLabelImageFilter_txx +#ifndef otbChangeLabelImageFilter_txx +#define otbChangeLabelImageFilter_txx #include "otbChangeLabelImageFilter.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h index 2aea702ab130b28b767192ebf034042b7a67dc2d..6767be3145522bd42179aca577ed73c7a970ea48 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbChangeNoDataValueFilter_h -#define __otbChangeNoDataValueFilter_h +#ifndef otbChangeNoDataValueFilter_h +#define otbChangeNoDataValueFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkMetaDataObject.h" @@ -134,10 +134,10 @@ protected: ChangeNoDataValueFilter() {} - virtual ~ChangeNoDataValueFilter() + ~ChangeNoDataValueFilter() ITK_OVERRIDE {} - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h index 3679dd4446684962cc9d905595711c19638f8ac9..fd2c6a54abef808a185ea0f5962b517fcf2a6040 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbClampImageFilter_h -#define __otbClampImageFilter_h +#ifndef otbClampImageFilter_h +#define otbClampImageFilter_h #include "itkImageToImageFilter.h" @@ -100,8 +100,8 @@ public: protected: ClampImageFilter(); - virtual ~ClampImageFilter() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ClampImageFilter() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ClampImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -114,9 +114,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ); + itk::ThreadIdType threadId ) ITK_OVERRIDE; - void GenerateOutputInformation(void) + void GenerateOutputInformation(void) ITK_OVERRIDE { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx index 89abe23b2229df95e90592c2b1b8954297d1aeff..cb1f7fcab8d2b995c2c77f4c2c22e884b8ac81e7 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbClampImageFilter_txx -#define __otbClampImageFilter_txx +#ifndef otbClampImageFilter_txx +#define otbClampImageFilter_txx #include "otbClampImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h index 900df35a42744956acbdf0ce2c2c66c74ae12043..8a2adf3c19774633f0b9e33007fbb0b28ec9eff1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbClampVectorImageFilter_h -#define __otbClampVectorImageFilter_h +#ifndef otbClampVectorImageFilter_h +#define otbClampVectorImageFilter_h #include "itkImageToImageFilter.h" @@ -102,8 +102,8 @@ public: protected: ClampVectorImageFilter(); - virtual ~ClampVectorImageFilter() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ClampVectorImageFilter() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ClampVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -116,9 +116,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ); + itk::ThreadIdType threadId ) ITK_OVERRIDE; - void GenerateOutputInformation(void) + void GenerateOutputInformation(void) ITK_OVERRIDE { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.txx index e6893ab2138af0f9fed3b5e453e01a69d27b746b..d6259e7235988a0210a6cc92e733c9220c2f2dbd 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.txx @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbClampVectorImageFilter_txx -#define __otbClampVectorImageFilter_txx +#ifndef otbClampVectorImageFilter_txx +#define otbClampVectorImageFilter_txx #include "otbClampVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h index a4866f222cdb4ca64c80bf8286bba85467245de8..0839c75516f9b871eb776a81440b675895708824 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateScalarValueImageFilter_h -#define __otbConcatenateScalarValueImageFilter_h +#ifndef otbConcatenateScalarValueImageFilter_h +#define otbConcatenateScalarValueImageFilter_h #include "itkMacro.h" #include "itkUnaryFunctorImageFilter.h" @@ -138,11 +138,11 @@ public: protected: ConcatenateScalarValueImageFilter(); - virtual ~ConcatenateScalarValueImageFilter() {} + ~ConcatenateScalarValueImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: ConcatenateScalarValueImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.txx index e2c8ff1ccc286f3980c8b80aaa7848f429bc468f..40099dc5445f8cbfae6e9d7b09487fa8a76c0549 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateScalarValueImageFilter_txx -#define __otbConcatenateScalarValueImageFilter_txx +#ifndef otbConcatenateScalarValueImageFilter_txx +#define otbConcatenateScalarValueImageFilter_txx #include "otbConcatenateScalarValueImageFilter.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h index 6e179ae3cf56514f0e909142720d9f4ce94d6e8e..12f290d9810d18b8aa6dbe2b273890bee4b9bbdb 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateVectorImageFilter_h -#define __otbConcatenateVectorImageFilter_h +#ifndef otbConcatenateVectorImageFilter_h +#define otbConcatenateVectorImageFilter_h #include "itkImageToImageFilter.h" #include "otbVectorImage.h" @@ -92,13 +92,13 @@ protected: /** Constructor. */ ConcatenateVectorImageFilter(); /** Destructor. */ - virtual ~ConcatenateVectorImageFilter(); - virtual void GenerateOutputInformation(); - virtual void BeforeThreadedGenerateData(); + ~ConcatenateVectorImageFilter() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Main computation method. */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ConcatenateVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.txx index d956787de224486cc914c07ad6bc65faf6fdbcd7..24ecb274f8def8dec19d742975786e979ef34843 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateVectorImageFilter_txx -#define __otbConcatenateVectorImageFilter_txx +#ifndef otbConcatenateVectorImageFilter_txx +#define otbConcatenateVectorImageFilter_txx #include "otbConcatenateVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h index 62bbeff2bb2ac17fbce7c6c4f1b7b9a5597f2189..3f6a73275cac366f5f6b4136a5193db688f9c47e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h +++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbEuclideanDistanceMetricWithMissingValue_h -#define __otbEuclideanDistanceMetricWithMissingValue_h +#ifndef otbEuclideanDistanceMetricWithMissingValue_h +#define otbEuclideanDistanceMetricWithMissingValue_h #include "otbEuclideanDistanceMetricWithMissingValuePow2.h" @@ -68,13 +68,13 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const + double Evaluate(const TVector& x) const ITK_OVERRIDE { return ::vcl_sqrt(Superclass::Evaluate(x)); } /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const + double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE { return ::vcl_sqrt(Superclass::Evaluate(x1, x2)); } @@ -95,7 +95,7 @@ public: protected: EuclideanDistanceMetricWithMissingValue() {} - virtual ~EuclideanDistanceMetricWithMissingValue() {} + ~EuclideanDistanceMetricWithMissingValue() ITK_OVERRIDE {} }; // end of class } // end namespace statistics diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h index 6aa3b2e47cc44848247961a76f5844ff5965643b..08c9283657ad4497a21349b2e408a7aebcb67997 100644 --- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h +++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbEuclideanDistanceMetricWithMissingValuePow2_h -#define __otbEuclideanDistanceMetricWithMissingValuePow2_h +#ifndef otbEuclideanDistanceMetricWithMissingValuePow2_h +#define otbEuclideanDistanceMetricWithMissingValuePow2_h #include "itkEuclideanDistanceMetric.h" @@ -67,10 +67,10 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const; + double Evaluate(const TVector& x) const ITK_OVERRIDE; /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const; + double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE; /** Gets the cooridnate distance between a and b. NOTE: a and b * should be type of component */ @@ -91,7 +91,7 @@ public: protected: EuclideanDistanceMetricWithMissingValuePow2() {} - virtual ~EuclideanDistanceMetricWithMissingValuePow2() {} + ~EuclideanDistanceMetricWithMissingValuePow2() ITK_OVERRIDE {} }; // end of class } // end namespace statistics diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx index 37c2115f0f2869d4b26bc0490875db58a67eb551..c581cc6c21be71d53bc265dcd6a723513da0e7fd 100644 --- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx +++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx @@ -18,9 +18,10 @@ =========================================================================*/ -#ifndef __otbEuclideanDistanceMetricWithMissingValuePow2_txx -#define __otbEuclideanDistanceMetricWithMissingValuePow2_txx +#ifndef otbEuclideanDistanceMetricWithMissingValuePow2_txx +#define otbEuclideanDistanceMetricWithMissingValuePow2_txx +#include "otbEuclideanDistanceMetricWithMissingValuePow2.h" #include "itkMeasurementVectorTraits.h" namespace otb { diff --git a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h index 2c948872edaced2683511424babdae1b35ab8d41..ac156f9e0576f291587dcef46b10cfd469e69b38 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h +++ b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbFlexibleDistanceWithMissingValue_h -#define __otbFlexibleDistanceWithMissingValue_h +#ifndef otbFlexibleDistanceWithMissingValue_h +#define otbFlexibleDistanceWithMissingValue_h #include "otbEuclideanDistanceMetricWithMissingValuePow2.h" @@ -71,10 +71,10 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const; + double Evaluate(const TVector& x) const ITK_OVERRIDE; /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const; + double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE; /** Gets the cooridnate distance between a and b. NOTE: a and b * should be type of component */ @@ -99,7 +99,7 @@ public: protected: FlexibleDistanceWithMissingValue() {} - virtual ~FlexibleDistanceWithMissingValue() {} + ~FlexibleDistanceWithMissingValue() ITK_OVERRIDE {} }; // end of class /** Static variable instanciation */ diff --git a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx index 9bdb74433f09aa97e0fbd201a90b5b30f3861676..b1d0e5ba6a46e12b8f983773b1c7f5caeb219992 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx +++ b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx @@ -18,9 +18,10 @@ =========================================================================*/ -#ifndef __otbFlexibleDistanceWithMissingValue_txx -#define __otbFlexibleDistanceWithMissingValue_txx +#ifndef otbFlexibleDistanceWithMissingValue_txx +#define otbFlexibleDistanceWithMissingValue_txx +#include "otbFlexibleDistanceWithMissingValue.h" #include "itkNumericTraits.h" namespace otb { diff --git a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h index 9a6331b18a641bbce69dcfee59622cff88066d07..f387bc8e39d3ff97d05a66e1a53a9811efbc2d34 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFunctionWithNeighborhoodToImageFilter_h -#define __otbFunctionWithNeighborhoodToImageFilter_h +#ifndef otbFunctionWithNeighborhoodToImageFilter_h +#define otbFunctionWithNeighborhoodToImageFilter_h #include "otbFunctionToImageFilter.h" @@ -121,11 +121,11 @@ public: protected: FunctionWithNeighborhoodToImageFilter(); - virtual ~FunctionWithNeighborhoodToImageFilter(){} + ~FunctionWithNeighborhoodToImageFilter() ITK_OVERRIDE{} - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** SpatialFunctionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -138,7 +138,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: FunctionWithNeighborhoodToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.txx index 1343d615ca13f5f8dee6cd2f15f573ad715b9200..416d644d7c44de5512f9706a1af02e19622bff27 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFunctionWithNeighborhoodToImageFilter_txx -#define __otbFunctionWithNeighborhoodToImageFilter_txx +#ifndef otbFunctionWithNeighborhoodToImageFilter_txx +#define otbFunctionWithNeighborhoodToImageFilter_txx #include "otbFunctionWithNeighborhoodToImageFilter.h" #include "otbMacro.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h index 30d508aa21c38177bf93e87d11990886f5ed95a5..d6e9e9eb284b3c758d05e77b79a82e58cf04017d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGridResampleImageFilter_h -#define __otbGridResampleImageFilter_h +#ifndef otbGridResampleImageFilter_h +#define otbGridResampleImageFilter_h #include "itkImageToImageFilter.h" @@ -134,23 +134,23 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); /** Method Compute the Modified Time based on changed to the components. */ - itk::ModifiedTimeType GetMTime(void) const; + itk::ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; protected: GridResampleImageFilter(); /** Destructor */ - virtual ~GridResampleImageFilter() {}; + ~GridResampleImageFilter() ITK_OVERRIDE {}; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; inline void CastPixelWithBoundsChecking( const InterpolatorOutputType& value, const InterpolatorComponentType& minComponent, @@ -183,7 +183,7 @@ protected: } - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GridResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx index 2f0ec7cf577c1da5172980fcf0336e2a442e2fce..f40fbd47e3bf33220aa4b34acd55ba3b68116af0 100644 --- a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGridResampleImageFilter_txx -#define __otbGridResampleImageFilter_txx +#ifndef otbGridResampleImageFilter_txx +#define otbGridResampleImageFilter_txx #include "otbGridResampleImageFilter.h" @@ -238,8 +238,8 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision> } // Compute ReachableOutputRegion - // InputImage buffered region corresponds to a region of the ouptut - // image. Computing it beforehand allows to save IsInsideBuffer + // InputImage buffered region corresponds to a region of the output + // image. Computing it beforehand allows saving IsInsideBuffer // calls in the interpolation loop // Compute the padding due to the interpolator diff --git a/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h b/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h index ea5d1367d52d02e831831628634f6f2394eacdf3..cfaeaa271e6750c8147c0219eb5456398e75614b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHillShadingFilter_h -#define __otbHillShadingFilter_h +#ifndef otbHillShadingFilter_h +#define otbHillShadingFilter_h #include "otbUnaryFunctorNeighborhoodImageFilter.h" #include "otbHillShadingFunctor.h" @@ -79,7 +79,7 @@ public: protected: HillShadingFilter() {} - virtual ~HillShadingFilter() {} + ~HillShadingFilter() ITK_OVERRIDE {} private: HillShadingFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbHillShadingFunctor.h b/Modules/Filtering/ImageManipulation/include/otbHillShadingFunctor.h index 4a62f6fd29854fead54871b1adb0defeb5dbf8dc..415b2c39dbce40723f01458d0ec02f374ad609f9 100644 --- a/Modules/Filtering/ImageManipulation/include/otbHillShadingFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbHillShadingFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHillShadingFunctor_h -#define __otbHillShadingFunctor_h +#ifndef otbHillShadingFunctor_h +#define otbHillShadingFunctor_h #include "itkNumericTraits.h" #include "otbMath.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h index a790b37a0ea031c3695ac7fcb8058d313f51e0ea..c15518d009d35d92ef6781a2d6bed786e1848ccb 100644 --- a/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToNoDataMaskFilter_h -#define __otbImageToNoDataMaskFilter_h +#ifndef otbImageToNoDataMaskFilter_h +#define otbImageToNoDataMaskFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkMetaDataObject.h" @@ -130,10 +130,10 @@ protected: ImageToNoDataMaskFilter() {} - virtual ~ImageToNoDataMaskFilter() + ~ImageToNoDataMaskFilter() ITK_OVERRIDE {} - virtual void BeforeThreadedGenerateData() + void BeforeThreadedGenerateData() ITK_OVERRIDE { std::vector<bool> noDataValueAvailable; std::vector<double> noDataValues; diff --git a/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h b/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h index 06178f8be9aa7eb9975c6f79f6e9a9a68586f222..566a1d1aa2428bc33b3e967bad112deb831a5d87 100644 --- a/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToVectorImageCastFilter_h -#define __otbImageToVectorImageCastFilter_h +#ifndef otbImageToVectorImageCastFilter_h +#define otbImageToVectorImageCastFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkVariableLengthVector.h" @@ -93,15 +93,15 @@ protected: /// Constructor ImageToVectorImageCastFilter() {} /// Detructor - virtual ~ImageToVectorImageCastFilter() {} + ~ImageToVectorImageCastFilter() ITK_OVERRIDE {} /// Additionnal output information for allocation - virtual void GenerateOutputInformation(void) + void GenerateOutputInformation(void) ITK_OVERRIDE { Superclass::GenerateOutputInformation(); this->GetOutput()->SetNumberOfComponentsPerPixel(1); } /// Copy output requested region to input requested region - virtual void GenerateInputRequestedRegion(void) + void GenerateInputRequestedRegion(void) ITK_OVERRIDE { if (this->GetInput()) { diff --git a/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h index bb878ab949685cd5d538878539007f0592ff964e..7a201934d0d2d8755519b548b099518425bc2157 100644 --- a/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalGradientVectorImageFilter_h -#define __otbLocalGradientVectorImageFilter_h +#ifndef otbLocalGradientVectorImageFilter_h +#define otbLocalGradientVectorImageFilter_h #include "otbUnaryFunctorNeighborhoodVectorImageFilter.h" @@ -93,7 +93,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - virtual ~LocalGradientVectorImageFilter() { } + ~LocalGradientVectorImageFilter() ITK_OVERRIDE { } private: LocalGradientVectorImageFilter( const Self & ); // Not implemented @@ -103,4 +103,4 @@ private: } // end of namespace otb -#endif // __otbLocalGradientVectorImageFilter_h +#endif // otbLocalGradientVectorImageFilter_h diff --git a/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h index 454b11df33b6a8276d70dab2976785a52ae2c060..e21f5dd9268f8d46dce4f72fb3e2fde2ae619c3f 100644 --- a/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLog10ThresholdedImageFilter_h -#define __otbLog10ThresholdedImageFilter_h +#ifndef otbLog10ThresholdedImageFilter_h +#define otbLog10ThresholdedImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -101,7 +101,7 @@ public: } protected: Log10ThresholdedImageFilter() {} - virtual ~Log10ThresholdedImageFilter() {} + ~Log10ThresholdedImageFilter() ITK_OVERRIDE {} private: Log10ThresholdedImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbMaskedIteratorDecorator.txx b/Modules/Filtering/ImageManipulation/include/otbMaskedIteratorDecorator.txx index c4c0fed42bef02f0998c15f6bb06b528247aa1c8..ce75332a0e3badf3e9770f29a57d2dff2db69ec0 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMaskedIteratorDecorator.txx +++ b/Modules/Filtering/ImageManipulation/include/otbMaskedIteratorDecorator.txx @@ -31,7 +31,7 @@ MaskedIteratorDecorator<TIteratorType,TMaskIteratorType> const RegionType& region) { m_ItImage = TIteratorType(image,region); - if (mask == NULL) + if (mask == ITK_NULLPTR) { m_UseMask = false; } diff --git a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h index ab3e1d38111e100fb306f9ff6906a165502e06d7..d3e1a7a256fab57be4bf2b98245200a93deaf3df 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMatrixImageFilter_h -#define __otbMatrixImageFilter_h +#ifndef otbMatrixImageFilter_h +#define otbMatrixImageFilter_h #include "itkImageToImageFilter.h" #include "otbMath.h" @@ -108,13 +108,13 @@ public: protected: MatrixImageFilter(); - virtual ~MatrixImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MatrixImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Before threaded generate data method. */ - void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** MatrixImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -125,7 +125,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: MatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.txx index c2146680b251546e6119b3788eeb2a5aae2ae161..c8d6053b95500b0366dbd187025a837c26c5c2a1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMatrixImageFilter_txx -#define __otbMatrixImageFilter_txx +#ifndef otbMatrixImageFilter_txx +#define otbMatrixImageFilter_txx #include "otbMatrixImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbMeanFunctor.h b/Modules/Filtering/ImageManipulation/include/otbMeanFunctor.h index 9f513fbf195bbfb271fe4fc66d5f87cf0c07ad44..df5baf5c671c33db76746837c086977bbdad3668 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMeanFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbMeanFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanFunctor_h -#define __otbMeanFunctor_h +#ifndef otbMeanFunctor_h +#define otbMeanFunctor_h namespace otb { diff --git a/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h index 3f6cfbaf029dc5f12eabe1893f95ca00e5604fe7..5e0a679a6e5cfa465be314f84d775cdcbfbed34e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiplyByScalarImageFilter_h -#define __otbMultiplyByScalarImageFilter_h +#ifndef otbMultiplyByScalarImageFilter_h +#define otbMultiplyByScalarImageFilter_h #include "itkUnaryFunctorImageFilter.h" @@ -98,7 +98,7 @@ public: } protected: MultiplyByScalarImageFilter() {} - virtual ~MultiplyByScalarImageFilter() {} + ~MultiplyByScalarImageFilter() ITK_OVERRIDE {} private: MultiplyByScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h index 18f1465b0941b453bd5c9330dda92e2873f69d4f..858719d0d7702ee41de2e3611a7123127f08f3a0 100644 --- a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNRIBandImagesToOneNComplexBandsImage_h -#define __otbNRIBandImagesToOneNComplexBandsImage_h +#ifndef otbNRIBandImagesToOneNComplexBandsImage_h +#define otbNRIBandImagesToOneNComplexBandsImage_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -69,13 +69,13 @@ public: protected: NRIBandImagesToOneNComplexBandsImage(); - virtual ~NRIBandImagesToOneNComplexBandsImage() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~NRIBandImagesToOneNComplexBandsImage() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateOutputInformation(void); - void BeforeThreadedGenerateData(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: NRIBandImagesToOneNComplexBandsImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx index 46abbf79efee49136fe17fc0be5d36e9e6ae13cf..260801206aec72c3d1cdf07d5fda42dddcadccd6 100644 --- a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx +++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNRIBandImagesToOneNComplexBandsImage_txx -#define __otbNRIBandImagesToOneNComplexBandsImage_txx +#ifndef otbNRIBandImagesToOneNComplexBandsImage_txx +#define otbNRIBandImagesToOneNComplexBandsImage_txx #include "otbNRIBandImagesToOneNComplexBandsImage.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h index 745199721496ff2f6b9797cfa5e031ab3ec4ebde..2479807232b9710ca272df8c88c6b51282f3db11 100644 --- a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOneRIBandImageToOneComplexBandImage_h -#define __otbOneRIBandImageToOneComplexBandImage_h +#ifndef otbOneRIBandImageToOneComplexBandImage_h +#define otbOneRIBandImageToOneComplexBandImage_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -69,12 +69,12 @@ public: protected: OneRIBandImageToOneComplexBandImage(); - virtual ~OneRIBandImageToOneComplexBandImage() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~OneRIBandImageToOneComplexBandImage() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: OneRIBandImageToOneComplexBandImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx index 8a7003a8eec8066ed212245a9ff0162310f38499..a9bb0c03528df7ee4f82cc3cab02b851155bb40d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx +++ b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOneRIBandImageToOneComplexBandImage_txx -#define __otbOneRIBandImageToOneComplexBandImage_txx +#ifndef otbOneRIBandImageToOneComplexBandImage_txx +#define otbOneRIBandImageToOneComplexBandImage_txx #include "otbOneRIBandImageToOneComplexBandImage.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h index 7c950734ec9ee0327ed0dac2e32510637dcab489..45b0b251bcd2d5f573bc11c64bd2bbf92be6e073 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPerBandVectorImageFilter_h -#define __otbPerBandVectorImageFilter_h +#ifndef otbPerBandVectorImageFilter_h +#define otbPerBandVectorImageFilter_h #include "otbVectorImageToImageListFilter.h" #include "otbImageListToImageListApplyFilter.h" @@ -91,18 +91,18 @@ public: itkSetMacro(OutputIndex, unsigned int); itkGetMacro(OutputIndex, unsigned int); - virtual void GenerateInputRequestedRegion(void); - virtual void GenerateOutputInformation(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) ITK_OVERRIDE; protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ PerBandVectorImageFilter(); /** Destructor */ - virtual ~PerBandVectorImageFilter() {} + ~PerBandVectorImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PerBandVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.txx index 2687b4a8066326de157f6dd6c78589077e65ef60..b29893160f8f1e0c8232dbdd1105dd5c45df5bef 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPerBandVectorImageFilter_txx -#define __otbPerBandVectorImageFilter_txx +#ifndef otbPerBandVectorImageFilter_txx +#define otbPerBandVectorImageFilter_txx #include "otbPerBandVectorImageFilter.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h b/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h index 2dd917adb48d7ce19a4b4545172be509f5cab7c3..c7e12a456eb8ddda5ca28c5531e3a0b91c13f5a4 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPhaseFunctor_h -#define __otbPhaseFunctor_h +#ifndef otbPhaseFunctor_h +#define otbPhaseFunctor_h #include "otbChannelSelectorFunctor.h" @@ -67,17 +67,17 @@ public: } /** Destructor */ - virtual ~PhaseFunctor() {} + ~PhaseFunctor() ITK_OVERRIDE {} const char *GetDescription() const {return "Phase"; } - virtual unsigned int GetOutputSize() const + unsigned int GetOutputSize() const ITK_OVERRIDE { return 1; } - virtual OutputPixelType operator ()(const VectorPixelType& inPixel) const + OutputPixelType operator ()(const VectorPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); @@ -88,13 +88,13 @@ public: return outPixel; } - virtual OutputPixelType operator ()(ScalarType /*inPixel*/) const + OutputPixelType operator ()(ScalarType /*inPixel*/) const ITK_OVERRIDE { //FIXME we don't handle the std::complex<> yet itkExceptionMacro(<< "Can't compute amplitude from a scalar value"); } - virtual OutputPixelType operator ()(const RGBPixelType& inPixel) const + OutputPixelType operator ()(const RGBPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); @@ -106,7 +106,7 @@ public: return outPixel; } - virtual OutputPixelType operator ()(const RGBAPixelType& inPixel) const + OutputPixelType operator ()(const RGBAPixelType& inPixel) const ITK_OVERRIDE { OutputPixelType outPixel; outPixel.SetSize(1); diff --git a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h index edf9d121853e160fed27683ba91cb1a3a40ebca3..8e7c25c6446268ea672d4e9397703f2b9d60d377 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbPrintableImageFilter_h -#define __otbPrintableImageFilter_h +#ifndef otbPrintableImageFilter_h +#define otbPrintableImageFilter_h #include "otbImage.h" #include "itkImageToImageFilter.h" @@ -160,7 +160,7 @@ public: itk::ImageToImageFilter); /** Display */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; void SetChannel(unsigned int channel); const ChannelsType GetChannels(void) const; @@ -231,14 +231,14 @@ public: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; protected: PrintableImageFilter(); void BeforeGenerateData(); - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.txx index 146c65fd025850e33d745e3efd0dd67eca88d2d9..ad4143123da0127e5e55674c85586e5cb3ca1f65 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPrintableImageFilter_txx -#define __otbPrintableImageFilter_txx +#ifndef otbPrintableImageFilter_txx +#define otbPrintableImageFilter_txx #include "otbPrintableImageFilter.h" @@ -80,7 +80,7 @@ PrintableImageFilter<TInputImage, TMaskImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h index e3aed3ade939c53d7f17c42e0529a4b0de7b408c..4a9a5d889e4fa0c1bc9dff3940a01024c982a754 100644 --- a/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRealAndImaginaryImageToComplexImageFilter_h -#define __otbRealAndImaginaryImageToComplexImageFilter_h +#ifndef otbRealAndImaginaryImageToComplexImageFilter_h +#define otbRealAndImaginaryImageToComplexImageFilter_h #include "itkBinaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -113,7 +113,7 @@ public: protected: RealAndImaginaryImageToComplexImageFilter() {} - virtual ~RealAndImaginaryImageToComplexImageFilter() {} + ~RealAndImaginaryImageToComplexImageFilter() ITK_OVERRIDE {} private: RealAndImaginaryImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h index 9525b667dc36b64a1dfea3aae0c6881cf7b5536d..d17b5a9b1181b65f705b2d378d3f5bf2d45f483d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRealImageToComplexImageFilter_h -#define __otbRealImageToComplexImageFilter_h +#ifndef otbRealImageToComplexImageFilter_h +#define otbRealImageToComplexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -89,7 +89,7 @@ public: protected: RealImageToComplexImageFilter() {} - virtual ~RealImageToComplexImageFilter() {} + ~RealImageToComplexImageFilter() ITK_OVERRIDE {} private: RealImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h b/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h index 7341aadfc7f8b4c4090db0d3bc7057a947486814..faaf39a8066e5c9c8e5cce737f553688d812938d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h +++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbShiftScaleImageAdaptor_h -#define __otbShiftScaleImageAdaptor_h +#ifndef otbShiftScaleImageAdaptor_h +#define otbShiftScaleImageAdaptor_h #include "vnl/vnl_math.h" #include "itkImageAdaptor.h" @@ -163,7 +163,7 @@ public: protected: ShiftScaleImageAdaptor() {} - virtual ~ShiftScaleImageAdaptor() {} + ~ShiftScaleImageAdaptor() ITK_OVERRIDE {} private: ShiftScaleImageAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h index 431bd73669855d003eac211273c4166e93e8176f..7834dde1e2f8084cc7ba18177d6632e86c4ae858 100644 --- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShiftScaleImageFilter_h -#define __otbShiftScaleImageFilter_h +#ifndef otbShiftScaleImageFilter_h +#define otbShiftScaleImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkVariableLengthVector.h" @@ -194,16 +194,16 @@ public: protected: ShiftScaleVectorImageFilter() {} - virtual ~ShiftScaleVectorImageFilter() {} + ~ShiftScaleVectorImageFilter() ITK_OVERRIDE {} /** Process to execute before entering the multithreaded section */ - void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; /** Generate output information */ - void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region */ - void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; private: ShiftScaleVectorImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.txx index 4b2edaa7caa7d1f8f154d754108e8e4e2e4b10c7..3882ff2d8259779afc9f573dc430ce3db679d4f7 100644 --- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShiftScaleVectorImageFilter_txx -#define __otbShiftScaleVectorImageFilter_txx +#ifndef otbShiftScaleVectorImageFilter_txx +#define otbShiftScaleVectorImageFilter_txx #include "otbShiftScaleVectorImageFilter.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h index b8cf7b4782d1de9083d0ac740cecfcaa88405957..db1f3b79eb10b4721b53ac459c6b40030bf42712 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralAngleDistanceImageFilter_h -#define __otbSpectralAngleDistanceImageFilter_h +#ifndef otbSpectralAngleDistanceImageFilter_h +#define otbSpectralAngleDistanceImageFilter_h #include "itkImageToImageFilter.h" @@ -81,9 +81,9 @@ protected: /** Constructor */ SpectralAngleDistanceImageFilter(); /** Destructor */ - virtual ~SpectralAngleDistanceImageFilter() {} + ~SpectralAngleDistanceImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** SpectralAngleDistanceImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -95,9 +95,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; private: SpectralAngleDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.txx index edcc5e07bdf4cab99f58b5db0cfc29f61f22fe14..ac01ae19444c5589dbe58657fdff9b50a5add7df 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralAngleDistanceImageFilter_txx -#define __otbSpectralAngleDistanceImageFilter_txx +#ifndef otbSpectralAngleDistanceImageFilter_txx +#define otbSpectralAngleDistanceImageFilter_txx #include "otbSpectralAngleDistanceImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h index 4ce398a881f39fc6e1f31f5ccc95726a327ebd13..74fb60b6647226d13e6c3a35947b2650ddddb3a1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralAngleFunctor_h -#define __otbSpectralAngleFunctor_h +#ifndef otbSpectralAngleFunctor_h +#define otbSpectralAngleFunctor_h #include "otbMath.h" #include <algorithm> diff --git a/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h b/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h index c2ac2a812a45ed94e366264dc86cd8ce49665b25..481247471698ee73ddcfdf8f9a4835e88ec015fe 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h @@ -15,10 +15,11 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSqrtSpectralAngleFunctor_h -#define __otbSqrtSpectralAngleFunctor_h +#ifndef otbSqrtSpectralAngleFunctor_h +#define otbSqrtSpectralAngleFunctor_h #include "otbSpectralAngleFunctor.h" +#include "itkMacro.h" namespace otb { @@ -39,10 +40,10 @@ public: typedef SpectralAngleFunctor<TInputVectorPixel, TOutputPixel> Superclass; SqrtSpectralAngleFunctor() {} - virtual ~SqrtSpectralAngleFunctor() {} + ~SqrtSpectralAngleFunctor() ITK_OVERRIDE {} protected: - virtual TOutputPixel Evaluate(const TInputVectorPixel& inPix) const + TOutputPixel Evaluate(const TInputVectorPixel& inPix) const ITK_OVERRIDE { return static_cast<TOutputPixel>(vcl_sqrt(Superclass::Evaluate(inPix))); } diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h index ddbfb1a5673f75034498d90e8e9a4c34be45f0a0..036807e5f835dbbedd9496548731b2ef857fe0bd 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingInnerProductVectorImageFilter_h -#define __otbStreamingInnerProductVectorImageFilter_h +#ifndef otbStreamingInnerProductVectorImageFilter_h +#define otbStreamingInnerProductVectorImageFilter_h #include "otbPersistentImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -101,16 +101,16 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); - virtual void GenerateOutputInformation(); - virtual void Synthetize(void); - virtual void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; /** Enable/Disable center data */ itkSetMacro(CenterData, bool); @@ -119,10 +119,10 @@ public: protected: PersistentInnerProductVectorImageFilter(); - virtual ~PersistentInnerProductVectorImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentInnerProductVectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentInnerProductVectorImageFilter(const Self &); //purposely not implemented @@ -216,7 +216,7 @@ protected: /** Constructor */ StreamingInnerProductVectorImageFilter() {}; /** Destructor */ - virtual ~StreamingInnerProductVectorImageFilter() {} + ~StreamingInnerProductVectorImageFilter() ITK_OVERRIDE {} private: StreamingInnerProductVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.txx index bb33a873e180315afffb52a6e36261c0811aff41..54c3e93b66964533aae95e4b851468981165e738 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingInnerProductVectorImageFilter_txx -#define __otbStreamingInnerProductVectorImageFilter_txx +#ifndef otbStreamingInnerProductVectorImageFilter_txx +#define otbStreamingInnerProductVectorImageFilter_txx #include "otbStreamingInnerProductVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h index 76d0da2f5f256f5eeaf97f8115c3ca7c266bd07f..bb7f8efcf402fe75c3aa5076eebd41e2cf0dabd4 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMatrixTransposeMatrixImageFilter_h -#define __otbStreamingMatrixTransposeMatrixImageFilter_h +#ifndef otbStreamingMatrixTransposeMatrixImageFilter_h +#define otbStreamingMatrixTransposeMatrixImageFilter_h #include "otbPersistentImageFilter.h" #include "itkSimpleDataObjectDecorator.h" @@ -121,18 +121,18 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs(); - void GenerateOutputInformation(); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; // Override since the filter needs all the data for the algorithm - virtual void GenerateInputRequestedRegion(); - virtual void Reset(void); - virtual void Synthetize(void); + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; /** Input wrapper */ void SetFirstInput(const TInputImage *input1) @@ -148,7 +148,7 @@ public: { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } else return (static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0))); } @@ -157,17 +157,17 @@ public: { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } else return (static_cast<const TInputImage2 *>(this->itk::ProcessObject::GetInput(1))); } protected: PersistentMatrixTransposeMatrixImageFilter(); - virtual ~PersistentMatrixTransposeMatrixImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentMatrixTransposeMatrixImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentMatrixTransposeMatrixImageFilter(const Self &); //purposely not implemented @@ -273,7 +273,7 @@ protected: /** Constructor */ StreamingMatrixTransposeMatrixImageFilter() {}; /** Destructor */ - virtual ~StreamingMatrixTransposeMatrixImageFilter() {} + ~StreamingMatrixTransposeMatrixImageFilter() ITK_OVERRIDE {} private: StreamingMatrixTransposeMatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.txx index 535d2a565f76b59e1e4f0a59f87fb5c82abb6bc7..14cb93bc00a26f70d6283833c0eabbed7fcf61c9 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMatrixTransposeMatrixImageFilter_txx -#define __otbStreamingMatrixTransposeMatrixImageFilter_txx +#ifndef otbStreamingMatrixTransposeMatrixImageFilter_txx +#define otbStreamingMatrixTransposeMatrixImageFilter_txx #include "otbStreamingMatrixTransposeMatrixImageFilter.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h index 24038a5bb7ff3e5d72be20676a9f034d384e1bad..9a2f24df2f34ea0a3581a8758f38be8406c0e020 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingResampleImageFilter_h -#define __otbStreamingResampleImageFilter_h +#ifndef otbStreamingResampleImageFilter_h +#define otbStreamingResampleImageFilter_h #include "itkImageToImageFilter.h" #include "otbStreamingWarpImageFilter.h" @@ -172,19 +172,19 @@ public: } /** Override itk::ProcessObject method to let the internal filter do the propagation */ - virtual void PropagateRequestedRegion(itk::DataObject *output); + void PropagateRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; protected: StreamingResampleImageFilter(); /** Destructor */ - virtual ~StreamingResampleImageFilter() {}; + ~StreamingResampleImageFilter() ITK_OVERRIDE {}; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StreamingResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx index 8543b9e8881d3f3fe80db35cff33602cbc7eae74..c71004746104a95446cb8a047859fbe206476ac9 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingResampleImageFilter_txx -#define __otbStreamingResampleImageFilter_txx +#ifndef otbStreamingResampleImageFilter_txx +#define otbStreamingResampleImageFilter_txx +#include "otbStreamingResampleImageFilter.h" #include "itkProgressAccumulator.h" namespace otb diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h index a31571fed74cfa523471bedb3f9d4ae622064038..9524f87717f73f3a5c2cc4a28a97dd390148e6dd 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingShrinkImageFilter_h -#define __otbStreamingShrinkImageFilter_h +#ifndef otbStreamingShrinkImageFilter_h +#define otbStreamingShrinkImageFilter_h #include "otbPersistentImageFilter.h" @@ -68,14 +68,14 @@ public: * instance, if the numberOfPieces exceeds the number of pixels along * a certain dimensions, then some splits will not be possible. */ - virtual unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber); + unsigned int GetNumberOfSplits(const RegionType& region, + unsigned int requestedNumber) ITK_OVERRIDE; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ - virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region); + RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, + const RegionType& region) ITK_OVERRIDE; itkGetMacro(TileSizeAlignment, unsigned int); itkSetMacro(TileSizeAlignment, unsigned int); @@ -87,8 +87,8 @@ public: protected: StreamingShrinkImageRegionSplitter() : m_SplitsPerDimension(0U), m_TileDimension(0), m_TileSizeAlignment(0), m_ShrinkFactor(10) {} - virtual ~StreamingShrinkImageRegionSplitter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~StreamingShrinkImageRegionSplitter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StreamingShrinkImageRegionSplitter(const StreamingShrinkImageRegionSplitter &); //purposely not implemented @@ -128,7 +128,7 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion); + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; void SetShrinkFactor(unsigned int val) { @@ -142,7 +142,7 @@ public: protected: StreamingShrinkStreamingManager(); - virtual ~StreamingShrinkStreamingManager(); + ~StreamingShrinkStreamingManager() ITK_OVERRIDE; private: StreamingShrinkStreamingManager(const StreamingShrinkStreamingManager &); //purposely not implemented @@ -201,9 +201,9 @@ public: return m_ShrinkedOutput; } - virtual void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; - virtual void Reset(void); + void Reset(void) ITK_OVERRIDE; itkSetMacro(ShrinkFactor, unsigned int); itkGetMacro(ShrinkFactor, unsigned int); @@ -211,23 +211,23 @@ public: protected: PersistentShrinkImageFilter(); - virtual ~PersistentShrinkImageFilter(); + ~PersistentShrinkImageFilter() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: @@ -300,7 +300,7 @@ public: otbSetObjectMemberMacro(Filter, ShrinkFactor, unsigned int); otbGetObjectMemberMacro(Filter, ShrinkFactor, unsigned int); - virtual void Update(void) + void Update(void) ITK_OVERRIDE { m_StreamingManager->SetShrinkFactor( this->GetFilter()->GetShrinkFactor() ); Superclass::Update(); @@ -316,7 +316,7 @@ protected: } /** Destructor */ - virtual ~StreamingShrinkImageFilter() {} + ~StreamingShrinkImageFilter() ITK_OVERRIDE {} private: StreamingShrinkImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx index 95761c9fe1a199a7ffb2052142ab64b5227a3f87..bbe7e020718bf656476a61c384a5dbd0d9b034aa 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingShrinkImageFilter_txx -#define __otbStreamingShrinkImageFilter_txx +#ifndef otbStreamingShrinkImageFilter_txx +#define otbStreamingShrinkImageFilter_txx #include "otbStreamingShrinkImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h index e0e1e615423060a160fd253477b496c0ffa6d90c..32453a0c1fea9c860d29a9160e6ef55fe4118a4b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbThresholdVectorImageFilter_h -#define __otbThresholdVectorImageFilter_h +#ifndef otbThresholdVectorImageFilter_h +#define otbThresholdVectorImageFilter_h #include "itkImageToImageFilter.h" @@ -97,8 +97,8 @@ public: protected: ThresholdVectorImageFilter(); - virtual ~ThresholdVectorImageFilter() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ThresholdVectorImageFilter() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** ThresholdVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -111,9 +111,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType ThrethreadId ); + itk::ThreadIdType ThrethreadId ) ITK_OVERRIDE; - void GenerateOutputInformation(void) + void GenerateOutputInformation(void) ITK_OVERRIDE { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.txx index 51cb678bd794bd0b3834874cd24fe8f754217409..c2b9bc843d8e864aba7cf9d3570598d85910f18b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbThresholdVectorImageFilter_txx -#define __otbThresholdVectorImageFilter_txx +#ifndef otbThresholdVectorImageFilter_txx +#define otbThresholdVectorImageFilter_txx #include "otbThresholdVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h index 961936b05d852b885cd088c8d58193cb44f4a454..3e8da58747f808ca23a34be8462d0af0c7bf9718 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileImageFilter_h -#define __otbTileImageFilter_h +#ifndef otbTileImageFilter_h +#define otbTileImageFilter_h #include "itkImageToImageFilter.h" @@ -77,26 +77,26 @@ protected: TileImageFilter(); /** Destructor */ - virtual ~TileImageFilter(); + ~TileImageFilter() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Generate input requested region method */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Generate input requested region method */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx index 55dd3e5bec9f6bff845988ed1a169319a18f1f69..3b59245ffa94bd63d2f6f1b96923042bf9ad9cdf 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileImageFilter_txx -#define __otbTileImageFilter_txx +#ifndef otbTileImageFilter_txx +#define otbTileImageFilter_txx #include "otbTileImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h index e60a091176e80ff21ba52c3156aa2ba0413b3a13..ae4ccb2fecc7b2908a91abfecae798a95eacb2aa 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTwoNRIBandsImageToNComplexBandsImage_h -#define __otbTwoNRIBandsImageToNComplexBandsImage_h +#ifndef otbTwoNRIBandsImageToNComplexBandsImage_h +#define otbTwoNRIBandsImageToNComplexBandsImage_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -69,13 +69,13 @@ public: protected: TwoNRIBandsImageToNComplexBandsImage(); - virtual ~TwoNRIBandsImageToNComplexBandsImage() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~TwoNRIBandsImageToNComplexBandsImage() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateOutputInformation(void); - void BeforeThreadedGenerateData(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: TwoNRIBandsImageToNComplexBandsImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx index c61f07a9009b4fe2365f926e55c1a9c4111b27fa..82195468981d29d24fe3f3ceddc7e12be2987b6d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx +++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTwoNRIBandsImageToNComplexBandsImage_txx -#define __otbTwoNRIBandsImageToNComplexBandsImage_txx +#ifndef otbTwoNRIBandsImageToNComplexBandsImage_txx +#define otbTwoNRIBandsImageToNComplexBandsImage_txx #include "otbTwoNRIBandsImageToNComplexBandsImage.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h index 8b1f93d2450cfd5be162baf08c2f90ebf466148d..336b9cdebc57de2805999fad38013bb18e508a5d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodImageFilter_h -#define __otbUnaryFunctorNeighborhoodImageFilter_h +#ifndef otbUnaryFunctorNeighborhoodImageFilter_h +#define otbUnaryFunctorNeighborhoodImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -120,7 +120,7 @@ protected: /** * Destructor */ - virtual ~UnaryFunctorNeighborhoodImageFilter() {} + ~UnaryFunctorNeighborhoodImageFilter() ITK_OVERRIDE {} /** UnaryFunctorNeighborhoodImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -132,12 +132,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the input requested region by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; private: UnaryFunctorNeighborhoodImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.txx index 3ee51a2ec6c0d4a99f5664154710f11a08be423c..77e6947a8037168b0a352a741f85776c56754811 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodImageFilter_txx -#define __otbUnaryFunctorNeighborhoodImageFilter_txx +#ifndef otbUnaryFunctorNeighborhoodImageFilter_txx +#define otbUnaryFunctorNeighborhoodImageFilter_txx #include "otbUnaryFunctorNeighborhoodImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h index c9b5d1bd81c7221786b9d45904015f9c22fe3c0e..02c694335d3a84710fadd2b936a80bf279b6f4ff 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodWithOffsetImageFilter_h -#define __otbUnaryFunctorNeighborhoodWithOffsetImageFilter_h +#ifndef otbUnaryFunctorNeighborhoodWithOffsetImageFilter_h +#define otbUnaryFunctorNeighborhoodWithOffsetImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -130,9 +130,9 @@ protected: /** * Destructor */ - virtual ~UnaryFunctorNeighborhoodWithOffsetImageFilter() {} + ~UnaryFunctorNeighborhoodWithOffsetImageFilter() ITK_OVERRIDE {} - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** UnaryFunctorNeighborhoodWithOffsetImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -144,12 +144,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the input requested region by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; std::vector<FunctorType> m_FunctorList; private: diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.txx index a0c040c668c5b9d4d6c93e6e85b4c1c6bf8e78f7..7c318b3263fe4e323b25ef9f5587dc05f43e39bc 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorNeighborhoodWithOffsetImageFilter_txx -#define __otbUnaryFunctorNeighborhoodWithOffsetImageFilter_txx +#ifndef otbUnaryFunctorNeighborhoodWithOffsetImageFilter_txx +#define otbUnaryFunctorNeighborhoodWithOffsetImageFilter_txx #include "otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h index fdb2713907d792a5b822a8870d1c9050b736c0f6..d387433d9d100fc6383e454434dcd697c667c774 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorWithIndexImageFilter_h -#define __otbUnaryFunctorWithIndexImageFilter_h +#ifndef otbUnaryFunctorWithIndexImageFilter_h +#define otbUnaryFunctorWithIndexImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -108,7 +108,7 @@ protected: /** * Destructor */ - virtual ~UnaryFunctorWithIndexImageFilter() {} + ~UnaryFunctorWithIndexImageFilter() ITK_OVERRIDE {} /** UnaryFunctorWithIndexImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -120,12 +120,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Pad the input requested region by radius */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; private: UnaryFunctorWithIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.txx index dc78ead9291b3edc51fcf238dbccf19f3a78aa14..1d5b9795a92b29fb85e0ea1064f264d5a928009d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryFunctorWithIndexImageFilter_txx -#define __otbUnaryFunctorWithIndexImageFilter_txx +#ifndef otbUnaryFunctorWithIndexImageFilter_txx +#define otbUnaryFunctorWithIndexImageFilter_txx #include "otbUnaryFunctorWithIndexImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h index cb1a41967b154d88de16c6bcf4c83c7608aefff9..1854a8536f65205687c4456e1df5c592f7c087fc 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryImageFunctorWithVectorImageFilter_h -#define __otbUnaryImageFunctorWithVectorImageFilter_h +#ifndef otbUnaryImageFunctorWithVectorImageFilter_h +#define otbUnaryImageFunctorWithVectorImageFilter_h #include "otbVectorImage.h" #include "itkVariableLengthVector.h" @@ -88,7 +88,7 @@ public: protected: UnaryImageFunctorWithVectorImageFilter(); - virtual ~UnaryImageFunctorWithVectorImageFilter() {} + ~UnaryImageFunctorWithVectorImageFilter() ITK_OVERRIDE {} /** UnaryImageFunctorWithVectorImageFilter can produce an image which is a different * resolution than its input image. As such, UnaryImageFunctorWithVectorImageFilter @@ -98,7 +98,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** UnaryImageFunctorWithVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -110,9 +110,9 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** Ponderation declaration*/ diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.txx index 9718f7d2767cd54f697167cffa44d3a4a9ab9c70..6c77bd78f214c36bb077fd73c350380b7b22c8f2 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnaryImageFunctorWithVectorImageFilter_txx -#define __otbUnaryImageFunctorWithVectorImageFilter_txx +#ifndef otbUnaryImageFunctorWithVectorImageFilter_txx +#define otbUnaryImageFunctorWithVectorImageFilter_txx #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h index 18a45eb160c0e9b95d099bf59339c8f446968732..4683217271c060f2392319d2b341d171c9b616b8 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageTo3DScalarImageFilter_h -#define __otbVectorImageTo3DScalarImageFilter_h +#ifndef otbVectorImageTo3DScalarImageFilter_h +#define otbVectorImageTo3DScalarImageFilter_h #include "itkImageToImageFilter.h" @@ -71,21 +71,21 @@ public: protected: /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Threaded Generate data */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; /** Constructor */ VectorImageTo3DScalarImageFilter(); /** Destructor */ - virtual ~VectorImageTo3DScalarImageFilter() {} + ~VectorImageTo3DScalarImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorImageTo3DScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.txx index 2f05d6dfc0763139c2b6dd99e1273ded76135049..423e1425c5e332cd788ecaca500d41fb0f3a72a3 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageTo3DScalarImageFilter_txx -#define __otbVectorImageTo3DScalarImageFilter_txx +#ifndef otbVectorImageTo3DScalarImageFilter_txx +#define otbVectorImageTo3DScalarImageFilter_txx #include "otbVectorImageTo3DScalarImageFilter.h" #include "itkImageRegionConstIterator.h" diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h index 4bbb5f79fcf75babe0c06581ced9560828a9e54a..8142135240f8e0d7902e22c6636e07eb9d4e998d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToAmplitudeImageFilter_h -#define __otbVectorImageToAmplitudeImageFilter_h +#ifndef otbVectorImageToAmplitudeImageFilter_h +#define otbVectorImageToAmplitudeImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "otbMath.h" @@ -81,9 +81,9 @@ protected: /** Constructor */ VectorImageToAmplitudeImageFilter() {}; /** Destructor */ - virtual ~VectorImageToAmplitudeImageFilter() {} + ~VectorImageToAmplitudeImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h index 9c80e7ffd11218691cee1cc0f555c88bb059670d..150b4166c9043b87bd200e880f8726105a8fdf6e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorRescaleIntensityImageFilter_h -#define __otbVectorRescaleIntensityImageFilter_h +#ifndef otbVectorRescaleIntensityImageFilter_h +#define otbVectorRescaleIntensityImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkVariableLengthVector.h" @@ -254,20 +254,20 @@ public: itkGetConstReferenceMacro(Gamma,double); /** Process to execute before entering the multithreaded section */ - void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; /** Generate output information */ - void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region */ - void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Print internal ivars */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; protected: VectorRescaleIntensityImageFilter(); - virtual ~VectorRescaleIntensityImageFilter() {} + ~VectorRescaleIntensityImageFilter() ITK_OVERRIDE {} private: VectorRescaleIntensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.txx index 41409e7a95f5ec72a9686bee31fe093552bb37ec..425dbdc2ff53b8305ed587fe3d06f5f59b18715a 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorRescaleIntensityImageFilter_txx -#define __otbVectorRescaleIntensityImageFilter_txx +#ifndef otbVectorRescaleIntensityImageFilter_txx +#define otbVectorRescaleIntensityImageFilter_txx #include "otbVectorRescaleIntensityImageFilter.h" #include "itkSampleToHistogramFilter.h" diff --git a/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx index 2a6a7e2a904cee67cfa8d15e7bf7d3be65126ece..d3a6c078f51e2bcff95a852ab08ee64667a69e30 100644 --- a/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx @@ -36,7 +36,7 @@ int otbChangeInformationImageFilter(int itkNotUsed(argc), char * argv[]) std::string newProj("Fake ProjRef"); filter->SetOutputMetaData<std::string>(otb::MetaDataKey::ProjectionRefKey,&newProj); // erase that choice - filter->SetOutputMetaData<std::string>(otb::MetaDataKey::ProjectionRefKey,NULL); + filter->SetOutputMetaData<std::string>(otb::MetaDataKey::ProjectionRefKey,ITK_NULLPTR); // add a no data to the image std::vector<bool> flags; flags.push_back(true); diff --git a/Modules/Filtering/ImageManipulation/test/otbMaskedIteratorDecorator.cxx b/Modules/Filtering/ImageManipulation/test/otbMaskedIteratorDecorator.cxx index 37f7a18c14f6f4d269f742e91a8b47e7c5bcf668..d93396d4953d885b03dbf4dd768382bf75bb6ec2 100644 --- a/Modules/Filtering/ImageManipulation/test/otbMaskedIteratorDecorator.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbMaskedIteratorDecorator.cxx @@ -345,12 +345,12 @@ int otbMaskedIteratorDecoratorExtended(int itkNotUsed(argc), char * itkNotUsed(a std::cout << std::endl << "itk::ImageRegionIterator without mask: "; ret = TripleTest< itk::ImageRegionIterator<ImageType>, - itk::ImageRegionIterator<MaskType> >(image, NULL, region); + itk::ImageRegionIterator<MaskType> >(image, ITK_NULLPTR, region); retGlobal = (ret == EXIT_FAILURE ? EXIT_FAILURE : retGlobal); std::cout << std::endl << "itk::ImageRegionConstIterator without mask: "; ret = TripleTest< itk::ImageRegionConstIterator<ImageType>, - itk::ImageRegionConstIterator<MaskType> >(image, NULL, region); + itk::ImageRegionConstIterator<MaskType> >(image, ITK_NULLPTR, region); retGlobal = (ret == EXIT_FAILURE ? EXIT_FAILURE : retGlobal); return retGlobal; diff --git a/Modules/Filtering/ImageManipulation/test/otbRegionProjectionResampler.cxx b/Modules/Filtering/ImageManipulation/test/otbRegionProjectionResampler.cxx index 4984bdad5f0d3c5d558987e4d25a31fc98fc5291..acbbbdb90c728409821275b864fc5930737aae3e 100644 --- a/Modules/Filtering/ImageManipulation/test/otbRegionProjectionResampler.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbRegionProjectionResampler.cxx @@ -107,8 +107,8 @@ int otbRegionProjectionResampler(int argc, char* argv[]) spacing[0] = atof(argv[8]); spacing[1] = atof(argv[9]); - origin[0] = strtod(argv[3], NULL); // origin longitude. - origin[1] = strtod(argv[4], NULL); // origin latitude. + origin[0] = strtod(argv[3], ITK_NULLPTR); // origin longitude. + origin[1] = strtod(argv[4], ITK_NULLPTR); // origin latitude. otbGenericMsgDebugMacro(<< "Origin " << origin); diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h index 0e54d13b0916e92aa8d5670aa10fcec8a57c1497..62956d3121817eb3cf5ec155ce9c0800f6a4656d 100644 --- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFrostImageFilter_h -#define __otbFrostImageFilter_h +#ifndef otbFrostImageFilter_h +#define otbFrostImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -95,13 +95,13 @@ public: /** To be allowed to use the pipeline method FrostImageFilter needs * an input processing area larger than the output one. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: FrostImageFilter(); - virtual ~FrostImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~FrostImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** FrostImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -112,7 +112,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: FrostImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx index bca00f9c7d22893f9cb5f026095d52ce2a46e017..c4e7e9ab3bb5c8ca8863a442827c1516c1ee2bd9 100644 --- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx +++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFrostImageFilter_txx -#define __otbFrostImageFilter_txx +#ifndef otbFrostImageFilter_txx +#define otbFrostImageFilter_txx #include "otbFrostImageFilter.h" diff --git a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h index a3fcfd4dcd74a7723d9f90d4188d87d247f1dd4b..709860695513128a4f509ae69b86fd27f6923224 100644 --- a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGammaMAPImageFilter_h -#define __otbGammaMAPImageFilter_h +#ifndef otbGammaMAPImageFilter_h +#define otbGammaMAPImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -87,19 +87,19 @@ public: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: GammaMAPImageFilter(); - virtual ~GammaMAPImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~GammaMAPImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** GammaMAPImageFilter can be multithreaded. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: GammaMAPImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx index 10883ddc815a5a26368bae355be364bbb33fe68a..08c5181df27735ea2474d23571ca3d03d14130e8 100644 --- a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx +++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGammaMAPImageFilter_txx -#define __otbGammaMAPImageFilter_txx +#ifndef otbGammaMAPImageFilter_txx +#define otbGammaMAPImageFilter_txx #include "otbGammaMAPImageFilter.h" diff --git a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h index 9008cce9b2ab75e5b63d5b37d48f92fee515d405..ca82a8beb17313464b8e9b5fd95c7bdeca17ee14 100644 --- a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKuanImageFilter_h -#define __otbKuanImageFilter_h +#ifndef otbKuanImageFilter_h +#define otbKuanImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -87,19 +87,19 @@ public: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: KuanImageFilter(); - virtual ~KuanImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~KuanImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** KuanImageFilter can be multithreaded. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: KuanImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx index 351aed9dcd1b901e1d5fe8e3f7661913b57bcc9f..2960cd303fc12966dd0f45ff25a71ff1e123083b 100644 --- a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx +++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKuanImageFilter_txx -#define __otbKuanImageFilter_txx +#ifndef otbKuanImageFilter_txx +#define otbKuanImageFilter_txx #include "otbKuanImageFilter.h" diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h index b6e6f6963f81b1f6670a9111d68a3fc6aa088b40..6c07139d958753a90a358960b2ae88f2573e92d3 100644 --- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLeeImageFilter_h -#define __otbLeeImageFilter_h +#ifndef otbLeeImageFilter_h +#define otbLeeImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -94,13 +94,13 @@ public: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; protected: LeeImageFilter(); - virtual ~LeeImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LeeImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** LeeImageFilter can be multithreaded. * As such, it provides a definition of ThreadedGenerateData() @@ -113,7 +113,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: LeeImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx index 4c68f1916a22f14bf5786d10be8658930bcfaa90..0ea7e3aa09a965ebfbc4d30d1ab59a76adb233b2 100644 --- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx +++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLeeImageFilter_txx -#define __otbLeeImageFilter_txx +#ifndef otbLeeImageFilter_txx +#define otbLeeImageFilter_txx #include "otbLeeImageFilter.h" diff --git a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h index 5e15182a9e3af66eb0b2f9a57c5e9c567bb04007..a7f68ee4d98e894e6c04adcabfb23f2aab23ebe4 100644 --- a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h +++ b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbBandMathImageFilter_h -#define __otbBandMathImageFilter_h +#ifndef otbBandMathImageFilter_h +#define otbBandMathImageFilter_h #include "itkInPlaceImageFilter.h" #include "itkImageRegionIteratorWithIndex.h" @@ -127,12 +127,12 @@ public: protected : BandMathImageFilter(); - virtual ~BandMathImageFilter(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BandMathImageFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(); - void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); - void AfterThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE; + void AfterThreadedGenerateData() ITK_OVERRIDE; private : BandMathImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx index 8bc0e54ee7f236388aee45d6c5c6e777685d391a..ae7af5ab4f488288ebb645cca598bebe6e93f49a 100644 --- a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx +++ b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBandMathImageFilter_txx -#define __otbBandMathImageFilter_txx +#ifndef otbBandMathImageFilter_txx +#define otbBandMathImageFilter_txx #include "otbBandMathImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h index ebf63c6cf36f6c1dcf164dc72edb3ac4c7c3109c..c1984a532a0f38992e52df515d1fb482cc91ee18 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbMaskMuParserFilter_h -#define __otbMaskMuParserFilter_h +#ifndef otbMaskMuParserFilter_h +#define otbMaskMuParserFilter_h #include "itkProgressReporter.h" @@ -119,12 +119,12 @@ public: protected: MaskMuParserFilter(); - virtual ~MaskMuParserFilter(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MaskMuParserFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData(); - void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId); - void AfterThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void AfterThreadedGenerateData() ITK_OVERRIDE; private: MaskMuParserFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.txx b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.txx index 391adfec7d9a74db1cf8479de3c6597be50be15f..01bce06c3db651d47abc86115424f45ca4b2a207 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.txx +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMaskMuParserFilter_txx -#define __otbMaskMuParserFilter_txx +#ifndef otbMaskMuParserFilter_txx +#define otbMaskMuParserFilter_txx #include "otbMaskMuParserFilter.h" #include <iostream> diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h index 9ba384f7f0084f043b206f3507ce8f8056d93184..78bd01e63c770c21ebb0be25cf2c7840e299a9d7 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbMaskMuParserFunctor_h -#define __otbMaskMuParserFunctor_h +#ifndef otbMaskMuParserFunctor_h +#define otbMaskMuParserFunctor_h #include "otbParser.h" #include "otbMacro.h" @@ -97,7 +97,7 @@ public: protected: MaskMuParserFunctor(); - virtual ~MaskMuParserFunctor(); + ~MaskMuParserFunctor() ITK_OVERRIDE; private: diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.txx b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.txx index dc6a43b3cffe4b1863b14cb4aa967887eca96aa3..98ee3728369478431e533c245c98dcb8f84d9883 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.txx +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMaskMuParserFunctor_txx -#define __otbMaskMuParserFunctor_txx +#ifndef otbMaskMuParserFunctor_txx +#define otbMaskMuParserFunctor_txx #include "otbMaskMuParserFunctor.h" diff --git a/Modules/Filtering/MathParser/include/otbOBIAMuParserFunctor.h b/Modules/Filtering/MathParser/include/otbOBIAMuParserFunctor.h index 0979d2dab9b2a7e768d3d2963a6a765f44fb615d..710ed11f43af49736b0fa25e272d9972fc98fc37 100644 --- a/Modules/Filtering/MathParser/include/otbOBIAMuParserFunctor.h +++ b/Modules/Filtering/MathParser/include/otbOBIAMuParserFunctor.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbOBIAMuParserFunctor_h -#define __otbOBIAMuParserFunctor_h +#ifndef otbOBIAMuParserFunctor_h +#define otbOBIAMuParserFunctor_h #include "otbParser.h" #include "otbMacro.h" diff --git a/Modules/Filtering/MathParser/include/otbParser.h b/Modules/Filtering/MathParser/include/otbParser.h index 0fa8ce7894cf741a668286255eed30845843061a..5ecd32321cb8a98dc5919d5f257e483281999a1a 100644 --- a/Modules/Filtering/MathParser/include/otbParser.h +++ b/Modules/Filtering/MathParser/include/otbParser.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParser_h -#define __otbParser_h +#ifndef otbParser_h +#define otbParser_h #include "itkLightObject.h" #include "itkObjectFactory.h" @@ -86,8 +86,8 @@ public: protected: Parser(); - virtual ~Parser(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~Parser() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h index eb8a373b9f26ee8afaeaf442701d1b7a62658ae1..0e47e59e3aec5c64a400edbd627b8cbf28bfc8d8 100644 --- a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h +++ b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParserConditionDataNodeFeatureFunction_h -#define __otbParserConditionDataNodeFeatureFunction_h +#ifndef otbParserConditionDataNodeFeatureFunction_h +#define otbParserConditionDataNodeFeatureFunction_h #include "otbDataNodeImageFunction.h" #include "otbPolyLineImageConstIterator.h" @@ -84,7 +84,7 @@ public: typedef std::vector<PrecisionType> OutputType; - virtual OutputType Evaluate( const DataNodeType& node ) const; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; std::string GetExpression() const { @@ -103,8 +103,8 @@ public: protected: ParserConditionDataNodeFeatureFunction(); - virtual ~ParserConditionDataNodeFeatureFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ParserConditionDataNodeFeatureFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ParserConditionDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.txx b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.txx index a9d0faed56178b6fd2a8cd8979498d934566be6d..2413d93dd2e94318678a686542e867f65a954e4d 100644 --- a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.txx +++ b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParserConditionDataNodeFeatureFunction_txx -#define __otbParserConditionDataNodeFeatureFunction_txx +#ifndef otbParserConditionDataNodeFeatureFunction_txx +#define otbParserConditionDataNodeFeatureFunction_txx #include "otbParserConditionDataNodeFeatureFunction.h" diff --git a/Modules/Filtering/MathParser/src/otbParser.cxx b/Modules/Filtering/MathParser/src/otbParser.cxx index fafd8f946a3e37dc496652bfb33422545a256168..b7f3f32de027a4a81af8616f07ab8d350199ac02 100644 --- a/Modules/Filtering/MathParser/src/otbParser.cxx +++ b/Modules/Filtering/MathParser/src/otbParser.cxx @@ -180,11 +180,11 @@ protected: InitConst(); } - virtual ~ParserImpl() + ~ParserImpl() ITK_OVERRIDE { } - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h index f259390e069da651bf223a463dcca5eef435010d..9be1b698788c47e15f54312421d05d234015d1d4 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbBandMathXImageFilter_h -#define __otbBandMathXImageFilter_h +#ifndef otbBandMathXImageFilter_h +#define otbBandMathXImageFilter_h #include "itkConstNeighborhoodIterator.h" #include "itkImageToImageFilter.h" @@ -131,15 +131,15 @@ public: protected : BandMathXImageFilter(); - virtual ~BandMathXImageFilter(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~BandMathXImageFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateOutputInformation(); - void GenerateInputRequestedRegion(); + void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void BeforeThreadedGenerateData(); - void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); - void AfterThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE; + void AfterThreadedGenerateData() ITK_OVERRIDE; private : @@ -166,7 +166,7 @@ private : void OutputsDimensions(); std::vector<std::string> m_Expression; - std::vector<ParserType::Pointer> m_VParser; + std::vector< std::vector<ParserType::Pointer> > m_VParser; std::vector< std::vector<adhocStruct> > m_AImage; std::vector< adhocStruct > m_VVarName; std::vector< adhocStruct > m_VAllowedVarNameAuto; diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx index 61ba03478b00fdce66df56d346aea2c98c6f1b47..9030e2cef5022a0634a38a04ca7f9e16e26462d4 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx @@ -18,12 +18,15 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBandMathXImageFilter_txx -#define __otbBandMathXImageFilter_txx +#ifndef otbBandMathXImageFilter_txx +#define otbBandMathXImageFilter_txx #include "otbBandMathXImageFilter.h" #include "itkImageRegionIterator.h" #include "itkImageRegionConstIterator.h" +#include "itkImageScanlineConstIterator.h" +#include "itkImageScanlineIterator.h" +#include "itkImageRegionConstIteratorWithOnlyIndex.h" #include "itkConstNeighborhoodIterator.h" #include "itkNumericTraits.h" #include "itkProgressReporter.h" @@ -515,7 +518,7 @@ template< typename TImage > std::string BandMathXImageFilter<TImage> ::GetExpression(int IDExpression) const { - return m_Expression.at(IDExpression); + return m_Expression[IDExpression]; } @@ -567,8 +570,8 @@ void BandMathXImageFilter<TImage> for(unsigned int i=0; i<m_VAllowedVarNameAuto.size(); i++) m_VFinalAllowedVarName.push_back(m_VAllowedVarNameAuto[i]); - - for(unsigned int IDExpression=0; IDExpression<m_Expression.size(); ++IDExpression) // For each expression + unsigned int nbExpr = m_Expression.size(); + for(unsigned int IDExpression=0; IDExpression < nbExpr; ++IDExpression) // For each expression { ParserType::Pointer dummyParser = ParserType::New(); dummyParser->SetExpr(this->GetExpression(IDExpression)); @@ -608,14 +611,17 @@ void BandMathXImageFilter<TImage> } - // Register variables for each parser (important : one parser per thread) + // Register variables for each parser (important : one parser per thread and per expression) m_VParser.clear(); unsigned int nbThreads = this->GetNumberOfThreads(); - typename std::vector<ParserType::Pointer>::iterator itParser; - m_VParser.resize(nbThreads); - for(itParser = m_VParser.begin(); itParser < m_VParser.end(); itParser++) + for (unsigned int k=0 ; k<nbThreads ; k++) { - *itParser = ParserType::New(); + std::vector<ParserType::Pointer> parserList; + for (unsigned int i=0 ; i<nbExpr ; i++) + { + parserList.push_back(ParserType::New()); + } + m_VParser.push_back(parserList); } // Important to remember that variables of m_VVarName come from a call of GetExprVar method @@ -724,7 +730,10 @@ void BandMathXImageFilter<TImage> //Register variable - m_VParser.at(i)->DefineVar(m_AImage[i][j].name, &(m_AImage[i][j].value)); + for (unsigned int k=0 ; k<nbExpr ; k++) + { + m_VParser[i][k]->DefineVar(m_AImage[i][j].name, &(m_AImage[i][j].value)); + } initValue += 0.001; @@ -733,6 +742,15 @@ void BandMathXImageFilter<TImage> } } + // Set expressions + for (unsigned int k=0 ; k<nbThreads ; k++) + { + for (unsigned int i=0 ; i<nbExpr ; i++) + { + m_VParser[k][i]->SetExpr(m_Expression[i]); + } + } + } @@ -821,11 +839,14 @@ void BandMathXImageFilter< TImage > for(int i=0; i<(int) m_Expression.size(); ++i) { - m_VParser.at(0)->SetExpr(m_Expression[i]); - ValueType value = m_VParser.at(0)->Eval(); + ValueType value = m_VParser[0][i]->EvalRef(); switch (value.GetType()) { //ValueType + case 'b': + itkExceptionMacro(<< "Booleans not supported." << std::endl); + break; + case 'i': m_outputsDimensions.push_back(1); break; @@ -839,13 +860,18 @@ void BandMathXImageFilter< TImage > break; case 'm': - mup::matrix_type vect = value.GetArray(); + { + const mup::matrix_type &vect = value.GetArray(); if ( vect.GetRows() == 1 ) //Vector m_outputsDimensions.push_back(vect.GetCols()); else //Matrix itkExceptionMacro(<< "Result of the evaluation can't be a matrix." << std::endl); + } break; + default: + itkExceptionMacro(<< "Unknown output type : "<< value.GetType() << std::endl); + break; } //std::cout << "Type = " << value.GetType() << " dimension = " << m_outputsDimensions.back() << std::endl; @@ -1024,17 +1050,19 @@ void BandMathXImageFilter<TImage> //----------------- --------- -----------------// //----------------- Iterators -----------------// //----------------- --------- -----------------// - typedef itk::ImageRegionConstIterator<TImage> ImageRegionConstIteratorType; - std::vector< ImageRegionConstIteratorType > Vit; + typedef itk::ImageScanlineConstIterator<TImage> ImageScanlineConstIteratorType; + typedef itk::ImageScanlineIterator<TImage> ImageScanlineIteratorType; + typedef itk::ImageRegionConstIteratorWithOnlyIndex<TImage> IndexIteratorType; + std::vector< ImageScanlineConstIteratorType > Vit; Vit.resize(nbInputImages); for(unsigned int j=0; j < nbInputImages; ++j) - Vit[j] = ImageRegionConstIteratorType (this->GetNthInput(j), outputRegionForThread); + Vit[j] = ImageScanlineConstIteratorType (this->GetNthInput(j), outputRegionForThread); - std::vector< ImageRegionConstIteratorType > VoutIt; + std::vector< ImageScanlineIteratorType > VoutIt; VoutIt.resize(m_Expression.size()); for(unsigned int j=0; j < VoutIt.size(); ++j) - VoutIt[j] = ImageRegionConstIteratorType (this->GetOutput(j), outputRegionForThread); + VoutIt[j] = ImageScanlineIteratorType (this->GetOutput(j), outputRegionForThread); //Special case : neighborhoods @@ -1049,10 +1077,24 @@ void BandMathXImageFilter<TImage> VNit.back().NeedToUseBoundaryConditionOn(); } + // Index only iterator + IndexIteratorType indexIterator(this->GetNthInput(0), outputRegionForThread); // Support progress methods/callbacks itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + // iterator on variables + typename std::vector<adhocStruct>::iterator iterVarStart = + m_AImage[threadId].begin(); + typename std::vector<adhocStruct>::iterator iterVarEnd = + m_AImage[threadId].end(); + typename std::vector<adhocStruct>::iterator iterVar = + iterVarStart; + + // temporary output vectors + std::vector<PixelType> tmpOutputs(m_Expression.size()); + for(unsigned int k=0; k<m_Expression.size(); ++k) + tmpOutputs[k].SetSize(m_outputsDimensions[k]); //----------------- --------------------- -----------------// //----------------- Variable affectations -----------------// @@ -1060,23 +1102,25 @@ void BandMathXImageFilter<TImage> for(unsigned int j=0; j < nbInputImages; ++j) { Vit[j].GoToBegin(); } for(unsigned int j=0; j < m_Expression.size(); ++j) { VoutIt[j].GoToBegin(); } for(unsigned int j=0; j < VNit.size(); ++j) { VNit[j].GoToBegin(); } + indexIterator.GoToBegin(); while(!Vit[0].IsAtEnd()) // For each pixel - { - - int ngbhNameIndex=0; int index; - for(unsigned int j=0; j < m_AImage[threadId].size(); ++j) // For each variable, perform a copy { + while(!Vit[0].IsAtEndOfLine()) // For each line + { + int ngbhNameIndex=0; int index; - switch (m_AImage[threadId][j].type) + iterVar = iterVarStart; + while (iterVar != iterVarEnd) { - + switch (iterVar->type) + { case 0 : //idxX - m_AImage[threadId][j].value = static_cast<double>(Vit[0].GetIndex()[0]); + iterVar->value = static_cast<double>(indexIterator.GetIndex()[0]); break; case 1 : //idxY - m_AImage[threadId][j].value = static_cast<double>(Vit[0].GetIndex()[1]); + iterVar->value = static_cast<double>(indexIterator.GetIndex()[1]); break; case 2 : //Spacing X (imiPhyX) @@ -1088,28 +1132,28 @@ void BandMathXImageFilter<TImage> break; case 4 : //vector - // m_AImage[threadId][j].info[0] : Input image #ID - for(int p=0; p < m_AImage[threadId][j].value.GetCols(); ++p) - m_AImage[threadId][j].value.At(0,p) = Vit[m_AImage[threadId][j].info[0]].Get()[p]; + // iterVar->info[0] : Input image #ID + for(int p=0; p < iterVar->value.GetCols(); ++p) + iterVar->value.At(0,p) = Vit[iterVar->info[0]].Get()[p]; break; case 5 : //pixel - // m_AImage[threadId][j].info[0] : Input image #ID - // m_AImage[threadId][j].info[1] : Band #ID - m_AImage[threadId][j].value = Vit[m_AImage[threadId][j].info[0]].Get()[m_AImage[threadId][j].info[1]]; + // iterVar->info[0] : Input image #ID + // iterVar->info[1] : Band #ID + iterVar->value = Vit[iterVar->info[0]].Get()[iterVar->info[1]]; break; case 6 : //neighborhood - // m_AImage[threadId][j].info[1] : Band #ID - if (m_AImage[threadId][j].info[2]*m_AImage[threadId][j].info[3] != (int) VNit[ngbhNameIndex].Size() ) + // iterVar->info[1] : Band #ID + if (iterVar->info[2]*iterVar->info[3] != (int) VNit[ngbhNameIndex].Size() ) itkExceptionMacro(<< "Size of muparserx variable is different from its related otb neighborhood iterator") index=0; - for(int rows=0; rows<m_AImage[threadId][j].info[3]; ++rows) - for(int cols=0; cols<m_AImage[threadId][j].info[2]; ++cols) + for(int rows=0; rows<iterVar->info[3]; ++rows) + for(int cols=0; cols<iterVar->info[2]; ++cols) { - m_AImage[threadId][j].value.At(rows,cols) = VNit[ngbhNameIndex].GetPixel(index)[m_AImage[threadId][j].info[1]]; + iterVar->value.At(rows,cols) = VNit[ngbhNameIndex].GetPixel(index)[iterVar->info[1]]; index++; } @@ -1127,72 +1171,76 @@ void BandMathXImageFilter<TImage> default : itkExceptionMacro(<< "Type of the variable is unknown"); break; - } - }//End while - - - //----------------- ----------- -----------------// - //----------------- Evaluations -----------------// - //----------------- ----------- -----------------// - for(unsigned int IDExpression=0; IDExpression<m_Expression.size(); ++IDExpression) - { + } - m_VParser[threadId]->SetExpr(m_Expression[IDExpression]); + iterVar++; + }//End while on vars - value = m_VParser[threadId]->Eval(); + //----------------- ----------- -----------------// + //----------------- Evaluations -----------------// + //----------------- ----------- -----------------// + for(unsigned int IDExpression=0; IDExpression<m_Expression.size(); ++IDExpression) + { + value = m_VParser[threadId][IDExpression]->EvalRef(); switch (value.GetType()) - { //ValueType - case 'i': - VoutIt[IDExpression].Get()[0] = value.GetInteger(); - break; - - case 'f': - VoutIt[IDExpression].Get()[0] = value.GetFloat(); - break; + { //ValueType + case 'i': + tmpOutputs[IDExpression][0] = value.GetInteger(); + break; - case 'c': - itkExceptionMacro(<< "Complex numbers are not supported." << std::endl); - break; + case 'f': + tmpOutputs[IDExpression][0] = value.GetFloat(); + break; - case 'm': - mup::matrix_type vect = value.GetArray(); + case 'c': + itkExceptionMacro(<< "Complex numbers are not supported." << std::endl); + break; + case 'm': + { + const mup::matrix_type &vect = value.GetArray(); + if ( vect.GetRows() == 1 ) //Vector for(int p=0; p<vect.GetCols(); ++p) - VoutIt[IDExpression].Get()[p] = vect.At(0,p).GetFloat(); + tmpOutputs[IDExpression][p] = vect.At(0,p).GetFloat(); else //Matrix itkExceptionMacro(<< "Result of the evaluation can't be a matrix." << std::endl); - break; - } - + } + break; + } //----------------- Pixel affectations -----------------// - for(unsigned int p=0; p<VoutIt[IDExpression].Get().GetSize(); ++p) - { - // Case value is equal to -inf or inferior to the minimum value - // allowed by the PixelValueType cast - if (VoutIt[IDExpression].Get()[p] < double(itk::NumericTraits<PixelValueType>::NonpositiveMin())) + for(unsigned int p=0; p<m_outputsDimensions[IDExpression]; ++p) + { + // Case value is equal to -inf or inferior to the minimum value + // allowed by the PixelValueType cast + if (tmpOutputs[IDExpression][p] < double(itk::NumericTraits<PixelValueType>::NonpositiveMin())) { - VoutIt[IDExpression].Get()[p] = itk::NumericTraits<PixelValueType>::NonpositiveMin(); - m_ThreadUnderflow[threadId]++; + tmpOutputs[IDExpression][p] = itk::NumericTraits<PixelValueType>::NonpositiveMin(); + m_ThreadUnderflow[threadId]++; } - // Case value is equal to inf or superior to the maximum value - // allowed by the PixelValueType cast - else if (VoutIt[IDExpression].Get()[p] > double(itk::NumericTraits<PixelValueType>::max())) + // Case value is equal to inf or superior to the maximum value + // allowed by the PixelValueType cast + else if (tmpOutputs[IDExpression][p] > double(itk::NumericTraits<PixelValueType>::max())) { - VoutIt[IDExpression].Get()[p] = itk::NumericTraits<PixelValueType>::max(); - m_ThreadOverflow[threadId]++; + tmpOutputs[IDExpression][p] = itk::NumericTraits<PixelValueType>::max(); + m_ThreadOverflow[threadId]++; } + } + VoutIt[IDExpression].Set(tmpOutputs[IDExpression]); } - } - for(unsigned int j=0; j < nbInputImages; ++j) { ++Vit[j]; } - for(unsigned int j=0; j < m_Expression.size(); ++j) { ++VoutIt[j]; } - for(unsigned int j=0; j < VNit.size(); ++j) { ++VNit[j]; } + for(unsigned int j=0; j < nbInputImages; ++j) { ++Vit[j]; } + for(unsigned int j=0; j < m_Expression.size(); ++j) { ++VoutIt[j]; } + for(unsigned int j=0; j < VNit.size(); ++j) { ++VNit[j]; } + ++indexIterator; - progress.CompletedPixel(); - } + progress.CompletedPixel(); + } + for(unsigned int j=0; j < nbInputImages; ++j) { Vit[j].NextLine(); } + for(unsigned int j=0; j < m_Expression.size(); ++j) { VoutIt[j].NextLine(); } + } } diff --git a/Modules/Filtering/MathParserX/include/otbParserX.h b/Modules/Filtering/MathParserX/include/otbParserX.h index aad7ecf867bd01d36f54cffe921a584f16497ea5..eb58857f4cc4d1e1a15fb03f92443355efd1834b 100644 --- a/Modules/Filtering/MathParserX/include/otbParserX.h +++ b/Modules/Filtering/MathParserX/include/otbParserX.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParserX_h -#define __otbParserX_h +#ifndef otbParserX_h +#define otbParserX_h #include "itkLightObject.h" #include "itkObjectFactory.h" @@ -63,6 +63,7 @@ public: /** Convenient type definitions */ typedef ParserX ParserXType; typedef mup::Value ValueType; + typedef mup::IValue IValueType; /** Set the expression to be parsed */ virtual void SetExpr(const std::string & Expression); @@ -70,6 +71,9 @@ public: /** Trigger the parsing */ ValueType Eval(); + /** Trigger the parsing but return a const ref */ + const IValueType & EvalRef(); + /** Define a variable */ void DefineVar(const std::string &sName, ValueType *fVar); @@ -93,8 +97,8 @@ public: protected: ParserX(); - virtual ~ParserX(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ParserX() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h index cf557ec36a835666e38ff7e695776faab82c1471..443768e68c9a3f13729d1685f03a3eea41e011c9 100644 --- a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h +++ b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbParserXPlugins_h -#define __otbParserXPlugins_h +#ifndef otbParserXPlugins_h +#define otbParserXPlugins_h #include "itkMacro.h" #include "otbMath.h" @@ -33,14 +33,14 @@ public: bands():ICallback(mup::cmFUNC, "bands", 2) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "bands - A bands selector"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new bands(*this); } @@ -53,14 +53,14 @@ public: dotpr():ICallback(mup::cmFUNC, "dotpr", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "dotpr(m1,m2) - A vector/matrix dot product"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new dotpr(*this); } @@ -72,14 +72,14 @@ class ElementWiseDivision : public mup::IOprtBin ElementWiseDivision():IOprtBin(_T("div"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; - virtual const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("x div y - Element-wise division (vectors / matrices)"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new ElementWiseDivision(*this); } @@ -92,14 +92,14 @@ class DivisionByScalar : public mup::IOprtBin DivisionByScalar():IOprtBin(_T("dv"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; - virtual const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("x dv y - division of vectors / matrices by a scalar"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new DivisionByScalar(*this); } @@ -112,14 +112,14 @@ class ElementWiseMultiplication : public mup::IOprtBin ElementWiseMultiplication():IOprtBin(_T("mult"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; - virtual const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("x mult y - Element wise multiplication (vectors / matrices)"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new ElementWiseMultiplication(*this); } @@ -132,14 +132,14 @@ class MultiplicationByScalar : public mup::IOprtBin MultiplicationByScalar():IOprtBin(_T("mlt"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; - virtual const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("x mlt y - multiplication of vectors / matrices by a scalar"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new MultiplicationByScalar(*this); } @@ -152,14 +152,14 @@ public: ElementWisePower():IOprtBin(_T("pow"), (int) mup::prPOW, mup::oaRIGHT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("pow - Power for noncomplex vectors & matrices"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new ElementWisePower(*this); } @@ -172,14 +172,14 @@ class PowerByScalar : public mup::IOprtBin PowerByScalar():IOprtBin(_T("pw"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; - virtual const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return _T("x pw y - power of vectors / matrices by a scalar"); } - virtual mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new PowerByScalar(*this); } @@ -192,14 +192,14 @@ public: ndvi():ICallback(mup::cmFUNC, "ndvi", 2) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "NDVI - Normalized Difference Vegetation Index"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new ndvi(*this); } @@ -212,14 +212,14 @@ public: cat():ICallback(mup::cmFUNC, "cat", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "cat(m1,m2) - Values concatenation"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new cat(*this); } @@ -232,14 +232,14 @@ public: mean():ICallback(mup::cmFUNC, "mean", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "mean(m1,m2,..) - mean of each neighborhood"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new mean(*this); } @@ -252,14 +252,14 @@ public: var():ICallback(mup::cmFUNC, "var", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "var(m1,m2,..) - variance of each neighborhood"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new var(*this); } @@ -272,14 +272,14 @@ public: corr():ICallback(mup::cmFUNC, "corr", 2) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "corr(m1,m2) - variance of two variables m1 and m2"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new corr(*this); } @@ -292,14 +292,14 @@ public: median():ICallback(mup::cmFUNC, "median", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "median(m1,m2,..) - median value of each neighborhood"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new median(*this); } @@ -312,14 +312,14 @@ public: maj():ICallback(mup::cmFUNC, "maj", -1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "maj(m1,m2,..) - majority value of each neighborhood"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new maj(*this); } @@ -332,14 +332,14 @@ public: vnorm():ICallback(mup::cmFUNC, "vnorm", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vnorm(v1) - Norm for a vector : sqrt(sum of squared elements); works also with matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vnorm(*this); } @@ -351,14 +351,14 @@ public: vmin():ICallback(mup::cmFUNC, "vmin", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vmin(m1) - overall minimun"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vmin(*this); } @@ -371,14 +371,14 @@ public: vmax():ICallback(mup::cmFUNC, "vmax", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vmax(m1) - overall maximun"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vmax(*this); } @@ -391,14 +391,14 @@ public: vect2scal():ICallback(mup::cmFUNC, "vect2scal", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vect2scal - Convert one dimensional vector to scalar"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vect2scal(*this); } @@ -412,14 +412,14 @@ public: vcos():ICallback(mup::cmFUNC, "vcos", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vcos - Cosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vcos(*this); } @@ -432,14 +432,14 @@ public: vacos():ICallback(mup::cmFUNC, "vacos", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vacos - Arccosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vacos(*this); } @@ -451,14 +451,14 @@ public: vsin():ICallback(mup::cmFUNC, "vsin", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vsin - Sinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vsin(*this); } @@ -470,14 +470,14 @@ public: vasin():ICallback(mup::cmFUNC, "vasin", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vasin - Arcsinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vasin(*this); } @@ -490,14 +490,14 @@ public: vtan():ICallback(mup::cmFUNC, "vtan", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vtan - Tangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vtan(*this); } @@ -510,14 +510,14 @@ public: vatan():ICallback(mup::cmFUNC, "vatan", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vatan - Arctangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vatan(*this); } @@ -530,14 +530,14 @@ public: vtanh():ICallback(mup::cmFUNC, "vtanh", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vtanh - Hyperbolic tangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vtanh(*this); } @@ -550,14 +550,14 @@ public: vsinh():ICallback(mup::cmFUNC, "vsinh", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vsinh - Hyperbolic sinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vsinh(*this); } @@ -570,14 +570,14 @@ public: vcosh():ICallback(mup::cmFUNC, "vcosh", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vcosh - Hyperbolic cosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vcosh(*this); } @@ -590,14 +590,14 @@ public: vlog():ICallback(mup::cmFUNC, "vlog", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vlog - Log for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vlog(*this); } @@ -610,14 +610,14 @@ public: vlog10():ICallback(mup::cmFUNC, "vlog10", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vlog10 - Log10 for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vlog10(*this); } @@ -630,14 +630,14 @@ public: vabs():ICallback(mup::cmFUNC, "vabs", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vabs - Absolute value for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vabs(*this); } @@ -650,14 +650,14 @@ public: vexp():ICallback(mup::cmFUNC, "vexp", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vexp - Exponential for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vexp(*this); } @@ -670,14 +670,14 @@ public: vsqrt():ICallback(mup::cmFUNC, "vsqrt", 1) {} - virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)); + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; - const mup::char_type* GetDesc() const + const mup::char_type* GetDesc() const ITK_OVERRIDE { return "vsqrt - Sqrt for noncomplex vectors & matrices"; } - mup::IToken* Clone() const + mup::IToken* Clone() const ITK_OVERRIDE { return new vsqrt(*this); } diff --git a/Modules/Filtering/MathParserX/src/otbParserX.cxx b/Modules/Filtering/MathParserX/src/otbParserX.cxx index f7ed3240eccd5f3609d2aa08a3160e1797450f51..b6d4ac8dcff3c8f44c0a28a59281fc6d464b8c86 100644 --- a/Modules/Filtering/MathParserX/src/otbParserX.cxx +++ b/Modules/Filtering/MathParserX/src/otbParserX.cxx @@ -40,6 +40,7 @@ public: /** Convenient type definitions */ typedef mup::Value ValueType; + typedef mup::IValue IValueType; typedef mup::ParserError ExceptionType; /** Initialize user defined constants */ @@ -117,6 +118,19 @@ public: return result; } + const IValueType & EvalRef() + { + try + { + return m_MuParserX.Eval(); + } + catch(ExceptionType &e) + { + ExceptionHandler(e); + } + return m_NullValue; + } + /** Define a variable */ void DefineVar(const std::string &sName, ValueType *fVar) @@ -228,15 +242,16 @@ public: protected: ParserXImpl() { + m_NullValue = ValueType(0.0); InitFun(); InitConst(); } - virtual ~ParserXImpl() + ~ParserXImpl() ITK_OVERRIDE { } - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } @@ -248,6 +263,8 @@ private: mup::ParserX m_MuParserX; + ValueType m_NullValue; + }; // end class @@ -277,6 +294,11 @@ ParserX::ValueType ParserX::Eval() return m_InternalParserX->Eval(); } +const ParserX::IValueType & ParserX::EvalRef() +{ + return m_InternalParserX->EvalRef(); +} + void ParserX::DefineVar(const std::string &sName, ValueType *fVar) { m_InternalParserX->DefineVar(sName, fVar); diff --git a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx index 139e5a7f44763f95b45cad961514ba8db412b515..41814e0b76c1f05ef52c207aafd5a225f22ed387 100644 --- a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx +++ b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx @@ -85,15 +85,26 @@ int otbBandMathXImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) []) IteratorType it2(image2, region); IteratorType it3(image3, region); + ImageType::PixelType val1, val2, val3; + val1.SetSize(D1); + val2.SetSize(D2); + val3.SetSize(D3); + for (it1.GoToBegin(), it2.GoToBegin(), it3.GoToBegin(); !it1.IsAtEnd(); ++it1, ++it2, ++it3) { ImageType::IndexType i1 = it1.GetIndex(); ImageType::IndexType i2 = it2.GetIndex(); ImageType::IndexType i3 = it3.GetIndex(); - it1.Get()[0] = i1[0] + i1[1] -50; it1.Get()[1] = i1[0] * i1[1] -50; it1.Get()[2] = i1[0] / (i1[1]+1)+5; - it2.Get()[0] = i2[0] * i2[1]; - it3.Get()[0] = i3[0] + i3[1] * i3[1]; + val1[0] = i1[0] + i1[1] -50; + val1[1] = i1[0] * i1[1] -50; + val1[2] = i1[0] / (i1[1]+1)+5; + val2[0] = i2[0] * i2[1]; + val3[0] = i3[0] + i3[1] * i3[1]; + + it1.Set(val1); + it2.Set(val2); + it3.Set(val3); } @@ -118,8 +129,6 @@ int otbBandMathXImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) []) std::cout << "\n--- Standard Use\n"; std::cout << "Parsed Expression : " << filter->GetExpression(0) << std::endl; - - //Sub-test 1 IteratorType itoutput1(output1, region); diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h index f8bd0adb2a4645022162c662ec43a9a65f5b3c27..4fe7728133633b97df9c0c38d67f482811f57d0c 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidAnalysisFilter_h -#define __otbMorphologicalPyramidAnalysisFilter_h +#ifndef otbMorphologicalPyramidAnalysisFilter_h +#define otbMorphologicalPyramidAnalysisFilter_h #include "otbImageToImageListFilter.h" @@ -90,7 +90,7 @@ public: * Get The Analyse image at each level of the pyramid. * \return The analysed image at each level of the pyramid. */ - OutputImageListType* GetOutput(void); + OutputImageListType* GetOutput(void) ITK_OVERRIDE; /** * Get The SupFilter details * \return The brighter details extracted from the filtering operation. @@ -116,12 +116,12 @@ protected: /** Constructor */ MorphologicalPyramidAnalysisFilter(); /** Destructor */ - virtual ~MorphologicalPyramidAnalysisFilter(); - virtual void GenerateOutputInformation() {} // does nothing + ~MorphologicalPyramidAnalysisFilter() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Printself method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** Number of levels of the algorithm */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx index 3ad47321d4d5eed2ddd472dbd208265f65c0f33f..f010b4c6be93ee4da9fc850d87ec9f4cf0cc0c62 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidAnalysisFilter_txx -#define __otbMorphologicalPyramidAnalysisFilter_txx +#ifndef otbMorphologicalPyramidAnalysisFilter_txx +#define otbMorphologicalPyramidAnalysisFilter_txx #include "otbMorphologicalPyramidAnalysisFilter.h" diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h index ed0d020562cb47b20b14643ccaad873042ba2661..40721088e6397f3aca64a605d4ba353e46b63792 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidMRToMSConverter_h -#define __otbMorphologicalPyramidMRToMSConverter_h +#ifndef otbMorphologicalPyramidMRToMSConverter_h +#define otbMorphologicalPyramidMRToMSConverter_h #include "otbImageListToImageListFilter.h" @@ -68,7 +68,7 @@ public: * \param imageList The analysed image at each level of the pyramid. */ using Superclass::SetInput; - void SetInput(const InputImageListType * imageList); + void SetInput(const InputImageListType * imageList) ITK_OVERRIDE; /** * Set The SupFilter details * \param imageList The brighter details extracted from the filtering operation. @@ -93,7 +93,7 @@ public: * Get the input list. * \return The list of the analysed image at each pyramid level. */ - InputImageListType* GetInput(void); + InputImageListType* GetInput(void) ITK_OVERRIDE; /** * Get The SupFilter details * \return The brighter details extracted from the filtering operation. @@ -119,7 +119,7 @@ public: * \return The analysed image at each pyramid level * resampled at full resolution. */ - OutputImageListType* GetOutput(void); + OutputImageListType* GetOutput(void) ITK_OVERRIDE; /** * Get The SupFilter details at full resolution. * \return The brighter details extracted from the filtering operation @@ -149,12 +149,12 @@ protected: /** Constructor */ MRToMSConverter(); /** Destructor */ - ~MRToMSConverter() {} + ~MRToMSConverter() ITK_OVERRIDE {} /** Main computation method */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: MRToMSConverter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.txx index 3c26e6f695104cbc46d9b0f74da03fb88b1be17c..a4288dea7751d9bb85110334d3782bcbb6499422 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidMRToMSConverter_txx -#define __otbMorphologicalPyramidMRToMSConverter_txx +#ifndef otbMorphologicalPyramidMRToMSConverter_txx +#define otbMorphologicalPyramidMRToMSConverter_txx #include "otbMorphologicalPyramidMRToMSConverter.h" #include "otbMorphologicalPyramidResampler.h" diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h index 83c831fae5c34025eba711ff1d753a9589af7265..4f9377338e837ba3066a4885c3cd1d33e9580728 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidResampler_h -#define __otbMorphologicalPyramidResampler_h +#ifndef otbMorphologicalPyramidResampler_h +#define otbMorphologicalPyramidResampler_h #include "itkImageToImageFilter.h" @@ -74,17 +74,17 @@ protected: /** Constructor */ Resampler(); /** Destructor */ - virtual ~Resampler() {} + ~Resampler() ITK_OVERRIDE {} /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Configure input requested region to be the largest possible region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Configure output requested region to be the largest possible region */ - virtual void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)); + void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) ITK_OVERRIDE; /** Main computation method */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: Resampler(const Self &); // purposely not implemented void operator =(const Self&); // purposely not implemented diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx index aecbfdbf20cbd32c4641e7f26c58b232e9a91e47..07526fadcca1f6319686eccabfc7d1c24a614fbd 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidResampler_txx -#define __otbMorphologicalPyramidResampler_txx +#ifndef otbMorphologicalPyramidResampler_txx +#define otbMorphologicalPyramidResampler_txx #include "otbMorphologicalPyramidResampler.h" #include "itkResampleImageFilter.h" #include "itkScalableAffineTransform.h" diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h index 08e8e2b3ac92449278583dd26d3ae16d7abb8bd9..a47b4334d4c1dde745ba245c1b3ec2b094610ef6 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSegmentationFilter_h -#define __otbMorphologicalPyramidSegmentationFilter_h +#ifndef otbMorphologicalPyramidSegmentationFilter_h +#define otbMorphologicalPyramidSegmentationFilter_h #include "otbImageListToImageListFilter.h" namespace otb @@ -138,12 +138,12 @@ protected: /** Constructor */ MorphologicalPyramidSegmentationFilter(); /** Destructor */ - virtual ~MorphologicalPyramidSegmentationFilter(); - virtual void GenerateOutputInformation() {} // does nothing + ~MorphologicalPyramidSegmentationFilter() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Printself method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: unsigned long m_MinimumObjectSize; /** Quantile for seeds determination */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.txx index 03521bb256391802c387810fd1932b52ad361609..27838358311db0b0614cd51b35e6ae95c1e5970c 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSegmentationFilter_txx -#define __otbMorphologicalPyramidSegmentationFilter_txx +#ifndef otbMorphologicalPyramidSegmentationFilter_txx +#define otbMorphologicalPyramidSegmentationFilter_txx #include "otbMorphologicalPyramidSegmentationFilter.h" diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h index 97ab6a777b7580cab87b2d091d7e4ff5b986b198..79652b191ac7b15d690d416533b1b748651c230d 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSegmenter_h -#define __otbMorphologicalPyramidSegmenter_h +#ifndef otbMorphologicalPyramidSegmenter_h +#define otbMorphologicalPyramidSegmenter_h #include "itkImageToImageFilter.h" @@ -117,15 +117,15 @@ protected: /** Constructor */ Segmenter(); /** Destructor */ - ~Segmenter() {} + ~Segmenter() ITK_OVERRIDE {} /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Configure the input datas. */ - void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** * Configure the output data. */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.txx index e67e86c695fa47c4db39509989e1aab8c6c816e2..aa24b811beefe23190b5c3e024f76ae615dc9d30 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSegmenter_txx -#define __otbMorphologicalPyramidSegmenter_txx +#ifndef otbMorphologicalPyramidSegmenter_txx +#define otbMorphologicalPyramidSegmenter_txx #include "otbMorphologicalPyramidSegmenter.h" diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h index 904786e17bbb17fb57afcf981dae8de9df338f01..45b5acea5344c4fbe3f2b668444cf7cd8ed7b052 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSynthesisFilter_h -#define __otbMorphologicalPyramidSynthesisFilter_h +#ifndef otbMorphologicalPyramidSynthesisFilter_h +#define otbMorphologicalPyramidSynthesisFilter_h #include "otbImageToImageListFilter.h" @@ -125,12 +125,12 @@ protected: /** Constructor */ MorphologicalPyramidSynthesisFilter(); /** Destructor */ - virtual ~MorphologicalPyramidSynthesisFilter(); - virtual void GenerateOutputInformation() {} // does nothing + ~MorphologicalPyramidSynthesisFilter() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Printself method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; }; } // End namespace otb diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.txx index de2aaa7bb18da5e531334efcd2b1981d0575626e..f37b510a46b783f4d0f131dd96b59f70ed7a9b44 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalPyramidSynthesisFilter_txx -#define __otbMorphologicalPyramidSynthesisFilter_txx +#ifndef otbMorphologicalPyramidSynthesisFilter_txx +#define otbMorphologicalPyramidSynthesisFilter_txx #include "otbMorphologicalPyramidSynthesisFilter.h" diff --git a/Modules/Filtering/Path/include/otbClosePathFunctor.h b/Modules/Filtering/Path/include/otbClosePathFunctor.h index dec07b272e217ec320d31b22701936fc3812f983..9d7d44bb5c08886f3ff59f64bbd0f64166bcd12d 100644 --- a/Modules/Filtering/Path/include/otbClosePathFunctor.h +++ b/Modules/Filtering/Path/include/otbClosePathFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbClosePathFunctor_h -#define __otbClosePathFunctor_h +#ifndef otbClosePathFunctor_h +#define otbClosePathFunctor_h #include "otbMath.h" diff --git a/Modules/Filtering/Path/include/otbCompacityPathFunction.h b/Modules/Filtering/Path/include/otbCompacityPathFunction.h index 52d5eb9f6fcebf9366f90442a9223fa7b6f1e1d3..cb8e5e815072d5be06ac26f4e765a7088dbbad20 100644 --- a/Modules/Filtering/Path/include/otbCompacityPathFunction.h +++ b/Modules/Filtering/Path/include/otbCompacityPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCompacityPathFunction_h -#define __otbCompacityPathFunction_h +#ifndef otbCompacityPathFunction_h +#define otbCompacityPathFunction_h #include "otbPathFunction.h" #include "itkVectorContainer.h" @@ -67,13 +67,13 @@ public: typedef double RealType; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PathType& path) const; + OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; virtual OutputType Evaluate() const; protected: CompacityPathFunction() {}; - virtual ~CompacityPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~CompacityPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: CompacityPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbCompacityPathFunction.txx b/Modules/Filtering/Path/include/otbCompacityPathFunction.txx index bffc74afc2c0cab72fca1aa21140821b837bef16..842c635ebd4e1787cf66f3e8e1dc530f8f9a94ca 100644 --- a/Modules/Filtering/Path/include/otbCompacityPathFunction.txx +++ b/Modules/Filtering/Path/include/otbCompacityPathFunction.txx @@ -15,10 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCompacityPathFunction_txx -#define __otbCompacityPathFunction_txx +#ifndef otbCompacityPathFunction_txx +#define otbCompacityPathFunction_txx -#include "otbPathFunction.h" +#include "otbCompacityPathFunction.h" #include "itkNumericTraits.h" #include "otbMacro.h" #include "otbMath.h" diff --git a/Modules/Filtering/Path/include/otbDrawPathFilter.h b/Modules/Filtering/Path/include/otbDrawPathFilter.h index 670203f4dcb95a752b3650817305cc29ab7fe89b..19bb249f6993eb3892a03c7d7d9f643a07b3bfcc 100644 --- a/Modules/Filtering/Path/include/otbDrawPathFilter.h +++ b/Modules/Filtering/Path/include/otbDrawPathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawPathFilter_h -#define __otbDrawPathFilter_h +#ifndef otbDrawPathFilter_h +#define otbDrawPathFilter_h #include "itkImageAndPathToImageFilter.h" @@ -87,10 +87,10 @@ public: protected: DrawPathFilter(); - virtual ~DrawPathFilter() {} + ~DrawPathFilter() ITK_OVERRIDE {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateData(); + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: DrawPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbDrawPathFilter.txx b/Modules/Filtering/Path/include/otbDrawPathFilter.txx index fac98e7a120375b34c44997e4cce304332ccc0ac..ae297095420d05a671a1ad1d62da2d8e9443d3ce 100644 --- a/Modules/Filtering/Path/include/otbDrawPathFilter.txx +++ b/Modules/Filtering/Path/include/otbDrawPathFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbDrawPathFilter_txx -#define __otbDrawPathFilter_txx +#ifndef otbDrawPathFilter_txx +#define otbDrawPathFilter_txx #include "otbDrawPathFilter.h" #include "otbDrawPathListFilter.h" diff --git a/Modules/Filtering/Path/include/otbDrawPathListFilter.h b/Modules/Filtering/Path/include/otbDrawPathListFilter.h index bdeb1565ea23459a00d49c035fa229a97d1d872e..963ad8d85d4c96696116df0100432cf3a1b73071 100644 --- a/Modules/Filtering/Path/include/otbDrawPathListFilter.h +++ b/Modules/Filtering/Path/include/otbDrawPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDrawPathListFilter_h -#define __otbDrawPathListFilter_h +#ifndef otbDrawPathListFilter_h +#define otbDrawPathListFilter_h #include "itkImageToImageFilter.h" #include "otbObjectList.h" @@ -108,11 +108,11 @@ protected: /** Constructor */ DrawPathListFilter(); /** Desctructor */ - virtual ~DrawPathListFilter() {} + ~DrawPathListFilter() ITK_OVERRIDE {} /** Printself method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: DrawPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbDrawPathListFilter.txx b/Modules/Filtering/Path/include/otbDrawPathListFilter.txx index ade94420a3a8f6fe430df2ed9413abd2be0a9f93..ebfca07e0a63309112b10e0eb2372804399df0fb 100644 --- a/Modules/Filtering/Path/include/otbDrawPathListFilter.txx +++ b/Modules/Filtering/Path/include/otbDrawPathListFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbDrawPathListFilter_txx -#define __otbDrawPathListFilter_txx +#ifndef otbDrawPathListFilter_txx +#define otbDrawPathListFilter_txx #include "otbDrawPathListFilter.h" @@ -56,7 +56,7 @@ DrawPathListFilter<TInputImage, TInputPath, TOutputImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputPathListType *>(this->ProcessObjectType::GetInput(1)); } diff --git a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h index f54a400d5c6c4fa25c73e2830e8b790da518edb4..57a3fbb7c672d024bb985e93b11c2080e55db1bb 100644 --- a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h +++ b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFittingPolygonListFilter_h -#define __otbImageFittingPolygonListFilter_h +#ifndef otbImageFittingPolygonListFilter_h +#define otbImageFittingPolygonListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -91,11 +91,11 @@ protected: /** Constructor */ ImageFittingPolygonListFilter(); /** Destructor */ - virtual ~ImageFittingPolygonListFilter() {} + ~ImageFittingPolygonListFilter() ITK_OVERRIDE {} /** GenerateData method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; virtual double computeValue(ImageConstPointerType image, VertexType middlePoint, diff --git a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.txx b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.txx index 5cb12c555ac56183b5779b0ea16d154c162472d7..89943767c0a41991746776e8fbab54b1e4cd9738 100644 --- a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.txx +++ b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFittingPolygonListFilter_txx -#define __otbImageFittingPolygonListFilter_txx +#ifndef otbImageFittingPolygonListFilter_txx +#define otbImageFittingPolygonListFilter_txx #include "otbImageFittingPolygonListFilter.h" #include "otbPolyLineImageConstIterator.h" @@ -53,7 +53,7 @@ ImageFittingPolygonListFilter<TPath, TImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h index 69b9a335d7ccea0ce0fa50c45dd2044708007a14..87d6301923b2d76d2596ac49648f0c280844a149 100644 --- a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h +++ b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToEdgePathFilter_h -#define __otbImageToEdgePathFilter_h +#ifndef otbImageToEdgePathFilter_h +#define otbImageToEdgePathFilter_h #include "otbImageToPathFilter.h" @@ -82,10 +82,10 @@ public: protected: ImageToEdgePathFilter(); - virtual ~ImageToEdgePathFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void GenerateOutputInformation() {} //does nothing - virtual void GenerateData(); + ~ImageToEdgePathFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE {} //does nothing + void GenerateData() ITK_OVERRIDE; private: ImageToEdgePathFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.txx b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.txx index fb34a166790e6866a4ff4a25665ad37816fd533f..9306826888a17656f3839b2fbc2bdc531fb5f0e9 100644 --- a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.txx +++ b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToEdgePathFilter_txx -#define __otbImageToEdgePathFilter_txx +#ifndef otbImageToEdgePathFilter_txx +#define otbImageToEdgePathFilter_txx #include "otbImageToEdgePathFilter.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Path/include/otbImageToPathFilter.h b/Modules/Filtering/Path/include/otbImageToPathFilter.h index 436856831acb774cddf7c75f507604e461c4f788..ffc0ffd6a20b0751166b35ef263298dd647cf9dd 100644 --- a/Modules/Filtering/Path/include/otbImageToPathFilter.h +++ b/Modules/Filtering/Path/include/otbImageToPathFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPathFilter_h -#define __otbImageToPathFilter_h +#ifndef otbImageToPathFilter_h +#define otbImageToPathFilter_h #include "itkPathSource.h" @@ -58,8 +58,8 @@ public: protected: ImageToPathFilter(); - virtual ~ImageToPathFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageToPathFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToPathFilter(const Self &); diff --git a/Modules/Filtering/Path/include/otbImageToPathFilter.txx b/Modules/Filtering/Path/include/otbImageToPathFilter.txx index 45c6af20e5c19ee80733a37d09f6966cfb8354ca..c6628d10207975dca57c216608718d35483c8328 100644 --- a/Modules/Filtering/Path/include/otbImageToPathFilter.txx +++ b/Modules/Filtering/Path/include/otbImageToPathFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPathFilter_txx -#define __otbImageToPathFilter_txx +#ifndef otbImageToPathFilter_txx +#define otbImageToPathFilter_txx #include "otbImageToPathFilter.h" diff --git a/Modules/Filtering/Path/include/otbImageToPathListFilter.h b/Modules/Filtering/Path/include/otbImageToPathListFilter.h index 535362cd81b704f65019f34644488ed6233691f7..0f609053dcf7415d8bb5315398a7f24840186044 100644 --- a/Modules/Filtering/Path/include/otbImageToPathListFilter.h +++ b/Modules/Filtering/Path/include/otbImageToPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToPathListFilter_h -#define __otbImageToPathListFilter_h +#ifndef otbImageToPathListFilter_h +#define otbImageToPathListFilter_h #include "otbPathListSource.h" namespace otb @@ -73,9 +73,9 @@ public: protected: ImageToPathListFilter(); - virtual ~ImageToPathListFilter() {} + ~ImageToPathListFilter() ITK_OVERRIDE {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbImageToPathListFilter.txx b/Modules/Filtering/Path/include/otbImageToPathListFilter.txx index 1f6296792c928327ce2e3bcaad8c4941c4c2a584..b67b226f89cebfff83400ac1adc0a9fb70269736 100644 --- a/Modules/Filtering/Path/include/otbImageToPathListFilter.txx +++ b/Modules/Filtering/Path/include/otbImageToPathListFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageToPathListFilter_txx -#define __otbImageToPathListFilter_txx +#ifndef otbImageToPathListFilter_txx +#define otbImageToPathListFilter_txx #include "otbImageToPathListFilter.h" #include "itkProcessObject.h" @@ -58,7 +58,7 @@ ImageToPathListFilter<TInputImage, TOutputPath> if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *> diff --git a/Modules/Filtering/Path/include/otbOrientationPathFunction.h b/Modules/Filtering/Path/include/otbOrientationPathFunction.h index e1b1b19ff89ff57624b3377324baa20d7164ea3f..ca207f685ac315ac4e2f9c83c399f0d4f9fbea0e 100644 --- a/Modules/Filtering/Path/include/otbOrientationPathFunction.h +++ b/Modules/Filtering/Path/include/otbOrientationPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOrientationPathFunction_h -#define __otbOrientationPathFunction_h +#ifndef otbOrientationPathFunction_h +#define otbOrientationPathFunction_h #include "otbPathFunction.h" #include "itkVectorContainer.h" @@ -63,13 +63,13 @@ public: typedef double RealType; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PathType& path) const; + OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; virtual OutputType Evaluate() const; protected: OrientationPathFunction() {}; - virtual ~OrientationPathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~OrientationPathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: OrientationPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbOrientationPathFunction.txx b/Modules/Filtering/Path/include/otbOrientationPathFunction.txx index ab09be6b0cdfae701a6d99414afa2d06d024f9d4..b8141f3620ebf8d7258d7385a9a55393ba91b9de 100644 --- a/Modules/Filtering/Path/include/otbOrientationPathFunction.txx +++ b/Modules/Filtering/Path/include/otbOrientationPathFunction.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOrientationPathFunction_txx -#define __otbOrientationPathFunction_txx +#ifndef otbOrientationPathFunction_txx +#define otbOrientationPathFunction_txx +#include "otbOrientationPathFunction.h" #include "otbPathFunction.h" #include "itkNumericTraits.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Path/include/otbPathFunction.h b/Modules/Filtering/Path/include/otbPathFunction.h index 568007a1da1178179e3178cb7ad1a01e014118a3..25ca7f89e64503aa07874cb4bdbdb9eac8184b2c 100644 --- a/Modules/Filtering/Path/include/otbPathFunction.h +++ b/Modules/Filtering/Path/include/otbPathFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPathFunction_h -#define __otbPathFunction_h +#ifndef otbPathFunction_h +#define otbPathFunction_h #include "itkFunctionBase.h" @@ -77,8 +77,8 @@ public: protected: PathFunction(); - virtual ~PathFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PathFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; InputPathConstPointer m_Path; diff --git a/Modules/Filtering/Path/include/otbPathFunction.txx b/Modules/Filtering/Path/include/otbPathFunction.txx index b3d9086a808feb480cf6579fba875413c0762aa7..971f4587454f772eed96760bf49cb37e0bb05d3c 100644 --- a/Modules/Filtering/Path/include/otbPathFunction.txx +++ b/Modules/Filtering/Path/include/otbPathFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPathFunction_txx -#define __otbPathFunction_txx +#ifndef otbPathFunction_txx +#define otbPathFunction_txx #include "otbPathFunction.h" @@ -30,7 +30,7 @@ template <class TInputPath, class TOutput> PathFunction<TInputPath, TOutput> ::PathFunction() { - m_Path = NULL; + m_Path = ITK_NULLPTR; } /** diff --git a/Modules/Filtering/Path/include/otbPathLengthFunctor.h b/Modules/Filtering/Path/include/otbPathLengthFunctor.h index f8dd25a0f7c44ab6e30611ac3137aa45f994417f..2fcbfb1893ba9dee3ccdecd78108aef88b10dba3 100644 --- a/Modules/Filtering/Path/include/otbPathLengthFunctor.h +++ b/Modules/Filtering/Path/include/otbPathLengthFunctor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbPathLengthFunctor_h -#define __otbPathLengthFunctor_h +#ifndef otbPathLengthFunctor_h +#define otbPathLengthFunctor_h #include "otbMath.h" diff --git a/Modules/Filtering/Path/include/otbPathListSource.h b/Modules/Filtering/Path/include/otbPathListSource.h index 766a2b5eb7018a63bfe6ea51c77c67f0cb0b5fd5..b25f914fd7492f41035ee6bdfe7b48c7a5404344 100644 --- a/Modules/Filtering/Path/include/otbPathListSource.h +++ b/Modules/Filtering/Path/include/otbPathListSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPathListSource_h -#define __otbPathListSource_h +#ifndef otbPathListSource_h +#define otbPathListSource_h // #include "itkProcessObject.h" // #include "itkDataObject.h" @@ -169,7 +169,7 @@ public: protected: PathListSource() {}; - virtual ~PathListSource() {} + ~PathListSource() ITK_OVERRIDE {} // void PrintSelf(std::ostream& os, itk::Indent indent) const; private: diff --git a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h index e9c7fdbf0aac48725df9a6a1d85499dfbdabea6f..2f46aad8b6176c1ae4c8f04d21fb900d442d0609 100644 --- a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h +++ b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbPathListToHistogramGenerator_h -#define __otbPathListToHistogramGenerator_h +#ifndef otbPathListToHistogramGenerator_h +#define otbPathListToHistogramGenerator_h #include "itkSampleToHistogramFilter.h" #include "itkHistogram.h" @@ -114,12 +114,12 @@ public: protected: PathListToHistogramGenerator(); - virtual ~PathListToHistogramGenerator() {} - virtual void GenerateData(); - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + ~PathListToHistogramGenerator() ITK_OVERRIDE {} + void GenerateData() ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.txx b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.txx index 6c2cf4daafc2ca28ee60714dc9518092de4920cd..850b32dea38ab663480fa45565858a9ab4d216bc 100644 --- a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.txx +++ b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbPathListToHistogramGenerator_txx -#define __otbPathListToHistogramGenerator_txx +#ifndef otbPathListToHistogramGenerator_txx +#define otbPathListToHistogramGenerator_txx #include "otbPathListToHistogramGenerator.h" @@ -53,7 +53,7 @@ PathListToHistogramGenerator<TPath, TFunction> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const PathListType* > (this->itk::ProcessObject::GetInput(0) ); diff --git a/Modules/Filtering/Path/include/otbPathListToPathListFilter.h b/Modules/Filtering/Path/include/otbPathListToPathListFilter.h index 53a38c2c11c5f3c253421910b46b678f64845ec7..b822cd9f81d0ad0c6fb05854be0dc86e21eac69b 100644 --- a/Modules/Filtering/Path/include/otbPathListToPathListFilter.h +++ b/Modules/Filtering/Path/include/otbPathListToPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPathListToPathListFilter_h -#define __otbPathListToPathListFilter_h +#ifndef otbPathListToPathListFilter_h +#define otbPathListToPathListFilter_h #include "otbObjectListToObjectListFilter.h" #include "otbObjectList.h" @@ -60,7 +60,7 @@ protected: /** Constructor */ PathListToPathListFilter() {}; /** Destructor */ - virtual ~PathListToPathListFilter() {} + ~PathListToPathListFilter() ITK_OVERRIDE {} private: PathListToPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbPathMeanDistanceFunctor.h b/Modules/Filtering/Path/include/otbPathMeanDistanceFunctor.h index 7d632d99d4e2e3084a4eb22925481cdab3b13d2a..eff6f2a533aaa7b0b71e769834f01a5870e498a9 100644 --- a/Modules/Filtering/Path/include/otbPathMeanDistanceFunctor.h +++ b/Modules/Filtering/Path/include/otbPathMeanDistanceFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPathMeanDistanceFunctor_h -#define __otbPathMeanDistanceFunctor_h +#ifndef otbPathMeanDistanceFunctor_h +#define otbPathMeanDistanceFunctor_h #include "otbMacro.h" #include "otbMath.h" diff --git a/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.h b/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.h index 4d44ee407b8f944cd3effb55d3139ba847fd6d22..01868c0eb1dcfce36c698791083c92d80ab011a4 100644 --- a/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.h +++ b/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolyLineImageConstIterator_h -#define __otbPolyLineImageConstIterator_h +#ifndef otbPolyLineImageConstIterator_h +#define otbPolyLineImageConstIterator_h #include "itkIndex.h" #include "itkImage.h" diff --git a/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.txx b/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.txx index 2016bf5dc466c1fe9bbdd7963c69356fdb2248fb..a0e748d78ccdd81f97aef41c45e4d03171398b64 100644 --- a/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.txx +++ b/Modules/Filtering/Path/include/otbPolyLineImageConstIterator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolyLineImageConstIterator_txx -#define __otbPolyLineImageConstIterator_txx +#ifndef otbPolyLineImageConstIterator_txx +#define otbPolyLineImageConstIterator_txx #include "otbPolyLineImageConstIterator.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Path/include/otbPolyLineImageIterator.h b/Modules/Filtering/Path/include/otbPolyLineImageIterator.h index 6431149cd6971740e0f9325e087782ee8f81ebb7..4611700a929e29d1a27cdadb78280f4916badbb7 100644 --- a/Modules/Filtering/Path/include/otbPolyLineImageIterator.h +++ b/Modules/Filtering/Path/include/otbPolyLineImageIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolyLineImageIterator_h -#define __otbPolyLineImageIterator_h +#ifndef otbPolyLineImageIterator_h +#define otbPolyLineImageIterator_h #include "otbPolyLineImageConstIterator.h" @@ -92,7 +92,7 @@ public: PolyLineImageIterator(ImageType * imagePtr, PathType * pathPtr) : Superclass(imagePtr, pathPtr) {}; /** Default Destructor. */ - virtual ~PolyLineImageIterator() {} + ~PolyLineImageIterator() ITK_OVERRIDE {} }; } // End namespace otb diff --git a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h index a402cb52b1e05b5ce101d644f5d8ac56463b2d10..c7d98969dfc3009fd55c18f2fc4fe17548e4377e 100644 --- a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h +++ b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h @@ -17,8 +17,8 @@ =========================================================================*/ // Adapted from otbImageToPathListAlignFilter.h -#ifndef __otbRegionImageToRectangularPathListFilter_h -#define __otbRegionImageToRectangularPathListFilter_h +#ifndef otbRegionImageToRectangularPathListFilter_h +#define otbRegionImageToRectangularPathListFilter_h #include "itkImageSource.h" #include "itkConceptChecking.h" @@ -99,16 +99,16 @@ public: protected: RegionImageToRectangularPathListFilter(); - virtual ~RegionImageToRectangularPathListFilter(); + ~RegionImageToRectangularPathListFilter() ITK_OVERRIDE; - virtual void GenerateOutputInformation(){} // do nothing - virtual void GenerateData(); + void GenerateOutputInformation() ITK_OVERRIDE{} // do nothing + void GenerateData() ITK_OVERRIDE; double m_MinimumFit; double m_MinimumSize; int m_CrossTermFormula; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; //jgc typedef Image<unsigned char, itkGetStaticConstMacro(NDimensions)> MarkerImageType; diff --git a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx index 251efe9828e4870f857c5f93a3cf113ea25e1ee9..d96e1b2b19fe6aa7244aee68699b9b1d274ff24c 100644 --- a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx +++ b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx @@ -18,8 +18,8 @@ // Adapted from otbImageToPathListAlignFilter.txx -#ifndef __otbRegionImageToRectangularPathListFilter_txx -#define __otbRegionImageToRectangularPathListFilter_txx +#ifndef otbRegionImageToRectangularPathListFilter_txx +#define otbRegionImageToRectangularPathListFilter_txx #include <iostream> #include <exception> diff --git a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h index 9d22d9584170dbfb8746a9fe08c462e3e47da31a..60a36144e992543b286f29cad069560072ed715f 100644 --- a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h +++ b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorizationPathListFilter_h -#define __otbVectorizationPathListFilter_h +#ifndef otbVectorizationPathListFilter_h +#define otbVectorizationPathListFilter_h #include "otbPathListSource.h" #include "itkImageRegionIterator.h" @@ -114,11 +114,11 @@ protected: /** Constructor */ VectorizationPathListFilter(); /** Destructor */ - virtual ~VectorizationPathListFilter() {} + ~VectorizationPathListFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** * Compute a vector of the 8 neighbors to explore from the direction and the type of search (forward or backward). * \param direction The direction diff --git a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.txx b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.txx index 90599e0d19ebc9259fbe552afc9e7af8dd1fdd0a..ef7c42fe40dd6d25ded284cfb63e07fbc0cebff7 100644 --- a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.txx +++ b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorizationPathListFilter_txx -#define __otbVectorizationPathListFilter_txx +#ifndef otbVectorizationPathListFilter_txx +#define otbVectorizationPathListFilter_txx #include "otbVectorizationPathListFilter.h" #include "otbMacro.h" @@ -52,7 +52,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputModulus*>(this->itk::ProcessObject::GetInput(0)); } @@ -73,7 +73,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputDirection *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Filtering/Path/test/otbRegionImageToRectangularPathListFilter.cxx b/Modules/Filtering/Path/test/otbRegionImageToRectangularPathListFilter.cxx index e088c294b2879de526044720c50535f4ab07a838..a42753cdeb05eb21854847906284a6a1dd0b6f95 100644 --- a/Modules/Filtering/Path/test/otbRegionImageToRectangularPathListFilter.cxx +++ b/Modules/Filtering/Path/test/otbRegionImageToRectangularPathListFilter.cxx @@ -62,7 +62,7 @@ int otbRegionImageToRectangularPathListFilter(int itkNotUsed(argc), char * argv[ ListType::Iterator listIt = pathList->Begin(); FILE *file = fopen(outputFilename, "w"); - if (file == NULL) + if (file == ITK_NULLPTR) { fprintf(stderr, "Error, can't open file"); exit(-1); diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h index 11aff0d012419391e95809ce63755aceacc39aaa..413694fe2cd9b8e1cf1052e91c0f58f77573cdbd 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __MuellerToPolarisationDegreeAndPowerImageFilter_h -#define __MuellerToPolarisationDegreeAndPowerImageFilter_h +#ifndef otbMuellerToPolarisationDegreeAndPowerImageFilter_h +#define otbMuellerToPolarisationDegreeAndPowerImageFilter_h #include "otbUnaryFunctorImageFilter.h" #include "itkNumericTraits.h" @@ -227,7 +227,7 @@ public: protected: MuellerToPolarisationDegreeAndPowerImageFilter() {} - virtual ~MuellerToPolarisationDegreeAndPowerImageFilter() {} + ~MuellerToPolarisationDegreeAndPowerImageFilter() ITK_OVERRIDE {} private: MuellerToPolarisationDegreeAndPowerImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h index 0aa2d8665815ca14c7005fd99fc32eb9f3532b64..0df1f256a760539cb01ead1b990c63b4d9e67d6a 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __MuellerToReciprocalCovarianceImageFilter_h -#define __MuellerToReciprocalCovarianceImageFilter_h +#ifndef otbMuellerToReciprocalCovarianceImageFilter_h +#define otbMuellerToReciprocalCovarianceImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -155,7 +155,7 @@ public: protected: MuellerToReciprocalCovarianceImageFilter() {} - virtual ~MuellerToReciprocalCovarianceImageFilter() {} + ~MuellerToReciprocalCovarianceImageFilter() ITK_OVERRIDE {} private: MuellerToReciprocalCovarianceImageFilter(const Self&); // purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h index 900da39d185e58f9b1920102c66073ec31cc5c17..841b97563e481c9952d99e4aafacd24be5cc37d7 100644 --- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelsPolarimetricSynthesisFilter_h -#define __otbMultiChannelsPolarimetricSynthesisFilter_h +#ifndef otbMultiChannelsPolarimetricSynthesisFilter_h +#define otbMultiChannelsPolarimetricSynthesisFilter_h #include "itkInPlaceImageFilter.h" #include "otbPolarimetricSynthesisFunctor.h" @@ -152,7 +152,7 @@ protected: /** Constructor */ MultiChannelsPolarimetricSynthesisFilter(); /** Destructor */ - virtual ~MultiChannelsPolarimetricSynthesisFilter() {} + ~MultiChannelsPolarimetricSynthesisFilter() ITK_OVERRIDE {} /** MultiChannelsPolarimetricSynthesisFilter can produce an image * which is a synthesis of channels HH, HV, VH and VV. @@ -164,9 +164,9 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** MultiChannelsPolarimetricSynthesisFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -179,7 +179,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; /** Computation of the electromagnetic fields Ei Er */ void ComputeElectromagneticFields(); @@ -187,7 +187,7 @@ protected: /** Verify and force the inputs, if only 2 or 3 channels are present */ void VerifyAndForceInputs(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: MultiChannelsPolarimetricSynthesisFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx index e5539846c767445733336cd7952e937a42f6e60f..4640fd4d0bd75488967134388f819196386a4e46 100644 --- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx +++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelsPolarimetricSynthesisFilter_txx -#define __otbMultiChannelsPolarimetricSynthesisFilter_txx +#ifndef otbMultiChannelsPolarimetricSynthesisFilter_txx +#define otbMultiChannelsPolarimetricSynthesisFilter_txx #include <complex> diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h index 1de47c38598d65fca4003e04c88eae22bbcbb101..15cd3bf513a4f7b947f5eb688bfa7efb8bb128e5 100644 --- a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h +++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolarimetricData_h -#define __otbPolarimetricData_h +#ifndef otbPolarimetricData_h +#define otbPolarimetricData_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -76,9 +76,9 @@ protected: /** Constructor */ PolarimetricData(); /** Destructor */ - virtual ~PolarimetricData() {} + ~PolarimetricData() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PolarimetricData(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricSynthesisFunctor.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricSynthesisFunctor.h index 0877fbb161e2966d2d51e1565a7f288bb348d34b..2b22bff697eaf74ae88db0dcbc6456af45eb04b7 100644 --- a/Modules/Filtering/Polarimetry/include/otbPolarimetricSynthesisFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricSynthesisFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolarimetricSynthesisFunctor_h -#define __otbPolarimetricSynthesisFunctor_h +#ifndef otbPolarimetricSynthesisFunctor_h +#define otbPolarimetricSynthesisFunctor_h #include "otbMath.h" #include "vcl_complex.h" diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h index 4b6403f1435dc3eb521fc9d9faf762549e2bafe6..16a18128c8e5498a03d32ce8d9771e96105d79ec 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalBarnesDecompImageFilter_h -#define __ReciprocalBarnesDecompImageFilter_h +#ifndef otbReciprocalBarnesDecompImageFilter_h +#define otbReciprocalBarnesDecompImageFilter_h #include "otbUnaryFunctorImageFilter.h" #include "otbMath.h" @@ -148,7 +148,7 @@ public: protected: ReciprocalBarnesDecompImageFilter() {} - virtual ~ReciprocalBarnesDecompImageFilter() {} + ~ReciprocalBarnesDecompImageFilter() ITK_OVERRIDE {} private: ReciprocalBarnesDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h index a025d9c337a32c5865a964452bba75a247bb0373..6bbe7ef74bd5ddad9d684b587b784e82867ad080 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalCoherencyToReciprocalMuellerImageFilter_h -#define __ReciprocalCoherencyToReciprocalMuellerImageFilter_h +#ifndef otbReciprocalCoherencyToReciprocalMuellerImageFilter_h +#define otbReciprocalCoherencyToReciprocalMuellerImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -160,7 +160,7 @@ public: protected: ReciprocalCoherencyToReciprocalMuellerImageFilter() {} - virtual ~ReciprocalCoherencyToReciprocalMuellerImageFilter() {} + ~ReciprocalCoherencyToReciprocalMuellerImageFilter() ITK_OVERRIDE {} private: diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h index 2ffb1b9a225273a1bf89aed98b38130345773247..4b8d26c7662b19e7a28cb570d5bb1f142d3b6359 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalCovarianceToCoherencyDegreeImageFilter_h -#define __ReciprocalCovarianceToCoherencyDegreeImageFilter_h +#ifndef otbReciprocalCovarianceToCoherencyDegreeImageFilter_h +#define otbReciprocalCovarianceToCoherencyDegreeImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -144,7 +144,7 @@ public: protected: ReciprocalCovarianceToCoherencyDegreeImageFilter() {} - virtual ~ReciprocalCovarianceToCoherencyDegreeImageFilter() {} + ~ReciprocalCovarianceToCoherencyDegreeImageFilter() ITK_OVERRIDE {} private: ReciprocalCovarianceToCoherencyDegreeImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h index f34b83c5035cb68cb302dfa1856a282298d65e9f..df9206e889b2f97fb6f72d603827206194767f1f 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalCovarianceToReciprocalCoherencyImageFilter_h -#define __ReciprocalCovarianceToReciprocalCoherencyImageFilter_h +#ifndef otbReciprocalCovarianceToReciprocalCoherencyImageFilter_h +#define otbReciprocalCovarianceToReciprocalCoherencyImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -135,7 +135,7 @@ public: protected: ReciprocalCovarianceToReciprocalCoherencyImageFilter() {} - virtual ~ReciprocalCovarianceToReciprocalCoherencyImageFilter() {} + ~ReciprocalCovarianceToReciprocalCoherencyImageFilter() ITK_OVERRIDE {} private: ReciprocalCovarianceToReciprocalCoherencyImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h index cb5938671d4304062d14a268e17b863b41809644..0775f5dc9832041355be803ed1358379381f79b9 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalHAlphaImageFilter_h -#define __ReciprocalHAlphaImageFilter_h +#ifndef otbReciprocalHAlphaImageFilter_h +#define otbReciprocalHAlphaImageFilter_h #include "otbUnaryFunctorImageFilter.h" #include "otbMath.h" @@ -217,7 +217,7 @@ public: protected: ReciprocalHAlphaImageFilter() {} - virtual ~ReciprocalHAlphaImageFilter() {} + ~ReciprocalHAlphaImageFilter() ITK_OVERRIDE {} private: ReciprocalHAlphaImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h index d083b7de4044adbc2ce58cb9c7c1b151cc866fae..108fe361f34f78575a3c81b55cb00944127a9053 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalHuynenDecompImageFilter_h -#define __ReciprocalHuynenDecompImageFilter_h +#ifndef otbReciprocalHuynenDecompImageFilter_h +#define otbReciprocalHuynenDecompImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -119,7 +119,7 @@ public: protected: ReciprocalHuynenDecompImageFilter() {} - virtual ~ReciprocalHuynenDecompImageFilter() {} + ~ReciprocalHuynenDecompImageFilter() ITK_OVERRIDE {} private: ReciprocalHuynenDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h index 8a8caa7b31c69756801047673bbab3706c614945..af4061490fcfecd9ebb1b576882b4bd1534a8c52 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter_h -#define __ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter_h +#ifndef otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter_h +#define otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "vcl_complex.h" @@ -140,7 +140,7 @@ public: protected: ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() {} - virtual ~ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() {} + ~ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() ITK_OVERRIDE {} private: ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h index ab8ac23d87f579992b20d8d94a024b957ab6dd28..9cde846e5f5dfaa9021394390d0a0f0fa04d77ff 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __ReciprocalPauliDecompImageFilter_h -#define __ReciprocalPauliDecompImageFilter_h +#ifndef otbReciprocalPauliDecompImageFilter_h +#define otbReciprocalPauliDecompImageFilter_h #include "otbUnaryFunctorImageFilter.h" @@ -110,7 +110,7 @@ public: protected: ReciprocalPauliDecompImageFilter() {this->SetNumberOfThreads(1);} - virtual ~ReciprocalPauliDecompImageFilter() {} + ~ReciprocalPauliDecompImageFilter() ITK_OVERRIDE {} private: ReciprocalPauliDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h index 1df4e8c8a268fdad4cea5e0015f87b45ea2369f2..8f2f6a38c58fc45b9877225775f616934b878d28 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairImageFilter_h -#define __otbSinclairImageFilter_h +#ifndef otbSinclairImageFilter_h +#define otbSinclairImageFilter_h #include "otbQuaternaryFunctorImageFilter.h" #include "otbSinclairToCovarianceMatrixFunctor.h" @@ -106,11 +106,11 @@ protected: /** Constructor */ SinclairImageFilter() {} /** Destructor */ - virtual ~SinclairImageFilter() {} + ~SinclairImageFilter() ITK_OVERRIDE {} - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.txx b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.txx index d929a06c695a1c9823ff8422d3b5ac125519930c..eb81e538e2415ddb0bbbbecdb21e7c5e1889498f 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.txx +++ b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairImageFilter_txx -#define __otbSinclairImageFilter_txx +#ifndef otbSinclairImageFilter_txx +#define otbSinclairImageFilter_txx #include "otbSinclairImageFilter.h" #include "otbMath.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h index 55bb5c9ecdc47dd70179488ccea6871a66c66382..b089f94a7d26614ed37f7d9b6c5d420fb3ab6417 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairReciprocalImageFilter_h -#define __otbSinclairReciprocalImageFilter_h +#ifndef otbSinclairReciprocalImageFilter_h +#define otbSinclairReciprocalImageFilter_h #include "itkTernaryFunctorImageFilter.h" #include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" @@ -105,11 +105,11 @@ protected: /** Constructor */ SinclairReciprocalImageFilter() {} /** Destructor */ - virtual ~SinclairReciprocalImageFilter() {} + ~SinclairReciprocalImageFilter() ITK_OVERRIDE {} - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.txx b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.txx index 82ca755cbfd28dc4c3296a623392f1133e20519a..159b3745015590d9ebaf88d7ec4cb62d2b27058b 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.txx +++ b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairReciprocalImageFilter_txx -#define __otbSinclairReciprocalImageFilter_txx +#ifndef otbSinclairReciprocalImageFilter_txx +#define otbSinclairReciprocalImageFilter_txx #include "otbSinclairReciprocalImageFilter.h" #include "otbMath.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h index 08e10da87a53b51cbd79ae565c598240911c4965..174dcd82637119ae948c515dc16f8d4b09f94a46 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToCircularCovarianceMatrixFunctor_h -#define __otbSinclairToCircularCovarianceMatrixFunctor_h +#ifndef otbSinclairToCircularCovarianceMatrixFunctor_h +#define otbSinclairToCircularCovarianceMatrixFunctor_h #include "vcl_complex.h" #include "otbSinclairToCovarianceMatrixFunctor.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h index 43b3320ce7a3bde391ae89d3b63fde566323588d..779eef23e6dcf8bc071da0fd4b2099c3dc581c81 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToCoherencyMatrixFunctor_h -#define __otbSinclairToCoherencyMatrixFunctor_h +#ifndef otbSinclairToCoherencyMatrixFunctor_h +#define otbSinclairToCoherencyMatrixFunctor_h #include "vcl_complex.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h index 390487cf7c17393c35e22745380b114fad65be23..2a0d1dac862de648909b14900e0e186ca47dd8c1 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToCovarianceMatrixFunctor_h -#define __otbSinclairToCovarianceMatrixFunctor_h +#ifndef otbSinclairToCovarianceMatrixFunctor_h +#define otbSinclairToCovarianceMatrixFunctor_h #include "vcl_complex.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h index 4bd338ccef5c7dbf1fcdd8eb92b79723a925ccf1..33ab0b9d1e3d19f27136810e6e5fc1c5aff68eee 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToMuellerMatrixFunctor_h -#define __otbSinclairToMuellerMatrixFunctor_h +#ifndef otbSinclairToMuellerMatrixFunctor_h +#define otbSinclairToMuellerMatrixFunctor_h #include "vcl_complex.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h index 7dbb8322dc7cd0f7f01a5d0f0cd21f20c65c8c3b..5fc5a2c009deeff6b7e78d86a86b6af23efb76ab 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h -#define __otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h +#ifndef otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h +#define otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h #include "vcl_complex.h" #include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h index 7fb9ddc327a721737781b24eb065de7bc07dcf63..06db3349cdbc67b4746e2f2a2e993c2e191275b4 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToReciprocalCoherencyMatrixFunctor_h -#define __otbSinclairToReciprocalCoherencyMatrixFunctor_h +#ifndef otbSinclairToReciprocalCoherencyMatrixFunctor_h +#define otbSinclairToReciprocalCoherencyMatrixFunctor_h #include "itkMacro.h" #include "vcl_complex.h" diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h index 632033676ae0d5b2895f723074d9459a736969ba..4aed252c5cba8d8cdc8cc1770deb2708ceee9038 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinclairToReciprocalCovarianceMatrixFunctor_h -#define __otbSinclairToReciprocalCovarianceMatrixFunctor_h +#ifndef otbSinclairToReciprocalCovarianceMatrixFunctor_h +#define otbSinclairToReciprocalCovarianceMatrixFunctor_h #include "vcl_complex.h" #include "otbMath.h" diff --git a/Modules/Filtering/Polarimetry/test/otbMultiChannelsPolarimetricSynthesisFilter.cxx b/Modules/Filtering/Polarimetry/test/otbMultiChannelsPolarimetricSynthesisFilter.cxx index dab9e4dd1ca5db03bd08444c750bec0a2c3cffcd..8f13439f1012ba94353382eafa65f9ce806faef7 100644 --- a/Modules/Filtering/Polarimetry/test/otbMultiChannelsPolarimetricSynthesisFilter.cxx +++ b/Modules/Filtering/Polarimetry/test/otbMultiChannelsPolarimetricSynthesisFilter.cxx @@ -34,10 +34,10 @@ int otbMultiChannelsPolarimetricSynthesisFilter(int itkNotUsed(argc), char * arg const char * outputFilename = argv[4]; - double PsiI = strtod(argv[5], NULL); - double KhiI = strtod(argv[6], NULL); - double PsiR = strtod(argv[7], NULL); - double KhiR = strtod(argv[8], NULL); + double PsiI = strtod(argv[5], ITK_NULLPTR); + double KhiI = strtod(argv[6], ITK_NULLPTR); + double PsiR = strtod(argv[7], ITK_NULLPTR); + double KhiR = strtod(argv[8], ITK_NULLPTR); typedef std::complex <double> InputPixelType; typedef double OutputPixelType; diff --git a/Modules/Filtering/Polarimetry/test/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx b/Modules/Filtering/Polarimetry/test/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx index 66fa248109683e15d70562a0abe40e26c48b7d82..61b4c6a95971464251fb4a653918a30f307fb96e 100644 --- a/Modules/Filtering/Polarimetry/test/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx +++ b/Modules/Filtering/Polarimetry/test/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx @@ -31,10 +31,10 @@ int otbVectorMultiChannelsPolarimetricSynthesisFilter(int itkNotUsed(argc), char const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - double PsiI = strtod(argv[3], NULL); - double KhiI = strtod(argv[4], NULL); - double PsiR = strtod(argv[5], NULL); - double KhiR = strtod(argv[6], NULL); + double PsiI = strtod(argv[3], ITK_NULLPTR); + double KhiI = strtod(argv[4], ITK_NULLPTR); + double PsiR = strtod(argv[5], ITK_NULLPTR); + double KhiR = strtod(argv[6], ITK_NULLPTR); typedef std::complex <double> InputPixelType; typedef double OutputPixelType; diff --git a/Modules/Filtering/Projection/include/otbEckert4MapProjection.h b/Modules/Filtering/Projection/include/otbEckert4MapProjection.h index 06f254308d19aa0660d0d8864e35e3af0f44e671..e2288456e8851cbe1214e23618275e81eef3a696 100644 --- a/Modules/Filtering/Projection/include/otbEckert4MapProjection.h +++ b/Modules/Filtering/Projection/include/otbEckert4MapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEckert4MapProjection_h -#define __otbEckert4MapProjection_h +#ifndef otbEckert4MapProjection_h +#define otbEckert4MapProjection_h #include "otbGenericMapProjection.h" @@ -58,7 +58,7 @@ public: protected: Eckert4MapProjection(); - virtual ~Eckert4MapProjection(); + ~Eckert4MapProjection() ITK_OVERRIDE; private: Eckert4MapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbEckert4MapProjection.txx b/Modules/Filtering/Projection/include/otbEckert4MapProjection.txx index a3567527c1c5468e81c8ab56a745a186fb85954c..71bb883ae7bee874194ed6d4658043f43f1444c1 100644 --- a/Modules/Filtering/Projection/include/otbEckert4MapProjection.txx +++ b/Modules/Filtering/Projection/include/otbEckert4MapProjection.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbEckert4MapProjection_txx -#define __otbEckert4MapProjection_txx +#ifndef otbEckert4MapProjection_txx +#define otbEckert4MapProjection_txx #include "otbEckert4MapProjection.h" #include "otbUtils.h" diff --git a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h index 47a8c503eae8fae8626ea4645fd9392f721117a6..f3a1f8fb3af3ad7df2b5bbe4907576e4ae6125de 100644 --- a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h +++ b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGCPsToRPCSensorModelImageFilter_h -#define __otbGCPsToRPCSensorModelImageFilter_h +#ifndef otbGCPsToRPCSensorModelImageFilter_h +#define otbGCPsToRPCSensorModelImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkCastImageFilter.h" @@ -167,17 +167,17 @@ protected: /** Constructor */ GCPsToRPCSensorModelImageFilter(); /** Destructor */ - virtual ~GCPsToRPCSensorModelImageFilter(); + ~GCPsToRPCSensorModelImageFilter() ITK_OVERRIDE; /** The PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Actual estimation of the sensor model takes place in the * GenerateOutputInformation() method */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Drive the model up-to-date flag */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: GCPsToRPCSensorModelImageFilter (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.txx b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.txx index 66d876c9f192cd204aa3083f7af4f9e5b6c673b0..f9b78b91135d1626d0bf66368c1afe5cf6a89fd7 100644 --- a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGCPsToRPCSensorModelImageFilter_txx -#define __otbGCPsToRPCSensorModelImageFilter_txx +#ifndef otbGCPsToRPCSensorModelImageFilter_txx +#define otbGCPsToRPCSensorModelImageFilter_txx #include "otbGCPsToRPCSensorModelImageFilter.h" diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h index e755f1f3503847f40d81fcb6039b97e513ccc83c..97ff952021d352525b20a57c41b65a42c459bef0 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRSResampleImageFilter_h -#define __otbGenericRSResampleImageFilter_h +#ifndef otbGenericRSResampleImageFilter_h +#define otbGenericRSResampleImageFilter_h #include "otbStreamingResampleImageFilter.h" #include "otbPhysicalToRPCSensorModelImageFilter.h" @@ -265,20 +265,20 @@ public: } /** Override itk::ProcessObject method to let the internal filter do the propagation */ - virtual void PropagateRequestedRegion(itk::DataObject *output); + void PropagateRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; protected: GenericRSResampleImageFilter(); /** Destructor */ - virtual ~GenericRSResampleImageFilter() {}; + ~GenericRSResampleImageFilter() ITK_OVERRIDE {}; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; virtual void UpdateTransform(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GenericRSResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx index bd60be834c18f3fb6d63714e5655743de13120fa..10c6fab1ddfd297f70eb5a151fc22096bd1a22ff 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGenericRSResampleImageFilter_txx -#define __otbGenericRSResampleImageFilter_txx +#ifndef otbGenericRSResampleImageFilter_txx +#define otbGenericRSResampleImageFilter_txx #include "otbGenericRSResampleImageFilter.h" @@ -200,7 +200,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> m_InputRpcEstimator->SetInput(tempPtr); m_InputRpcEstimator->UpdateOutputInformation(); - // No need to override the input kwl, just setup the + // No need to ITK_OVERRIDE the input kwl, just setup the // transform with the kwl estimated if(m_InputRpcEstimator->GetInput()->GetImageKeywordlist().GetSize() > 0) m_Transform->SetOutputKeywordList(m_InputRpcEstimator->GetOutput()->GetImageKeywordlist()); @@ -295,12 +295,12 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> bool hem = (geoPoint[1]>1e-10)?true:false; // Build the output UTM projection ref - OGRSpatialReferenceH oSRS = OSRNewSpatialReference(NULL); + OGRSpatialReferenceH oSRS = OSRNewSpatialReference(ITK_NULLPTR); OSRSetProjCS(oSRS, "UTM"); OSRSetWellKnownGeogCS(oSRS, "WGS84"); OSRSetUTM(oSRS, zone, hem); - char * utmRefC = NULL; + char * utmRefC = ITK_NULLPTR; OSRExportToWkt(oSRS, &utmRefC); projectionRef = utmRefC; diff --git a/Modules/Filtering/Projection/include/otbGeographicalDistance.h b/Modules/Filtering/Projection/include/otbGeographicalDistance.h index 22aa459ee81bed3e6dd95c5ea347e11fd53ab7ff..c05ee3243a3592858edc9001c1f25e226461572d 100644 --- a/Modules/Filtering/Projection/include/otbGeographicalDistance.h +++ b/Modules/Filtering/Projection/include/otbGeographicalDistance.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeographicalDistance_h -#define __otbGeographicalDistance_h +#ifndef otbGeographicalDistance_h +#define otbGeographicalDistance_h #include "itkNumericTraits.h" #include "itkDistanceMetric.h" @@ -67,10 +67,10 @@ public: /** Gets the distance between the origin point and x. This function * work with SetOrigin() function */ - virtual double Evaluate(const VectorType & x) const; + double Evaluate(const VectorType & x) const ITK_OVERRIDE; /* Gets the distance between x and y points */ - virtual double Evaluate(const VectorType & x, const VectorType & y) const; + double Evaluate(const VectorType & x, const VectorType & y) const ITK_OVERRIDE; /** Set the earth radius */ itkSetMacro(EarthRadius, double); @@ -83,10 +83,10 @@ protected: GeographicalDistance(); /** Destructor */ - virtual ~GeographicalDistance(){} + ~GeographicalDistance() ITK_OVERRIDE{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GeographicalDistance(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGeographicalDistance.txx b/Modules/Filtering/Projection/include/otbGeographicalDistance.txx index 1a84de0490fbd905a2f1ac48b5a6eae086a93709..fb75398d5c179f5baa6f9a5d4335a201dc828357 100644 --- a/Modules/Filtering/Projection/include/otbGeographicalDistance.txx +++ b/Modules/Filtering/Projection/include/otbGeographicalDistance.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeographicalDistance_txx -#define __otbGeographicalDistance_txx +#ifndef otbGeographicalDistance_txx +#define otbGeographicalDistance_txx #include "otbGeographicalDistance.h" #include "otbMath.h" diff --git a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h index b5da04780933378402761eee4010dce4a1ce18c5..542916f2b7372ba9e05da3c13a3265a58c8b7c4c 100644 --- a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeometriesProjectionFilter_h -#define __otbGeometriesProjectionFilter_h +#ifndef otbGeometriesProjectionFilter_h +#define otbGeometriesProjectionFilter_h #include "otbGeometriesToGeometriesFilter.h" #include "otbOGRGeometryWrapper.h" @@ -190,7 +190,7 @@ private: * of the filter. It's up to the caller to take responsibility of the returned * object. */ - virtual OGRSpatialReference* DoDefineNewLayerSpatialReference(ogr::Layer const& source) const; + OGRSpatialReference* DoDefineNewLayerSpatialReference(ogr::Layer const& source) const ITK_OVERRIDE; /** * Hook that actually filters an OGR \c Layer. * \param[in] source Input layer @@ -202,13 +202,13 @@ private: * inner-filter working on \c ogr::DataSource cannot be globally configured * once and for all. */ - virtual void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const; + void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const ITK_OVERRIDE; /** Hook used to conclude the initialization phase. * Global \c ogr::DataSource settings for the \c m_Transform functor are * forwarded to the functor. \c ogr::Layer specific settings will be set at * the last moment from \c DoProcessLayer(). */ - virtual void DoFinalizeInitialisation(); + void DoFinalizeInitialisation() ITK_OVERRIDE; /** * Hook used to define the fields of the new layer. * \param[in] source source \c Layer -- for reference @@ -217,18 +217,18 @@ private: * Just forwards the fields definition to the \c FieldTransformationPolicy * encapsuled in the \c TransformationFunctorDispatcherType. */ - virtual void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const; + void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const ITK_OVERRIDE; protected: /** Default constructor. */ GeometriesProjectionFilter(); /** Destructor. */ - virtual ~GeometriesProjectionFilter(); + ~GeometriesProjectionFilter() ITK_OVERRIDE; /** Computes output information. * \post \c m_OutputProjectionRef contains all its related meta-data */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; public: /**\name Image Reference (origin, spacing) */ @@ -292,4 +292,4 @@ private: #include "otbGeometriesProjectionFilter.txx" #endif -#endif // __otbGeometriesProjectionFilter_h +#endif // otbGeometriesProjectionFilter_h diff --git a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.txx b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.txx index c6c3fdf32c0b9fc0c70577b5929a29694f828b7e..d86a0169034b5f47d375ed45a64365765e941595 100644 --- a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.txx +++ b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.txx @@ -15,6 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbGeometriesProjectionFilter_txx +#define otbGeometriesProjectionFilter_txx /*===========================================================================*/ /*===============================[ Includes ]================================*/ @@ -32,7 +34,7 @@ otb::ogr::UniqueGeometryPtr otb::internal::ReprojectTransformationFunctor::ByCopy::operator()(TGeometry const* in) const { boost::interprocess::unique_ptr<TGeometry, ogr::internal::GeometryDeleter> - out(in ? static_cast <TGeometry*>(in->clone()) : 0); // OGR clone doesn't use covariant return ... + out(in ? static_cast <TGeometry*>(in->clone()) : ITK_NULLPTR); // OGR clone doesn't use covariant return ... if (out) m_Reprojector.do_transform(*out); ogr::UniqueGeometryPtr res(out.release()); @@ -97,3 +99,5 @@ void otb::GeometriesProjectionFilter::SetOutputKeywordList(const ImageKeywordlis this->m_OutputKeywordList = kwl; this->Modified(); } + +#endif diff --git a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h index bc85e4bb917f1c5dd2d1c625dff11e3d0bfd2638..70e3945ae7cc62e9a37c1d3040acc87338117bdd 100644 --- a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h +++ b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGroundSpacingImageFunction_h -#define __otbGroundSpacingImageFunction_h +#ifndef otbGroundSpacingImageFunction_h +#define otbGroundSpacingImageFunction_h #include "itkImageFunction.h" #include "itkNumericTraits.h" diff --git a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx index c9ed6c63e64d620370ecd63d2f595e4f0f4eced6..b966d643475fbed256f22361a3d4b3ea59591a52 100644 --- a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx +++ b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbGroundSpacingImageFunction_txx -#define __otbGroundSpacingImageFunction_txx +#ifndef otbGroundSpacingImageFunction_txx +#define otbGroundSpacingImageFunction_txx #include "otbMath.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h index 512922dbb378f06555fd07b17da4f5e0da0ca678..fde7efc0b6fd5de9bc3b7e8c82c4c29ea53946b6 100644 --- a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h +++ b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToEnvelopeVectorDataFilter_h -#define __otbImageToEnvelopeVectorDataFilter_h +#ifndef otbImageToEnvelopeVectorDataFilter_h +#define otbImageToEnvelopeVectorDataFilter_h #include "otbVectorDataSource.h" #include "otbGenericRSTransform.h" @@ -93,13 +93,13 @@ public: protected: ImageToEnvelopeVectorDataFilter(); - virtual ~ImageToEnvelopeVectorDataFilter() {} + ~ImageToEnvelopeVectorDataFilter() ITK_OVERRIDE {} - void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; void InstantiateTransform(); diff --git a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.txx b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.txx index cdd2263ccc3bbcd453d34c94bba6536791e74292..3f7908bae6ec7eda55ceeec97042b2806ec7cd51 100644 --- a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.txx +++ b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToEnvelopeVectorDataFilter_txx -#define __otbImageToEnvelopeVectorDataFilter_txx +#ifndef otbImageToEnvelopeVectorDataFilter_txx +#define otbImageToEnvelopeVectorDataFilter_txx #include "otbImageToEnvelopeVectorDataFilter.h" #include "otbDataNode.h" @@ -54,7 +54,7 @@ const TInputImage * ImageToEnvelopeVectorDataFilter<TInputImage, TOutputVectorData> ::GetInput(void) { - if (this->GetNumberOfInputs() < 1) return 0; + if (this->GetNumberOfInputs() < 1) return ITK_NULLPTR; return dynamic_cast<const InputImageType*> (this->itk::ProcessObject::GetInput(0)); diff --git a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h index 9b4e931260b658ca7162737949f7bc755ac47b99..26fa8c755eb7416f8958551a81a0697f7cf41b30 100644 --- a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h +++ b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImportGeoInformationImageFilter_h -#define __otbImportGeoInformationImageFilter_h +#ifndef otbImportGeoInformationImageFilter_h +#define otbImportGeoInformationImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkCastImageFilter.h" @@ -78,20 +78,20 @@ protected: /** Constructor */ ImportGeoInformationImageFilter(); /** Destructor */ - virtual ~ImportGeoInformationImageFilter() {} + ~ImportGeoInformationImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate input requested region */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: ImportGeoInformationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx index 2e10dc4c119ede48f329711e48145487533e7e44..8a64e95e21f7831879367afe0b288d7d6ff4a88e 100644 --- a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImportGeoInformationImageFilter_txx -#define __otbImportGeoInformationImageFilter_txx +#ifndef otbImportGeoInformationImageFilter_txx +#define otbImportGeoInformationImageFilter_txx #include "otbImportGeoInformationImageFilter.h" #include "itkMetaDataObject.h" diff --git a/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h b/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h index 27a1739567ab5feaa600af9380a25b9d997b3bd2..e19f4d8a62cc4428743f7ed054476883a6fe48cd 100644 --- a/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h +++ b/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLambert2EtenduProjection_h -#define __otbLambert2EtenduProjection_h +#ifndef otbLambert2EtenduProjection_h +#define otbLambert2EtenduProjection_h #include "otbLambertConformalConicMapProjection.h" @@ -57,7 +57,7 @@ protected: this->SetParameter("StandardParallel2", "47.69601389"); } - virtual ~Lambert2EtenduProjection() {} + ~Lambert2EtenduProjection() ITK_OVERRIDE {} private: Lambert2EtenduProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambert3CartoSudProjection.h b/Modules/Filtering/Projection/include/otbLambert3CartoSudProjection.h index 5fc17804dc20050c228b450558d2dcd9569095bb..1a81254c896464506aed7e2043c158f75ce447e9 100644 --- a/Modules/Filtering/Projection/include/otbLambert3CartoSudProjection.h +++ b/Modules/Filtering/Projection/include/otbLambert3CartoSudProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLambert3CartoSudProjection_h -#define __otbLambert3CartoSudProjection_h +#ifndef otbLambert3CartoSudProjection_h +#define otbLambert3CartoSudProjection_h #include "otbLambertConformalConicMapProjection.h" diff --git a/Modules/Filtering/Projection/include/otbLambert93Projection.h b/Modules/Filtering/Projection/include/otbLambert93Projection.h index ba70c784263f0d9daa031647eb918ecf235e01c2..828fe4da0bea722a0768a779cce2339c1dd047c0 100644 --- a/Modules/Filtering/Projection/include/otbLambert93Projection.h +++ b/Modules/Filtering/Projection/include/otbLambert93Projection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLambert93Projection_h -#define __otbLambert93Projection_h +#ifndef otbLambert93Projection_h +#define otbLambert93Projection_h #include "otbLambertConformalConicMapProjection.h" @@ -57,7 +57,7 @@ protected: this->SetParameter("StandardParallel2", "49"); } - virtual ~Lambert93Projection() {} + ~Lambert93Projection() ITK_OVERRIDE {} private: Lambert93Projection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h index 0bb68589c52b3ff63769a41caa176e53794c6d20..96b1be98c66d866e0d29c5918dbaec1f3ddd729f 100644 --- a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h +++ b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLambertConformalConicMapProjection_h -#define __otbLambertConformalConicMapProjection_h +#ifndef otbLambertConformalConicMapProjection_h +#define otbLambertConformalConicMapProjection_h #include "otbGenericMapProjection.h" @@ -61,7 +61,7 @@ public: protected: LambertConformalConicMapProjection(); - virtual ~LambertConformalConicMapProjection() {}; + ~LambertConformalConicMapProjection() ITK_OVERRIDE {}; private: LambertConformalConicMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.txx b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.txx index 590732ef9b06e8e3bede148149e20a3fd2a75635..c88a49e64bf99e4f53a0d69da7a606b73ce28b14 100644 --- a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.txx +++ b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLambertConformalConicMapProjection_txx -#define __otbLambertConformalConicMapProjection_txx +#ifndef otbLambertConformalConicMapProjection_txx +#define otbLambertConformalConicMapProjection_txx #include "otbLambertConformalConicMapProjection.h" #include "otbUtils.h" diff --git a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h index 26effa3d8f77a9e2a6c9b810ff1e407d6b37ec93..d593ca9d24be59802cf8af622e85c63ba1045e11 100644 --- a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h +++ b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLeastSquareAffineTransformEstimator_h -#define __otbLeastSquareAffineTransformEstimator_h +#ifndef otbLeastSquareAffineTransformEstimator_h +#define otbLeastSquareAffineTransformEstimator_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -135,10 +135,10 @@ protected: /** Constructor */ LeastSquareAffineTransformEstimator(); /** Destructor */ - virtual ~LeastSquareAffineTransformEstimator(); + ~LeastSquareAffineTransformEstimator() ITK_OVERRIDE; /** The PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LeastSquareAffineTransformEstimator (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.txx b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.txx index 4dad5e6fa4d047ab182560de80796555638f462a..d04f54f5ac3198330f8897a8656db3bf710c3a4d 100644 --- a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.txx +++ b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLeastSquareAffineTransformEstimator_txx -#define __otbLeastSquareAffineTransformEstimator_txx +#ifndef otbLeastSquareAffineTransformEstimator_txx +#define otbLeastSquareAffineTransformEstimator_txx #include <vnl/algo/vnl_lsqr.h> #include <vnl/vnl_sparse_matrix_linear_system.h> diff --git a/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.h b/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.h index 07a44f6b401bfbdebf868d3608008b44bd217ac2..20c2c9c5e68bf0d38c5453cc54f89272d78abe8b 100644 --- a/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.h +++ b/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapProjectionDeprecated_h -#define __otbMapProjectionDeprecated_h +#ifndef otbMapProjectionDeprecated_h +#define otbMapProjectionDeprecated_h #include "otbGenericMapProjection.h" @@ -87,7 +87,7 @@ public: protected: MapProjectionDeprecated(); - virtual ~MapProjectionDeprecated() {}; + ~MapProjectionDeprecated() ITK_OVERRIDE {}; private: MapProjectionDeprecated(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.txx b/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.txx index 66ba50c01e47cac8d58991abbbf9ab3295c533e0..4854d9923ca303c52eed117158c2a9a63fc419f4 100644 --- a/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.txx +++ b/Modules/Filtering/Projection/include/otbMapProjectionDeprecated.txx @@ -15,8 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapProjectionDeprecated_txx -#define __otbMapProjectionDeprecated_txx +#ifndef otbMapProjectionDeprecated_txx +#define otbMapProjectionDeprecated_txx + +#include "otbMapProjectionDeprecated.h" namespace otb { diff --git a/Modules/Filtering/Projection/include/otbMapProjections.h b/Modules/Filtering/Projection/include/otbMapProjections.h index 644a0d0c3d5d7625c2e3f2386728aef736b3a0ec..19d28f234323d845907b023b651a16e7415ee81d 100644 --- a/Modules/Filtering/Projection/include/otbMapProjections.h +++ b/Modules/Filtering/Projection/include/otbMapProjections.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapProjections_h -#define __otbMapProjections_h +#ifndef otbMapProjections_h +#define otbMapProjections_h #include "otbMapProjectionDeprecated.h" diff --git a/Modules/Filtering/Projection/include/otbMollweidMapProjection.h b/Modules/Filtering/Projection/include/otbMollweidMapProjection.h index 90b885c7781ed43bea9ddd1a0ee43f348c8ff29a..40be10376dc4f3dc8efe4362c525ccda1a5d753c 100644 --- a/Modules/Filtering/Projection/include/otbMollweidMapProjection.h +++ b/Modules/Filtering/Projection/include/otbMollweidMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMollweidMapProjection_h -#define __otbMollweidMapProjection_h +#ifndef otbMollweidMapProjection_h +#define otbMollweidMapProjection_h #include "otbGenericMapProjection.h" @@ -56,7 +56,7 @@ public: protected: MollweidMapProjection(); - virtual ~MollweidMapProjection(); + ~MollweidMapProjection() ITK_OVERRIDE; private: MollweidMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbMollweidMapProjection.txx b/Modules/Filtering/Projection/include/otbMollweidMapProjection.txx index 013db5c0c40fdd15ff9bd8282c9d37660ba2f892..435ce3f08f32a1f1d6c4728b18313b2766c7d9f0 100644 --- a/Modules/Filtering/Projection/include/otbMollweidMapProjection.txx +++ b/Modules/Filtering/Projection/include/otbMollweidMapProjection.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMollweidMapProjection_txx -#define __otbMollweidMapProjection_txx +#ifndef otbMollweidMapProjection_txx +#define otbMollweidMapProjection_txx #include "otbMollweidMapProjection.h" #include "otbUtils.h" diff --git a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h index e64b0df1725b83b48d5d559aa3356d775a529ac6..55e830bbe91acf981248d58cc0ea0f66b7d9b291 100644 --- a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h +++ b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOrthoRectificationFilter_h -#define __otbOrthoRectificationFilter_h +#ifndef otbOrthoRectificationFilter_h +#define otbOrthoRectificationFilter_h #include <iostream> #include <sstream> @@ -90,11 +90,11 @@ public: protected: OrthoRectificationFilter(); - virtual ~OrthoRectificationFilter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~OrthoRectificationFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); - virtual void GenerateOutputInformation(void); + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateOutputInformation(void) ITK_OVERRIDE; private: OrthoRectificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx index 51bdfecb491266a1054ad32a3c8098aceab67cbd..eb3b407617fd033f366ab68fe10665a3a61e0839 100644 --- a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx +++ b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOrthoRectificationFilter_txx -#define __otbOrthoRectificationFilter_txx +#ifndef otbOrthoRectificationFilter_txx +#define otbOrthoRectificationFilter_txx #include "otbOrthoRectificationFilter.h" #include "itkMetaDataObject.h" @@ -26,7 +26,7 @@ namespace otb template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> -::OrthoRectificationFilter(): m_MapProjection(NULL) +::OrthoRectificationFilter(): m_MapProjection(ITK_NULLPTR) {} template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> diff --git a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h index 0992f8e563af2910cf803d1cb079a11ea317c912..98d76ee01642b3151bfb27f002635d028e723699 100644 --- a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h +++ b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPhysicalToRPCSensorModelImageFilter_h -#define __otbPhysicalToRPCSensorModelImageFilter_h +#ifndef otbPhysicalToRPCSensorModelImageFilter_h +#define otbPhysicalToRPCSensorModelImageFilter_h #include "otbGCPsToRPCSensorModelImageFilter.h" #include "otbGenericRSTransform.h" @@ -107,19 +107,19 @@ public: } /** Reimplement the method Modified() */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; protected: /** Constructor */ PhysicalToRPCSensorModelImageFilter(); /** Destructor */ - virtual ~PhysicalToRPCSensorModelImageFilter(); + ~PhysicalToRPCSensorModelImageFilter() ITK_OVERRIDE; /** The PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate the Output image information*/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: PhysicalToRPCSensorModelImageFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx index 59047b41a17a1c0e1b0801bbaf8fbb019b632205..d9c619c78c347aad6496e25cf217435279a403d3 100644 --- a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPhysicalToRPCSensorModelImageFilter_txx -#define __otbPhysicalToRPCSensorModelImageFilter_txx +#ifndef otbPhysicalToRPCSensorModelImageFilter_txx +#define otbPhysicalToRPCSensorModelImageFilter_txx #include "otbPhysicalToRPCSensorModelImageFilter.h" #include "otbDEMHandler.h" diff --git a/Modules/Filtering/Projection/include/otbPleiadesPToXSAffineTransformCalculator.h b/Modules/Filtering/Projection/include/otbPleiadesPToXSAffineTransformCalculator.h index 0ff93665a2bf35e58d9656068b70879f9d626577..bfd76656ea356b7e10853b0da2b038a1d176b2e0 100644 --- a/Modules/Filtering/Projection/include/otbPleiadesPToXSAffineTransformCalculator.h +++ b/Modules/Filtering/Projection/include/otbPleiadesPToXSAffineTransformCalculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPleiadesPToXSAffineTransformCalculator__h -#define __otbPleiadesPToXSAffineTransformCalculator__h +#ifndef otbPleiadesPToXSAffineTransformCalculator__h +#define otbPleiadesPToXSAffineTransformCalculator__h #include "itkLightObject.h" #include "itkScalableAffineTransform.h" diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h index feaa3e60afe56849d7cdcdbcda07160798500c0d..597d79cd08ab9fd993f464413512e2938caf9422 100644 --- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h +++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProjectiveProjectionImageFilter_h -#define __otbProjectiveProjectionImageFilter_h +#ifndef otbProjectiveProjectionImageFilter_h +#define otbProjectiveProjectionImageFilter_h #include "itkMacro.h" #include "otbUnaryFunctorImageFilter.h" @@ -151,11 +151,11 @@ public: protected: ProjectiveProjectionImageFilter(); - virtual ~ProjectiveProjectionImageFilter() {} + ~ProjectiveProjectionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.txx b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.txx index edebb7140de2188f0be46dd46bbfb4fa2c0094d0..213cffc9a8c7233c8e0631b111045bcd7265c5a0 100644 --- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProjectiveProjectionImageFilter_txx -#define __otbProjectiveProjectionImageFilter_txx +#ifndef otbProjectiveProjectionImageFilter_txx +#define otbProjectiveProjectionImageFilter_txx #include "otbProjectiveProjectionImageFilter.h" diff --git a/Modules/Filtering/Projection/include/otbROIdataConversion.h b/Modules/Filtering/Projection/include/otbROIdataConversion.h index 541eddb93cfd3faa230885c507e29ad4ef1f490c..ed3b5c7b738e29d681e57d084eb70424e57aa8c8 100644 --- a/Modules/Filtering/Projection/include/otbROIdataConversion.h +++ b/Modules/Filtering/Projection/include/otbROIdataConversion.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbROIdataConversion_h -#define __otbROIdataConversion_h +#ifndef otbROIdataConversion_h +#define otbROIdataConversion_h #include <vector> #include "otbImage.h" @@ -79,16 +79,16 @@ public: protected: ROIdataConversion(); - virtual ~ROIdataConversion() {} - virtual void GenerateOutputInformation(); - virtual void GenerateInputRequestedRegion(); - void PrintSelf(std::ostream& os, itk::Indent indent) const + ~ROIdataConversion() ITK_OVERRIDE {} + void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } /** Performs its job! */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Count the number for sample in the training area */ SizeValueType GetNumberOfSample(); diff --git a/Modules/Filtering/Projection/include/otbROIdataConversion.txx b/Modules/Filtering/Projection/include/otbROIdataConversion.txx index b8513a07a84af131eefb692c87db89760c83542f..d5737a5a68380a21de6e9a8687841759f7dfb660 100644 --- a/Modules/Filtering/Projection/include/otbROIdataConversion.txx +++ b/Modules/Filtering/Projection/include/otbROIdataConversion.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbROIdataConversion_txx -#define __otbROIdataConversion_txx +#ifndef otbROIdataConversion_txx +#define otbROIdataConversion_txx #include "itkVector.h" diff --git a/Modules/Filtering/Projection/include/otbRationalTransform.h b/Modules/Filtering/Projection/include/otbRationalTransform.h index 5adfb206ab26e55218e9e1d1b7f22c87291d701f..bdd889160c9b8f509b1a88dce4454ca9abcbf7a1 100644 --- a/Modules/Filtering/Projection/include/otbRationalTransform.h +++ b/Modules/Filtering/Projection/include/otbRationalTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRationalTransform_h -#define __otbRationalTransform_h +#ifndef otbRationalTransform_h +#define otbRationalTransform_h #include "otbTransform.h" #include "itkMacro.h" @@ -98,7 +98,7 @@ public: itkGetConstMacro(DenominatorDegree, unsigned int); /** The transform point method */ - virtual OutputPointType TransformPoint(const InputPointType& point) const + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE { // Check for consistency if(this->GetNumberOfParameters() != this->m_Parameters.size()) @@ -145,13 +145,13 @@ public: } /** Get the number of parameters */ - virtual NumberOfParametersType GetNumberOfParameters() const + NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE { return (static_cast <NumberOfParametersType> ( (m_NumeratorDegree +1 + m_DenominatorDegree+1)*SpaceDimension )); } // Set parameter method - virtual void SetParameters(const typename Superclass::ParametersType & params) + void SetParameters(const typename Superclass::ParametersType & params) ITK_OVERRIDE { // Check for the appropriate size if(params.Size() != this->GetNumberOfParameters()) @@ -184,9 +184,9 @@ protected: } - virtual ~RationalTransform() {} + ~RationalTransform() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Numerator Degree : " << m_NumeratorDegree << std::endl; diff --git a/Modules/Filtering/Projection/include/otbSVY21MapProjection.h b/Modules/Filtering/Projection/include/otbSVY21MapProjection.h index 1d6ca66b0e46e987345fc2a1553319c39576afa6..4555a109d95b600bbc39103c0e859d57408091f7 100644 --- a/Modules/Filtering/Projection/include/otbSVY21MapProjection.h +++ b/Modules/Filtering/Projection/include/otbSVY21MapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVY21MapProjection_h -#define __otbSVY21MapProjection_h +#ifndef otbSVY21MapProjection_h +#define otbSVY21MapProjection_h #include "otbTransMercatorMapProjection.h" @@ -59,7 +59,7 @@ protected: this->SetParameter("FalseEasting", "28001.642"); this->SetParameter("ScaleFactor", "1.00"); } - virtual ~SVY21MapProjection() {} + ~SVY21MapProjection() ITK_OVERRIDE {} private: SVY21MapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h index 57ec659d12198fe0b566b6bfbf06322de5460c2c..c299742ee0b21f57af19da9bdb2a42efd090d615 100644 --- a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h +++ b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSinusoidalMapProjection_h -#define __otbSinusoidalMapProjection_h +#ifndef otbSinusoidalMapProjection_h +#define otbSinusoidalMapProjection_h #include "otbGenericMapProjection.h" @@ -59,7 +59,7 @@ public: protected: SinusoidalMapProjection(); - virtual ~SinusoidalMapProjection(); + ~SinusoidalMapProjection() ITK_OVERRIDE; private: SinusoidalMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.txx b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.txx index 04c194124a47ef16efffdd4627017efbd08c1f24..e0d34783e9566c8bc70214d01b34b0c568eabdbf 100644 --- a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.txx +++ b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSinusoidalMapProjection_txx -#define __otbSinusoidalMapProjection_txx +#ifndef otbSinusoidalMapProjection_txx +#define otbSinusoidalMapProjection_txx #include "otbSinusoidalMapProjection.h" #include "otbUtils.h" diff --git a/Modules/Filtering/Projection/include/otbTileMapTransform.h b/Modules/Filtering/Projection/include/otbTileMapTransform.h index 0489909517676baf0f2ed358f1e67cc6f5c199a7..31487c07b3e9230d3f3fb0d559d8cd4f39ee1076 100644 --- a/Modules/Filtering/Projection/include/otbTileMapTransform.h +++ b/Modules/Filtering/Projection/include/otbTileMapTransform.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileMapTransform_h -#define __otbTileMapTransform_h +#ifndef otbTileMapTransform_h +#define otbTileMapTransform_h // Only for the enum definition @@ -70,7 +70,7 @@ public: void SetLevel(unsigned int level); unsigned int GetLevel() const; - OutputPointType TransformPoint(const InputPointType& point) const; + OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; virtual void PrintMap() const; @@ -82,7 +82,7 @@ public: protected: TileMapTransform(); - virtual ~TileMapTransform(); + ~TileMapTransform() ITK_OVERRIDE; private: TileMapTransform(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbTileMapTransform.txx b/Modules/Filtering/Projection/include/otbTileMapTransform.txx index 863b866ed9c80665fc68145bd3ff1dd1739f2de7..fe9ec1ef52c8d3ab392ecb27347014b050778392 100644 --- a/Modules/Filtering/Projection/include/otbTileMapTransform.txx +++ b/Modules/Filtering/Projection/include/otbTileMapTransform.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileMapTransform_txx -#define __otbTileMapTransform_txx +#ifndef otbTileMapTransform_txx +#define otbTileMapTransform_txx #include "otbTileMapTransform.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h index f684ff3807854540722ae9cad575c7d7e2ba75a6..7001173fc95f939c49f6a7288657c4db8732dc73 100644 --- a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h +++ b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTransMercatorMapProjection_h -#define __otbTransMercatorMapProjection_h +#ifndef otbTransMercatorMapProjection_h +#define otbTransMercatorMapProjection_h #include "otbGenericMapProjection.h" @@ -61,7 +61,7 @@ public: protected: TransMercatorMapProjection(); - virtual ~TransMercatorMapProjection(); + ~TransMercatorMapProjection() ITK_OVERRIDE; private: TransMercatorMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.txx b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.txx index 3ae3397234e68d701bd3b6d6db71fdfbd90a5fdb..5bfa8a7254d2c45c131fe7138c939269b1c701c2 100644 --- a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.txx +++ b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTransMercatorMapProjection_txx -#define __otbTransMercatorMapProjection_txx +#ifndef otbTransMercatorMapProjection_txx +#define otbTransMercatorMapProjection_txx #include "otbTransMercatorMapProjection.h" #include "otbUtils.h" diff --git a/Modules/Filtering/Projection/include/otbUtmMapProjection.h b/Modules/Filtering/Projection/include/otbUtmMapProjection.h index 471bee55671017498f16ba4a0cfeae5aa6f687b1..bee651dbb6866a258cff88d7b8b2e1d6118c7820 100644 --- a/Modules/Filtering/Projection/include/otbUtmMapProjection.h +++ b/Modules/Filtering/Projection/include/otbUtmMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUtmMapProjection_h -#define __otbUtmMapProjection_h +#ifndef otbUtmMapProjection_h +#define otbUtmMapProjection_h #include "otbGenericMapProjection.h" @@ -60,7 +60,7 @@ public: protected: UtmMapProjection(); - virtual ~UtmMapProjection() {}; + ~UtmMapProjection() ITK_OVERRIDE {}; private: UtmMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbUtmMapProjection.txx b/Modules/Filtering/Projection/include/otbUtmMapProjection.txx index b947df22ebb4336cd9fcc2d529a742e03f119ba5..715c93e2725c15cc2aa44217c694cb64dc129998 100644 --- a/Modules/Filtering/Projection/include/otbUtmMapProjection.txx +++ b/Modules/Filtering/Projection/include/otbUtmMapProjection.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbUtmMapProjection_txx -#define __otbUtmMapProjection_txx +#ifndef otbUtmMapProjection_txx +#define otbUtmMapProjection_txx #include "otbUtmMapProjection.h" diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h index a555e1a289a9bc3f0edd27c6adf7f6da3de55303..686b112b64db32e16295a513ace40e98499852d7 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataIntoImageProjectionFilter_h -#define __otbVectorDataIntoImageProjectionFilter_h +#ifndef otbVectorDataIntoImageProjectionFilter_h +#define otbVectorDataIntoImageProjectionFilter_h #include "otbImage.h" @@ -102,9 +102,9 @@ public: protected: VectorDataIntoImageProjectionFilter(); - virtual ~VectorDataIntoImageProjectionFilter() {} + ~VectorDataIntoImageProjectionFilter() ITK_OVERRIDE {} - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; // Projection filter typedef VectorDataProjectionFilter<InputVectorDataType, InputVectorDataType> diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx index 8a912bbeefb97d976ed47b0d4c92e50132db9eb8..d92d3dd787adb0f23808b8efcfc723499a220aee 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx +++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataIntoImageProjectionFilter_txx -#define __otbVectorDataIntoImageProjectionFilter_txx +#ifndef otbVectorDataIntoImageProjectionFilter_txx +#define otbVectorDataIntoImageProjectionFilter_txx #include "otbVectorDataIntoImageProjectionFilter.h" #include "otb_boost_string_header.h" diff --git a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h index 0fe63b0ef0599b166f34b5e7786e154830c70c6c..17b2349146b8a569f86fe424f5fd7589055068b8 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataProjectionFilter_h -#define __otbVectorDataProjectionFilter_h +#ifndef otbVectorDataProjectionFilter_h +#define otbVectorDataProjectionFilter_h #include "otbVectorDataToVectorDataFilter.h" #include "otbGenericRSTransform.h" @@ -172,17 +172,17 @@ public: protected: VectorDataProjectionFilter(); - virtual ~VectorDataProjectionFilter() {} + ~VectorDataProjectionFilter() ITK_OVERRIDE {} - virtual OutputPointType ProcessPoint(InputPointType point) const; - virtual OutputLinePointerType ProcessLine(InputLinePointerType line) const; - virtual OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const; - virtual OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const; + OutputPointType ProcessPoint(InputPointType point) const ITK_OVERRIDE; + OutputLinePointerType ProcessLine(InputLinePointerType line) const ITK_OVERRIDE; + OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const ITK_OVERRIDE; + OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const ITK_OVERRIDE; virtual void InstanciateTransform(void); - virtual void GenerateOutputInformation(void); - virtual void GenerateData(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateData(void) ITK_OVERRIDE; private: VectorDataProjectionFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.txx b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.txx index 9fc262fe14344ec659d705a4d4c4e53247e4e140..6bd1b232af14184525fdbdefd768393e72d328a4 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.txx +++ b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataProjectionFilter_txx -#define __otbVectorDataProjectionFilter_txx +#ifndef otbVectorDataProjectionFilter_txx +#define otbVectorDataProjectionFilter_txx #include "otbVectorDataProjectionFilter.h" #include "itkProgressReporter.h" diff --git a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h index 2060c4d16beafbac55111212ac0258e737339f76..67562ea247688a100ad328c1f281fbe96016a325 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataTransformFilter_h -#define __otbVectorDataTransformFilter_h +#ifndef otbVectorDataTransformFilter_h +#define otbVectorDataTransformFilter_h #include "otbVectorDataToVectorDataFilter.h" #include "itkTransform.h" @@ -99,14 +99,14 @@ public: protected: VectorDataTransformFilter(); - virtual ~VectorDataTransformFilter() {}; + ~VectorDataTransformFilter() ITK_OVERRIDE {}; - PointType ProcessPoint(PointType point) const; - LinePointerType ProcessLine(LinePointerType line) const; - PolygonPointerType ProcessPolygon(PolygonPointerType polygon) const; - PolygonListPointerType ProcessPolygonList(PolygonListPointerType polygonList) const; + PointType ProcessPoint(PointType point) const ITK_OVERRIDE; + LinePointerType ProcessLine(LinePointerType line) const ITK_OVERRIDE; + PolygonPointerType ProcessPolygon(PolygonPointerType polygon) const ITK_OVERRIDE; + PolygonListPointerType ProcessPolygonList(PolygonListPointerType polygonList) const ITK_OVERRIDE; - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: VectorDataTransformFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.txx b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.txx index 027d6293458443ce67c729ad6a1e12faa85de231..9bf0281aff7b3f5af64cf29c75614b915b9054ba 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.txx +++ b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataTransformFilter_txx -#define __otbVectorDataTransformFilter_txx +#ifndef otbVectorDataTransformFilter_txx +#define otbVectorDataTransformFilter_txx #include "otbVectorDataTransformFilter.h" #include "itkProgressReporter.h" @@ -38,7 +38,7 @@ VectorDataTransformFilter<TInputVectorData, TOutputVectorData> // use the otb::Transform or we loose the capability of using all the existing // itk transform, so we just keep it as NULL and you have to be careful not // to burn yourself when using it. - m_Transform = NULL; + m_Transform = ITK_NULLPTR; } /** diff --git a/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx b/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx index 24c477ccc13749b1535fee3ae4dafc8fd2ad283c..35d0ff4787cf73f4aeade22b120fe4be4d47fd08 100644 --- a/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx +++ b/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx @@ -216,7 +216,7 @@ OGRSpatialReference* otb::GeometriesProjectionFilter::DoDefineNewLayerSpatialRef } else { - return 0; + return ITK_NULLPTR; } } diff --git a/Modules/Filtering/Projection/src/otbPleiadesPToXSAffineTransformCalculator.cxx b/Modules/Filtering/Projection/src/otbPleiadesPToXSAffineTransformCalculator.cxx index 74b1bcc20c8bac2f769ee5d09a29484cf1d95cb5..025262da7422b6d7b367bef433363ecc9574f9fa 100644 --- a/Modules/Filtering/Projection/src/otbPleiadesPToXSAffineTransformCalculator.cxx +++ b/Modules/Filtering/Projection/src/otbPleiadesPToXSAffineTransformCalculator.cxx @@ -15,9 +15,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPleiadesPToXSAffineTransformCalculator__cxx -#define __otbPleiadesPToXSAffineTransformCalculator__cxx - #include "otbPleiadesPToXSAffineTransformCalculator.h" #include "otbPleiadesImageMetadataInterface.h" #include "otbDateTimeAdapter.h" @@ -199,7 +196,3 @@ PleiadesPToXSAffineTransformCalculator } } // End namespace otb - -#endif - - diff --git a/Modules/Filtering/Projection/test/CMakeLists.txt b/Modules/Filtering/Projection/test/CMakeLists.txt index d7f73f4511262ca9338202077e43433fcd898ddd..ec86d271b4666b0b5040c05915877870d7d0b4df 100644 --- a/Modules/Filtering/Projection/test/CMakeLists.txt +++ b/Modules/Filtering/Projection/test/CMakeLists.txt @@ -58,6 +58,7 @@ set(GEOMGCP "QB/qb-1" #LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} "ikonos/ikonos-1" #LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} "rapideye/rapideye-1" #LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf} +"sentinel1/sentinel1-1" #LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff} ) set(NEEDEDKW @@ -67,12 +68,24 @@ set(NEEDEDKW "line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff" #QB "line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff" #Ikonos "line_den_coeff line_num_coeff samp_den_coeff samp_num_coeff" #Rapideye +"number_lines number_samples orbitList support_data.geom.bursts support_data.geom.gcp support_data.pulse_repetition_frequency support_data.radar_frequency support_data.range_sampling_rate support_data.slant_range_to_first_pixel" # Sentinel1 ) +set(GEOTOL + 1 # Pleiades + 1 # Worldview2 + 1 # Spot 6 + 1 # QB + 1 # Ikonos + 1 # Rapideye + 5 # Sentinel1 + ) + set( GEOM_TESTNB 0) foreach( file ${GEOMGCP} ) - list(GET GEOMGCP ${GEOM_TESTNB} current_geomgcp ) + list(GET GEOMGCP ${GEOM_TESTNB} current_geomgcp ) list(GET NEEDEDKW ${GEOM_TESTNB} current_neededkw ) + list(GET GEOTOL ${GEOM_TESTNB} current_geotol ) math(EXPR GEOM_TESTNB "${GEOM_TESTNB} + 1") string(FIND ${current_geomgcp} "/" POS) @@ -88,7 +101,7 @@ foreach( file ${GEOMGCP} ) ${TEMP}/${TESTNAME}.gcp # baseline (produced only if argv[7] == 1) ${current_neededkw} 1 # imgTol - 1 # geoTol + ${current_geotol} # geoTol 0 # create baseline (argv[7]) 1 # mode verbose 1 # 0 : no keyword check 1 : check needed keywords @@ -102,7 +115,7 @@ endforeach() #"terrasarx/gd-terrasarx-1" #LARGEINPUT{TERRASARX/TORONTO/TSX1_SAR__SSC/IMAGEDATA/IMAGE_HH_SRA_spot_074.cos} #"terrasarx/gd-terrasarx-1" #LARGEINPUT{TERRASARX/PANGKALANBUUN/IMAGEDATA/IMAGE_HH_SRA_stripFar_008.cos} #"palsar/gd-palsar-1" #LARGEINPUT{PALSAR/200801280007/l1data/IMG-HH-ALPSRP037120700-H1.1__A} Ne reconnaît pas l'image -#"s1/gd-s1-A" #LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff} segfault +#"s1/gd-s1-A" #LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff} #) @@ -165,6 +178,7 @@ SPOT6/600143101-Primary-Bundle-JP2-LOSSLESS/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_S QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf +SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff ) set(IMG_TYPE @@ -174,6 +188,7 @@ set(IMG_TYPE "qb-1" "ikonos-1" "rapideye-1" +"sentinel1" ) set(GEOMGCP @@ -183,6 +198,7 @@ set(GEOMGCP "QB/qb-1" #LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} "ikonos/ikonos-1" #LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif} "rapideye/rapideye-1" #LARGEINPUT{RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf} +"sentinel1/sentinel1-1" #LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff} ) set(ORIGINSX @@ -192,6 +208,7 @@ set(ORIGINSX 375000 340000 430000 +787422 ) set(ORIGINSY @@ -201,6 +218,7 @@ set(ORIGINSY 4823000 5524000 6190000 +1664034 ) set(UTMZONES @@ -210,6 +228,7 @@ set(UTMZONES 31 31 55 +26 ) set(HEMIS @@ -219,8 +238,40 @@ N N N S +N ) +set(RESOL + 0.5 + 0.5 + 0.5 + 0.5 + 0.5 + 0.5 + 4 + ) + +set(GRIDSPACING + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 32 + ) + +set(ISCOMPLEX + 0 + 0 + 0 + 0 + 0 + 0 + 1 + ) + set(MODE "noDEM" "DEMSRTM" @@ -242,6 +293,9 @@ foreach(current_img ${IMG_TEST_ORTHO}) list(GET ORIGINSY ${IMGNB} current_originy ) list(GET UTMZONES ${IMGNB} current_zone ) list(GET HEMIS ${IMGNB} current_hemis ) + list(GET RESOL ${IMGNB} current_resol ) + list(GET GRIDSPACING ${IMGNB} current_grid_spacing) + list(GET ISCOMPLEX ${IMGNB} current_is_compex) math(EXPR IMGNB "${IMGNB} + 1") set( MODENB 0) @@ -259,13 +313,14 @@ foreach(current_img ${IMG_TEST_ORTHO}) ${current_originy} 500 500 - 0.5 - -0.5 + ${current_resol} + -${current_resol} ${current_zone} ${current_hemis} - 4 # Spacing of the displacement field + ${current_grid_spacing} # Spacing of the displacement field ${MODENB} ${current_demdir} + ${current_is_compex} ) endforeach() diff --git a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx index 223b841a6cf566468bfe7f8b16f072855c3edfd1..afa4ed6c4a4c50c0ffb242ffa13a67f3d79205e7 100644 --- a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx +++ b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx @@ -107,8 +107,8 @@ int otbGCPsToRPCSensorModelImageFilterAndOrtho(int argc, char* argv[]) orthoRectifFilter->SetOutputSpacing(spacing); ImageType::PointType origin; - origin[0] = strtod(argv[3], NULL); //Origin easting - origin[1] = strtod(argv[4], NULL); //Origin northing + origin[0] = strtod(argv[3], ITK_NULLPTR); //Origin easting + origin[1] = strtod(argv[4], ITK_NULLPTR); //Origin northing orthoRectifFilter->SetOutputOrigin(origin); utmMapProjection->SetZone(atoi(argv[9])); diff --git a/Modules/Filtering/Projection/test/otbGenericRSResampleImageFilter.cxx b/Modules/Filtering/Projection/test/otbGenericRSResampleImageFilter.cxx index 2c529aedac1268cb89e30d6cda28680931368a21..2d9dce59a0c9f26b37771de13f54a9186806cd66 100644 --- a/Modules/Filtering/Projection/test/otbGenericRSResampleImageFilter.cxx +++ b/Modules/Filtering/Projection/test/otbGenericRSResampleImageFilter.cxx @@ -85,7 +85,7 @@ int otbGenericRSResampleImageFilter(int itkNotUsed(argc), char* argv[]) OGRSpatialReference oSRS; oSRS.SetProjCS("UTM"); oSRS.SetUTM(31, true); - char * utmRef = NULL; + char * utmRef = ITK_NULLPTR; oSRS.exportToWkt(&utmRef); // Displacement Field spacing diff --git a/Modules/Filtering/Projection/test/otbGenericRSTransformFromImage.cxx b/Modules/Filtering/Projection/test/otbGenericRSTransformFromImage.cxx index 2afa82d52df492277a90b30c19dbe5ea54b47d80..fee540a43bf37d2422a1f38f8a35541fcdd0a29e 100644 --- a/Modules/Filtering/Projection/test/otbGenericRSTransformFromImage.cxx +++ b/Modules/Filtering/Projection/test/otbGenericRSTransformFromImage.cxx @@ -56,7 +56,7 @@ int otbGenericRSTransformFromImage(int itkNotUsed(argc), char* argv[]) // Build wgs ref OGRSpatialReference oSRS; oSRS.SetWellKnownGeogCS("WGS84"); - char * wgsRef = NULL; + char * wgsRef = ITK_NULLPTR; oSRS.exportToWkt(&wgsRef); // Instanciate WGS->Image transform @@ -106,7 +106,7 @@ int otbGenericRSTransformImageAndMNTToWGS84ConversionChecking(int itkNotUsed(arg // Build wgs ref OGRSpatialReference oSRS; oSRS.SetWellKnownGeogCS("WGS84"); - char * wgsRef = NULL; + char * wgsRef = ITK_NULLPTR; oSRS.exportToWkt(&wgsRef); DistanceType::Pointer distance = DistanceType::New(); diff --git a/Modules/Filtering/Projection/test/otbOrthoRectificationFilter.cxx b/Modules/Filtering/Projection/test/otbOrthoRectificationFilter.cxx index 4312136b7ff553f72670afe44a5dbb0428fed80b..ff9c828efda8f31dc14ba4372796a02e5b5415f5 100644 --- a/Modules/Filtering/Projection/test/otbOrthoRectificationFilter.cxx +++ b/Modules/Filtering/Projection/test/otbOrthoRectificationFilter.cxx @@ -20,6 +20,7 @@ // iostream is used for general output #include <iostream> #include <stdlib.h> +#include <complex> #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -30,41 +31,70 @@ #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "otbOrthoRectificationFilter.h" #include "otbMapProjections.h" +#include "otbComplexToIntensityImageFilter.h" +#include "otbPerBandVectorImageFilter.h" int otbOrthoRectificationFilter(int argc, char* argv[]) { - if (argc != 14) + if (argc != 15) { std::cout << argv[0] << " <input filename> <output filename> <origin easting> <origin northing>" " <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" - " <grid_spacing> <mode> <mode.info>" + " <grid_spacing> <mode> <mode.info> <is_complex>" << std::endl; return EXIT_FAILURE; } + typedef std::complex<double> ComplexPixelType; + typedef otb::VectorImage<ComplexPixelType,2> ComplexVectorImageType; typedef otb::VectorImage<double, 2> VectorImageType; typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + typedef otb::ImageFileReader<ComplexVectorImageType> ComplexReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; typedef otb::UtmInverseProjection UtmMapProjectionType; + + // Handling of complex images + typedef otb::Image<ComplexPixelType> ComplexImageType; + typedef otb::Image<double> ImageType; + typedef otb::ComplexToIntensityImageFilter<ComplexImageType, ImageType> IntensityFilterType; + typedef otb::PerBandVectorImageFilter<ComplexVectorImageType,VectorImageType,IntensityFilterType> PerBandIntensityFilterType; + typedef otb::OrthoRectificationFilter<VectorImageType, VectorImageType, UtmMapProjectionType> OrthoRectifFilterType; //Allocate pointer ReaderType::Pointer reader = ReaderType::New(); + ComplexReaderType::Pointer cReader = ComplexReaderType::New(); WriterType::Pointer writer = WriterType::New(); - + PerBandIntensityFilterType::Pointer intensityFilter = PerBandIntensityFilterType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); - // Set parameters ... - reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); + + bool isComplex = atoi(argv[14]); - reader->GenerateOutputInformation(); - std::cout << reader->GetOutput() << std::endl; - - orthoRectifFilter->SetInput(reader->GetOutput()); + if(isComplex) + { + cReader->SetFileName(argv[1]); + cReader->GenerateOutputInformation(); + intensityFilter->SetInput(cReader->GetOutput()); + VectorImageType::PixelType no_data(cReader->GetOutput()->GetNumberOfComponentsPerPixel()); + no_data.Fill(0); + orthoRectifFilter->SetEdgePaddingValue(no_data); + orthoRectifFilter->SetInput(intensityFilter->GetOutput()); + } + else + { + reader->SetFileName(argv[1]); + reader->GenerateOutputInformation(); + VectorImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel()); + no_data.Fill(0); + orthoRectifFilter->SetEdgePaddingValue(no_data); + orthoRectifFilter->SetInput(reader->GetOutput()); + } VectorImageType::IndexType start; start[0] = 0; @@ -82,8 +112,8 @@ int otbOrthoRectificationFilter(int argc, char* argv[]) orthoRectifFilter->SetOutputSpacing(spacing); VectorImageType::PointType origin; - origin[0] = strtod(argv[3], NULL); //Origin easting - origin[1] = strtod(argv[4], NULL); //Origin northing + origin[0] = strtod(argv[3], ITK_NULLPTR); //Origin easting + origin[1] = strtod(argv[4], ITK_NULLPTR); //Origin northing orthoRectifFilter->SetOutputOrigin(origin); utmMapProjection->SetZone(atoi(argv[9])); @@ -95,10 +125,6 @@ int otbOrthoRectificationFilter(int argc, char* argv[]) gridSpacing[0] = atof(argv[11]); gridSpacing[1] = -atof(argv[11]); orthoRectifFilter->SetDisplacementFieldSpacing(gridSpacing); - - VectorImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel()); - no_data.Fill(0); - orthoRectifFilter->SetEdgePaddingValue(no_data); // manage demHandler if (atoi(argv[12])==1) //mode = no DEM diff --git a/Modules/Filtering/Projection/test/otbSensorModel.cxx b/Modules/Filtering/Projection/test/otbSensorModel.cxx index 30e5456c9ca1265f0a33784a2b924b1b63062cf2..5c2e116d169dcf26a70a65ca78139791956e8dd2 100644 --- a/Modules/Filtering/Projection/test/otbSensorModel.cxx +++ b/Modules/Filtering/Projection/test/otbSensorModel.cxx @@ -65,11 +65,11 @@ int produceGCP(char * outputgcpfilename, const otb::ImageKeywordlist& kwlist, bo kwlist.convertToOSSIMKeywordlist(ossimKwlist); ossimProjection* ossimSensorModel = ossimSensorModelFactory::instance()->createProjection(ossimKwlist); - if (ossimSensorModel == NULL) + if (ossimSensorModel == ITK_NULLPTR) { ossimSensorModel = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(ossimKwlist); } - if (ossimSensorModel == NULL) // Model validity + if (ossimSensorModel == ITK_NULLPTR) // Model validity { std::cerr << "Invalid sensor model (ossimSensorModel is NULL)" << std::endl; return EXIT_FAILURE; @@ -216,7 +216,7 @@ int otbSensorModel(int argc, char* argv[]) // Build wgs ref OGRSpatialReference oSRS; oSRS.SetWellKnownGeogCS("WGS84"); - char * wgsRef = NULL; + char * wgsRef = ITK_NULLPTR; oSRS.exportToWkt(&wgsRef); typedef otb::GenericRSTransform<> GRSTransformType; @@ -251,11 +251,11 @@ int otbSensorModel(int argc, char* argv[]) kwlist.convertToOSSIMKeywordlist(ossimKwlist); ossimProjection* ossimSensorModel = ossimSensorModelFactory::instance()->createProjection(ossimKwlist); - if (ossimSensorModel == NULL) + if (ossimSensorModel == ITK_NULLPTR) { ossimSensorModel = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(ossimKwlist); } - if (ossimSensorModel == NULL) // Model validity + if (ossimSensorModel == ITK_NULLPTR) // Model validity { std::cerr << "Invalid sensor model (ossimSensorModel is NULL)" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h index 8b7582709525827c526acd9768c81a1a2bc1d2dc..7b08f2f81d781328d7b4a0839db093e89938a265 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __MeanShiftSmoothingImageFilter_h -#define __MeanShiftSmoothingImageFilter_h +#ifndef otbMeanShiftSmoothingImageFilter_h +#define otbMeanShiftSmoothingImageFilter_h #include "otbImage.h" #include "otbVectorImage.h" @@ -572,11 +572,11 @@ protected: * Define output pixel size * **/ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** MeanShiftFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -588,21 +588,21 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** Allocates the outputs (need to be reimplemented since outputs have different type) */ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; /** Constructor */ MeanShiftSmoothingImageFilter(); /** Destructor */ - virtual ~MeanShiftSmoothingImageFilter(); + ~MeanShiftSmoothingImageFilter() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; virtual void CalculateMeanShiftVector(const typename RealVectorImageType::Pointer inputImagePtr, const RealVector& jointPixel, const OutputRegionType& outputRegion, diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx index 77a563765ec41237b94db08bc2b02f891caa94b8..a881287db8a8ee0d8cd39a34aed5a62cf5289093 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMeanShiftSmoothingImageFilter_txx -#define __otbMeanShiftSmoothingImageFilter_txx +#ifndef otbMeanShiftSmoothingImageFilter_txx +#define otbMeanShiftSmoothingImageFilter_txx #include "otbMeanShiftSmoothingImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/CMakeLists.txt b/Modules/Filtering/Statistics/CMakeLists.txt index bbf8d4d98d1964ae13d184fe17a195597c2b7f94..7a70756ebf9ebeac7ce74ec6042c1f4737c59bf6 100644 --- a/Modules/Filtering/Statistics/CMakeLists.txt +++ b/Modules/Filtering/Statistics/CMakeLists.txt @@ -1,2 +1,4 @@ project(OTBStatistics) + +set(OTBStatistics_LIBRARIES OTBStatistics) otb_module_impl() diff --git a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h index e85e627b871c2495adeccf54b75c48b8f9a89c67..4b0822594e28080ae21ad32dd8437250eea7a6b0 100644 --- a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateSampleListFilter_h -#define __otbConcatenateSampleListFilter_h +#ifndef otbConcatenateSampleListFilter_h +#define otbConcatenateSampleListFilter_h #include "otbListSampleToListSampleFilter.h" @@ -64,11 +64,11 @@ public: protected: /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; ConcatenateSampleListFilter(); - virtual ~ConcatenateSampleListFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ConcatenateSampleListFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ConcatenateSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.txx b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.txx index d32a8f200041cc7730bf20c3599b2c4fa6387da5..3c5ccf4aa9b70b9b7b1022c0931b28e2990209fd 100644 --- a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.txx +++ b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateSampleListFilter_txx -#define __otbConcatenateSampleListFilter_txx +#ifndef otbConcatenateSampleListFilter_txx +#define otbConcatenateSampleListFilter_txx #include "otbConcatenateSampleListFilter.h" #include "itkProgressReporter.h" diff --git a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h index 9286ff30d9a11c463f8997af94e3a0c100082326..de39962689920b0cbf34e4a563e81572487adba8 100644 --- a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h +++ b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbContinuousMinimumMaximumImageCalculator_h -#define __otbContinuousMinimumMaximumImageCalculator_h +#ifndef otbContinuousMinimumMaximumImageCalculator_h +#define otbContinuousMinimumMaximumImageCalculator_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -134,8 +134,8 @@ public: protected: ContinuousMinimumMaximumImageCalculator(); - virtual ~ContinuousMinimumMaximumImageCalculator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ContinuousMinimumMaximumImageCalculator() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; PixelType m_Minimum; PixelType m_Maximum; diff --git a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.txx b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.txx index c6079d432e11e745bd23a5855a66765b140dc960..05c50cce4cb14e0bb0da9a6c6f4afb2159165351 100644 --- a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.txx +++ b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbContinuousMinimumMaximumImageCalculator_txx -#define __otbContinuousMinimumMaximumImageCalculator_txx +#ifndef otbContinuousMinimumMaximumImageCalculator_txx +#define otbContinuousMinimumMaximumImageCalculator_txx #include "otbContinuousMinimumMaximumImageCalculator.h" #include "itkImageRegionConstIteratorWithIndex.h" diff --git a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h index 0d6eaf34274fab9de46392fb9d6ffaf07dd14379..91d7b1fb25bc46f3fc90292eefa27270305f9d61 100644 --- a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaussianAdditiveNoiseSampleListFilter_h -#define __otbGaussianAdditiveNoiseSampleListFilter_h +#ifndef otbGaussianAdditiveNoiseSampleListFilter_h +#define otbGaussianAdditiveNoiseSampleListFilter_h #include "otbListSampleToListSampleFilter.h" @@ -85,7 +85,7 @@ public: protected: /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Generate a white gaussian noise with mean m_Mean and variance * m_Variance @@ -93,8 +93,8 @@ protected: void GenerateRandomSequence(); GaussianAdditiveNoiseSampleListFilter(); - virtual ~GaussianAdditiveNoiseSampleListFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~GaussianAdditiveNoiseSampleListFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GaussianAdditiveNoiseSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.txx b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.txx index cf482b771179e88a1abf91ee54851e094f09c5b0..c538763c76f3c7f82ef6b647f232252a558055db 100644 --- a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.txx +++ b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaussianAdditiveNoiseSampleListFilter_txx -#define __otbGaussianAdditiveNoiseSampleListFilter_txx +#ifndef otbGaussianAdditiveNoiseSampleListFilter_txx +#define otbGaussianAdditiveNoiseSampleListFilter_txx #include "otbGaussianAdditiveNoiseSampleListFilter.h" #include "itkMersenneTwisterRandomVariateGenerator.h" diff --git a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h index 5ba1e63b74bfe22be7a4343b52f62bd7c6e12ab9..20f6a2537b76b95f12f9dfd256b38b907a2aebcf 100644 --- a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h +++ b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbHistogramStatisticsFunction_h -#define __otbHistogramStatisticsFunction_h +#ifndef otbHistogramStatisticsFunction_h +#define otbHistogramStatisticsFunction_h #include "itkNumericTraits.h" #include "itkHistogramAlgorithmBase.h" @@ -80,7 +80,7 @@ public: } /** Calculates the thresholds and save them */ - void Compute() + void Compute() ITK_OVERRIDE { this->GenerateData(); } @@ -88,8 +88,8 @@ public: protected: HistogramStatisticsFunction(); - virtual ~HistogramStatisticsFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~HistogramStatisticsFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Calculates the thresholds and save them */ void GenerateData(); diff --git a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.txx b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.txx index ee609e3bf8badb1cd5c770d9bf019c19b7cd94a4..c3d3bee9a6ab3b1b40b0cf6c13f421f3668d1dfa 100644 --- a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.txx +++ b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbHistogramStatisticsFunction_txx -#define __otbHistogramStatisticsFunction_txx +#ifndef otbHistogramStatisticsFunction_txx +#define otbHistogramStatisticsFunction_txx #include "otbHistogramStatisticsFunction.h" diff --git a/Modules/Filtering/Statistics/include/otbListSampleGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleGenerator.h index 4bac4b059dcc62e9a3e84be28c8dac32abfae61f..2fb3f17fb6417b8660510fd813686f6b78e3ea1c 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleGenerator.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbListSampleGenerator_h -#define __otbListSampleGenerator_h +#ifndef otbListSampleGenerator_h +#define otbListSampleGenerator_h #include "itkProcessObject.h" #include "itkListSample.h" @@ -95,7 +95,7 @@ public: // Build the outputs typedef itk::DataObject::Pointer DataObjectPointer; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; //virtual void Update(); @@ -149,13 +149,13 @@ public: protected: ListSampleGenerator(); - virtual ~ListSampleGenerator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ListSampleGenerator() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Triggers the Computation of the sample list */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Compute the calss statistics*/ void GenerateClassStatistics(); diff --git a/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx b/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx index 85fcebc15ecc6fd7d35979d38ec15fd41d19048c..8945cda273f15bcfa2c85305865776a9141396d5 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleGenerator_txx -#define __otbListSampleGenerator_txx +#ifndef otbListSampleGenerator_txx +#define otbListSampleGenerator_txx #include "otbListSampleGenerator.h" @@ -97,7 +97,7 @@ ListSampleGenerator<TImage, TVectorData> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ImageType *>(this->ProcessObject::GetInput(0)); @@ -121,7 +121,7 @@ ListSampleGenerator<TImage, TVectorData> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const VectorDataType *>(this->ProcessObject::GetInput(1)); diff --git a/Modules/Filtering/Statistics/include/otbListSampleSource.h b/Modules/Filtering/Statistics/include/otbListSampleSource.h index 5876869d5bdf1dedc2f51a105396d891f1fe00d6..8224d1a12dd75ae2ca6a70cd51cd6b8bd7f0496d 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleSource.h +++ b/Modules/Filtering/Statistics/include/otbListSampleSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleSource_h -#define __otbListSampleSource_h +#ifndef otbListSampleSource_h +#define otbListSampleSource_h #include "itkProcessObject.h" #include "itkDataObjectDecorator.h" @@ -70,12 +70,12 @@ public: protected: /** Standard itk::ProcessObject subclass method. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; ListSampleSource(); - virtual ~ListSampleSource() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ListSampleSource() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ListSampleSource(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleSource.txx b/Modules/Filtering/Statistics/include/otbListSampleSource.txx index 512a21d83bac71f68c1fd1bbe3962eb8c758dcdf..9e161248e22b779851f3d8c7a96509f1b302f357 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleSource.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleSource_txx -#define __otbListSampleSource_txx +#ifndef otbListSampleSource_txx +#define otbListSampleSource_txx #include "otbListSampleSource.h" diff --git a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h index 1f4dcab79013200163acb027ce18dfc267fcb9d0..525d9f80dbdf6314188914305960dd8f10e745d2 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToBalancedListSampleFilter_h -#define __otbListSampleToBalancedListSampleFilter_h +#ifndef otbListSampleToBalancedListSampleFilter_h +#define otbListSampleToBalancedListSampleFilter_h #include "otbGaussianAdditiveNoiseSampleListFilter.h" #include "itkDataObjectDecorator.h" @@ -117,7 +117,7 @@ public: protected: /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** In order to respect the fair data principle, the number of samples for * each label must be the same. This method computes the label that @@ -126,12 +126,12 @@ protected: void ComputeMaxSampleFrequency(); /** Make Output */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; ListSampleToBalancedListSampleFilter(); - virtual ~ListSampleToBalancedListSampleFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ListSampleToBalancedListSampleFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ListSampleToBalancedListSampleFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.txx b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.txx index 2ddde509e7efd58264df4b68ac7030c29ee286c6..3c411abe62443f1210b0abcff34dec296f47fda5 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToBalancedListSampleFilter_txx -#define __otbListSampleToBalancedListSampleFilter_txx +#ifndef otbListSampleToBalancedListSampleFilter_txx +#define otbListSampleToBalancedListSampleFilter_txx #include "otbListSampleToBalancedListSampleFilter.h" #include "itkProgressReporter.h" @@ -86,7 +86,7 @@ ListSampleToBalancedListSampleFilter<TInputSampleList, TLabelSampleList, TOutput { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const LabelSampleListType* > diff --git a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h index eada89c0fda8fa4aac925c1c98f8c6cf85f4ba4f..e4afc9216b800e968f4490b127284c1cebea22c3 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToHistogramListGenerator_h -#define __otbListSampleToHistogramListGenerator_h +#ifndef otbListSampleToHistogramListGenerator_h +#define otbListSampleToHistogramListGenerator_h #include "itkNumericTraits.h" #include "itkProcessObject.h" @@ -146,14 +146,14 @@ public: protected: ListSampleToHistogramListGenerator(); - virtual ~ListSampleToHistogramListGenerator() {} + ~ListSampleToHistogramListGenerator() ITK_OVERRIDE {} - void GenerateData(); + void GenerateData() ITK_OVERRIDE; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: //ListSampleConstPointerType m_List; diff --git a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.txx b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.txx index 28fb6e6dddb6d5798546581b64c0a656098d703f..a16618998bd2efd816b13da51cfae4e7dae6cffd 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.txx @@ -18,9 +18,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToHistogramListGenerator_txx -#define __otbListSampleToHistogramListGenerator_txx +#ifndef otbListSampleToHistogramListGenerator_txx +#define otbListSampleToHistogramListGenerator_txx +#include "otbListSampleToHistogramListGenerator.h" #include "itkArray.h" #include "otbMacro.h" @@ -69,7 +70,7 @@ ListSampleToHistogramListGenerator<TListSample,THistogramMeasurement, TFrequency { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ListSampleType* > (this->itk::ProcessObject::GetInput(0) ); diff --git a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h index 3e21f1939bbfea971877ee84757162eec8bdcdce..fc2122bc3f0789d057fde61e0ef180fec76b428b 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToListSampleFilter_h -#define __otbListSampleToListSampleFilter_h +#ifndef otbListSampleToListSampleFilter_h +#define otbListSampleToListSampleFilter_h #include "otbListSampleSource.h" @@ -85,8 +85,8 @@ public: protected: ListSampleToListSampleFilter(); - virtual ~ListSampleToListSampleFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ListSampleToListSampleFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ListSampleToListSampleFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.txx b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.txx index 82b4c2781712536ac53d3a82c8781409481baf0f..80ed0d7146af735a4e1baeea575fbfdfe34d1c9a 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToListSample_txx -#define __otbListSampleToListSample_txx +#ifndef otbListSampleToListSample_txx +#define otbListSampleToListSample_txx #include "otbListSampleToListSampleFilter.h" #include "itkProgressReporter.h" @@ -49,7 +49,7 @@ ListSampleToListSampleFilter<TInputSampleList, TOutputSampleList> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputSampleListType * > diff --git a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h index c876944cd5b68fd8f2139f06c427b4b0700f6c82..0c562152a234267b2403abd2223cb0575b45552d 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToVariableDimensionHistogramGenerator_h -#define __otbListSampleToVariableDimensionHistogramGenerator_h +#ifndef otbListSampleToVariableDimensionHistogramGenerator_h +#define otbListSampleToVariableDimensionHistogramGenerator_h #include "itkProcessObject.h" #include "itkHistogram.h" @@ -110,10 +110,10 @@ public: protected: ListSampleToVariableDimensionHistogramGenerator(); - virtual ~ListSampleToVariableDimensionHistogramGenerator() {} - void GenerateData(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + ~ListSampleToVariableDimensionHistogramGenerator() ITK_OVERRIDE {} + void GenerateData() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; private: diff --git a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.txx b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.txx index 7830624e9bf0ca4905332aaad8525ed7dddaff09..fc6c96ab2b43b3f4f0d232470744526446c3e5cc 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.txx @@ -18,9 +18,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbListSampleToVariableDimensionHistogramGenerator_txx -#define __otbListSampleToVariableDimensionHistogramGenerator_txx +#ifndef otbListSampleToVariableDimensionHistogramGenerator_txx +#define otbListSampleToVariableDimensionHistogramGenerator_txx +#include "otbListSampleToVariableDimensionHistogramGenerator.h" #include "otbMacro.h" #include "itkStatisticsAlgorithm.h" @@ -64,7 +65,7 @@ ListSampleToVariableDimensionHistogramGenerator<TListSample, THistogramMeasureme { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ListSampleType* > (this->itk::ProcessObject::GetInput(0) ); diff --git a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h index b08f73682c06e004b331172d785627472952c19a..2ccbe0d966214a20c16bc7d2236df79c2ebe471b 100644 --- a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h +++ b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHistogramImageFunction_h -#define __otbLocalHistogramImageFunction_h +#ifndef otbLocalHistogramImageFunction_h +#define otbLocalHistogramImageFunction_h #include "itkImageFunction.h" #include "itkHistogram.h" @@ -86,17 +86,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -125,8 +125,8 @@ public: protected: LocalHistogramImageFunction(); - virtual ~LocalHistogramImageFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LocalHistogramImageFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LocalHistogramImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.txx b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.txx index 4d729c653b3f16d3c97417c6cfc462ca7d5a778a..6fe3f1ab0cfd50b62f05af70e9e779034a962e6a 100644 --- a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.txx +++ b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLocalHistogramImageFunction_txx -#define __otbLocalHistogramImageFunction_txx +#ifndef otbLocalHistogramImageFunction_txx +#define otbLocalHistogramImageFunction_txx #include "otbLocalHistogramImageFunction.h" #include "itkConstNeighborhoodIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h index e5b3888da8d1e4fe5a651bfa6714beba146174d9..f58676f6f65357f23b5be78d126354a163bdf748 100644 --- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeVectorImageFilter_h -#define __otbNormalizeVectorImageFilter_h +#ifndef otbNormalizeVectorImageFilter_h +#define otbNormalizeVectorImageFilter_h #include <vnl/vnl_math.h> @@ -193,9 +193,9 @@ public: protected: NormalizeVectorImageFilter (); - virtual ~NormalizeVectorImageFilter() { } + ~NormalizeVectorImageFilter() ITK_OVERRIDE { } - void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: @@ -218,5 +218,5 @@ private: #include "otbNormalizeVectorImageFilter.txx" #endif -#endif // __otbNormalizeVectorImageFilter_h +#endif // otbNormalizeVectorImageFilter_h diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx index 9d578bf1a9baded6e8753b4091cc85a079254126..6f6b8b839700dc234acf3001c0c6398c4d5f44a0 100644 --- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalizeVectorImageFilter_txx -#define __otbNormalizeVectorImageFilter_txx +#ifndef otbNormalizeVectorImageFilter_txx +#define otbNormalizeVectorImageFilter_txx #include "otbNormalizeVectorImageFilter.h" namespace otb @@ -83,4 +83,4 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage > } // end of namespace otb -#endif // __otbNormalizeVectorImageFilter_txx +#endif // otbNormalizeVectorImageFilter_txx diff --git a/Modules/Filtering/Statistics/include/otbPatternSampler.h b/Modules/Filtering/Statistics/include/otbPatternSampler.h new file mode 100644 index 0000000000000000000000000000000000000000..e341f1ef7e8a9a88764621140ddbb6eb9f0375d3 --- /dev/null +++ b/Modules/Filtering/Statistics/include/otbPatternSampler.h @@ -0,0 +1,148 @@ +/*========================================================================= + + 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 otbPatternSampler_h +#define otbPatternSampler_h + +#include "otbSamplerBase.h" + +namespace otb +{ + +/** + * \class PatternSampler + * + * \brief Periodic sampler for iteration loops + * + * This class allows doing periodic sampling during an iteration loop. + * + * \ingroup OTBStatistics + */ +class ITK_EXPORT PatternSampler : public SamplerBase +{ +public: + typedef PatternSampler Self; + typedef SamplerBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Internal parameters, only contains an offset to shift the periodic + * sampling + */ + typedef struct Parameter + { + /** Maximum size of the internal patterns */ + unsigned long MaxPatternSize; + + /** First sampling pattern */ + std::vector<bool> Pattern1; + + /** Second sampling pattern (can be empty). + * It is called when the first pattern returns false */ + std::vector<bool> Pattern2; + + /** Seed used to randomly generate patterns (used only if greater than 0) */ + unsigned int Seed; + + bool operator!=(const struct Parameter & param) const; + } ParameterType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(PatternSampler,SamplerBase); + + /** Setter for internal parameters */ + void SetParameters(const ParameterType ¶m) + { + if (m_Parameters != param) + { + this->Modified(); + m_Parameters = param; + } + } + + /** Getter for internal parameters */ + ParameterType GetParameters() + { + return m_Parameters; + } + + /** + * Method that resets the internal state of the sampler + */ + virtual void Reset(void); + + /** + * Method to call during iteration, returns true if the sample is selected, + * and false otherwise. + */ + bool TakeSample(void); + + /** Import sampling patterns from an input string + * Two patterns may be given, separated by a slash + * Beware, the second pattern may be empty + */ + static void ImportPatterns( + const std::string &data, + ParameterType ¶m); + + /** Export the sampling patterns in the input parameter to + * an output string. If the second pattern is not empty, it will be + * concatenated to the output string, separated by a slash + */ + static void ExportPatterns( + const ParameterType ¶m, + std::string &data); + +protected: + /** Constructor */ + PatternSampler(); + + /** Destructor */ + virtual ~PatternSampler() {} + +private: + // Not implemented + PatternSampler(const Self&); + void operator=(const Self&); + + /** Generate a random array of booleans */ + std::vector<bool> RandArray(unsigned long N,unsigned long T); + + /** Find a suitable size for internal patterns */ + unsigned long FindBestSize(unsigned long tot); + + /** Internal parameters for the sampler */ + ParameterType m_Parameters; + + /** Index tracking the position in first internal pattern */ + unsigned long m_Index1; + + /** Index tracking the position in the second internal pattern */ + unsigned long m_Index2; + + /** Helper function to decode boolean sequence + * Caracters converted into true : '1' 'X' 'y' 'Y' '|' '+' + * Caracters converted into false : '0' '_' 'n' 'N' '.' '-' + * Other caracters will return a 2 */ + static unsigned int ParseSymbol(const char &s); +}; + +} // namespace otb +#endif diff --git a/Modules/Filtering/Statistics/include/otbPeriodicSampler.h b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h new file mode 100644 index 0000000000000000000000000000000000000000..64b12e111b7c490d86fc49207330285bf3c15e4d --- /dev/null +++ b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h @@ -0,0 +1,115 @@ +/*========================================================================= + + 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 otbPeriodicSampler_h +#define otbPeriodicSampler_h + +#include "otbSamplerBase.h" + +namespace otb +{ + +/** + * \class PeriodicSampler + * + * \brief Periodic sampler for iteration loops + * + * This class allows doing periodic sampling during an iteration loop. + * + * \ingroup OTBStatistics + */ +class ITK_EXPORT PeriodicSampler : public SamplerBase +{ +public: + typedef PeriodicSampler Self; + typedef SamplerBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Internal parameters, only contains an offset to shift the periodic + * sampling + */ + typedef struct Parameter + { + /** Offset that shifts the whole periodic sampling + * (disabled if jitter is used) */ + unsigned long Offset; + + /** Maximum jitter to introduce (0 means no jitter) */ + unsigned long MaxJitter; + + bool operator!=(const struct Parameter & param) const; + } ParameterType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(PeriodicSampler,SamplerBase); + + /** Setter for internal parameters */ + void SetParameters(const ParameterType ¶m) + { + if (m_Parameters != param) + { + this->Modified(); + m_Parameters = param; + } + } + + /** Getter for internal parameters */ + ParameterType GetParameters() + { + return m_Parameters; + } + + /** + * Method that resets the internal state of the sampler + */ + virtual void Reset(void); + + /** + * Method to call during iteration, returns true if the sample is selected, + * and false otherwise. + */ + bool TakeSample(void); + +protected: + /** Constructor */ + PeriodicSampler(); + + /** Destructor */ + virtual ~PeriodicSampler() {} + +private: + // Not implemented + PeriodicSampler(const Self&); + void operator=(const Self&); + + /** Internal parameters for the sampler */ + ParameterType m_Parameters; + + /** Internal width for jitter */ + double m_JitterSize; + + /** Internal current offset value + * (either fixed, or reset each time a sample is taken)*/ + double m_OffsetValue; +}; + +} // namespace otb +#endif diff --git a/Modules/Filtering/Statistics/include/otbRandomSampler.h b/Modules/Filtering/Statistics/include/otbRandomSampler.h new file mode 100644 index 0000000000000000000000000000000000000000..e132c6bee12ab11aefaf3d4f9b1a90aa8553eb09 --- /dev/null +++ b/Modules/Filtering/Statistics/include/otbRandomSampler.h @@ -0,0 +1,111 @@ +/*========================================================================= + + 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 otbRandomSampler_h +#define otbRandomSampler_h + +#include "otbSamplerBase.h" + +namespace otb +{ + +/** + * \class RandomSampler + * + * \brief Random sampler for iteration loops + * + * This class allows doing random sampling during an iteration loop. + * It uses the MersenneTwisterRandomGenerator. + * + * \ingroup OTBStatistics + */ +class ITK_EXPORT RandomSampler : public SamplerBase +{ +public: + typedef RandomSampler Self; + typedef SamplerBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Internal parameters, only contains an offset to shift the periodic + * sampling + */ + typedef struct Parameter + { + /** Maximum buffer size to generate permutations */ + unsigned long MaxBufferSize; + + bool operator!=(const struct Parameter & param) const; + } ParameterType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(RandomSampler,SamplerBase); + + /** Setter for internal parameters */ + void SetParameters(const ParameterType ¶m) + { + if (m_Parameters != param) + { + this->Modified(); + m_Parameters = param; + } + } + + /** Getter for internal parameters */ + ParameterType GetParameters() + { + return m_Parameters; + } + + /** + * Reset internal counter (to be called before starting iteration) + */ + virtual void Reset(void); + + /** + * Method to call during iteration, returns true if the sample is selected, + * and false otherwise. + */ + bool TakeSample(void); + +protected: + /** Constructor */ + RandomSampler(); + + /** Destructor */ + virtual ~RandomSampler() {} + +private: + // Not implemented + RandomSampler(const Self&); + void operator=(const Self&); + + /** Internal parameters for the sampler */ + ParameterType m_Parameters; + + /** Internal list of positions to select */ + std::vector<unsigned long> m_Positions; + + /** Internal current position */ + std::vector<unsigned long>::iterator m_CurrentPosition; +}; + +} // namespace otb +#endif diff --git a/Modules/Filtering/Statistics/include/otbSamplerBase.h b/Modules/Filtering/Statistics/include/otbSamplerBase.h new file mode 100644 index 0000000000000000000000000000000000000000..c152a86d8348796ba921a376932a937e2a10eb2e --- /dev/null +++ b/Modules/Filtering/Statistics/include/otbSamplerBase.h @@ -0,0 +1,102 @@ +/*========================================================================= + + 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 otbSamplerBase_h +#define otbSamplerBase_h + +#include "itkObject.h" +#include "itkObjectFactory.h" + +namespace otb +{ + +/** + * \class SamplerBase + * + * \brief This is a base class for sampling methods + * + * \ingroup OTBStatistics + */ +class ITK_EXPORT SamplerBase : public itk::Object +{ +public: + typedef SamplerBase Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Runtime information support. */ + itkTypeMacro(SamplerBase, itk::Object); + + /** + * Reset internal counter (to be called before starting iteration) + */ + virtual void Reset(void); + + /** method to set the number of needed and total elements + * the sampling rate is automatically updated */ + void SetNumberOfElements(unsigned long needed, unsigned long total); + + /** method to set the sampling rate, if the total number of elements + * is given, the number of needed elements is updated */ + void SetRate(double rate, unsigned long total=0UL); + + /** Get macro for sampling rate */ + itkGetMacro(Rate,double); + + /** Get macro for the total number of elements */ + itkGetMacro(TotalElements,unsigned long); + + /** Get macro for the number of needed elements */ + itkGetMacro(NeededElements,unsigned long); + + /** Get macro for the current number of chosen elements */ + itkGetMacro(ChosenElements, unsigned long); + + /** Get macro for the current number of processed elements */ + itkGetMacro(ProcessedElements,unsigned long); + +protected: + /** Constructor */ + SamplerBase(); + + /** Destructor */ + virtual ~SamplerBase() {} + + /** Current count of selected elements */ + unsigned long m_ChosenElements; + + /** Current count of encountered elements during iteration */ + unsigned long m_ProcessedElements; + +private: + // Not implemented + SamplerBase(const Self&); + void operator=(const Self&); + + /** Total number of elements during the iteration */ + unsigned long m_TotalElements; + + /** Number of elements to select during the iteration */ + unsigned long m_NeededElements; + + /** Sampling rate */ + double m_Rate; +}; + +} // namespace otb +#endif diff --git a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h index 2a5b07a391c47866b6c70a0f31c11cf9f9a3703e..e3737808555dd0aa20d633df55cef2506123f592 100644 --- a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShiftScaleSampleListFilter_h -#define __otbShiftScaleSampleListFilter_h +#ifndef otbShiftScaleSampleListFilter_h +#define otbShiftScaleSampleListFilter_h #include "otbListSampleToListSampleFilter.h" @@ -84,11 +84,11 @@ public: protected: /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; ShiftScaleSampleListFilter(); - virtual ~ShiftScaleSampleListFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ShiftScaleSampleListFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ShiftScaleSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.txx b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.txx index e2d6139f960e331a971208847ebb78481d75441e..10af8a845c2bcc64ad38c2a8d502d5ae3b8ccef8 100644 --- a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.txx +++ b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbShiftScaleSampleListFilter_txx -#define __otbShiftScaleSampleListFilter_txx +#ifndef otbShiftScaleSampleListFilter_txx +#define otbShiftScaleSampleListFilter_txx #include "otbShiftScaleSampleListFilter.h" #include "itkProgressReporter.h" diff --git a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h index aa1792ca7a2b6e78f7a2ca1088c228e1551baefc..dc4c43787601a3ea71f9d7adae682281b9fa03a9 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingCompareImageFilter_h -#define __otbStreamingCompareImageFilter_h +#ifndef otbStreamingCompareImageFilter_h +#define otbStreamingCompareImageFilter_h #include "otbPersistentImageFilter.h" #include "itkNumericTraits.h" @@ -123,37 +123,45 @@ public: } RealObjectType* GetMAEOutput(); const RealObjectType* GetMAEOutput() const; + + /** Return the Number of Pixel which are different. */ + RealType GetDiffCount() const + { + return this->GetDiffCountOutput()->Get(); + } + RealObjectType* GetDiffCountOutput(); + const RealObjectType* GetDiffCountOutput() const; itkGetMacro(PhysicalSpaceCheck,bool); itkSetMacro(PhysicalSpaceCheck,bool); /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs(); - virtual void GenerateOutputInformation(); - void Synthetize(void); - void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; protected: PersistentCompareImageFilter(); - virtual ~PersistentCompareImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentCompareImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; /** Allows skipping the verification of physical space between * the two input images (see flag m_PhysicalSpaceCheck) */ - virtual void VerifyInputInformation(); + void VerifyInputInformation() ITK_OVERRIDE; private: PersistentCompareImageFilter(const Self &); //purposely not implemented @@ -164,6 +172,7 @@ private: itk::Array<PixelType> m_ThreadMinRef; itk::Array<PixelType> m_ThreadMaxRef; itk::Array<long> m_Count; + itk::Array<long> m_DiffCount; bool m_PhysicalSpaceCheck; }; // end of class PersistentCompareImageFilter @@ -278,6 +287,20 @@ public: { return this->GetFilter()->GetMAEOutput(); } + + /** Return the Number of Pixel different. */ + RealType GetDiffCount() const + { + return this->GetFilter()->GetDiffCountOutput()->Get(); + } + RealObjectType* GetDiffCountOutput() + { + return this->GetFilter()->GetDiffCountOutput(); + } + const RealObjectType* GetDiffCountOutput() const + { + return this->GetFilter()->GetDiffCountOutput(); + } /** Set the PhysicalSpaceCheck flag */ void SetPhysicalSpaceCheck(bool flag) @@ -295,7 +318,7 @@ protected: /** Constructor */ StreamingCompareImageFilter() {}; /** Destructor */ - virtual ~StreamingCompareImageFilter() {} + ~StreamingCompareImageFilter() ITK_OVERRIDE {} private: StreamingCompareImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.txx index 968c0bcd91078dbc10a1f7c0801087d6e7a3def9..7c1c39f35a06c83538cfe65a262767a6a42ea3ab 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.txx @@ -15,12 +15,13 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingCompareImageFilter_txx -#define __otbStreamingCompareImageFilter_txx +#ifndef otbStreamingCompareImageFilter_txx +#define otbStreamingCompareImageFilter_txx #include "otbStreamingCompareImageFilter.h" #include "itkImageRegionIterator.h" #include "itkProgressReporter.h" +#include "itkMath.h" #include "otbMacro.h" namespace otb @@ -29,7 +30,7 @@ namespace otb template<class TInputImage> PersistentCompareImageFilter<TInputImage> ::PersistentCompareImageFilter() : m_SquareOfDifferences(1), m_AbsoluteValueOfDifferences(1), - m_ThreadMinRef(1), m_ThreadMaxRef(1), m_Count(1), m_PhysicalSpaceCheck(true) + m_ThreadMinRef(1), m_ThreadMaxRef(1), m_Count(1), m_DiffCount(1), m_PhysicalSpaceCheck(true) { this->SetNumberOfRequiredInputs( 2 ); // first output is a copy of the image, DataObject created by @@ -37,7 +38,7 @@ PersistentCompareImageFilter<TInputImage> // allocate the data objects for the outputs which are // just decorators around real types - for (int i = 1; i < 4; ++i) + for (int i = 1; i < 5; ++i) { typename RealObjectType::Pointer output = static_cast<RealObjectType*>(this->MakeOutput(i).GetPointer()); @@ -47,6 +48,7 @@ PersistentCompareImageFilter<TInputImage> this->GetPSNROutput()->Set(itk::NumericTraits<RealType>::max()); this->GetMSEOutput()->Set(itk::NumericTraits<RealType>::max()); this->GetMAEOutput()->Set(itk::NumericTraits<RealType>::max()); + this->GetDiffCountOutput()->Set(itk::NumericTraits<RealType>::Zero); this->Reset(); } @@ -112,6 +114,7 @@ PersistentCompareImageFilter<TInputImage> case 1: case 2: case 3: + case 4: return static_cast<itk::DataObject*>(RealObjectType::New().GetPointer()); break; default: @@ -169,6 +172,22 @@ PersistentCompareImageFilter<TInputImage> return static_cast<const RealObjectType*>(this->itk::ProcessObject::GetOutput(3)); } +template<class TInputImage> +typename PersistentCompareImageFilter<TInputImage>::RealObjectType* +PersistentCompareImageFilter<TInputImage> +::GetDiffCountOutput() +{ + return static_cast<RealObjectType*>(this->itk::ProcessObject::GetOutput(4)); +} + +template<class TInputImage> +const typename PersistentCompareImageFilter<TInputImage>::RealObjectType* +PersistentCompareImageFilter<TInputImage> +::GetDiffCountOutput() const +{ + return static_cast<const RealObjectType*>(this->itk::ProcessObject::GetOutput(4)); +} + template<class TInputImage> void PersistentCompareImageFilter<TInputImage> @@ -204,7 +223,8 @@ PersistentCompareImageFilter<TInputImage> ::Synthetize() { int i; - long count; + unsigned long count; + unsigned long diffCount; RealType squareOfDifferences, absoluteValueOfDifferences; int numberOfThreads = this->GetNumberOfThreads(); @@ -216,6 +236,7 @@ PersistentCompareImageFilter<TInputImage> squareOfDifferences = absoluteValueOfDifferences = itk::NumericTraits<RealType>::Zero; count = 0; + diffCount=0; // Find min/max and the accumulate count and difference of squares over all threads minimumRef = itk::NumericTraits<PixelType>::max(); @@ -224,6 +245,7 @@ PersistentCompareImageFilter<TInputImage> for (i = 0; i < numberOfThreads; ++i) { count += m_Count[i]; + diffCount += m_DiffCount[i]; squareOfDifferences += m_SquareOfDifferences[i]; absoluteValueOfDifferences += m_AbsoluteValueOfDifferences[i]; @@ -248,6 +270,7 @@ PersistentCompareImageFilter<TInputImage> this->GetMSEOutput()->Set(mse); this->GetMAEOutput()->Set(mae); this->GetPSNROutput()->Set(psnr); + this->GetDiffCountOutput()->Set(static_cast<RealType>(diffCount)); } template<class TInputImage> @@ -259,6 +282,7 @@ PersistentCompareImageFilter<TInputImage> // Resize the thread temporaries m_Count.SetSize(numberOfThreads); + m_DiffCount.SetSize(numberOfThreads); m_SquareOfDifferences.SetSize(numberOfThreads); m_AbsoluteValueOfDifferences.SetSize(numberOfThreads); @@ -267,6 +291,7 @@ PersistentCompareImageFilter<TInputImage> // Initialize the temporaries m_Count.Fill(itk::NumericTraits<long>::Zero); + m_DiffCount.Fill(itk::NumericTraits<long>::Zero); m_SquareOfDifferences.Fill(itk::NumericTraits<RealType>::Zero); m_AbsoluteValueOfDifferences.Fill(itk::NumericTraits<RealType>::Zero); m_ThreadMinRef.Fill(itk::NumericTraits<PixelType>::max()); @@ -322,9 +347,14 @@ PersistentCompareImageFilter<TInputImage> { m_ThreadMaxRef[threadId] = value1; } - - m_SquareOfDifferences[threadId] += ( realValue1 - realValue2 ) * ( realValue1 - realValue2 ); - m_AbsoluteValueOfDifferences[threadId] += vcl_abs( realValue1 - realValue2 ); + + RealType diffVal = realValue1 - realValue2; + m_SquareOfDifferences[threadId] += diffVal * diffVal; + m_AbsoluteValueOfDifferences[threadId] += vcl_abs( diffVal ); + if (! itk::Math::FloatAlmostEqual(realValue1, realValue2)) + { + m_DiffCount[threadId]++; + } m_Count[threadId]++; ++it1; ++it2; @@ -340,7 +370,8 @@ PersistentCompareImageFilter<TImage> os << indent << "PSNR: " << this->GetPSNR() << std::endl; os << indent << "MSE: " << this->GetMSE() << std::endl; - os << indent << "MAE: " << this->GetMAE() << std::endl; + os << indent << "MAE: " << this->GetMAE() << std::endl; + os << indent << "Count: " << this->GetDiffCount() << std::endl; } } // end namespace otb #endif diff --git a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h index f0c0dbe3493ada801b5c63266ce59ca4933fa428..04e60cb1ac07d33b04ef09a0e0db093fa5b0b99c 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingHistogramVectorImageFilter_h -#define __otbStreamingHistogramVectorImageFilter_h +#ifndef otbStreamingHistogramVectorImageFilter_h +#define otbStreamingHistogramVectorImageFilter_h #include "otbPersistentImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -168,23 +168,23 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); - virtual void GenerateOutputInformation(); - virtual void Synthetize(void); - virtual void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; protected: PersistentHistogramVectorImageFilter(); - virtual ~PersistentHistogramVectorImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentHistogramVectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentHistogramVectorImageFilter(const Self &); //purposely not implemented @@ -270,7 +270,7 @@ protected: /** Constructor */ StreamingHistogramVectorImageFilter() {}; /** Destructor */ - virtual ~StreamingHistogramVectorImageFilter() {} + ~StreamingHistogramVectorImageFilter() ITK_OVERRIDE {} private: StreamingHistogramVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.txx index d84366ed20db25428cf19168a2345ff0152473b0..bc980f6e6c67abc211cb864f92544bac2cdc8751 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingHistogramVectorImageFilter_txx -#define __otbStreamingHistogramVectorImageFilter_txx +#ifndef otbStreamingHistogramVectorImageFilter_txx +#define otbStreamingHistogramVectorImageFilter_txx #include "otbStreamingHistogramVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h index 750e0e5276df8536fa5874e990f6b9c91dc69c8c..334be523da425375eee761d775b9dac700b28f0e 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMinMaxImageFilter_h -#define __otbStreamingMinMaxImageFilter_h +#ifndef otbStreamingMinMaxImageFilter_h +#define otbStreamingMinMaxImageFilter_h #include <vector> #include "otbPersistentImageFilter.h" @@ -123,26 +123,26 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs(); - virtual void GenerateOutputInformation(); - void Synthetize(void); - void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; protected: PersistentMinMaxImageFilter(); - virtual ~PersistentMinMaxImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentMinMaxImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentMinMaxImageFilter(const Self &); //purposely not implemented @@ -279,7 +279,7 @@ protected: /** Constructor */ StreamingMinMaxImageFilter() {} /** Destructor */ - virtual ~StreamingMinMaxImageFilter() {} + ~StreamingMinMaxImageFilter() ITK_OVERRIDE {} private: StreamingMinMaxImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.txx index 6ab54e02d59f1432c337fa1e52e800f30cad1762..9b871c119720d9832acbd4d5240e43a28bb15164 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMinMaxImageFilter_txx -#define __otbStreamingMinMaxImageFilter_txx +#ifndef otbStreamingMinMaxImageFilter_txx +#define otbStreamingMinMaxImageFilter_txx #include "otbStreamingMinMaxImageFilter.h" #include <algorithm> diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h index 238260482a157f448b51cb80398643f58de26a99..ac8ce99b5e55b398210682f61931ad069a902397 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMinMaxVectorImageFilter_h -#define __otbStreamingMinMaxVectorImageFilter_h +#ifndef otbStreamingMinMaxVectorImageFilter_h +#define otbStreamingMinMaxVectorImageFilter_h #include "otbPersistentImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -143,23 +143,23 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); - virtual void GenerateOutputInformation(); - virtual void Synthetize(void); - virtual void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; protected: PersistentMinMaxVectorImageFilter(); - virtual ~PersistentMinMaxVectorImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentMinMaxVectorImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentMinMaxVectorImageFilter(const Self &); //purposely not implemented @@ -270,7 +270,7 @@ protected: /** Constructor */ StreamingMinMaxVectorImageFilter() {}; /** Destructor */ - virtual ~StreamingMinMaxVectorImageFilter() {} + ~StreamingMinMaxVectorImageFilter() ITK_OVERRIDE {} private: StreamingMinMaxVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.txx index fb9e4e1fe0208bba1a2f61cc22029afd0c49346c..097ac7b048fa66ebee0b1841fc7edb06f14a2494 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingMinMaxVectorImageFilter_txx -#define __otbStreamingMinMaxVectorImageFilter_txx +#ifndef otbStreamingMinMaxVectorImageFilter_txx +#define otbStreamingMinMaxVectorImageFilter_txx #include "otbStreamingMinMaxVectorImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h index d81ec6e097dac5cb7a67f3f619914a52c0f4ba28..a9443a6fd6d31ab4881c9ad831a5eec12141c1a1 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsImageFilter_h -#define __otbStreamingStatisticsImageFilter_h +#ifndef otbStreamingStatisticsImageFilter_h +#define otbStreamingStatisticsImageFilter_h #include "otbPersistentImageFilter.h" #include "itkNumericTraits.h" @@ -141,16 +141,16 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs(); - virtual void GenerateOutputInformation(); - void Synthetize(void); - void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; itkSetMacro(IgnoreInfiniteValues, bool); itkGetMacro(IgnoreInfiniteValues, bool); @@ -163,13 +163,13 @@ public: protected: PersistentStatisticsImageFilter(); - virtual ~PersistentStatisticsImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentStatisticsImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentStatisticsImageFilter(const Self &); //purposely not implemented @@ -357,7 +357,7 @@ protected: /** Constructor */ StreamingStatisticsImageFilter() {}; /** Destructor */ - virtual ~StreamingStatisticsImageFilter() {} + ~StreamingStatisticsImageFilter() ITK_OVERRIDE {} private: StreamingStatisticsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.txx index 328f517d8a944749e78867d3d14168b114503b06..1001ed7a27a40b26813814d60833b36e40440526 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsImageFilter_txx -#define __otbStreamingStatisticsImageFilter_txx +#ifndef otbStreamingStatisticsImageFilter_txx +#define otbStreamingStatisticsImageFilter_txx #include "otbStreamingStatisticsImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h index 0c95602e5d574a379a9bb9c233c6f2f13f4793d3..5ad13c27917b0d96c3bb09ebda157607f16c21c6 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsMapFromLabelImageFilter_h -#define __otbStreamingStatisticsMapFromLabelImageFilter_h +#ifndef otbStreamingStatisticsMapFromLabelImageFilter_h +#define otbStreamingStatisticsMapFromLabelImageFilter_h #include "otbPersistentImageFilter.h" #include "itkNumericTraits.h" @@ -109,31 +109,31 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; - void Reset(void); + void Reset(void) ITK_OVERRIDE; /** Due to heterogeneous input template GenerateInputRequestedRegion must be reimplemented using explicit cast **/ /** This new implementation is inspired by the one of itk::ImageToImageFilter **/ - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; protected: PersistentStreamingStatisticsMapFromLabelImageFilter(); - virtual ~PersistentStreamingStatisticsMapFromLabelImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentStreamingStatisticsMapFromLabelImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** GenerateData. */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: PersistentStreamingStatisticsMapFromLabelImageFilter(const Self &); //purposely not implemented @@ -257,7 +257,7 @@ protected: /** Constructor */ StreamingStatisticsMapFromLabelImageFilter() {} /** Destructor */ - virtual ~StreamingStatisticsMapFromLabelImageFilter() {} + ~StreamingStatisticsMapFromLabelImageFilter() ITK_OVERRIDE {} private: StreamingStatisticsMapFromLabelImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.txx index d9d9db8493e2be7e47fc69bd064a040de7573c0b..561a837f2dca336bcf22706e9c6555dd35a888a0 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsMapFromLabelImageFilter_txx -#define __otbStreamingStatisticsMapFromLabelImageFilter_txx +#ifndef otbStreamingStatisticsMapFromLabelImageFilter_txx +#define otbStreamingStatisticsMapFromLabelImageFilter_txx #include "otbStreamingStatisticsMapFromLabelImageFilter.h" #include "itkInputDataObjectIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h index c4ce0c9b9a81703dff5cc851acc463dc7bbfbd6f..d3da80dceb3d65e08965727eec485e187c8da615 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsVectorImageFilter_h -#define __otbStreamingStatisticsVectorImageFilter_h +#ifndef otbStreamingStatisticsVectorImageFilter_h +#define otbStreamingStatisticsVectorImageFilter_h #include "otbPersistentImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -174,12 +174,12 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - virtual void Reset(void); + void Reset(void) ITK_OVERRIDE; - virtual void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; itkSetMacro(EnableMinMax, bool); itkGetMacro(EnableMinMax, bool); @@ -205,19 +205,19 @@ public: protected: PersistentStreamingStatisticsVectorImageFilter(); - virtual ~PersistentStreamingStatisticsVectorImageFilter() {} + ~PersistentStreamingStatisticsVectorImageFilter() ITK_OVERRIDE {} /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentStreamingStatisticsVectorImageFilter(const Self &); //purposely not implemented @@ -465,7 +465,7 @@ protected: StreamingStatisticsVectorImageFilter() {} /** Destructor */ - virtual ~StreamingStatisticsVectorImageFilter() {} + ~StreamingStatisticsVectorImageFilter() ITK_OVERRIDE {} private: StreamingStatisticsVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx index 3801d3b44010765d8b3fa258f282de732cefb474..e76b876e578063e4914da29921c93b591d004a35 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingStatisticsVectorImageFilter_txx -#define __otbStreamingStatisticsVectorImageFilter_txx +#ifndef otbStreamingStatisticsVectorImageFilter_txx +#define otbStreamingStatisticsVectorImageFilter_txx #include "otbStreamingStatisticsVectorImageFilter.h" #include "itkImageRegionIterator.h" @@ -35,7 +35,8 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> m_EnableSecondOrderStats(true), m_UseUnbiasedEstimator(true), m_IgnoreInfiniteValues(true), - m_IgnoreUserDefinedValue(false) + m_IgnoreUserDefinedValue(false), + m_UserIgnoredValue(itk::NumericTraits<InternalPixelType>::Zero) { // first output is a copy of the image, DataObject created by // superclass @@ -506,7 +507,7 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> const PixelType& vectorValue = it.Get(); float finiteProbe = 0.; - bool userProbe = true; + bool userProbe = m_IgnoreUserDefinedValue; for (unsigned int j = 0; j < vectorValue.GetSize(); ++j) { finiteProbe += (float)(vectorValue[j]); @@ -519,7 +520,7 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> } else { - if (m_IgnoreUserDefinedValue && (userProbe)) + if (userProbe) { m_IgnoredUserPixelCount[threadId] ++; } diff --git a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h index 2aea72e42b9137ef9b9d846bb330982e36fdee4d..586e94bba8a37864c4011d8fcf77fa3abc21b604 100644 --- a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVarianceImageFilter_h -#define __otbVarianceImageFilter_h +#ifndef otbVarianceImageFilter_h +#define otbVarianceImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -89,8 +89,8 @@ public: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -101,8 +101,8 @@ public: protected: VarianceImageFilter(); - virtual ~VarianceImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~VarianceImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** VarianceImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -115,7 +115,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: VarianceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.txx b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.txx index b104d6e4ea579b05ae5bb5869b75bf62aa4f7705..f13c14e6a13f0737ce48d9133c8c5f217b80d965 100644 --- a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVarianceImageFilter_txx -#define __otbVarianceImageFilter_txx +#ifndef otbVarianceImageFilter_txx +#define otbVarianceImageFilter_txx #include "otbVarianceImageFilter.h" diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h index 95f560aea3a3493c2e07fb14a1a1ea9bed445646..98fdb20f818fcc63e511676ad6bdd6ad49e36820 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToIntensityImageFilter_h -#define __otbVectorImageToIntensityImageFilter_h +#ifndef otbVectorImageToIntensityImageFilter_h +#define otbVectorImageToIntensityImageFilter_h #include "itkImageToImageFilter.h" @@ -76,9 +76,9 @@ protected: /** Constructor */ VectorImageToIntensityImageFilter(); /** Destructor */ - virtual ~VectorImageToIntensityImageFilter() {} + ~VectorImageToIntensityImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** VectorImageToIntensityImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -90,7 +90,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: VectorImageToIntensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.txx b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.txx index a4df410c7146c9a2de62e01b192d5fcfb3c8cbdb..8f1a32483998f6616c6db837c6d2906bb70bef4b 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToIntensityImageFilter_txx -#define __otbVectorImageToIntensityImageFilter_txx +#ifndef otbVectorImageToIntensityImageFilter_txx +#define otbVectorImageToIntensityImageFilter_txx #include "otbVectorImageToIntensityImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h index b03c8eda3243dbd336bd623be218b1dbff5275a8..f5853b0d55750244e449ae9390256178969a332f 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToMatrixFilter_h -#define __otbVectorImageToMatrixFilter_h +#ifndef otbVectorImageToMatrixFilter_h +#define otbVectorImageToMatrixFilter_h #include "otbPersistentImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -100,22 +100,22 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - virtual void AllocateOutputs(); - virtual void GenerateOutputInformation(); - virtual void Synthetize(void); - virtual void Reset(void); + void AllocateOutputs() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; protected: PersistentVectorImageToMatrixFilter(); - virtual ~PersistentVectorImageToMatrixFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId); + ~PersistentVectorImageToMatrixFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentVectorImageToMatrixFilter(const Self &); //purposely not implemented @@ -196,7 +196,7 @@ protected: /** Constructor */ VectorImageToMatrixImageFilter() {}; /** Destructor */ - virtual ~VectorImageToMatrixImageFilter() {} + ~VectorImageToMatrixImageFilter() ITK_OVERRIDE {} private: VectorImageToMatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.txx b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.txx index 3db7e891c538b76386275c22566895043cb269a7..846d9cd93790fd3c81c212afa6a354de998abc97 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorImageToMatrixFilter_txx -#define __otbVectorImageToMatrixFilter_txx +#ifndef otbVectorImageToMatrixFilter_txx +#define otbVectorImageToMatrixFilter_txx #include "otbVectorImageToMatrixImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Statistics/src/CMakeLists.txt b/Modules/Filtering/Statistics/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f91342b7d3ee3051c0a9399c1888e80c9c23ff --- /dev/null +++ b/Modules/Filtering/Statistics/src/CMakeLists.txt @@ -0,0 +1,18 @@ +set(OTBStatistics_SRC + otbSamplerBase.cxx + otbPeriodicSampler.cxx + otbPatternSampler.cxx + otbRandomSampler.cxx + ) + +add_library(OTBStatistics ${OTBStatistics_SRC}) +target_link_libraries(OTBStatistics + ${OTBCommon_LIBRARIES} + ${OTBITK_LIBRARIES} + ${OTBImageBase_LIBRARIES} + ${OTBObjectList_LIBRARIES} + ${OTBProjection_LIBRARIES} + ${OTBStreaming_LIBRARIES} + ) + +otb_module_target(OTBStatistics) diff --git a/Modules/Filtering/Statistics/src/otbPatternSampler.cxx b/Modules/Filtering/Statistics/src/otbPatternSampler.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bf6a6463d46105e256ec0cd9a47744b277ffaa1f --- /dev/null +++ b/Modules/Filtering/Statistics/src/otbPatternSampler.cxx @@ -0,0 +1,267 @@ +/*========================================================================= + + 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 "otbPatternSampler.h" +#include "otbMath.h" +#include "otbMacro.h" +#include <algorithm> + +namespace otb +{ + +bool +PatternSampler::ParameterType::operator!=(const PatternSampler::ParameterType & param) const +{ + return bool((MaxPatternSize != param.MaxPatternSize)|| + (Pattern1 != param.Pattern1)|| + (Pattern2 != param.Pattern2)|| + (Seed != param.Seed)); +} + +PatternSampler::PatternSampler() + : m_Index1(0UL) + , m_Index2(0UL) +{ + this->m_Parameters.MaxPatternSize = 1000; + this->m_Parameters.Pattern1.clear(); + this->m_Parameters.Pattern2.clear(); + this->m_Parameters.Seed = 121212; +} + +void +PatternSampler::Reset(void) +{ + Superclass::Reset(); + m_Index1 = 0UL; + m_Index2 = 0UL; + + // if seed is not 0, generate patterns + // since the pattern depend on the sampling rate they should be regenerated + // in order to keep existing patterns, the seed should be set to 0 + if (this->m_Parameters.Seed) + { + unsigned long T1 = FindBestSize(this->GetTotalElements()); + unsigned long N1 = static_cast<unsigned long>(vcl_floor( this->GetRate() * T1 )); + + double selected_ratio = static_cast<double>(N1)/static_cast<double>(T1); + + unsigned long taken = static_cast<unsigned long>(selected_ratio*static_cast<double>(this->GetTotalElements())); + unsigned long left = this->GetNeededElements() - taken; + unsigned long newtot = this->GetTotalElements() - taken; + + unsigned long T2 = 0; + unsigned long N2 = 0; + if (left>0) + { + double ratio2 = 0.0; + if (newtot>0) + ratio2 = static_cast<double>(left)/static_cast<double>(newtot); + + T2 = FindBestSize(this->GetTotalElements()/T1*(T1-N1)); + if (T2>0) + { + N2 = static_cast<unsigned long>(vcl_ceil( ratio2 * T2 )); + } + } + + std::srand ( m_Parameters.Seed ); + this->m_Parameters.Pattern1 = RandArray(N1,T1); + if (T2>0) + this->m_Parameters.Pattern2 = RandArray(N2,T2); + } +} + +bool +PatternSampler::TakeSample(void) +{ + bool ret = false; + this->m_ProcessedElements += 1UL; + if (this->m_ChosenElements >= this->GetNeededElements()) + return false; + + // Test selection with first pattern + ret = this->m_Parameters.Pattern1[m_Index1]; + m_Index1++; + if (m_Index1 >= this->m_Parameters.Pattern1.size()) + m_Index1=0UL; + + if(!ret && this->m_Parameters.Pattern2.size()) + { + // Test selection with second pattern + ret = this->m_Parameters.Pattern2[m_Index2]; + m_Index2++; + if (m_Index2 >= this->m_Parameters.Pattern2.size()) + m_Index2=0UL; + } + if (ret) + { + this->m_ChosenElements += 1UL; + } + return ret; +} + +// [static] +void +PatternSampler::ImportPatterns(const std::string &data, ParameterType ¶m) +{ + // clear output patterns + param.Pattern1.clear(); + param.Pattern2.clear(); + + // split the string on slash caracters + size_t sep1 = data.find('/'); + + // convert string into bool sequence + for (size_t pos=0 ; pos < data.size() ; ++pos) + { + if (pos == sep1) + break; + switch (ParseSymbol(data[pos])) + { + case 0: + { + param.Pattern1.push_back(false); + break; + } + case 1: + { + param.Pattern1.push_back(true); + break; + } + default: + { + break; + } + } + } + + if (sep1 != std::string::npos) + { + size_t sep2 = data.find('/',sep1+1); + for (size_t pos=(sep1+1) ; pos < data.size() ; ++pos) + { + if (pos == sep2) + break; + switch (ParseSymbol(data[pos])) + { + case 0: + { + param.Pattern2.push_back(false); + break; + } + case 1: + { + param.Pattern2.push_back(true); + break; + } + default: + { + break; + } + } + } + } +} + +// [static] +void +PatternSampler::ExportPatterns(const ParameterType ¶m, std::string &data) +{ + // clear output string + data.clear(); + // format output patterns + for (unsigned int i=0 ; i< param.Pattern1.size() ; ++i) + { + if (param.Pattern1[i]) + { + data.push_back('1'); + } + else + { + data.push_back('0'); + } + } + if (param.Pattern2.size()) + { + data.push_back('/'); + } + for (unsigned int i=0 ; i< param.Pattern2.size() ; ++i) + { + if (param.Pattern2[i]) + { + data.push_back('1'); + } + else + { + data.push_back('0'); + } + } +} + +unsigned int +PatternSampler::ParseSymbol(const char &s) +{ + if ((s == '1') || (s == 'X') || + (s == 'y') || (s == 'Y') || + (s == '|') || (s == '+') ) + { + return 1; + } + else if ((s == '0') || (s == '_') || + (s == 'n') || (s == 'N') || + (s == '.') || (s == '-') ) + { + return 0; + } + return 2; +} + +std::vector<bool> +PatternSampler::RandArray(unsigned long N,unsigned long T) +{ + if (N>T) + itkGenericExceptionMacro(<< "N must be <= to T (aka m_SamplingTabSize)." << std::endl); + + std::vector<bool> res(T,0); + for(unsigned long i=0; i<N;i++) + res[i]=1; + + std::random_shuffle ( res.begin(), res.end() ); + + return res; +} + + +unsigned long +PatternSampler::FindBestSize(unsigned long tot) +{ + // handle small values + if (tot<=m_Parameters.MaxPatternSize) + return tot; + + // try to find a sub-period in tot, between 20 and MaxPatternSize + for(unsigned long size = m_Parameters.MaxPatternSize; size >= 2; size--) + if (tot%size == 0) + return size; + + otbWarningMacro(<<"prime number > m_Parameters.MaxPatternSize (" << tot << ">" << m_Parameters.MaxPatternSize << ")."<< std::endl ); + // fallback : return the maximum size + return m_Parameters.MaxPatternSize; +} + +} // namespace otb diff --git a/Modules/Filtering/Statistics/src/otbPeriodicSampler.cxx b/Modules/Filtering/Statistics/src/otbPeriodicSampler.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ad4a6d88df1ed46ace6da5af59ac6f5d4b1894b5 --- /dev/null +++ b/Modules/Filtering/Statistics/src/otbPeriodicSampler.cxx @@ -0,0 +1,91 @@ +/*========================================================================= + + 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 "otbPeriodicSampler.h" +#include "otbMath.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" + +namespace otb +{ + +bool +PeriodicSampler::ParameterType::operator!=(const PeriodicSampler::ParameterType & param) const +{ + return bool((Offset != param.Offset)|| + (MaxJitter != param.MaxJitter)); +} + +void +PeriodicSampler::Reset(void) +{ + Superclass::Reset(); + // Detect maximum jitter size, clamp with (T/N - 1) + m_JitterSize = std::min((double) this->m_Parameters.MaxJitter, 1.0/this->GetRate() - 1.0); + if (m_JitterSize > 0.0) + { + // Using jitter : compute random offset value + m_OffsetValue = + itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance() + ->GetUniformVariate(0.0,m_JitterSize); + } + else + { + // Using a constant offset value, between 0 and T/N + m_OffsetValue = (double)this->m_Parameters.Offset; + while (m_OffsetValue >= 1.0/this->GetRate()) + { + m_OffsetValue -= 1.0/this->GetRate(); + } + } +} + +bool +PeriodicSampler::TakeSample(void) +{ + bool ret = false; + // Take p elements among N, while iterating on the full set (current index i) + // where k elements have already been selected. The offset is in the intervall + // [0, N/p] + // val = (i - offset)*p/N - k + // if ceil(val) > 0; then take the sample + this->m_ProcessedElements += 1UL; + double val = ((double)(this->m_ProcessedElements) - m_OffsetValue )*this->GetRate() - (double)(this->m_ChosenElements); + if (0 < (int)(vcl_ceil(val))) + { + this->m_ChosenElements += 1UL; + if (m_JitterSize > 0.0) + { + // Using jitter : compute random offset value + m_OffsetValue = + itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance() + ->GetUniformVariate(0.0,m_JitterSize); + } + ret = true; + } + return ret; +} + +PeriodicSampler::PeriodicSampler() +{ + this->m_Parameters.Offset = 0UL; + this->m_Parameters.MaxJitter = 0UL; + m_JitterSize = 0.0; + m_OffsetValue = 0.0; +} + +} diff --git a/Modules/Filtering/Statistics/src/otbRandomSampler.cxx b/Modules/Filtering/Statistics/src/otbRandomSampler.cxx new file mode 100644 index 0000000000000000000000000000000000000000..115fc50ee88b82e2399d166a65d6f44eaebac1a4 --- /dev/null +++ b/Modules/Filtering/Statistics/src/otbRandomSampler.cxx @@ -0,0 +1,116 @@ +/*========================================================================= + + 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 "otbRandomSampler.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" +#include "otbMath.h" +#include <algorithm> + +namespace otb +{ + +bool +RandomSampler::ParameterType::operator!=(const RandomSampler::ParameterType & param) const +{ + return bool(MaxBufferSize != param.MaxBufferSize); +} + +void +RandomSampler::Reset(void) +{ + Superclass::Reset(); + + // Generate list of positions + m_Positions.clear(); + unsigned int seed = + itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->GetSeed(); + std::srand(seed); + unsigned long currentOffset = 0UL; + unsigned long bufferSize, needed; + std::vector<bool> buffer; + while (currentOffset < this->GetTotalElements()) + { + // shuffle a buffer + bufferSize = std::min( + this->GetTotalElements() - currentOffset, + m_Parameters.MaxBufferSize); + if (bufferSize == this->GetTotalElements()) + { + needed = this->GetNeededElements(); + } + else + { + // try to handle cases where there is less than 1 needed sample per buffer + double sizeRatio1 = static_cast<double>(currentOffset)/ + static_cast<double>(this->GetTotalElements()); + double sizeRatio2 = static_cast<double>(currentOffset+bufferSize)/ + static_cast<double>(this->GetTotalElements()); + needed = + static_cast<unsigned long>( sizeRatio2 * (double)this->GetNeededElements()) - + static_cast<unsigned long>( sizeRatio1 * (double)this->GetNeededElements()); + } + buffer.clear(); + buffer.resize(bufferSize,0); + // switch ON the first 'needed' booleans + for (unsigned long k=0UL ; k<needed ; k++) + { + buffer[k] = 1; + } + // shuffle boolean buffer + std::random_shuffle ( buffer.begin(), buffer.end() ); + // compute positions + for (unsigned long k=0UL ; k<bufferSize ; k++) + { + if (buffer[k]) + { + m_Positions.push_back(k + currentOffset); + } + } + currentOffset += bufferSize; + } + m_CurrentPosition = m_Positions.begin(); +} + +bool +RandomSampler::TakeSample(void) +{ + bool ret = false; + if (this->m_ProcessedElements >= this->GetTotalElements() || + this->m_ChosenElements >= this->GetNeededElements()) + { + this->m_ProcessedElements += 1UL; + return false; + } + + if (this->m_ProcessedElements == *m_CurrentPosition) + { + ret = true; + this->m_ChosenElements += 1UL; + ++m_CurrentPosition; + } + + this->m_ProcessedElements += 1UL; + return ret; +} + +RandomSampler::RandomSampler() +{ + this->m_Parameters.MaxBufferSize = 100000000; +} + +} diff --git a/Modules/Filtering/Statistics/src/otbSamplerBase.cxx b/Modules/Filtering/Statistics/src/otbSamplerBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..45ed4efe3820b2ff9f1ff147bbe07812891bac9f --- /dev/null +++ b/Modules/Filtering/Statistics/src/otbSamplerBase.cxx @@ -0,0 +1,95 @@ +/*========================================================================= + + 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 "otbSamplerBase.h" +#include "otbMath.h" + +namespace otb +{ + +void +SamplerBase::Reset(void) +{ + this->m_ChosenElements = 0UL; + this->m_ProcessedElements = 0UL; +} + +void +SamplerBase::SetNumberOfElements(unsigned long needed, unsigned long total) +{ + bool modified = false; + if (needed > total) + { + itkExceptionMacro(<< "Needed elements (" << needed << + ") greater than total elements" << total << ")." << std::endl); + } + if (m_NeededElements != needed) + { + m_NeededElements = needed; + modified = true; + } + if (m_TotalElements != total) + { + m_TotalElements = total; + modified = true; + } + if (modified) + { + if (m_TotalElements > 0) + { + m_Rate = (double)(m_NeededElements) / (double)(m_TotalElements); + } + else + { + m_Rate = 0.0; + } + this->Modified(); + } +} + +void +SamplerBase::SetRate(double rate, unsigned long total) +{ + bool modified = false; + if (m_Rate != rate) + { + m_Rate = rate; + modified = true; + } + if (m_TotalElements != total) + { + m_TotalElements = total; + modified = true; + } + if (modified) + { + m_NeededElements = (unsigned long)(vcl_floor(0.5 + m_Rate * (double)(m_TotalElements) )); + this->Modified(); + } +} + +SamplerBase::SamplerBase() + : m_ChosenElements(0UL) + , m_ProcessedElements(0UL) + , m_TotalElements(0UL) + , m_NeededElements(0UL) + , m_Rate(0.0) +{ +} + +} diff --git a/Modules/Filtering/Statistics/test/CMakeLists.txt b/Modules/Filtering/Statistics/test/CMakeLists.txt index 18d97b67c991dafa8745d028f7c0c536a86068e2..ee8f8bda55a840e7e4f978717c5c75c575e2d3da 100644 --- a/Modules/Filtering/Statistics/test/CMakeLists.txt +++ b/Modules/Filtering/Statistics/test/CMakeLists.txt @@ -38,6 +38,7 @@ otbStreamingMinMaxVectorImageFilter.cxx otbListSampleGeneratorTest.cxx otbImaginaryImageToComplexImageFilterTest.cxx otbListSampleToHistogramListGenerator.cxx +otbSamplerTest.cxx ) add_executable(otbStatisticsTestDriver ${OTBStatisticsTests}) @@ -493,3 +494,14 @@ otb_add_test(NAME bfTvListSampleToHistogramListGenerator COMMAND otbStatisticsTe 10 1 ) +otb_add_test(NAME bfTvPeriodicSamplerTest + COMMAND otbStatisticsTestDriver + otbPeriodicSamplerTest) + +otb_add_test(NAME bfTvPatternSamplerTest + COMMAND otbStatisticsTestDriver + otbPatternSamplerTest) + +otb_add_test(NAME bfTvRandomSamplerTest + COMMAND otbStatisticsTestDriver + otbRandomSamplerTest) diff --git a/Modules/Filtering/Statistics/test/otbSamplerTest.cxx b/Modules/Filtering/Statistics/test/otbSamplerTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d50684d5410abb2f28c4269cf66d6c1580a2e1ea --- /dev/null +++ b/Modules/Filtering/Statistics/test/otbSamplerTest.cxx @@ -0,0 +1,164 @@ +/*========================================================================= + + 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 "otbPeriodicSampler.h" +#include "otbPatternSampler.h" +#include "otbRandomSampler.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" + +template <typename SamplerType> +std::string RunSampler(SamplerType *sampler, unsigned long total) +{ + std::string output; + std::ostringstream oss; + sampler->Reset(); + for (unsigned long i=0UL ; i < total ; ++i) + { + if (sampler->TakeSample()) + { + oss << "X"; + } + else + { + oss << "_"; + } + } + output = oss.str(); + std::cout << "Sampling result : "<< output << std::endl; + return output; +} + +int otbPeriodicSamplerTest(int, char *[]) +{ + otb::PeriodicSampler::Pointer sampler = otb::PeriodicSampler::New(); + otb::PeriodicSampler::ParameterType param; + param.Offset = 2; + param.MaxJitter = 0; + + sampler->SetNumberOfElements(5,23); + sampler->SetParameters(param); + std::string test1 = RunSampler<otb::PeriodicSampler>(sampler,23); + + if ( sampler->GetChosenElements() != sampler->GetNeededElements() ) { + std::cout << "1 - Wrong nb of needed elements :" << std::endl; + std::cout << " expected : " << sampler->GetNeededElements() << std::endl; + std::cout << " got : " << sampler->GetChosenElements() << std::endl; + return EXIT_FAILURE; + } + + std::string baseline1("__X___X____X___X____X__"); + if (test1 != baseline1) + { + std::cout << "1 - Wrong sampling sequence :" << std::endl; + std::cout << " expected : " << baseline1 << std::endl; + std::cout << " got : " << test1 << std::endl; + return EXIT_FAILURE; + } + + param.Offset = 0; + param.MaxJitter = 10; + sampler->SetRate(0.2,50); + sampler->SetParameters(param); + std::string test2 = RunSampler<otb::PeriodicSampler>(sampler,50); + + if ( sampler->GetChosenElements() != sampler->GetNeededElements() ) { + std::cout << "2 - Wrong nb of needed elements :" << std::endl; + std::cout << " expected : " << sampler->GetNeededElements() << std::endl; + std::cout << " got : " << sampler->GetChosenElements() << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +int otbPatternSamplerTest(int, char *[]) +{ + otb::PatternSampler::Pointer sampler = otb::PatternSampler::New(); + otb::PatternSampler::ParameterType param; + param.Seed = 121212; + param.MaxPatternSize = 100; + + sampler->SetNumberOfElements(5,23); + sampler->SetParameters(param); + std::string test1 = RunSampler<otb::PatternSampler>(sampler,23); + + if ( sampler->GetChosenElements() != sampler->GetNeededElements() ) { + std::cout << "1 - Wrong nb of needed elements :" << std::endl; + std::cout << " expected : " << sampler->GetNeededElements() << std::endl; + std::cout << " got : " << sampler->GetChosenElements() << std::endl; + return EXIT_FAILURE; + } + + param.Seed = 0; + param.Pattern1.clear(); + param.Pattern1.push_back(false); + param.Pattern1.push_back(true); + param.Pattern1.push_back(false); + param.Pattern1.push_back(false); + param.Pattern1.push_back(true); + param.Pattern1.push_back(true); + param.Pattern1.push_back(false); + param.Pattern2.clear(); + // here, the pattern is imposed so the sampling rate will be ignored + sampler->SetRate(0.34,23); + sampler->SetParameters(param); + std::string test2 = RunSampler<otb::PatternSampler>(sampler,23); + std::string baseline2("_X__XX__X__XX__X__X____"); + if (test2 != baseline2) + { + std::cout << "2 - Wrong sampling sequence :" << std::endl; + std::cout << " expected : " << baseline2 << std::endl; + std::cout << " got : " << test2 << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +int otbRandomSamplerTest(int, char *[]) +{ + itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->SetSeed(121212); + otb::RandomSampler::Pointer sampler = otb::RandomSampler::New(); + otb::RandomSampler::ParameterType param; + param.MaxBufferSize = 100000000; + + sampler->SetNumberOfElements(5,23); + sampler->SetParameters(param); + std::string test1 = RunSampler<otb::RandomSampler>(sampler,23); + + if ( sampler->GetChosenElements() != sampler->GetNeededElements() ) { + std::cout << "1 - Wrong nb of needed elements :" << std::endl; + std::cout << " expected : " << sampler->GetNeededElements() << std::endl; + std::cout << " got : " << sampler->GetChosenElements() << std::endl; + return EXIT_FAILURE; + } + + param.MaxBufferSize = 5; + sampler->SetRate(0.1,23); + sampler->SetParameters(param); + std::string test2 = RunSampler<otb::RandomSampler>(sampler,23); + + if ( sampler->GetChosenElements() != sampler->GetNeededElements() ) { + std::cout << "2 - Wrong nb of needed elements :" << std::endl; + std::cout << " expected : " << sampler->GetNeededElements() << std::endl; + std::cout << " got : " << sampler->GetChosenElements() << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx b/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx index cc7f85a5690d978429b797efb955700d464a86aa..670d0cd0190e565d66342433bcc5643ebb6f75a7 100644 --- a/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx +++ b/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx @@ -47,4 +47,7 @@ void RegisterTests() REGISTER_TEST(otbImaginaryImageToComplexImageFilterTest); REGISTER_TEST(otbListSampleToHistogramListGenerator); REGISTER_TEST(otbContinuousMinimumMaximumImageCalculatorTest); + REGISTER_TEST(otbPeriodicSamplerTest); + REGISTER_TEST(otbPatternSamplerTest); + REGISTER_TEST(otbRandomSamplerTest); } diff --git a/Modules/Filtering/Statistics/test/otbStreamingCompareImageFilter.cxx b/Modules/Filtering/Statistics/test/otbStreamingCompareImageFilter.cxx index 2a213139bc9b43b7cf3c54dbdf07330950180533..e6a1c7f9b9d05c8c4940fdc18e9d8606e03f06d9 100644 --- a/Modules/Filtering/Statistics/test/otbStreamingCompareImageFilter.cxx +++ b/Modules/Filtering/Statistics/test/otbStreamingCompareImageFilter.cxx @@ -73,6 +73,7 @@ int otbStreamingCompareImageFilter(int itkNotUsed(argc), char * argv[]) file << "MSE: " << filter->GetMSE() << std::endl; file << "MAE: " << filter->GetMAE() << std::endl; file << "PSNR: " << filter->GetPSNR() << std::endl; + file << "Count: " << filter->GetDiffCount() << std::endl; file.close(); diff --git a/Modules/Filtering/TimeSeries/include/otbEnvelopeSavitzkyGolayInterpolationFunctor.h b/Modules/Filtering/TimeSeries/include/otbEnvelopeSavitzkyGolayInterpolationFunctor.h index b0510786c80ccf39243f173f831eadbadb070fdd..6654dc0eca17303ad52a03179f45ac7f9efc2bea 100644 --- a/Modules/Filtering/TimeSeries/include/otbEnvelopeSavitzkyGolayInterpolationFunctor.h +++ b/Modules/Filtering/TimeSeries/include/otbEnvelopeSavitzkyGolayInterpolationFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEnvelopeSavitzkyGolayInterpolationFunctor_h -#define __otbEnvelopeSavitzkyGolayInterpolationFunctor_h +#ifndef otbEnvelopeSavitzkyGolayInterpolationFunctor_h +#define otbEnvelopeSavitzkyGolayInterpolationFunctor_h #include "otbSavitzkyGolayInterpolationFunctor.h" diff --git a/Modules/Filtering/TimeSeries/include/otbSavitzkyGolayInterpolationFunctor.h b/Modules/Filtering/TimeSeries/include/otbSavitzkyGolayInterpolationFunctor.h index 393bd3445bd4d5f631556808049144ad194ec2fd..c4fcea461bea12964ade0eb33c8a871b6bbf145f 100644 --- a/Modules/Filtering/TimeSeries/include/otbSavitzkyGolayInterpolationFunctor.h +++ b/Modules/Filtering/TimeSeries/include/otbSavitzkyGolayInterpolationFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSavitzkyGolayInterpolationFunctor_h -#define __otbSavitzkyGolayInterpolationFunctor_h +#ifndef otbSavitzkyGolayInterpolationFunctor_h +#define otbSavitzkyGolayInterpolationFunctor_h #include "otbTimeSeries.h" #include "otbTimeSeriesLeastSquareFittingFunctor.h" diff --git a/Modules/Filtering/TimeSeries/include/otbTimeSeries.h b/Modules/Filtering/TimeSeries/include/otbTimeSeries.h index 0d8c98129d251c3a04debdf2092e9fba84618e06..3958e59528147a8f4e6e373bfac0c00f7d5ca1cb 100644 --- a/Modules/Filtering/TimeSeries/include/otbTimeSeries.h +++ b/Modules/Filtering/TimeSeries/include/otbTimeSeries.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTimeSeries_h -#define __otbTimeSeries_h +#ifndef otbTimeSeries_h +#define otbTimeSeries_h #include "itkFixedArray.h" #include <vcl_cmath.h> diff --git a/Modules/Filtering/TimeSeries/include/otbTimeSeriesLeastSquareFittingFunctor.h b/Modules/Filtering/TimeSeries/include/otbTimeSeriesLeastSquareFittingFunctor.h index c527913c4a390eb64e28da8218098e0f1cd249cc..64d61f5857b66f9194661b5ca8c010ae163ed677 100644 --- a/Modules/Filtering/TimeSeries/include/otbTimeSeriesLeastSquareFittingFunctor.h +++ b/Modules/Filtering/TimeSeries/include/otbTimeSeriesLeastSquareFittingFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTimeSeriesLSFF_h -#define __otbTimeSeriesLSFF_h +#ifndef otbTimeSeriesLSFF_h +#define otbTimeSeriesLSFF_h #include "vnl/algo/vnl_matrix_inverse.h" #include "vnl/vnl_transpose.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h index 15e93edbdab16b1f11693de150ceca46a7160411..878e84e4d48e9dcfaaa010910aae8991e726a79c 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateVectorDataFilter_h -#define __otbConcatenateVectorDataFilter_h +#ifndef otbConcatenateVectorDataFilter_h +#define otbConcatenateVectorDataFilter_h #include "otbVectorDataToVectorDataFilter.h" #include "otbVectorData.h" @@ -79,11 +79,11 @@ public: protected: ConcatenateVectorDataFilter(); - virtual ~ConcatenateVectorDataFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ConcatenateVectorDataFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Triggers the Computation of the sample list */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Recursive method to visit efficiently the vectordata*/ void ProcessNode(TreeNodeType * source, DataNodeType * outputDocument); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.txx b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.txx index 0145df2ff752453bfe4fa9fa6b380a6bff2919ab..7c41c0f2a0066ec1676ded69305f22fdbd347922 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConcatenateVectorDataFilter_txx -#define __otbConcatenateVectorDataFilter_txx +#ifndef otbConcatenateVectorDataFilter_txx +#define otbConcatenateVectorDataFilter_txx #include "otbConcatenateVectorDataFilter.h" @@ -71,7 +71,7 @@ ConcatenateVectorDataFilter<TVectorData> { if (this->GetNumberOfInputs() < idx) { - return 0; + return ITK_NULLPTR; } return static_cast<const VectorDataType *>(this->Superclass::GetInput(idx)); } @@ -123,7 +123,7 @@ void ConcatenateVectorDataFilter<TVectorData> ::ProcessNode(TreeNodeType * source, DataNodeType * outputDocument) { - if (source == 0) + if (source == ITK_NULLPTR) return; diff --git a/Modules/Filtering/VectorDataManipulation/include/otbCorrectPolygonFunctor.h b/Modules/Filtering/VectorDataManipulation/include/otbCorrectPolygonFunctor.h index 027ef05668fc706896ca6b71ecd146d017fd5479..4a001376ba3a4cb4bec6b37e01d8a79107b1f747 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbCorrectPolygonFunctor.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbCorrectPolygonFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCorrectPolygonFunctor_h -#define __otbCorrectPolygonFunctor_h +#ifndef otbCorrectPolygonFunctor_h +#define otbCorrectPolygonFunctor_h #include "otbSimplifyPathFunctor.h" #include "otbClosePathFunctor.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h index f10cbb579ab543a2765a5bead613c36bbf3308bc..ab374199f74083dec1945977e9c962c79ee43cc4 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDBOverlapDataNodeFeatureFunction_h -#define __otbDBOverlapDataNodeFeatureFunction_h +#ifndef otbDBOverlapDataNodeFeatureFunction_h +#define otbDBOverlapDataNodeFeatureFunction_h #include "otbDataNodeVectorDataFunction.h" @@ -73,7 +73,7 @@ public: typedef std::vector<PrecisionType> OutputType; - virtual OutputType Evaluate( const DataNodeType& node ) const; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; /** Set/Get methods */ itkGetConstMacro(DistanceThreshold, PrecisionType); @@ -84,8 +84,8 @@ public: protected: DBOverlapDataNodeFeatureFunction(); - ~DBOverlapDataNodeFeatureFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DBOverlapDataNodeFeatureFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: DBOverlapDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.txx b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.txx index cedd4fe94418cc9b3e53478515e62bf3c4df1cdb..79f9bfff8faf6896940fa61919a1419b5cf0879c 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDBOverlapDataNodeFeatureFunction_txx -#define __otbDBOverlapDataNodeFeatureFunction_txx +#ifndef otbDBOverlapDataNodeFeatureFunction_txx +#define otbDBOverlapDataNodeFeatureFunction_txx #include "otbDBOverlapDataNodeFeatureFunction.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h b/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h index e4d8c022c8308af5c180b9b6d15e123f0157d4ee..3d04dcf9233b196724e6a3322a1c8992b93973cb 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygonCompacityFunctor_h -#define __otbPolygonCompacityFunctor_h +#ifndef otbPolygonCompacityFunctor_h +#define otbPolygonCompacityFunctor_h #include "otbMath.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h index 7e2939767e5c1be41adcf2dab02b898aa026ca66..1f205ccd5eefb4f4d410e83f491a921c6376c675 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_h -#define __otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_h +#ifndef otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_h +#define otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_h #include "otbDataNodeImageFunction.h" @@ -105,7 +105,7 @@ public: typedef std::vector<PrecisionType> OutputType; /* Compute the descriptor value along this DataNode */ - virtual OutputType Evaluate( const DataNodeType& node ) const; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; /* Get the radius used to define the area around a line segment. * A radius of 0 means that the area is reduced to a line joining @@ -135,8 +135,8 @@ public: protected: RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(); - ~RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.txx b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.txx index 617912c67ca5fc8e3f89e7cc86b6d08f13ecefb7..6fa0c37822ca962576e2ef13dc644fe827ccd342 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_txx -#define __otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_txx +#ifndef otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_txx +#define otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction_txx #include "otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbSimplifyPathFunctor.h b/Modules/Filtering/VectorDataManipulation/include/otbSimplifyPathFunctor.h index ad99254b884b03503dc162572594a8b38730906e..c60ede291eb7324b78540f1a62c8fec998744fb2 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbSimplifyPathFunctor.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbSimplifyPathFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSimplifyPathFunctor_h -#define __otbSimplifyPathFunctor_h +#ifndef otbSimplifyPathFunctor_h +#define otbSimplifyPathFunctor_h #include "otbMath.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h index e467edd33d1840fd8478029b63372b777084a779..30a379d20dc61c38b449dace51327b0bada2594d 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralAngleDataNodeFeatureFunction_h -#define __otbSpectralAngleDataNodeFeatureFunction_h +#ifndef otbSpectralAngleDataNodeFeatureFunction_h +#define otbSpectralAngleDataNodeFeatureFunction_h #include "otbDataNodeImageFunction.h" @@ -98,7 +98,7 @@ public: typedef std::pair<IndexType, IndexType> IndexPairType; typedef std::vector<PrecisionType> OutputType; - virtual OutputType Evaluate( const DataNodeType& node ) const; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; /** Set/Get methods */ itkGetConstMacro(RefPixel, PixelType); @@ -109,8 +109,8 @@ public: protected: SpectralAngleDataNodeFeatureFunction(); - ~SpectralAngleDataNodeFeatureFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SpectralAngleDataNodeFeatureFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SpectralAngleDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.txx b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.txx index 1982f3c57a1fef6ea71e50762e63cf336cfc2453..889fe99ab28656be8558cf68de5ad8b75b411eb2 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralAngleDataNodeFeatureFunction_txx -#define __otbSpectralAngleDataNodeFeatureFunction_txx +#ifndef otbSpectralAngleDataNodeFeatureFunction_txx +#define otbSpectralAngleDataNodeFeatureFunction_txx #include "otbSpectralAngleDataNodeFeatureFunction.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h index a9e508c914ffb82a44de8d33c6db9c5141d7cf35..12c45a59bb69da098b9e609e71e89f3debd9312b 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataAdapter_h -#define __otbVectorDataAdapter_h +#ifndef otbVectorDataAdapter_h +#define otbVectorDataAdapter_h #include "otbVectorDataToVectorDataFilter.h" @@ -75,12 +75,12 @@ public: protected: VectorDataAdapter() {}; - virtual ~VectorDataAdapter() {} + ~VectorDataAdapter() ITK_OVERRIDE {} - virtual OutputPointType ProcessPoint(InputPointType point) const; - virtual OutputLinePointerType ProcessLine(InputLinePointerType line) const; - virtual OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const; - virtual OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const; + OutputPointType ProcessPoint(InputPointType point) const ITK_OVERRIDE; + OutputLinePointerType ProcessLine(InputLinePointerType line) const ITK_OVERRIDE; + OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const ITK_OVERRIDE; + OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const ITK_OVERRIDE; private: VectorDataAdapter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.txx b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.txx index a7ad11ccfbd8f9308b972b6b80291febfedc2a64..9d181f7c4ca8308fb052fda8fdcf3d22b3b6bd5e 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataAdapterFilter_txx -#define __otbVectorDataAdapterFilter_txx +#ifndef otbVectorDataAdapterFilter_txx +#define otbVectorDataAdapterFilter_txx #include "otbVectorDataAdapter.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h index cd1a9ba52b92d67f8c159d2dfc111f1d6078d5eb..2312ab8ee7614e8c745521c1827c35f1d50f11d0 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataExtractROI_h -#define __otbVectorDataExtractROI_h +#ifndef otbVectorDataExtractROI_h +#define otbVectorDataExtractROI_h #include "otbVectorDataToVectorDataFilter.h" #include "otbRemoteSensingRegion.h" @@ -103,8 +103,8 @@ public: protected: VectorDataExtractROI(); - virtual ~VectorDataExtractROI() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~VectorDataExtractROI() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Method to compare the projection embedded in the cartoRegion And the the InputVectorData*/ virtual void CompareInputAndRegionProjection(); @@ -119,7 +119,7 @@ protected: virtual VertexType PointToContinuousIndex(ProjPointType point); /** Prototype of the generate data method*/ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Method to check if the polygon Bounding Box ha ve a non-null intersection with the ROI*/ virtual bool IsPolygonIntersectionNotNull(PolygonPointerType polygon); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.txx b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.txx index 51dab922d1477b718aa7feb42a847d995d168356..c37a0c28e5238130185c9afdc023d03bbbf137e0 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataExtractROI_txx -#define __otbVectorDataExtractROI_txx +#ifndef otbVectorDataExtractROI_txx +#define otbVectorDataExtractROI_txx #include "otbVectorDataExtractROI.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h index 8eb160a7b2f471615f26b4d64dda7ae99da46e46..16ffdd754d1a3113734239f5472fc707ec67d394 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRandomLineGenerator_h -#define __otbVectorDataToRandomLineGenerator_h +#ifndef otbVectorDataToRandomLineGenerator_h +#define otbVectorDataToRandomLineGenerator_h #include "otbVectorDataSource.h" #include "otbVectorData.h" @@ -94,11 +94,11 @@ public: protected: VectorDataToRandomLineGenerator(); - virtual ~VectorDataToRandomLineGenerator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~VectorDataToRandomLineGenerator() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Triggers the Computation of the sample list */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; PointVectorType RandomPointsGenerator(DataNodeType * node); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.txx b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.txx index b54797f7f4c3f8b0439777c21b29cc8f48022514..e7376547844264a30a7011477ae922c5a72bab61 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToRandomLineGenerator_txx -#define __otbVectorDataToRandomLineGenerator_txx +#ifndef otbVectorDataToRandomLineGenerator_txx +#define otbVectorDataToRandomLineGenerator_txx #include "otbVectorDataToRandomLineGenerator.h" diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h index cca26043958b34dfde3963a55c74e1bc3433e91d..9e31ae6b3eb1ae45a1a66cea585b05ef96920d87 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToSpecificDescriptionFilterBase_h -#define __otbVectorDataToSpecificDescriptionFilterBase_h +#ifndef otbVectorDataToSpecificDescriptionFilterBase_h +#define otbVectorDataToSpecificDescriptionFilterBase_h #include "otbVectorDataToVectorDataFilter.h" @@ -73,9 +73,9 @@ protected: /** Constructor */ VectorDataToSpecificDescriptionFilterBase(); /** Destructor */ - virtual ~VectorDataToSpecificDescriptionFilterBase() {} + ~VectorDataToSpecificDescriptionFilterBase() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorDataToSpecificDescriptionFilterBase(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.txx b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.txx index 7a856120bd88ab99c2eb9f027a2a2bf19ba570e7..24e40c819575ee57ec210cfce376befaa132397e 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToSpecificDescriptionFilterBase_txx -#define __otbVectorDataToSpecificDescriptionFilterBase_txx +#ifndef otbVectorDataToSpecificDescriptionFilterBase_txx +#define otbVectorDataToSpecificDescriptionFilterBase_txx #include "otbVectorDataToSpecificDescriptionFilterBase.h" @@ -51,7 +51,7 @@ VectorDataToSpecificDescriptionFilterBase<TVectorData> { if (this->GetNumberOfInputs() < idx+2) { - return 0; + return ITK_NULLPTR; } return static_cast<const DataObject *> diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h index f0f0b3157384a06e21142dc071fd5f21d9f17514..5c410dd15e1a75c1de5434ee6de9fd54914b1f94 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToVectorDataFilter_h -#define __otbVectorDataToVectorDataFilter_h +#ifndef otbVectorDataToVectorDataFilter_h +#define otbVectorDataToVectorDataFilter_h #include "otbVectorDataSource.h" @@ -91,7 +91,7 @@ protected: /** Constructor */ VectorDataToVectorDataFilter(); /** Destructor */ - virtual ~VectorDataToVectorDataFilter() {} + ~VectorDataToVectorDataFilter() ITK_OVERRIDE {} virtual OutputPointType ProcessPoint(InputPointType itkNotUsed(point)) const { @@ -110,14 +110,14 @@ protected: itkExceptionMacro( << "Subclass should reimplement this method"); } - virtual void GenerateOutputInformation(void); - virtual void GenerateData(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateData(void) ITK_OVERRIDE; /** Go through the vector data tree and process the nodes */ virtual void ProcessNode(InputInternalTreeNodeType * source, OutputInternalTreeNodeType * destination) const; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorDataToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.txx b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.txx index 71e607cd5f9427893b03940d67c3b93c1b8dc48a..4524933da9ed3a6680c032b39ddf000a0d8ef582 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.txx +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToVectorDataFilter_txx -#define __otbVectorDataToVectorDataFilter_txx +#ifndef otbVectorDataToVectorDataFilter_txx +#define otbVectorDataToVectorDataFilter_txx #include "otbVectorDataToVectorDataFilter.h" #include "itkProgressReporter.h" @@ -53,7 +53,7 @@ VectorDataToVectorDataFilter<TInputVectorData, TOutputVectorData> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputVectorData *> diff --git a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h index 9ac69affe747c571ecebe5f77b53c1cb7db58d91..41d31c08cb9536afa0eeb7a20c916abe7569ae64 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMapnikAdapter_h -#define __otbMapnikAdapter_h +#ifndef otbMapnikAdapter_h +#define otbMapnikAdapter_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h index c4c63e34711394b5c8dcb0f957a143e78322dfd4..816278921770fe7667c98e471ba83901c9bebd42 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataStyle_h -#define __otbVectorDataStyle_h +#ifndef otbVectorDataStyle_h +#define otbVectorDataStyle_h #include "itkLightObject.h" #include "itkObjectFactory.h" diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h index 86777f96055fdf2676ad72d040f10dcc719fb211..41a17260a2a738c5e14afa9b896295b06c4b0e21 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToImageFilter_h -#define __otbVectorDataToImageFilter_h +#ifndef otbVectorDataToImageFilter_h +#define otbVectorDataToImageFilter_h #include "itkImageSource.h" #include "otbRGBAPixelConverter.h" diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.txx b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.txx index d5d00eb26f14c42924504731456d0cfec3a2a223..38ce8b56cea0e22558685c638fff86e4ac1e31d9 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.txx +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToImageFilter_txx -#define __otbVectorDataToImageFilter_txx +#ifndef otbVectorDataToImageFilter_txx +#define otbVectorDataToImageFilter_txx #include <sstream> #include "otbVectorDataToImageFilter.h" diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h index a965bab322e591a51e09aeefa81e835f44789757..aba35b08446001fe319ad3300551a5210df723b6 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToMapFilter_h -#define __otbVectorDataToMapFilter_h +#ifndef otbVectorDataToMapFilter_h +#define otbVectorDataToMapFilter_h #include "itkImageSource.h" #include "otbRGBAPixelConverter.h" diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx index 928e5400902ec959f1a07430028703d53c0896fd..06435e7bf77047b0f801dbdf87c7d7fbaf54b268 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToMapFilter_txx -#define __otbVectorDataToMapFilter_txx +#ifndef otbVectorDataToMapFilter_txx +#define otbVectorDataToMapFilter_txx #include <sstream> #include "otbVectorDataToMapFilter.h" diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h index 92ac96137241a4c65253bfd74c2d6ee6e916b92c..095afc93056ab0d7e23f0e3f7025fc9bd0b1e2ea 100644 --- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h +++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSubsampleImageFilter_h -#define __otbSubsampleImageFilter_h +#ifndef otbSubsampleImageFilter_h +#define otbSubsampleImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" @@ -104,7 +104,7 @@ protected: m_SubsampleFactor.Fill(1); //this->SetNumberOfThreads(1); } - virtual ~SubsampleImageFilter() {} + ~SubsampleImageFilter() ITK_OVERRIDE {} /** Internal test function to check if there is any direction to subsample */ bool IsSubsampleFactorOne() const; @@ -112,24 +112,24 @@ protected: /** Since input and output image are very likely to be of different size. * Region estimation functions has to be reimplemented */ - virtual void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion); - virtual void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion); + void CallCopyOutputRegionToInputRegion + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + void CallCopyInputRegionToOutputRegion + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; /** Output image region size is not of the same dimension as the input. * That is why GenerateOutputInformation has to be redefined. */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Set output image to 0 before processing */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Allows multithreading */ - virtual void ThreadedGenerateData - (const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData + (const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SubsampleImageFilter (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx index 0375f3956aad96d52f20f24967927a424ea2ab8f..1848cc66b5b054d97f353da298315bb2798e2191 100644 --- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx +++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSubsampleImageFilter_txx -#define __otbSubsampleImageFilter_txx +#ifndef otbSubsampleImageFilter_txx +#define otbSubsampleImageFilter_txx #include "otbSubsampleImageFilter.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h index f4ca67bc3b48545bfd30261b7c26c598346ec93d..3a579fd07572445019199cb0a0b84493dd8a185b 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletFilterBank_h -#define __otbWaveletFilterBank_h +#ifndef otbWaveletFilterBank_h +#define otbWaveletFilterBank_h #include "itkProgressReporter.h" #include "itkImageToImageFilter.h" @@ -212,13 +212,13 @@ public: protected: WaveletFilterBank(); - virtual ~WaveletFilterBank() {} + ~WaveletFilterBank() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** The forward transformation needs a larger input requested * region than the output requested region (larger by subsampling @@ -229,13 +229,13 @@ protected: * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw (itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; /** BeforeThreadedGenerateData. * It allocates also internal images */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Internal Data Allocation * If m_SubsampleImageFactor != 1, internal data with progressive region size @@ -246,17 +246,17 @@ protected: /** AfterThreadedGenerateData. * It enforce memory destruction of internal images */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** CallCopyOutputRegionToInputRegion * Since input and output image may be of different size when a * subsampling factor has tp be applied, Region estimation * functions has to be reimplemented */ - virtual void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion); - virtual void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion); + void CallCopyOutputRegionToInputRegion + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + void CallCopyInputRegionToOutputRegion + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; /** CallCopyOutputRegionToInputRegion * This function is also redefined in order to adapt the shape of the regions with @@ -270,7 +270,7 @@ protected: const InputImageRegionType& srcRegion); /** Generate data redefinition */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Iterative call to the forward filter bank at each dimension. */ virtual void ThreadedGenerateDataAtDimensionN(unsigned int idx, unsigned int direction, @@ -397,13 +397,13 @@ public: protected: WaveletFilterBank(); - virtual ~WaveletFilterBank() {} + ~WaveletFilterBank() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** The inverse transformation needs larger inputs requested * region than the output requested region (larger by subsampling @@ -414,13 +414,13 @@ protected: * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw (itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() + throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; /** BeforeThreadedGenerateData * If SubsampleImageFactor neq 1, it is necessary to up sample input images in the Wavelet::INVERSE mode */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Internal Data Allocation * If m_SubsampleImageFactor != 1, internal data with progressive region size @@ -431,17 +431,17 @@ protected: /** AfterThreadedGenerateData. * It enforce memory destruction of internal images */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** CallCopyOutputRegionToInputRegion * Since input and output image may be of different size when a * subsampling factor has tp be applied, Region estimation * functions has to be reimplemented */ - virtual void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion); - virtual void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion); + void CallCopyOutputRegionToInputRegion + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + void CallCopyInputRegionToOutputRegion + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; /** CallCopyOutputRegionToInputRegion * This function is also redefined in order to adapt the shape of the regions with @@ -455,7 +455,7 @@ protected: const InputImageRegionType& srcRegion); /** Generate data redefinition */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** * Iterative call to the forward filter bank at each dimension. diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx index 21ba8cdf9f7ce65529c33adbe3b6c94a1ad29e85..c0cb161dbc22a9e42ea4b666371d2c72e69f1bf5 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx +++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletFilterBank_txx -#define __otbWaveletFilterBank_txx +#ifndef otbWaveletFilterBank_txx +#define otbWaveletFilterBank_txx #include "otbWaveletFilterBank.h" #include "otbSubsampleImageFilter.h" diff --git a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h index 68be4ad16b6f185059b8b7ba14a3f061f9940de6..0ff5365ba55316bb678fc40dafa56d4a30286c1d 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletGenerator_h -#define __otbWaveletGenerator_h +#ifndef otbWaveletGenerator_h +#define otbWaveletGenerator_h #include <vector> #include "itkLightObject.h" @@ -98,7 +98,7 @@ public: protected: WaveletGenerator() {} - ~WaveletGenerator() {} + ~WaveletGenerator() ITK_OVERRIDE {} private: WaveletGenerator(const Self &); // not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h index f680eea930fbc073ae371036d74f83c6c21bb9d4..37d2092df5b0b607273e153fb16869c068272f50 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaveletHighPassOperator_h -#define __otbWaveletHighPassOperator_h +#ifndef otbWaveletHighPassOperator_h +#define otbWaveletHighPassOperator_h #include "otbWaveletOperatorBase.h" @@ -58,7 +58,7 @@ public: protected: - virtual void PrintSelf(std::ostream& os, itk::Indent i) const + void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE { os << i << "WaveletHighPassOperator {this=" << this << "}" << std::endl; Superclass::PrintSelf(os, i.GetNextIndent()); @@ -74,7 +74,7 @@ protected: /** * Set operator coefficients. */ - CoefficientVector GenerateCoefficients() + CoefficientVector GenerateCoefficients() ITK_OVERRIDE { CoefficientVector coeff; if (DirectionOfTransformation == Wavelet::FORWARD) diff --git a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h index 2b612a2099f4c459f089be132c245c2a53466fc8..eaae45dc59c50261ed0416ed1091a9e8be222206 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaveletLowPassOperator_h -#define __otbWaveletLowPassOperator_h +#ifndef otbWaveletLowPassOperator_h +#define otbWaveletLowPassOperator_h #include "otbWaveletOperatorBase.h" @@ -57,7 +57,7 @@ public: protected: - virtual void PrintSelf(std::ostream& os, itk::Indent i) const + void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE { os << i << "WaveletLowPassOperator {this=" << this << "}" << std::endl; Superclass::PrintSelf(os, i.GetNextIndent()); @@ -73,7 +73,7 @@ protected: /** * Set operator coefficients. */ - CoefficientVector GenerateCoefficients() + CoefficientVector GenerateCoefficients() ITK_OVERRIDE { CoefficientVector coeff; if (DirectionOfTransformation == Wavelet::FORWARD) diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletOperator.h index a6d9394d3ebfedf3d520f6e904f9510ca392693e..031b8d63cce5585a01730d39cf574bd69e76a98a 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletOperator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletOperator.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaveletOperator_h -#define __otbWaveletOperator_h +#ifndef otbWaveletOperator_h +#define otbWaveletOperator_h #include "itkMacro.h" #include "itkNeighborhoodOperator.h" diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h index d17c1dfd9be33fb83d151e7d70b87793ef8b5429..f827ca79e48761703bac58ebea8d4a91a40075ec 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaveletOperatorBase_h -#define __otbWaveletOperatorBase_h +#ifndef otbWaveletOperatorBase_h +#define otbWaveletOperatorBase_h #include "itkMacro.h" #include "itkNeighborhoodOperator.h" @@ -98,7 +98,7 @@ public: m_WaveletGenerator = WaveletGeneratorType::New(); } - virtual ~WaveletOperatorBase() {} + ~WaveletOperatorBase() ITK_OVERRIDE {} /** Assignment operator */ Self & operator =(const Self& other) @@ -136,7 +136,7 @@ protected: /** * Prints some debugging information */ - virtual void PrintSelf(std::ostream& os, itk::Indent i) const; + void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE; typedef WaveletGenerator<TMotherWaveletOperator> WaveletGeneratorType; typedef typename WaveletGeneratorType::Pointer WaveletGeneratorPointerType; @@ -185,7 +185,7 @@ protected: void ReduceFilterLength(CoefficientVector& coeff); /** Arranges coefficients spatially in the memory buffer. */ - void Fill(const CoefficientVector& coeff) + void Fill(const CoefficientVector& coeff) ITK_OVERRIDE { this->FillCenteredDirectional(coeff); } diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx index 8b76a313d3f1b23fbf5970ade6a13c863e91c6ac..abba7348520884c6f9d649bec9fef2b7ad131bcb 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx +++ b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletOperatorBase_txx -#define __otbWaveletOperatorBase_txx +#ifndef otbWaveletOperatorBase_txx +#define otbWaveletOperatorBase_txx #include "otbWaveletOperatorBase.h" diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h index e87374c43d274f0c3f5ce6777bfb48ceaa472e5f..3c5e95b2993734d5a7a6093775a7c07c4b2b55af 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletPacketDecompositionCosts_h -#define __otbWaveletPacketDecompositionCosts_h +#ifndef otbWaveletPacketDecompositionCosts_h +#define otbWaveletPacketDecompositionCosts_h #include "itkObject.h" #include "itkMacro.h" @@ -67,7 +67,7 @@ public: protected: FullyDecomposedWaveletPacketCost () {} - virtual ~FullyDecomposedWaveletPacketCost() {} + ~FullyDecomposedWaveletPacketCost() ITK_OVERRIDE {} private: FullyDecomposedWaveletPacketCost (const Self &); // not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h index 38662c7de03892cdf07b228f436116b34d6f49ea..75380406a121f7074d3041bc484df20017a38a14 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletPacketTransform_h -#define __otbWaveletPacketTransform_h +#ifndef otbWaveletPacketTransform_h +#define otbWaveletPacketTransform_h #include "itkProgressAccumulator.h" @@ -183,13 +183,13 @@ public: protected: WaveletPacketTransform(); - virtual ~WaveletPacketTransform() {} + ~WaveletPacketTransform() ITK_OVERRIDE {} /** Generate data redefinition. * This class does not performs multi-threading directly. But it uses step by step the * GenerateData() of TFilter. If This one can thread, the transformation is threaded * (e.g. WaveletFilterBank) */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Performs (if any) the local decomposition (called recursively) */ virtual void GenerateData(unsigned int depth, OutputImageType * outputPtr, @@ -321,19 +321,19 @@ public: protected: WaveletPacketTransform(); - virtual ~WaveletPacketTransform() {} + ~WaveletPacketTransform() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate data redefinition. * This class does not performs multi-threading directly. But it uses step by step the * GenerateData() of TFilter. If This one can thread, the transformation is threaded * (e.g. WaveletFilterBank) */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Performs (if any) the local decomposition (called recursively) */ virtual unsigned int SetInputFilters(unsigned int& ruleID, InputImageIterator& inputIter, diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx index 2d0e628e7261313511f99fee398179cb28bf8844..be8c8bee03d9882053f859be8537a3a9f1a66a39 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx +++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletPacketTransform_txx -#define __otbWaveletPacketTransform_txx +#ifndef otbWaveletPacketTransform_txx +#define otbWaveletPacketTransform_txx #include "otbWaveletPacketTransform.h" #include "otbMacro.h" diff --git a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h index f6cf26a38eed82d608523966bfe8ef6db691fdca..8678966bfbddd1fdb5bd0e07e9f85f1b937dd1c7 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletTransform_h -#define __otbWaveletTransform_h +#ifndef otbWaveletTransform_h +#define otbWaveletTransform_h #include "otbImageToImageListFilter.h" #include "otbImageListToImageFilter.h" @@ -173,10 +173,10 @@ public: protected: WaveletTransform(); - virtual ~WaveletTransform() {} + ~WaveletTransform() ITK_OVERRIDE {} /** Generate data redefinition */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: WaveletTransform (const Self &); @@ -304,16 +304,16 @@ public: protected: WaveletTransform(); - virtual ~WaveletTransform() {} + ~WaveletTransform() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate data redefinition */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: WaveletTransform (const Self &); diff --git a/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx b/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx index 93eac94b95f2dfeeba0b94a6c25f0c04af34f475..625660e6945f7d9eebd97e3c970865f490c29797 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx +++ b/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbWaveletTransform_txx -#define __otbWaveletTransform_txx +#ifndef otbWaveletTransform_txx +#define otbWaveletTransform_txx #include "otbWaveletTransform.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx index a70046adc7aac287129532d65c873113f170f642..c2f4c7424571cad28b3dd30eb66d99d360c415c7 100644 --- a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx +++ b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx @@ -36,7 +36,7 @@ WaveletGenerator<TMotherWaveletOperator> { std::ostringstream msg; msg << "The mother wavelet ID " << TMotherWaveletOperator; - msg << " is unkown or has to be implemented...\n"; + msg << " is unknown or has to be implemented...\n"; throw itk::ExceptionObject(__FILE__, __LINE__, msg.str().c_str(), ITK_LOCATION); return "Unknown"; @@ -49,7 +49,7 @@ WaveletGenerator<TMotherWaveletOperator> { std::ostringstream msg; msg << "The mother wavelet ID " << TMotherWaveletOperator; - msg << " is unkown or has to be implemented...\n"; + msg << " is unknown or has to be implemented...\n"; throw itk::ExceptionObject(__FILE__, __LINE__, msg.str().c_str(), ITK_LOCATION); } @@ -60,7 +60,7 @@ WaveletGenerator<TMotherWaveletOperator> { std::ostringstream msg; msg << "The mother wavelet ID " << TMotherWaveletOperator; - msg << " is unkown or has to be implemented (check the txx file)...\n"; + msg << " is unknown or has to be implemented (check the txx file)...\n"; throw itk::ExceptionObject(__FILE__, __LINE__, msg.str().c_str(), ITK_LOCATION); } diff --git a/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h b/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h index 987aaceb8bb2b333882bfa10d0b8bae73c9bcfe0..76a69500b75aa9b67442b057d1eb5837f6e684ca 100644 --- a/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h +++ b/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFuzzyDescriptorsModelManager_h -#define __otbFuzzyDescriptorsModelManager_h +#ifndef otbFuzzyDescriptorsModelManager_h +#define otbFuzzyDescriptorsModelManager_h #include <vector> #include <utility> diff --git a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h index a792e7d8898808ca5759e595f08498e03c60f1ff..4b62d08bf1d5e858b1ba52f54d1a741bde2b8761 100644 --- a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h +++ b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFuzzyVariable_h -#define __otbFuzzyVariable_h +#ifndef otbFuzzyVariable_h +#define otbFuzzyVariable_h #include "itkDataObject.h" #include "itkFixedArray.h" @@ -104,9 +104,9 @@ protected: /** Constructor */ FuzzyVariable(); /** Destructor */ - virtual ~FuzzyVariable() {} + ~FuzzyVariable() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** Map containing the membership functions */ diff --git a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.txx b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.txx index bd64b464f576c857398eee303f36c7561f1c5123..4ebb79000e6cc16366ae4fb95e319ef186648d29 100644 --- a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.txx +++ b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFuzzyVariable_txx -#define __otbFuzzyVariable_txx +#ifndef otbFuzzyVariable_txx +#define otbFuzzyVariable_txx #include "otbFuzzyVariable.h" diff --git a/Modules/Fusion/Fuzzy/src/otbFuzzyDescriptorsModelManager.cxx b/Modules/Fusion/Fuzzy/src/otbFuzzyDescriptorsModelManager.cxx index fd28876504fb7a2a5e05c810067c09bebfbaa29e..692e3b1495ccf08e9380809f6d009b44c368a5f1 100644 --- a/Modules/Fusion/Fuzzy/src/otbFuzzyDescriptorsModelManager.cxx +++ b/Modules/Fusion/Fuzzy/src/otbFuzzyDescriptorsModelManager.cxx @@ -120,7 +120,7 @@ FuzzyDescriptorsModelManager // Iterate through the tree to get all the stats for( TiXmlElement* currentStat = root.FirstChildElement().ToElement(); - currentStat != NULL; + currentStat != ITK_NULLPTR; currentStat = currentStat->NextSiblingElement() ) { PairType currentDescriptor; @@ -133,7 +133,7 @@ FuzzyDescriptorsModelManager ParameterType param; for( TiXmlElement* sample = currentStat->FirstChildElement("Parameter"); - sample != NULL; + sample != ITK_NULLPTR; sample = sample->NextSiblingElement() ) { // Get the current value of the descriptor diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h index ce25b90ecedb1db3c54530bac7ffd8b0d9f3bfe7..f7ce6b84e5e25ebbf74c5c3d1cd517dc8a43fce5 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeighborhoodMajorityVotingImageFilter_h -#define __otbNeighborhoodMajorityVotingImageFilter_h +#ifndef otbNeighborhoodMajorityVotingImageFilter_h +#define otbNeighborhoodMajorityVotingImageFilter_h // First make sure that the configuration is available. // This line can be removed once the optimized versions @@ -152,7 +152,7 @@ public: protected: NeighborhoodMajorityVotingImageFilter(); - ~NeighborhoodMajorityVotingImageFilter() {}; + ~NeighborhoodMajorityVotingImageFilter() ITK_OVERRIDE {}; /** Evaluate image neighborhood with kernel to find the new value * for the center pixel value @@ -162,9 +162,9 @@ protected: * Evaluate is used for non-boundary pixels. */ PixelType Evaluate(const NeighborhoodIteratorType &nit, const KernelIteratorType kernelBegin, - const KernelIteratorType kernelEnd); + const KernelIteratorType kernelEnd) ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: NeighborhoodMajorityVotingImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx index 93c05d6b2034c637528cfaecec84e7e69a9fc89b..5fab37c3fe7a31395541cf91684ec5ef78419835 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeighborhoodMajorityVotingImageFilter_txx -#define __otbNeighborhoodMajorityVotingImageFilter_txx +#ifndef otbNeighborhoodMajorityVotingImageFilter_txx +#define otbNeighborhoodMajorityVotingImageFilter_txx // First make sure that the configuration is available. // This line can be removed once the optimized versions diff --git a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h index f77b932d6b598f03eaa908071516e73e8eec3447..312f82745f95b9ff9e7b88975d0a143548f1ea7f 100644 --- a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h @@ -20,8 +20,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBayesianFusionFilter_h -#define __otbBayesianFusionFilter_h +#ifndef otbBayesianFusionFilter_h +#define otbBayesianFusionFilter_h #include "itkImageToImageFilter.h" #include "otbVectorImage.h" @@ -300,14 +300,14 @@ public: protected: BayesianFusionFilter(); - virtual ~BayesianFusionFilter(); + ~BayesianFusionFilter() ITK_OVERRIDE; /** Check if internal statistics need to be computed, and do so */ - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Compute internal statistics required for fusion */ void ComputeInternalStatistics(void); /** Call the superclass implementation and set the StatisticsHaveBeenGenerated * flag to false */ - virtual void Modified(void) const; + void Modified(void) const ITK_OVERRIDE; private: /** Ponderation declaration*/ diff --git a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx index 0a2cc11e8628608a06a4a2c7e89ed0788309bf09..d1ff015d7e076500563f0ea0c6dd1be8b3c61633 100644 --- a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx +++ b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBayesianFusionFilter_txx -#define __otbBayesianFusionFilter_txx +#ifndef otbBayesianFusionFilter_txx +#define otbBayesianFusionFilter_txx #include "otbBayesianFusionFilter.h" diff --git a/Modules/Fusion/PanSharpening/include/otbFusionImageBase.h b/Modules/Fusion/PanSharpening/include/otbFusionImageBase.h index b983ba896b4354400302a0979d3e88a5edfb88a1..8cc7c49b87f3592b023b5d1abd31ec49ee6a99bf 100644 --- a/Modules/Fusion/PanSharpening/include/otbFusionImageBase.h +++ b/Modules/Fusion/PanSharpening/include/otbFusionImageBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFusionImageBase_h -#define __otbFusionImageBase_h +#ifndef otbFusionImageBase_h +#define otbFusionImageBase_h #include "itkTernaryFunctorImageFilter.h" #include "itkNumericTraits.h" @@ -98,7 +98,7 @@ public: { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } else return (static_cast<const InputMultiSpectralImageType *>(this->itk::ProcessObject::GetInput(0))); } @@ -107,7 +107,7 @@ public: { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } else return (static_cast<const InputMultiSpectralInterpImageType *>(this->itk::ProcessObject::GetInput(1))); } @@ -116,7 +116,7 @@ public: { if (this->GetNumberOfInputs() < 3) { - return 0; + return ITK_NULLPTR; } else return (static_cast<const InputPanchroImageType *>(this->itk::ProcessObject::GetInput(2))); } diff --git a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h index 5594b7364ac0cebe3bfade26b9f66b25009d36f3..f30c8c8525ae871620964c3ab8e2ae526303fc7e 100644 --- a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLmvmPanSharpeningFusionImageFilter_h -#define __otbLmvmPanSharpeningFusionImageFilter_h +#ifndef otbLmvmPanSharpeningFusionImageFilter_h +#define otbLmvmPanSharpeningFusionImageFilter_h #include "otbConvolutionImageFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -109,13 +109,13 @@ protected: LmvmPanSharpeningFusionImageFilter(); /** Destructor */ - virtual ~LmvmPanSharpeningFusionImageFilter() {}; + ~LmvmPanSharpeningFusionImageFilter() ITK_OVERRIDE {}; /** Call to generate data, wiring composite internal minipipeline */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LmvmPanSharpeningFusionImageFilter(Self &); // intentionally not implemented diff --git a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.txx b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.txx index da0825996322cb815d01fd50e92dc454ce3f0035..5c6acc98f5df56cfd29df214f35bb87e3362a0c7 100644 --- a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.txx +++ b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLmvmPanSharpeningFusionImageFilter_txx -#define __otbLmvmPanSharpeningFusionImageFilter_txx +#ifndef otbLmvmPanSharpeningFusionImageFilter_txx +#define otbLmvmPanSharpeningFusionImageFilter_txx #include "otbLmvmPanSharpeningFusionImageFilter.h" @@ -86,7 +86,7 @@ LmvmPanSharpeningFusionImageFilter { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TPanImageType *> @@ -115,7 +115,7 @@ LmvmPanSharpeningFusionImageFilter { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TXsImageType *> diff --git a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h index db0c2959a044fc75addc4e1cde565f15d0a815cc..25e1470de639d4b87a9a068e705dbc1281b31b13 100644 --- a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSimpleRcsPanSharpeningFusionImageFilter_h -#define __otbSimpleRcsPanSharpeningFusionImageFilter_h +#ifndef otbSimpleRcsPanSharpeningFusionImageFilter_h +#define otbSimpleRcsPanSharpeningFusionImageFilter_h #include "otbConvolutionImageFilter.h" #include "otbImage.h" @@ -94,13 +94,13 @@ protected: SimpleRcsPanSharpeningFusionImageFilter(); /** Destructor */ - virtual ~SimpleRcsPanSharpeningFusionImageFilter() {}; + ~SimpleRcsPanSharpeningFusionImageFilter() ITK_OVERRIDE {}; /** Call to generate data, wiring composite internal minipipeline */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SimpleRcsPanSharpeningFusionImageFilter(Self &); // intentionally not implemented diff --git a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.txx b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.txx index 4f99e10e8e05686f6173e7cedd5184daa6f21939..4ddbe4831764bef8a4b72abe65c251009b9f6670 100644 --- a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.txx +++ b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSimpleRcsPanSharpeningFusionImageFilter_txx -#define __otbSimpleRcsPanSharpeningFusionImageFilter_txx +#ifndef otbSimpleRcsPanSharpeningFusionImageFilter_txx +#define otbSimpleRcsPanSharpeningFusionImageFilter_txx #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" @@ -75,7 +75,7 @@ SimpleRcsPanSharpeningFusionImageFilter { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TPanImageType *> @@ -104,7 +104,7 @@ SimpleRcsPanSharpeningFusionImageFilter { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TXsImageType *> diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h index c8542ca44ae238fae92bd52c9a5d478bdf846f3f..a1b00a1f06ffd8fe67ddce4685ff92ec1a567ce3 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbLocalRxDetectorFilter_h -#define __otbLocalRxDetectorFilter_h +#ifndef otbLocalRxDetectorFilter_h +#define otbLocalRxDetectorFilter_h #include "itkImageToImageFilter.h" @@ -90,16 +90,16 @@ public: itkGetMacro(ExternalRadius, int); /** Main computation method */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; // virtual void GenerateData(); - virtual void BeforeThreadedGenerateData(); - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; protected: LocalRxDetectorFilter(); - virtual ~LocalRxDetectorFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LocalRxDetectorFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LocalRxDetectorFilter(const Self&); //purposely not implemented diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.txx b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.txx index 09004b54dd1755a3e95de6dc94f4964a9208c1a1..288e2a4662ba026ab6a0e43c1b2e067189c75902 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.txx +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.txx @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbLocalRxDetectorFilter_txx -#define __otbLocalRxDetectorFilter_txx +#ifndef otbLocalRxDetectorFilter_txx +#define otbLocalRxDetectorFilter_txx #include "otbLocalRxDetectorFilter.h" diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h index 117eefef8a583453eddef5394c9f08c02181eea7..39c665a3092a5fc2adff150d281fbeace4cf34d1 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbLocalRxDetectorNonThreadFilter_h -#define __otbLocalRxDetectorNonThreadFilter_h +#ifndef otbLocalRxDetectorNonThreadFilter_h +#define otbLocalRxDetectorNonThreadFilter_h #include "itkImageToImageFilter.h" @@ -89,16 +89,16 @@ public: itkGetMacro(ExternalRadius, int); /** Main computation method */ - virtual void GenerateInputRequestedRegion(); - virtual void GenerateData(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; // virtual void BeforeThreadedGenerateData(); // virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); protected: LocalRxDetectorNonThreadFilter(); - virtual ~LocalRxDetectorNonThreadFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LocalRxDetectorNonThreadFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LocalRxDetectorNonThreadFilter(const Self&); //purposely not implemented diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.txx b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.txx index 10fd32d4ce1698f1b060f044a3ab7762d8ec6d01..d78647732383318d98b87a81368d12e796ad19cf 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.txx +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.txx @@ -15,8 +15,8 @@ =========================================================================*/ -#ifndef __otbLocalRxDetectorNonThreadFilter_txx -#define __otbLocalRxDetectorNonThreadFilter_txx +#ifndef otbLocalRxDetectorNonThreadFilter_txx +#define otbLocalRxDetectorNonThreadFilter_txx #include "otbLocalRxDetectorNonThreadFilter.h" diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h index 86f59e68c5bb4735000f4edd678cefbaffb261bc..ad30119c02de25f268e530b61a93e37e1929bd01 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEigenvalueLikelihoodMaximisation_h -#define __otbEigenvalueLikelihoodMaximisation_h +#ifndef otbEigenvalueLikelihoodMaximisation_h +#define otbEigenvalueLikelihoodMaximisation_h #include "itkObjectFactory.h" #include "itkLightObject.h" @@ -104,8 +104,8 @@ public: protected: EigenvalueLikelihoodMaximisation(); - virtual ~EigenvalueLikelihoodMaximisation() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~EigenvalueLikelihoodMaximisation() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: EigenvalueLikelihoodMaximisation(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.txx b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.txx index cf49434cb8390b418021773e3f65846e16def298..4b28047c4e8ed595369baa919fac6cc622f218a8 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.txx +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbEigenvalueLikelihoodMaximisation_txx -#define __otbEigenvalueLikelihoodMaximisation_txx +#ifndef otbEigenvalueLikelihoodMaximisation_txx +#define otbEigenvalueLikelihoodMaximisation_txx #include "otbEigenvalueLikelihoodMaximisation.h" diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h index 3d1524811a7db9a4091aeac948463b2d6c6386bd..080d023d89b96d515e73973227e52f42ee884288 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVCAImageFilter_h -#define __otbVCAImageFilter_h +#ifndef otbVCAImageFilter_h +#define otbVCAImageFilter_h #include "otbImage.h" #include "itkUnaryFunctorImageFilter.h" @@ -103,12 +103,12 @@ public: itkGetMacro( NumberOfEndmembers, unsigned int ); itkSetMacro( NumberOfEndmembers, unsigned int ); - virtual void Update() + void Update() ITK_OVERRIDE { this->GenerateData(); } - virtual void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) + void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) ITK_OVERRIDE { this->GetOutput() ->SetRequestedRegion( this->GetOutput()->GetLargestPossibleRegion() ); @@ -117,13 +117,13 @@ public: protected: VCAImageFilter(); - virtual ~VCAImageFilter(); + ~VCAImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: VCAImageFilter(const Self &); //purposely not implemented @@ -136,4 +136,4 @@ private: #include "otbVcaImageFilter.txx" -#endif /* __otbVCAImageFilter_h */ +#endif /* otbVCAImageFilter_h */ diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.txx b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.txx index 0987179c6bb835ba25604ccfcde063b537dabc36..401594d3261679c6f36dfc3b10a7659105781acc 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.txx +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVCAImageFilter_txx -#define __otbVCAImageFilter_txx +#ifndef otbVCAImageFilter_txx +#define otbVCAImageFilter_txx #include "otbVcaImageFilter.h" #include "otbStandardWriterWatcher.h" diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h index 8c931bb2f83d9b4cf7b34885877035f381632f9f..fbc72a60270061cbadf2f24c0a01d46cee085537 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVirtualDimensionality_h -#define __otbVirtualDimensionality_h +#ifndef otbVirtualDimensionality_h +#define otbVirtualDimensionality_h #include "itkObjectFactory.h" #include "itkLightObject.h" @@ -117,8 +117,8 @@ public: protected: VirtualDimensionality(); - virtual ~VirtualDimensionality() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~VirtualDimensionality() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VirtualDimensionality(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx index c9892f0f7be537f4f1ac32c75864ba9307969b26..ee0165441227e4b9f90e17e4175adbd5bf06c0d2 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx @@ -18,8 +18,8 @@ for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVirtualDimensionality_txx -#define __otbVirtualDimensionality_txx +#ifndef otbVirtualDimensionality_txx +#define otbVirtualDimensionality_txx #include "otbVirtualDimensionality.h" diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h index 1bb707cc4189dadb48ee53f5c8112add9d84037b..b44458cc9f1553c709ffb940e7bcebea804ed6d8 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbISRAUnmixingImageFilter_h -#define __otbISRAUnmixingImageFilter_h +#ifndef otbISRAUnmixingImageFilter_h +#define otbISRAUnmixingImageFilter_h #include "itkNumericTraits.h" #include "otbUnaryFunctorImageFilter.h" @@ -168,9 +168,9 @@ public: protected: ISRAUnmixingImageFilter(); - virtual ~ISRAUnmixingImageFilter(); + ~ISRAUnmixingImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ISRAUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx index a8e71af5ccf32605cbeeaa63551adc5d6c8c5ffc..73be208c1cbf48f0a35cfe9bab61f2a21969a2a1 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbISRAUnmixingImageFilter_txx -#define __otbISRAUnmixingImageFilter_txx +#ifndef otbISRAUnmixingImageFilter_txx +#define otbISRAUnmixingImageFilter_txx #include "otbISRAUnmixingImageFilter.h" #include <algorithm> diff --git a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h index 07248e693f9782e032bb3aafa33a7d3911a184cd..bfd974692b6eff802402b304cbed4513424613cf 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMDMDNMFImageFilter_h -#define __otbMDMDNMFImageFilter_h +#ifndef otbMDMDNMFImageFilter_h +#define otbMDMDNMFImageFilter_h #include "itkImageToImageFilter.h" #include "otbVectorImageToMatrixImageFilter.h" @@ -190,18 +190,18 @@ public: protected: MDMDNMFImageFilter(); - virtual ~MDMDNMFImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MDMDNMFImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** GenerateOutputInformation * Propagate vector length info and modify if needed */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx index 2a2a030b36e0fe027a133f51fb461646cbf4c93b..0bd9cd8b53e57d0169cd6388f8bdf3fa8fabeaa2 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMDMDNMFImageFilter_txx -#define __otbMDMDNMFImageFilter_txx +#ifndef otbMDMDNMFImageFilter_txx +#define otbMDMDNMFImageFilter_txx #include "otbMDMDNMFImageFilter.h" diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h index a9d30c807dbb12ce314eed78c31ef0d568153fae..563b0ab9422f93fb668aaebf6397c0dd1c4f3f90 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCLSUnmixingImageFilter_h -#define __otbNCLSUnmixingImageFilter_h +#ifndef otbNCLSUnmixingImageFilter_h +#define otbNCLSUnmixingImageFilter_h #include "itkMacro.h" #include "itkNumericTraits.h" @@ -171,9 +171,9 @@ public: protected: NCLSUnmixingImageFilter(); - virtual ~NCLSUnmixingImageFilter(); + ~NCLSUnmixingImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: NCLSUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx index 7c7a2019147d69201dcef01f5b3811c7ad71b3cb..6f696b183f5bfde07fcb83eefd4b6c6e94f00605 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCLSUnmixingImageFilter_txx -#define __otbNCLSUnmixingImageFilter_txx +#ifndef otbNCLSUnmixingImageFilter_txx +#define otbNCLSUnmixingImageFilter_txx #include "otbNCLSUnmixingImageFilter.h" #include <algorithm> diff --git a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h index 9625cd73896b2e6199895d760985773ba4451702..64f22bd47a97f7bdb79ec97e02f0cb7f2305655f 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSparseUnmixingImageFilter_h -#define __otbSparseUnmixingImageFilter_h +#ifndef otbSparseUnmixingImageFilter_h +#define otbSparseUnmixingImageFilter_h #include "itkListSample.h" #include "itkHistogram.h" @@ -159,9 +159,9 @@ public: protected: SparseUnmixingImageFilter(); - virtual ~SparseUnmixingImageFilter() { } + ~SparseUnmixingImageFilter() ITK_OVERRIDE { } - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; virtual void GenerateNumberOfComponentsRequired (); private: SparseUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.txx index ceadc2e6b1f6e640ce3ecb1a8e06c71ed3920d78..8b84cb874fc8287a8177aa7661074ef11b1a42d0 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSparseUnmixingImageFilter_txx -#define __otbSparseUnmixingImageFilter_txx +#ifndef otbSparseUnmixingImageFilter_txx +#define otbSparseUnmixingImageFilter_txx #include "otbSparseUnmixingImageFilter.h" @@ -75,7 +75,7 @@ SparseUnmixingImageFilter< TInputImage, TOutputImage, VNbInputImage, TPrecision, { if ( i >= this->GetNumberOfInputs() ) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType * > diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h index 4a869df0037c44de2f401e989f74fd42157ac63a..58099595c8b1f0ea30a9169b8512ddc713cc8d8a 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnConstrainedLeastSquareImageFilter_h -#define __otbUnConstrainedLeastSquareImageFilter_h +#ifndef otbUnConstrainedLeastSquareImageFilter_h +#define otbUnConstrainedLeastSquareImageFilter_h #include "itkMacro.h" #include "otbUnaryFunctorImageFilter.h" @@ -171,9 +171,9 @@ public: protected: UnConstrainedLeastSquareImageFilter(); - virtual ~UnConstrainedLeastSquareImageFilter() {} + ~UnConstrainedLeastSquareImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: UnConstrainedLeastSquareImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.txx index 268af36187bf78121d4ed69e6d93b70bffa3978a..663b02fbdc28c4f2f258ced6dee55445be3a4cc9 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbUnConstrainedLeastSquareImageFilter_txx -#define __otbUnConstrainedLeastSquareImageFilter_txx +#ifndef otbUnConstrainedLeastSquareImageFilter_txx +#define otbUnConstrainedLeastSquareImageFilter_txx #include "otbUnConstrainedLeastSquareImageFilter.h" diff --git a/Modules/IO/Carto/include/otbCoordinateToName.h b/Modules/IO/Carto/include/otbCoordinateToName.h index 7c259a63d6fe2e3125dc165ed637bde6ce0e0339..952e27cc23bddc014fb7bd092bd5b6aa1974da02 100644 --- a/Modules/IO/Carto/include/otbCoordinateToName.h +++ b/Modules/IO/Carto/include/otbCoordinateToName.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCoordinateToName_h -#define __otbCoordinateToName_h +#ifndef otbCoordinateToName_h +#define otbCoordinateToName_h #include "itkPoint.h" #include "itkMultiThreader.h" @@ -114,8 +114,8 @@ public: protected: CoordinateToName(); - virtual ~CoordinateToName() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~CoordinateToName() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; void ParseXMLGeonames(std::string& placeName, std::string& countryName) const; virtual void DoEvaluate(); diff --git a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h index f57b27435a9546b73da5b2d3ba0caa22be285583..77665ad81ffefdf73df36b127b633029f7af9841 100644 --- a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h +++ b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToOSMVectorDataGenerator_h -#define __otbImageToOSMVectorDataGenerator_h +#ifndef otbImageToOSMVectorDataGenerator_h +#define otbImageToOSMVectorDataGenerator_h #include "otbOSMDataToVectorDataGenerator.h" @@ -78,13 +78,13 @@ public: const ImageType* GetInput() const; protected: - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; // Method to compute the extent of the image void EstimateImageExtent(); ImageToOSMVectorDataGenerator(); - virtual ~ImageToOSMVectorDataGenerator() {} + ~ImageToOSMVectorDataGenerator() ITK_OVERRIDE {} private: ImageToOSMVectorDataGenerator(const Self&); //purposely not implemented diff --git a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.txx b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.txx index 87f2ec062af04f8fc09c3782c3bbd7a78cbb1668..b7cbbe177c066ef6d1312bce5dd15de932fa0119 100644 --- a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.txx +++ b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToOSMVectorDataGenerator_txx -#define __otbImageToOSMVectorDataGenerator_txx +#ifndef otbImageToOSMVectorDataGenerator_txx +#define otbImageToOSMVectorDataGenerator_txx #include "otbImageToOSMVectorDataGenerator.h" #include "otbGeoInformationConversion.h" @@ -57,7 +57,7 @@ ImageToOSMVectorDataGenerator<TImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const ImageType* > diff --git a/Modules/IO/Carto/include/otbMapFileProductWriter.h b/Modules/IO/Carto/include/otbMapFileProductWriter.h index 4de59cbf3d0c2e9c3f95863414e77f0f8f093856..c180daf23dbda8431276233171c41ca433ac0809 100644 --- a/Modules/IO/Carto/include/otbMapFileProductWriter.h +++ b/Modules/IO/Carto/include/otbMapFileProductWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapFileProductWriter_h -#define __otbMapFileProductWriter_h +#ifndef otbMapFileProductWriter_h +#define otbMapFileProductWriter_h #include <fstream> @@ -151,7 +151,7 @@ public: itkGetStringMacro(ShapeIndexPath); /** Update Method : Call a porotected Write method */ - virtual void Update() + void Update() ITK_OVERRIDE { this->Write(); } @@ -161,8 +161,8 @@ public: protected: MapFileProductWriter(); - virtual ~MapFileProductWriter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MapFileProductWriter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /**Method for Tiling the input image*/ virtual void Tiling(); diff --git a/Modules/IO/Carto/include/otbMapFileProductWriter.txx b/Modules/IO/Carto/include/otbMapFileProductWriter.txx index d6e84cda4d6d923de9069667832325241cc2582e..f960e0b2f2ca79bac9f974884e011681de441553 100644 --- a/Modules/IO/Carto/include/otbMapFileProductWriter.txx +++ b/Modules/IO/Carto/include/otbMapFileProductWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMapFileProductWriter_txx -#define __otbMapFileProductWriter_txx +#ifndef otbMapFileProductWriter_txx +#define otbMapFileProductWriter_txx #include "otbMapFileProductWriter.h" #include "itksys/SystemTools.hxx" @@ -84,7 +84,7 @@ MapFileProductWriter<TInputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage * > diff --git a/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h b/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h index 4c55fb87565e1c7aff553894f43c4bea12e51787..a58f0a331e9f259f974de47f7b937f58409b7f41 100644 --- a/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h +++ b/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbOSMDataToVectorDataGenerator_h -#define __otbOSMDataToVectorDataGenerator_h +#ifndef otbOSMDataToVectorDataGenerator_h +#define otbOSMDataToVectorDataGenerator_h // store the nodes (points) coordinates #include <map> @@ -162,7 +162,7 @@ public: protected: /** Generate Data method : lauch the process */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** * Parse the xml file get from OSM to compose the requested vector @@ -182,7 +182,7 @@ protected: OSMDataToVectorDataGenerator(); - virtual ~OSMDataToVectorDataGenerator(); + ~OSMDataToVectorDataGenerator() ITK_OVERRIDE; private: OSMDataToVectorDataGenerator(const Self&); //purposely not implemented diff --git a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h index 920bd2f0d1e6d5c651a415f59c75280ea08ff101..1587e817eef783dcb24205b952e404083216988a 100644 --- a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h +++ b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPlaceNameToLonLat_h -#define __otbPlaceNameToLonLat_h +#ifndef otbPlaceNameToLonLat_h +#define otbPlaceNameToLonLat_h #include "otbCurlHelperInterface.h" @@ -57,8 +57,8 @@ public: protected: PlaceNameToLonLat(); - virtual ~PlaceNameToLonLat() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PlaceNameToLonLat() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; void RetrieveXML(const std::ostringstream& urlStream); void ParseXMLYahoo(); void ParseXMLGoogle(); diff --git a/Modules/IO/Carto/include/otbWorldFile.h b/Modules/IO/Carto/include/otbWorldFile.h index 3510967409f924966b7e677bea31e8d76b80385e..77624276b59c902149ad9ff994a51346034c7c25 100644 --- a/Modules/IO/Carto/include/otbWorldFile.h +++ b/Modules/IO/Carto/include/otbWorldFile.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWorldFile_h -#define __otbWorldFile_h +#ifndef otbWorldFile_h +#define otbWorldFile_h #include <iomanip> #include <fstream> @@ -93,7 +93,7 @@ protected: m_LonSpacing(0.0), m_LatSpacing(0.0), m_LonRotation(0.0), m_LatRotation(0.0), m_ImageFilename("") {} - ~WorldFile() {} + ~WorldFile() ITK_OVERRIDE {} private: WorldFile(const Self &); //purposely not implemented diff --git a/Modules/IO/Carto/src/otbOSMDataToVectorDataGenerator.cxx b/Modules/IO/Carto/src/otbOSMDataToVectorDataGenerator.cxx index 6d16f6ed7ddf9055f0875d0fa5a8a69a36c9f28c..3aa7df3e2bba20543081295b309ca05d99ac0a81 100644 --- a/Modules/IO/Carto/src/otbOSMDataToVectorDataGenerator.cxx +++ b/Modules/IO/Carto/src/otbOSMDataToVectorDataGenerator.cxx @@ -139,7 +139,7 @@ void OSMDataToVectorDataGenerator::ParseXmlFile() // Iterate through the tree to get all the nodes and store them in // a std::map for( TiXmlElement* node = root.FirstChild("node").ToElement(); - node != NULL && strcmp(node->Value(),"node")==0; + node != ITK_NULLPTR && strcmp(node->Value(),"node")==0; node = node->NextSiblingElement() ) { int id = 0; @@ -168,7 +168,7 @@ void OSMDataToVectorDataGenerator::ParseXmlFile() // Iterate through the tree to get all the fields ways with tag k=key for( TiXmlElement* currentLayer = root.FirstChildElement("way").ToElement(); - currentLayer != NULL && strcmp(currentLayer->Value(),"way") ==0; + currentLayer != ITK_NULLPTR && strcmp(currentLayer->Value(),"way") ==0; currentLayer = currentLayer->NextSiblingElement() ) { bool foundKey = false; @@ -180,7 +180,7 @@ void OSMDataToVectorDataGenerator::ParseXmlFile() // Iterate through the node tag to find the "key" for( TiXmlElement* currentTag = currentLayer->FirstChild("tag")->ToElement(); - currentTag != NULL; + currentTag != ITK_NULLPTR; currentTag = currentTag->NextSiblingElement() ) { std::string result = currentTag->Attribute("k"); @@ -211,7 +211,7 @@ void OSMDataToVectorDataGenerator::ParseXmlFile() // put the current layer pointer to the begining for( TiXmlElement* currentNode = currentLayer->FirstChildElement("nd"); - currentNode != NULL; + currentNode != ITK_NULLPTR; currentNode = currentNode->NextSiblingElement() ) { int value=0; diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h index 96e72fe51f617f41f61b89b1534ec9e9b13ccbd5..910d1068fb5d2b5970823947defba5d8b638fdd1 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h +++ b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtendedFilenameHelper_h -#define __otbExtendedFilenameHelper_h +#ifndef otbExtendedFilenameHelper_h +#define otbExtendedFilenameHelper_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -54,7 +54,7 @@ public: protected: ExtendedFilenameHelper() {} - virtual ~ExtendedFilenameHelper() {} + ~ExtendedFilenameHelper() ITK_OVERRIDE {} private: ExtendedFilenameHelper(const Self &); //purposely not implemented @@ -68,4 +68,4 @@ private: }; } // end namespace otb -#endif // __otbExtendedFilenameHelper_h +#endif // otbExtendedFilenameHelper_h diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h index d442a33fee8ede3ae1fcb2892c9986982892738d..7dc33dbecd36f6a4f1c6ea0c111175513b1f2dc2 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h +++ b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtendedFilenameToReaderOptions_h -#define __otbExtendedFilenameToReaderOptions_h +#ifndef otbExtendedFilenameToReaderOptions_h +#define otbExtendedFilenameToReaderOptions_h #include "otbExtendedFilenameHelper.h" @@ -87,7 +87,7 @@ public: protected: ExtendedFilenameToReaderOptions(); - virtual ~ExtendedFilenameToReaderOptions() {} + ~ExtendedFilenameToReaderOptions() ITK_OVERRIDE {} private: ExtendedFilenameToReaderOptions(const Self &); //purposely not implemented @@ -99,4 +99,4 @@ private: }; } // end namespace otb -#endif // __otbExtendedFilenameToReaderOptions_h +#endif // otbExtendedFilenameToReaderOptions_h diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h index 856d22b3b5ea8388db2ca7fa2d6d5c2909b6e871..994a9e3791d27ec0c086134ff12e3f7a0f8a1ccd 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h +++ b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExtendedFilenameToWriterOptions_h -#define __otbExtendedFilenameToWriterOptions_h +#ifndef otbExtendedFilenameToWriterOptions_h +#define otbExtendedFilenameToWriterOptions_h #include "otbExtendedFilenameHelper.h" #include "otbGDALImageIO.h" @@ -96,7 +96,7 @@ public: protected: ExtendedFilenameToWriterOptions(); - virtual ~ExtendedFilenameToWriterOptions() {} + ~ExtendedFilenameToWriterOptions() ITK_OVERRIDE {} private: ExtendedFilenameToWriterOptions(const Self &); //purposely not implemented @@ -108,4 +108,4 @@ private: }; } // end namespace otb -#endif // __otbExtendedFilenameToWriterOptions_h +#endif // otbExtendedFilenameToWriterOptions_h diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx index 49cd5f44c10304c6f4b0e254b88cc185dadbdd02..c89b2cb7b2915015e0647807644a12dd49613229 100644 --- a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx +++ b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx @@ -24,7 +24,7 @@ void ExtendedFilenameHelper ::SetExtendedFileName(const char *extFname) { - if (extFname == NULL) + if (extFname == ITK_NULLPTR) { itkGenericExceptionMacro( << "Filename is NULL" ); } diff --git a/Modules/IO/IOBSQ/include/otbBSQImageIO.h b/Modules/IO/IOBSQ/include/otbBSQImageIO.h index 5113a1ad439d81121ab4fbc23fa2b696468088ea..548aa31de617db9de3d1f4a0802c22309ece68b1 100644 --- a/Modules/IO/IOBSQ/include/otbBSQImageIO.h +++ b/Modules/IO/IOBSQ/include/otbBSQImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSQImageIO_h -#define __otbBSQImageIO_h +#ifndef otbBSQImageIO_h +#define otbBSQImageIO_h #include <fstream> #include <string> @@ -60,19 +60,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -81,28 +81,28 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; // JULIEN: NOT USED, NOT IMPLEMENTED // void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -111,7 +111,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -119,14 +119,14 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ BSQImageIO(); /** Destructor.*/ - virtual ~BSQImageIO(); + ~BSQImageIO() ITK_OVERRIDE; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -135,7 +135,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BSQImageIO(const Self &); //purposely not implemented @@ -183,4 +183,4 @@ private: } // end namespace otb -#endif // __otbBSQImageIO_h +#endif // otbBSQImageIO_h diff --git a/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h b/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h index a259920125384748227d6cd901c8d2773b6156d5..4233c7a8bdb4420f1ea7b9f6a4f93542cc0f87d6 100644 --- a/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h +++ b/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSQImageIOFactory_h -#define __otbBSQImageIOFactory_h +#ifndef otbBSQImageIOFactory_h +#define otbBSQImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: BSQImageIOFactory(); - virtual ~BSQImageIOFactory(); + ~BSQImageIOFactory() ITK_OVERRIDE; private: BSQImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOBSQ/src/otbBSQImageIO.cxx b/Modules/IO/IOBSQ/src/otbBSQImageIO.cxx index 9d1fa0e37b6f8f7f27f2e667903629cfad4db352..fd7039484e722837700d11c9b05a19735a1d0c1a 100644 --- a/Modules/IO/IOBSQ/src/otbBSQImageIO.cxx +++ b/Modules/IO/IOBSQ/src/otbBSQImageIO.cxx @@ -54,7 +54,7 @@ BSQImageIO::BSQImageIO() // (consistency between ImageIO, see Mantis #942) m_Origin[0] = 0.5; m_Origin[1] = 0.5; - m_ChannelsFile = NULL; + m_ChannelsFile = ITK_NULLPTR; m_FlagWriteImageInformation = true; this->AddSupportedWriteExtension(".hd"); @@ -71,7 +71,7 @@ BSQImageIO::~BSQImageIO() { m_HeaderFile.close(); } - if (m_ChannelsFile != NULL) + if (m_ChannelsFile != ITK_NULLPTR) { for (unsigned int numComponent = 0; numComponent < this->GetNumberOfComponents(); numComponent++) { @@ -152,7 +152,7 @@ void BSQImageIO::Read(void* buffer) step = step * (unsigned long) (this->GetComponentSize()); char * value = new char[numberOfBytesToBeRead]; - if (value == NULL) + if (value == ITK_NULLPTR) { itkExceptionMacro(<< "BSQImageIO::Read(): Bad alloc"); return; @@ -528,7 +528,7 @@ void BSQImageIO::Write(const void* buffer) const char * p = static_cast<const char *>(buffer); char* value = new char[numberOfBytesToBeWrite]; - if (value == NULL) + if (value == ITK_NULLPTR) { itkExceptionMacro(<< "Memory allocation error"); return; diff --git a/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h b/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h index 89c4a1a82ee75c6f7a721382dcab369f9e5ee5e5..7b675444e001976aa244d76081e207bf7df2d988 100644 --- a/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h +++ b/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h @@ -76,7 +76,7 @@ public: protected : GDALDatasetWrapper(); - virtual ~GDALDatasetWrapper(); + ~GDALDatasetWrapper() ITK_OVERRIDE; private: diff --git a/Modules/IO/IOGDAL/include/otbGDALImageIO.h b/Modules/IO/IOGDAL/include/otbGDALImageIO.h index c258c75002b6bcca15fea4cc735f8aba65c45237..fb3585b8a1de2f0894a3d295461a9993d634a356 100644 --- a/Modules/IO/IOGDAL/include/otbGDALImageIO.h +++ b/Modules/IO/IOGDAL/include/otbGDALImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGDALImageIO_h -#define __otbGDALImageIO_h +#ifndef otbGDALImageIO_h +#define otbGDALImageIO_h /* C++ Libraries */ @@ -113,8 +113,8 @@ public: /** Provide hist about the output container to deal with complex pixel * type */ - virtual void SetOutputImagePixelType( bool isComplexInternalPixelType, - bool isVectorImage) + void SetOutputImagePixelType( bool isComplexInternalPixelType, + bool isVectorImage) ITK_OVERRIDE { this->SetIsComplex(isComplexInternalPixelType); this->SetIsVectorImage(isVectorImage); @@ -124,19 +124,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -151,18 +151,18 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite(); + bool CanStreamWrite() ITK_OVERRIDE; /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; /** Get all resolutions possible from the file dimensions */ bool GetAvailableResolutions(std::vector<unsigned int>& res); @@ -175,10 +175,13 @@ public: * Currently this overview count is only based on the first band * If no pre-computed overviews are available we provide the overview * count based on size division by 2*/ - virtual unsigned int GetOverviewsCount(); + unsigned int GetOverviewsCount() ITK_OVERRIDE; /** Get description about overviews available into the file specified */ - virtual std::vector<std::string> GetOverviewsInfo(); + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE; + + /** Returns gdal pixel type as string */ + std::string GetGdalPixelTypeAsString() const; protected: /** @@ -188,9 +191,9 @@ protected: */ GDALImageIO(); /** Destructor.*/ - virtual ~GDALImageIO(); + ~GDALImageIO() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Read all information on the image*/ void InternalReadImageInformation(); /** Write all information on the image*/ @@ -278,4 +281,4 @@ private: } // end namespace otb -#endif // __otbGDALImageIO_h +#endif // otbGDALImageIO_h diff --git a/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h b/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h index 7e0c8b61da980198c9a80560cad2744f4555a155..c32302b1310bd65d969f405dd9cb1bf876fa58ee 100644 --- a/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h +++ b/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbGDALImageIOFactory_h -#define __otbGDALImageIOFactory_h +#ifndef otbGDALImageIOFactory_h +#define otbGDALImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: GDALImageIOFactory(); - virtual ~GDALImageIOFactory(); + ~GDALImageIOFactory() ITK_OVERRIDE; private: GDALImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h b/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h index e0335c34033851fc10130c70bf0638278a690536..4262a321607b27569e595bd1854e7760e9b4c34d 100644 --- a/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h +++ b/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h @@ -152,15 +152,15 @@ public: void SetInputFileName( const std::string & str ); - void Update(); + void Update() ITK_OVERRIDE; protected: GDALOverviewsBuilder(); - virtual ~GDALOverviewsBuilder() {}; + ~GDALOverviewsBuilder() ITK_OVERRIDE {}; - void PrintSelf( std::ostream & os, itk::Indent indent ) const; + void PrintSelf( std::ostream & os, itk::Indent indent ) const ITK_OVERRIDE; private: diff --git a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h index 6df03e24d743bccc4c4c5cb2a2858a1c2bf0c0d4..9f7e7616ccca92a4444a4c4c92e33368caf07ecc 100644 --- a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h +++ b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRIOHelper_h -#define __otbOGRIOHelper_h +#ifndef otbOGRIOHelper_h +#define otbOGRIOHelper_h #include <vector> @@ -53,6 +53,9 @@ public: typedef VectorDataType::DataTreeType DataTreeType; typedef DataTreeType::TreeNodeType InternalTreeNodeType; + typedef VectorDataType::DataNodeType DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; + /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -75,17 +78,20 @@ public: OGRLayer* ogrCurrentLayer, OGRSpatialReference * oSRS); + void ConvertGeometryToPointNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; + + void ConvertGeometryToLineNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; + + void ConvertGeometryToPolygonNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; + protected: OGRIOHelper(); - ~OGRIOHelper(); + ~OGRIOHelper() ITK_OVERRIDE; private: OGRIOHelper(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - typedef VectorDataType::DataNodeType DataNodeType; - typedef DataNodeType::Pointer DataNodePointerType; - typedef DataNodeType::PointType PointType; typedef DataNodeType::LineType LineType; @@ -98,12 +104,6 @@ private: typedef DataNodeType::PolygonListType PolygonListType; typedef PolygonListType::Pointer PolygonListPointerType; - void ConvertGeometryToPointNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; - - void ConvertGeometryToLineNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; - - void ConvertGeometryToPolygonNode(const OGRGeometry * ogrGeometry, DataNodePointerType node) const; - }; // end class OGRIOHelper } // end namespace otb diff --git a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h index 4a2d5dc8d0dc6f6c13a60965efb4c5344b29f2ea..d912fc3153017bdd507218bdedba334832d9d483 100644 --- a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h +++ b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRVectorDataIO_h -#define __otbOGRVectorDataIO_h +#ifndef otbOGRVectorDataIO_h +#define otbOGRVectorDataIO_h #include <string> #include <cassert> @@ -86,29 +86,29 @@ public: /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - virtual bool CanReadFile(const char*) const; + bool CanReadFile(const char*) const ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(itk::DataObject* data); + void Read(itk::DataObject* data) ITK_OVERRIDE; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*) const; + bool CanWriteFile(const char*) const ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided */ - virtual void Write(const itk::DataObject* data, char ** papszOptions = NULL); + void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) ITK_OVERRIDE; protected: /** Constructor.*/ OGRVectorDataIO(); /** Destructor.*/ - virtual ~OGRVectorDataIO(); + ~OGRVectorDataIO() ITK_OVERRIDE; /* virtual void InternalReadVectorDataInformation(){}; */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: OGRVectorDataIO(const Self &); //purposely not implemented @@ -124,4 +124,4 @@ private: } // end namespace otb -#endif // __otbOGRVectorDataIO_h +#endif // otbOGRVectorDataIO_h diff --git a/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h b/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h index 3571167e5971c035e00534e24375096a46f2b18b..3a414b63710b6fda0eb2d03ab22a4bb59304854f 100644 --- a/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h +++ b/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRVectorDataIOFactory_h -#define __otbOGRVectorDataIOFactory_h +#ifndef otbOGRVectorDataIOFactory_h +#define otbOGRVectorDataIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -55,7 +55,7 @@ public: protected: OGRVectorDataIOFactory(); - virtual ~OGRVectorDataIOFactory(); + ~OGRVectorDataIOFactory() ITK_OVERRIDE; private: OGRVectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/src/otbGDALDatasetWrapper.cxx b/Modules/IO/IOGDAL/src/otbGDALDatasetWrapper.cxx index c1d23d23a190c7037ccfadc494b5c722f0b66f3c..8842ef89e349972de700894b958bd83340e90a05 100644 --- a/Modules/IO/IOGDAL/src/otbGDALDatasetWrapper.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALDatasetWrapper.cxx @@ -26,7 +26,7 @@ namespace otb { GDALDatasetWrapper -::GDALDatasetWrapper(): m_Dataset(NULL) +::GDALDatasetWrapper(): m_Dataset(ITK_NULLPTR) { } @@ -41,7 +41,7 @@ GDALDatasetWrapper // GDALDriverManagerWrapper::Open(). So, it should be destroyed by // GDALClose() (see // http://gdal.org/classGDALDataset.html#a4d110533d799bac7dcfad3c41d30c0e7). - m_Dataset = NULL; + m_Dataset = ITK_NULLPTR; } } @@ -66,7 +66,7 @@ GDALDatasetWrapper bool GDALDatasetWrapper::IsJPEG2000() const { - if (m_Dataset == NULL) + if (m_Dataset == ITK_NULLPTR) { return false; } diff --git a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx index 747d851f3a4b7d60c0e4936af49b69a76460ac1e..6eb7a346fda5c32d6b19ca3f0f1c63800a113ec0 100644 --- a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx @@ -29,7 +29,7 @@ GDALDriverManagerWrapper::GDALDriverManagerWrapper() { GDALAllRegister(); - GDALDriver* driver = 0; + GDALDriver* driver = ITK_NULLPTR; // Ignore incompatible Jpeg2000 drivers (Jasper) driver = GetGDALDriverManager()->GetDriverByName( "JPEG2000" ); @@ -63,8 +63,8 @@ GDALDriverManagerWrapper::Open( std::string filename ) const } // test if a driver can identify the dataset - GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), NULL); - if(identifyDriverH == NULL) + GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), ITK_NULLPTR); + if(identifyDriverH == ITK_NULLPTR) { // don't try to open it and exit return datasetWrapper; @@ -83,7 +83,7 @@ GDALDriverManagerWrapper::Open( std::string filename ) const GDALDatasetH dataset = GDALOpen(filename.c_str(), GA_ReadOnly); - if (dataset != NULL) + if (dataset != ITK_NULLPTR) { datasetWrapper = GDALDatasetWrapper::New(); datasetWrapper->m_Dataset = static_cast<GDALDataset*>(dataset); @@ -100,14 +100,14 @@ GDALDriverManagerWrapper::Create( std::string driverShortName, std::string filen GDALDatasetWrapper::Pointer datasetWrapper; GDALDriver* driver = GetDriverByName( driverShortName ); - if(driver != NULL) + if(driver != ITK_NULLPTR) { GDALDataset* dataset = driver->Create(filename.c_str(), nXSize, nYSize, nBands, eType, papszOptions ); - if (dataset != NULL) + if (dataset != ITK_NULLPTR) { datasetWrapper = GDALDatasetWrapper::New(); datasetWrapper->m_Dataset = dataset; diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx index 41b09e667343af6e94f625334fa65e94ff9128c0..18a6da23667953397183290cd8f1d6719bc4c309 100644 --- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx @@ -172,7 +172,7 @@ GDALImageIO::~GDALImageIO() bool GDALImageIO::CanReadFile(const char* file) { // First check the extension - if (file == NULL) + if (file == ITK_NULLPTR) { itkDebugMacro(<< "No filename specified."); return false; @@ -202,7 +202,7 @@ void GDALImageIO::Read(void* buffer) unsigned char *p = static_cast<unsigned char *>(buffer); // Check if conversion succeed - if (p == NULL) + if (p == ITK_NULLPTR) { itkExceptionMacro(<< "GDAL : Bad alloc"); return; @@ -418,7 +418,7 @@ void GDALImageIO::Read(void* buffer) m_PxType->pixType, nbBands, // We want to read all bands - NULL, + ITK_NULLPTR, pixelOffset, lineOffset, bandOffset); @@ -449,7 +449,7 @@ bool GDALImageIO::GetSubDatasetInfo(std::vector<std::string> &names, std::vector (strcmp(m_Dataset->GetDataSet()->GetDriver()->GetDescription(),"HDF5") == 0) || (strcmp(m_Dataset->GetDataSet()->GetDriver()->GetDescription(),"SENTINEL2") == 0) ) ) { - for (int cpt = 0; papszMetadata[cpt] != NULL; ++cpt) + for (int cpt = 0; papszMetadata[cpt] != ITK_NULLPTR; ++cpt) { std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) @@ -602,7 +602,7 @@ void GDALImageIO::InternalReadImageInformation() std::vector<std::string> names; if( CSLCount(papszMetadata) > 0 ) { - for( int cpt = 0; papszMetadata[cpt] != NULL; ++cpt ) + for( int cpt = 0; papszMetadata[cpt] != ITK_NULLPTR; ++cpt ) { std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) @@ -891,7 +891,7 @@ void GDALImageIO::InternalReadImageInformation() if (m_NumberOfDimensions == 3) m_Spacing[2] = 1; - char** papszMetadata = dataset->GetMetadata(NULL); + char** papszMetadata = dataset->GetMetadata(ITK_NULLPTR); /* -------------------------------------------------------------------- */ /* Report general info. */ @@ -915,16 +915,16 @@ void GDALImageIO::InternalReadImageInformation() /* -------------------------------------------------------------------- */ /* Get the projection coordinate system of the image : ProjectionRef */ /* -------------------------------------------------------------------- */ - if (dataset->GetProjectionRef() != NULL && !std::string(dataset->GetProjectionRef()).empty()) + if (dataset->GetProjectionRef() != ITK_NULLPTR && !std::string(dataset->GetProjectionRef()).empty()) { - OGRSpatialReferenceH pSR = OSRNewSpatialReference(NULL); + OGRSpatialReferenceH pSR = OSRNewSpatialReference(ITK_NULLPTR); - const char * pszProjection = NULL; + const char * pszProjection = ITK_NULLPTR; pszProjection = dataset->GetProjectionRef(); if (OSRImportFromWkt(pSR, (char **) (&pszProjection)) == OGRERR_NONE) { - char * pszPrettyWkt = NULL; + char * pszPrettyWkt = ITK_NULLPTR; OSRExportToPrettyWkt(pSR, &pszPrettyWkt, FALSE); itk::EncapsulateMetaData<std::string> (dict, MetaDataKey::ProjectionRefKey, @@ -938,10 +938,10 @@ void GDALImageIO::InternalReadImageInformation() static_cast<std::string>(dataset->GetProjectionRef())); } - if (pSR != NULL) + if (pSR != ITK_NULLPTR) { OSRRelease(pSR); - pSR = NULL; + pSR = ITK_NULLPTR; } } else @@ -970,7 +970,7 @@ void GDALImageIO::InternalReadImageInformation() // assert( gcpProj!=NULL ); - if( gcpProj!=NULL ) + if( gcpProj!=ITK_NULLPTR ) gcpProjectionKey = gcpProj; } @@ -1084,12 +1084,12 @@ void GDALImageIO::InternalReadImageInformation() /* Report metadata. */ /* -------------------------------------------------------------------- */ - papszMetadata = dataset->GetMetadata(NULL); + papszMetadata = dataset->GetMetadata(ITK_NULLPTR); if (CSLCount(papszMetadata) > 0) { std::string key; - for (int cpt = 0; papszMetadata[cpt] != NULL; ++cpt) + for (int cpt = 0; papszMetadata[cpt] != ITK_NULLPTR; ++cpt) { std::ostringstream lStream; lStream << MetaDataKey::MetadataKey << cpt; @@ -1103,7 +1103,7 @@ void GDALImageIO::InternalReadImageInformation() /* Special case for JPEG2000, also look in the GML boxes */ if (m_Dataset->IsJPEG2000()) { - char **gmlMetadata = NULL; + char **gmlMetadata = ITK_NULLPTR; GDALJP2Metadata jp2Metadata; if (jp2Metadata.ReadAndParse(m_FileName.c_str())) { @@ -1117,7 +1117,7 @@ void GDALImageIO::InternalReadImageInformation() std::string key; int cptOffset = CSLCount(papszMetadata); - for (int cpt = 0; gmlMetadata[cpt] != NULL; ++cpt) + for (int cpt = 0; gmlMetadata[cpt] != ITK_NULLPTR; ++cpt) { std::ostringstream lStream; lStream << MetaDataKey::MetadataKey << (cpt+cptOffset); @@ -1140,7 +1140,7 @@ void GDALImageIO::InternalReadImageInformation() { std::string key; - for (int cpt = 0; papszMetadata[cpt] != NULL; ++cpt) + for (int cpt = 0; papszMetadata[cpt] != ITK_NULLPTR; ++cpt) { std::ostringstream lStream; lStream << MetaDataKey::SubMetadataKey << cpt; @@ -1200,7 +1200,7 @@ void GDALImageIO::InternalReadImageInformation() GDALRasterBandH hBand; hBand = GDALGetRasterBand(dataset, iBand + 1); if ((GDALGetRasterColorInterpretation(hBand) == GCI_PaletteIndex) - && (hTable = GDALGetRasterColorTable(hBand)) != NULL) + && (hTable = GDALGetRasterColorTable(hBand)) != ITK_NULLPTR) { m_IsIndexed = true; @@ -1269,7 +1269,7 @@ void GDALImageIO::InternalReadImageInformation() bool GDALImageIO::CanWriteFile(const char* name) { // First check the filename - if (name == NULL) + if (name == ITK_NULLPTR) { itkDebugMacro(<< "No filename specified."); return false; @@ -1286,8 +1286,8 @@ bool GDALImageIO::CanWriteFile(const char* name) // Check the driver for support of Create or at least CreateCopy GDALDriver* driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName(gdalDriverShortName); - if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, NULL ) == NULL - && GDALGetMetadataItem( driver, GDAL_DCAP_CREATECOPY, NULL ) == NULL ) + if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) == ITK_NULLPTR + && GDALGetMetadataItem( driver, GDAL_DCAP_CREATECOPY, ITK_NULLPTR ) == ITK_NULLPTR ) { itkDebugMacro(<< "The driver " << GDALGetDriverShortName(driver) << " does not support writing"); return false; @@ -1301,12 +1301,12 @@ bool GDALImageIO::CanStreamWrite() std::string gdalDriverShortName = FilenameToGdalDriverShortName(m_FileName); GDALDriver* driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName(gdalDriverShortName); - if (driver == NULL) + if (driver == ITK_NULLPTR) { itkDebugMacro(<< "Unable to instantiate driver " << gdalDriverShortName); m_CanStreamWrite = false; } - if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, NULL ) != NULL ) + if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) != ITK_NULLPTR ) { m_CanStreamWrite = true; } @@ -1327,7 +1327,7 @@ void GDALImageIO::Write(const void* buffer) } // Check if conversion succeed - if (buffer == NULL) + if (buffer == ITK_NULLPTR) { itkExceptionMacro(<< "GDAL : Bad alloc"); return; @@ -1381,7 +1381,7 @@ void GDALImageIO::Write(const void* buffer) m_PxType->pixType, m_NbBands, // We want to write all bands - NULL, + ITK_NULLPTR, // Pixel offset // is nbComp * BytePerPixel m_BytePerPixel * m_NbBands, @@ -1410,7 +1410,7 @@ void GDALImageIO::Write(const void* buffer) std::string realFileName = GetGdalWriteImageFileName(gdalDriverShortName, m_FileName); GDALDriver* driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName(gdalDriverShortName); - if (driver == NULL) + if (driver == ITK_NULLPTR) { itkExceptionMacro(<< "Unable to instantiate driver " << gdalDriverShortName << " to write " << m_FileName); } @@ -1418,7 +1418,7 @@ void GDALImageIO::Write(const void* buffer) GDALCreationOptionsType creationOptions = m_CreationOptions; GDALDataset* hOutputDS = driver->CreateCopy( realFileName.c_str(), m_Dataset->GetDataSet(), FALSE, otb::ogr::StringListConverter(creationOptions).to_ogr(), - NULL, NULL ); + ITK_NULLPTR, ITK_NULLPTR ); if(!hOutputDS) { itkExceptionMacro(<< "Error while writing image (GDAL format) '" @@ -1781,7 +1781,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) std::string tag = svalue.substr(0, equalityPos); std::string value = svalue.substr(equalityPos + 1); otbMsgDevMacro(<< "Metadata: " << tag << "=" << value); - dataset->SetMetadataItem(tag.c_str(), value.c_str(), NULL); + dataset->SetMetadataItem(tag.c_str(), value.c_str(), ITK_NULLPTR); } } @@ -1852,7 +1852,7 @@ std::string GDALImageIO::FilenameToGdalDriverShortName(const std::string& name) else if ( extension == ".j2k" || extension == ".jp2" || extension == ".jpx") { // Try different JPEG2000 drivers - GDALDriver *driver = NULL; + GDALDriver *driver = ITK_NULLPTR; driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName("JP2OpenJPEG"); if (driver) { @@ -1997,4 +1997,12 @@ bool GDALImageIO::CreationOptionContains(std::string partialOption) const return (i != m_CreationOptions.size()); } + +std::string GDALImageIO::GetGdalPixelTypeAsString() const +{ + std::string name = GDALGetDataTypeName(m_PxType->pixType); + + return name; +} + } // end namespace otb diff --git a/Modules/IO/IOGDAL/src/otbGDALOverviewsBuilder.cxx b/Modules/IO/IOGDAL/src/otbGDALOverviewsBuilder.cxx index c61bb67a4b623ebe00e9f970b2d0a0b1356172fd..40393537b984fa30665b237d5925ec44c94947cc 100644 --- a/Modules/IO/IOGDAL/src/otbGDALOverviewsBuilder.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALOverviewsBuilder.cxx @@ -72,10 +72,10 @@ GDAL_COMPRESSION_NAMES[ GDAL_COMPRESSION_COUNT ] = std::string GetConfigOption( const char * key ) { - const char * value = CPLGetConfigOption( key, NULL ); + const char * value = CPLGetConfigOption( key, ITK_NULLPTR ); return - value==NULL + value==ITK_NULLPTR ? std::string() : std::string( value ); } @@ -516,7 +516,7 @@ GDALOverviewsBuilder static_cast< int >( m_NbResolutions - 1 ), &ovwlist.front(), 0, // All bands - NULL, // All bands + ITK_NULLPTR, // All bands ( GDALProgressFunc )otb_UpdateGDALProgress, this ); diff --git a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx index 6cc3890ac278ad4b67c9731e58aadea10694e3bb..212d75c607ae63b2fde625fbbeb1e226b97c8a9e 100644 --- a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx +++ b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx @@ -31,7 +31,7 @@ OGRIOHelper { OGRPoint * ogrPoint = (OGRPoint *) ogrGeometry; - if (ogrPoint == NULL) + if (ogrPoint == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert OGRGeometry to OGRPoint"); } @@ -60,7 +60,7 @@ OGRIOHelper { OGRLineString * ogrLine = (OGRLineString *) ogrGeometry; - if (ogrLine == NULL) + if (ogrLine == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert OGRGeometry to OGRLine"); } @@ -102,7 +102,7 @@ OGRIOHelper { OGRPolygon * ogrPolygon = (OGRPolygon *) ogrGeometry; - if (ogrPolygon == NULL) + if (ogrPolygon == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert OGRGeometry to OGRPolygon"); } @@ -187,7 +187,7 @@ void OGRIOHelper unsigned int counter = 0; itk::TimeProbe chrono; - while ((feature = layer->GetNextFeature()) != NULL) + while ((feature = layer->GetNextFeature()) != ITK_NULLPTR) { chrono.Start(); @@ -197,7 +197,7 @@ void OGRIOHelper /** Temporary geometry container */ OGRGeometry * geometry = feature->GetGeometryRef(); - if (geometry == NULL) + if (geometry == ITK_NULLPTR) { OGRFeature::DestroyFeature(feature); chrono.Stop(); @@ -674,7 +674,7 @@ unsigned int OGRIOHelper kwl); // Create the field once - if (ogrCurrentLayer != NULL && !fieldsAddedToOGRLayer) + if (ogrCurrentLayer != ITK_NULLPTR && !fieldsAddedToOGRLayer) { // Take into account the fields stored in the // vectordatakeywordlist @@ -710,8 +710,8 @@ unsigned int OGRIOHelper } case DOCUMENT: { - ogrCurrentLayer = m_DataSource->CreateLayer(dataNode->GetNodeId(), oSRS, wkbUnknown, NULL); - if (ogrCurrentLayer == NULL) + ogrCurrentLayer = m_DataSource->CreateLayer(dataNode->GetNodeId(), oSRS, wkbUnknown, ITK_NULLPTR); + if (ogrCurrentLayer == ITK_NULLPTR) { //itkExceptionMacro(<<"Failed to create layer "<<dataNode->GetNodeId()); std::cout << "Failed to create layer " << dataNode->GetNodeId() << std::endl; @@ -742,7 +742,7 @@ unsigned int OGRIOHelper } //Save it in the structure - if (ogrCollection == NULL) + if (ogrCollection == ITK_NULLPTR) { OGRFeature *ogrFeature; ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn()); @@ -800,7 +800,7 @@ unsigned int OGRIOHelper } //Save it in the structure - if (ogrCollection == NULL) + if (ogrCollection == ITK_NULLPTR) { OGRFeature *ogrFeature; ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn()); @@ -885,7 +885,7 @@ unsigned int OGRIOHelper } //Save it in the structure - if (ogrCollection == NULL) + if (ogrCollection == ITK_NULLPTR) { OGRFeature *ogrFeature; ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn()); @@ -918,7 +918,7 @@ unsigned int OGRIOHelper } case FEATURE_MULTIPOINT: { - if (ogrCollection != NULL) + if (ogrCollection != ITK_NULLPTR) { itkExceptionMacro(<< "Problem while creating multipoint."); } @@ -941,7 +941,7 @@ unsigned int OGRIOHelper } case FEATURE_MULTILINE: { - if (ogrCollection != NULL) + if (ogrCollection != ITK_NULLPTR) { itkExceptionMacro(<< "Problem while creating multiline."); } @@ -966,7 +966,7 @@ unsigned int OGRIOHelper } case FEATURE_MULTIPOLYGON: { - if (ogrCollection != NULL) + if (ogrCollection != ITK_NULLPTR) { itkExceptionMacro(<< "Problem while creating multipolygon."); } @@ -989,7 +989,7 @@ unsigned int OGRIOHelper } case FEATURE_COLLECTION: { - if (ogrCollection != NULL) + if (ogrCollection != ITK_NULLPTR) { itkExceptionMacro(<< "Problem while creating collection."); } @@ -1031,7 +1031,7 @@ std::vector<OGRLayer*> OGRIOHelper { // Create the in memory datasource if NULL - if (inMemoryDataSource == NULL) + if (inMemoryDataSource == ITK_NULLPTR) { const char * driverName = "Memory"; ogr::version_proxy::GDALDriverType * ogrDriver = ogr::version_proxy::GetDriverByName(driverName); @@ -1057,7 +1057,7 @@ std::vector<OGRLayer*> OGRIOHelper kwl); // Create the field once - if (ogrCurrentLayer != NULL && !fieldsAddedToOGRLayer) + if (ogrCurrentLayer != ITK_NULLPTR && !fieldsAddedToOGRLayer) { // Take into account the fields stored in the // vectordatakeywordlist @@ -1088,8 +1088,8 @@ std::vector<OGRLayer*> OGRIOHelper case DOCUMENT: { ogrCurrentLayer = inMemoryDataSource->CreateLayer(dataNode->GetNodeId(), oSRS, - wkbUnknown, NULL); - if (ogrCurrentLayer == NULL) + wkbUnknown, ITK_NULLPTR); + if (ogrCurrentLayer == ITK_NULLPTR) { std::cout << "Failed to create layer " << dataNode->GetNodeId() << std::endl; } diff --git a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx index ec46d6e2f48f22e55ac27796acc790b3305c1f56..f4a4251d8181156c9a97795c1329b646d5c3fe06 100644 --- a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx +++ b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx @@ -15,9 +15,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRVectorDataIO_txx -#define __otbOGRVectorDataIO_txx - #include "otbOGRVectorDataIO.h" #include "ogrsf_frmts.h" @@ -35,7 +32,7 @@ namespace otb OGRVectorDataIO ::OGRVectorDataIO() : - m_DataSource(NULL) + m_DataSource(ITK_NULLPTR) { // OGR factory registration OGRRegisterAll(); @@ -44,7 +41,7 @@ OGRVectorDataIO OGRVectorDataIO::~OGRVectorDataIO() { - if (m_DataSource != NULL) + if (m_DataSource != ITK_NULLPTR) { this->CloseInternalDataSource(); } @@ -55,8 +52,8 @@ bool OGRVectorDataIO::CanReadFile(const char* filename) const { otb::ogr::version_proxy::GDALDatasetType * poDS = ogr::version_proxy::Open(filename, true); - - if (poDS == NULL) + + if (poDS == ITK_NULLPTR) { std::cerr<<"Can not read file "<<filename<<" with GDALOpen"<<std::endl; return false; @@ -88,14 +85,14 @@ OGRVectorDataIO itkExceptionMacro(<<"Failed to dynamic cast to otb::VectorData (this should never happen)"); } - if (m_DataSource != NULL) + if (m_DataSource != ITK_NULLPTR) { this->CloseInternalDataSource(); } m_DataSource = ogr::version_proxy::Open(this->m_FileName.c_str(),true); - if (m_DataSource == NULL) + if (m_DataSource == ITK_NULLPTR) { itkExceptionMacro(<< "Failed to open data file " << this->m_FileName); } @@ -110,11 +107,11 @@ OGRVectorDataIO DataTreePointerType tree = data->GetDataTree(); DataNodePointerType root = tree->GetRoot()->Get(); - OGRSpatialReference * oSRS = NULL; + OGRSpatialReference * oSRS = ITK_NULLPTR; //We take the assumption that the spatial reference is common to all layers oSRS = m_DataSource->GetLayer(0)->GetSpatialRef(); - if (oSRS != NULL) + if (oSRS != ITK_NULLPTR) { char * projectionRefChar; oSRS->exportToWkt(&projectionRefChar); @@ -185,7 +182,7 @@ void OGRVectorDataIO::CloseInternalDataSource() { assert(m_DataSource != NULL && "m_DataSource cannot be NULL"); ogr::version_proxy::Close(m_DataSource); - m_DataSource = NULL; + m_DataSource = ITK_NULLPTR; } @@ -219,13 +216,13 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) ogr::version_proxy::GDALDriverType * ogrDriver = ogr::version_proxy::GetDriverByName(this->GetOGRDriverName(this->m_FileName).data()); - if (ogrDriver == NULL) + if (ogrDriver == ITK_NULLPTR) { itkExceptionMacro(<< "No OGR driver found to write file " << this->m_FileName); } // free an existing previous data source, if any - if (m_DataSource != NULL) + if (m_DataSource != ITK_NULLPTR) { ogr::version_proxy::Close(m_DataSource); } @@ -237,7 +234,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) m_DataSource = ogr::version_proxy::Create(ogrDriver,this->m_FileName.c_str()); // check the created data source - if (m_DataSource == NULL) + if (m_DataSource == ITK_NULLPTR) { itkExceptionMacro( << "Failed to create OGR data source for file " << this->m_FileName << @@ -259,7 +256,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) } //TODO georeference here from OGRSpatialReference http://www.gdal.org/ogr/classOGRDataSource.html - OGRSpatialReference * oSRS = NULL; + OGRSpatialReference * oSRS = ITK_NULLPTR; if (projectionInformationAvailable) { oSRS = static_cast<OGRSpatialReference *>(OSRNewSpatialReference(projectionRefWkt.c_str())); @@ -267,16 +264,16 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) // Retrieving root node DataTreeConstPointerType tree = data->GetDataTree(); - if (tree->GetRoot() == NULL) + if (tree->GetRoot() == ITK_NULLPTR) { itkExceptionMacro(<< "Data tree is empty: Root == NULL"); } DataNodePointerType root = tree->GetRoot()->Get(); unsigned int layerKept; - OGRLayer * ogrCurrentLayer = NULL; + OGRLayer * ogrCurrentLayer = ITK_NULLPTR; // OGRFeatureVectorType ogrFeatures; - OGRGeometryCollection * ogrCollection = NULL; + OGRGeometryCollection * ogrCollection = ITK_NULLPTR; // OGRGeometry * ogrCurrentGeometry = NULL; // Get the input tree root @@ -290,9 +287,9 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) (void)layerKept; // keep compiler happy otb::ogr::version_proxy::Close(m_DataSource); - m_DataSource = NULL; + m_DataSource = ITK_NULLPTR; - if (oSRS != NULL) + if (oSRS != ITK_NULLPTR) { OSRRelease(oSRS); } @@ -328,7 +325,8 @@ OGRVectorDataIO::GetOGRDriverName(std::string name) const else if (extension == ".GML") driverOGR = "GML"; else if (extension == ".GPX") driverOGR = "GPX"; else if (extension == ".SQLITE") driverOGR = "SQLite"; - else if (extension==".KML") driverOGR="KML"; + else if (extension==".KML") driverOGR="KML"; + else if (extension == ".GMT") driverOGR = "OGR_GMT"; else driverOGR = "NOT-FOUND"; } //std::cout << name << " " << driverOGR <<" "<<upperName<< " "<< upperName.substr(0, 3) << std::endl; @@ -336,5 +334,3 @@ OGRVectorDataIO::GetOGRDriverName(std::string name) const } } // end namespace otb - -#endif diff --git a/Modules/IO/IOGDAL/test/CMakeLists.txt b/Modules/IO/IOGDAL/test/CMakeLists.txt index 49dfca6f84234e221f726fe9538a5f82169911eb..3f5078f05674abead6341cfcfde786626008c448 100644 --- a/Modules/IO/IOGDAL/test/CMakeLists.txt +++ b/Modules/IO/IOGDAL/test/CMakeLists.txt @@ -206,13 +206,15 @@ otb_add_test(NAME ioTuGDALImageIOCanRead_IKONOS_PAN COMMAND otbIOGDALTestDriver otb_add_test(NAME ioTuGDALImageIOCanRead_FORMOSAT2 COMMAND otbIOGDALTestDriver otbGDALImageIOTestCanRead LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF}) -otb_add_test(NAME ioTvMultiDatasetReadingInfo COMMAND otbIOGDALTestDriver - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReadingInfo.txt - ${TEMP}/ioTvMultiDatasetReadingInfoOut.txt - otbMultiDatasetReadingInfo - ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf - ${TEMP}/ioTvMultiDatasetReadingInfoOut.txt - ) +if(GDAL_HAS_HDF4) + otb_add_test(NAME ioTvMultiDatasetReadingInfo COMMAND otbIOGDALTestDriver + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiDatasetReadingInfo.txt + ${TEMP}/ioTvMultiDatasetReadingInfoOut.txt + otbMultiDatasetReadingInfo + ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf + ${TEMP}/ioTvMultiDatasetReadingInfoOut.txt + ) +endif() otb_add_test(NAME ioTuOGRVectorDataIOTestCanReadGML COMMAND otbIOGDALTestDriver otbOGRVectorDataIOTestCanRead diff --git a/Modules/IO/IOGDAL/test/otbGDALImageIOTestWriteMetadata.cxx b/Modules/IO/IOGDAL/test/otbGDALImageIOTestWriteMetadata.cxx index e226828a0253b550982c8907fc1aef1ce4ebcf3e..76f079c3470c798f5477f2052721ebc1b10f4b5a 100644 --- a/Modules/IO/IOGDAL/test/otbGDALImageIOTestWriteMetadata.cxx +++ b/Modules/IO/IOGDAL/test/otbGDALImageIOTestWriteMetadata.cxx @@ -462,7 +462,7 @@ bool writeReadDatasetMetadata(std::string filename, std::vector<std::string> opt GDALAllRegister(); poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat); - if( poDriver == NULL ) + if( poDriver == ITK_NULLPTR ) { std::cout << "impossible to get the driver" <<std::endl; return false; @@ -481,14 +481,14 @@ bool writeReadDatasetMetadata(std::string filename, std::vector<std::string> opt } GDALDataset *poDstDS; - char **papszOptions = NULL; + char **papszOptions = ITK_NULLPTR; // Create dataset poDstDS = poDriver->Create( filename.c_str(), 128, 128, 1, GDT_Byte, papszOptions ); OGRSpatialReference oSRS_GCP; - char *pszSRS_WKT_GCP = NULL; + char *pszSRS_WKT_GCP = ITK_NULLPTR; oSRS_GCP.SetWellKnownGeogCS( "WGS84" ); oSRS_GCP.exportToWkt( &pszSRS_WKT_GCP ); @@ -522,7 +522,7 @@ bool writeReadDatasetMetadata(std::string filename, std::vector<std::string> opt // Set ProjectionRef OGRSpatialReference oSRS_ProjRef; - char *pszSRS_WKT_ProjRef = NULL; + char *pszSRS_WKT_ProjRef = ITK_NULLPTR; if (setProjectionRef || setProjectionRef_UTM) { oSRS_ProjRef.SetWellKnownGeogCS( "WGS84" ); @@ -595,7 +595,7 @@ bool writeReadDatasetMetadata(std::string filename, std::vector<std::string> opt GDALDataset *poDataset; poDataset = (GDALDataset *) GDALOpen( filename.c_str(), GA_ReadOnly ); - if( poDataset == NULL ) + if( poDataset == ITK_NULLPTR ) return false; // Get some information from file diff --git a/Modules/IO/IOGDAL/test/otbGDALReadPxlComplex.cxx b/Modules/IO/IOGDAL/test/otbGDALReadPxlComplex.cxx index 8fc75af28c34feea171d023e8ab6748adeaf7cdf..9abca52f17e834ec4491367093039b360a5aaff0 100644 --- a/Modules/IO/IOGDAL/test/otbGDALReadPxlComplex.cxx +++ b/Modules/IO/IOGDAL/test/otbGDALReadPxlComplex.cxx @@ -21,6 +21,8 @@ #include <iostream> #include <complex> +#include "itkMacro.h" + // Do all comparison in double precision const double Epsilon = 1.E-6; @@ -54,7 +56,7 @@ int otbGDALReadPxlComplexGeneric(int argc, char * argv[]) GDALAllRegister(); poDataset = (GDALDataset *) GDALOpen( argv[1], GA_ReadOnly ); - if( poDataset == NULL ) + if( poDataset == ITK_NULLPTR ) return EXIT_FAILURE; // Get some information from file @@ -86,7 +88,7 @@ int otbGDALReadPxlComplexGeneric(int argc, char * argv[]) loadBuffer, // pData sizeX, sizeY, pxlTypeInFile, - nbBand, NULL, + nbBand, ITK_NULLPTR, pixelOffset, lineOffset, bandOffset); // Check if gdal call succeed if (lCrGdal == CE_Failure) diff --git a/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIO.h b/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIO.h index c8a1e3c794dfc5a65aff47c13c67be5c783908e8..d5b19bcad9196d29d47500438978df071b539a0b 100644 --- a/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIO.h +++ b/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJPEG2000ImageIO_h -#define __otbJPEG2000ImageIO_h +#ifndef otbJPEG2000ImageIO_h +#define otbJPEG2000ImageIO_h #include "otbImageIOBase.h" #include "itkMultiThreader.h" @@ -59,32 +59,32 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Get description about overviews available into the file specified */ - virtual std::vector<std::string> GetOverviewsInfo(); + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE; /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} /** Get number of available overviews in the jpeg2000 file * ( if return = 0 => no overviews available because only one resolution * is encoded in the file) */ - virtual unsigned int GetOverviewsCount(); + unsigned int GetOverviewsCount() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -93,21 +93,21 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; /** Return the multithreader used by this class. */ @@ -127,9 +127,9 @@ protected: /** Constructor.*/ JPEG2000ImageIO(); /** Destructor.*/ - virtual ~JPEG2000ImageIO(); + ~JPEG2000ImageIO() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; typedef std::vector<boost::shared_ptr<JPEG2000InternalReader> > ReaderVectorType; @@ -172,4 +172,4 @@ private: } // end namespace otb -#endif // __otbJPEG2000ImageIO_h +#endif // otbJPEG2000ImageIO_h diff --git a/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIOFactory.h b/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIOFactory.h index 018c7b0f0db404162f6aa26e2288106b4222d2a7..5a284580c0697611272705c6bbd80e1e5b81bae5 100644 --- a/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIOFactory.h +++ b/Modules/IO/IOJPEG2000/include/otbJPEG2000ImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJPEG2000ImageIOFactory_h -#define __otbJPEG2000ImageIOFactory_h +#ifndef otbJPEG2000ImageIOFactory_h +#define otbJPEG2000ImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: JPEG2000ImageIOFactory(); - virtual ~JPEG2000ImageIOFactory(); + ~JPEG2000ImageIOFactory() ITK_OVERRIDE; private: JPEG2000ImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx b/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx index e98c1a7e3e0acb250c96ace2d20928bb14c27fef..e1d79be76d8f537d0885878e6a82d49802a54e98 100644 --- a/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx +++ b/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx @@ -175,7 +175,7 @@ public: if (m_JP2Metadata.pszProjection) return m_JP2Metadata.pszProjection; else - return NULL; + return ITK_NULLPTR; }; /** Get the GML box from file*/ @@ -183,7 +183,7 @@ public: if (m_JP2Metadata.papszGMLMetadata) return m_JP2Metadata.papszGMLMetadata; else - return NULL; + return ITK_NULLPTR; }; // Get the origin from GML box (use tinyxml to parse the GML box) @@ -428,9 +428,9 @@ boost::shared_ptr<opj_image_t> JPEG2000InternalReader::DecodeTile(unsigned int t // Set default event mgr // catch events using our callbacks and give a local context - opj_set_info_handler(codec.get(), info_callback,00); - opj_set_warning_handler(codec.get(), warning_callback,00); - opj_set_error_handler(codec.get(), error_callback,00); + opj_set_info_handler(codec.get(), info_callback,ITK_NULLPTR); + opj_set_warning_handler(codec.get(), warning_callback,ITK_NULLPTR); + opj_set_error_handler(codec.get(), error_callback,ITK_NULLPTR); // Setup the decoder decoding parameters using user parameters if (!opj_setup_decoder(codec.get(), ¶meters)) @@ -441,7 +441,7 @@ boost::shared_ptr<opj_image_t> JPEG2000InternalReader::DecodeTile(unsigned int t // Read the main header of the codestream and if necessary the JP2 // boxes - opj_image_t * unsafeOpjImgPtr = NULL; + opj_image_t * unsafeOpjImgPtr = ITK_NULLPTR; if (!opj_read_header(stream.get(), codec.get(),&unsafeOpjImgPtr)) { @@ -512,9 +512,9 @@ int JPEG2000InternalReader::Initialize() // Set default event mgr // catch events using our callbacks and give a local context - opj_set_info_handler(codec.get(), info_callback,00); - opj_set_warning_handler(codec.get(), warning_callback,00); - opj_set_error_handler(codec.get(), error_callback,00); + opj_set_info_handler(codec.get(), info_callback,ITK_NULLPTR); + opj_set_warning_handler(codec.get(), warning_callback,ITK_NULLPTR); + opj_set_error_handler(codec.get(), error_callback,ITK_NULLPTR); // Setup the decoder decoding parameters using user parameters if (!opj_setup_decoder(codec.get(), ¶meters)) @@ -526,7 +526,7 @@ int JPEG2000InternalReader::Initialize() // Read the main header of the codestream and if necessary the JP2 // boxes - opj_image_t * unsafeOpjImgPtr = NULL; + opj_image_t * unsafeOpjImgPtr = ITK_NULLPTR; if (!opj_read_header(stream.get(), codec.get(),&unsafeOpjImgPtr)) { @@ -829,7 +829,7 @@ JPEG2000ImageIO::~JPEG2000ImageIO() bool JPEG2000ImageIO::CanReadFile(const char* filename) { - if (filename == NULL) + if (filename == ITK_NULLPTR) { itkDebugMacro(<< "No filename specified."); return false; @@ -931,7 +931,7 @@ void JPEG2000ImageIO::Read(void* buffer) chrono.Start(); // Check if conversion succeed - if (buffer == NULL) + if (buffer == ITK_NULLPTR) { itkExceptionMacro(<< "JPEG2000ImageIO : Bad alloc"); return; @@ -1369,7 +1369,7 @@ void JPEG2000ImageIO::ReadImageInformation() otbMsgDevMacro(<< "JPEG2000 file has GMLMetadata!"); std::string key; - for (int cpt = 0; papszGMLMetadata[cpt] != NULL; ++cpt) + for (int cpt = 0; papszGMLMetadata[cpt] != ITK_NULLPTR; ++cpt) { std::ostringstream lStream; lStream << MetaDataKey::MetadataKey << cpt; @@ -1384,14 +1384,14 @@ void JPEG2000ImageIO::ReadImageInformation() /* ProjectionRef*/ if (lJP2MetadataReader.GetProjectionRef() && !std::string(lJP2MetadataReader.GetProjectionRef()).empty() ) { - OGRSpatialReferenceH pSR = OSRNewSpatialReference(NULL); + OGRSpatialReferenceH pSR = OSRNewSpatialReference(ITK_NULLPTR); - const char * pszProjection = NULL; + const char * pszProjection = ITK_NULLPTR; pszProjection = lJP2MetadataReader.GetProjectionRef(); if (OSRImportFromWkt(pSR, (char **) (&pszProjection)) == OGRERR_NONE) { - char * pszPrettyWkt = NULL; + char * pszPrettyWkt = ITK_NULLPTR; OSRExportToPrettyWkt(pSR, &pszPrettyWkt, FALSE); itk::EncapsulateMetaData<std::string> (dict, MetaDataKey::ProjectionRefKey, @@ -1405,10 +1405,10 @@ void JPEG2000ImageIO::ReadImageInformation() static_cast<std::string>(lJP2MetadataReader.GetProjectionRef())); } - if (pSR != NULL) + if (pSR != ITK_NULLPTR) { OSRRelease(pSR); - pSR = NULL; + pSR = ITK_NULLPTR; } } else diff --git a/Modules/IO/IOKML/include/otbKMLVectorDataIO.h b/Modules/IO/IOKML/include/otbKMLVectorDataIO.h index 4bd9e0a53eaf2507a6c555e8aa46fc02242bbd3f..971da8555733aa95449789992fb01a0f892a8fb0 100644 --- a/Modules/IO/IOKML/include/otbKMLVectorDataIO.h +++ b/Modules/IO/IOKML/include/otbKMLVectorDataIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMLVectorDataIO_h -#define __otbKMLVectorDataIO_h +#ifndef otbKMLVectorDataIO_h +#define otbKMLVectorDataIO_h #include <string> @@ -87,27 +87,27 @@ public: /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - virtual bool CanReadFile(const char*) const; + bool CanReadFile(const char*) const ITK_OVERRIDE; /** Reads the data from disk into the data structure provided. */ - virtual void Read(itk::DataObject* data); + void Read(itk::DataObject* data) ITK_OVERRIDE; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - virtual bool CanWriteFile(const char*) const; + bool CanWriteFile(const char*) const ITK_OVERRIDE; /** Writes the data to disk from the data structure provided */ - virtual void Write(const itk::DataObject* data, char ** papszOptions = NULL); + void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) ITK_OVERRIDE; protected: /** Constructor.*/ KMLVectorDataIO(); /** Destructor.*/ - virtual ~KMLVectorDataIO(); + ~KMLVectorDataIO() ITK_OVERRIDE; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; static const kmldom::FeaturePtr GetRootFeature(const kmldom::ElementPtr& root); @@ -143,4 +143,4 @@ private: } // end namespace otb -#endif // __otbKMLVectorDataIO_h +#endif // otbKMLVectorDataIO_h diff --git a/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h b/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h index bbed681ee1d22b05c28ff000ce6fe5226f41f094..4155d5b883ce7a62a22e3fb1fdde4f1ce026d383 100644 --- a/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h +++ b/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMLVectorDataIOFactory_h -#define __otbKMLVectorDataIOFactory_h +#ifndef otbKMLVectorDataIOFactory_h +#define otbKMLVectorDataIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -55,7 +55,7 @@ public: protected: KMLVectorDataIOFactory(); - virtual ~KMLVectorDataIOFactory(); + ~KMLVectorDataIOFactory() ITK_OVERRIDE; private: KMLVectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOKML/src/otbKMLVectorDataIO.cxx b/Modules/IO/IOKML/src/otbKMLVectorDataIO.cxx index abc2e04901ff6be986672ea0722d4743840b72f1..68f6a9811b321a1ddd45b906d43a229c8ded7c4a 100644 --- a/Modules/IO/IOKML/src/otbKMLVectorDataIO.cxx +++ b/Modules/IO/IOKML/src/otbKMLVectorDataIO.cxx @@ -102,7 +102,7 @@ KMLVectorDataIO::PrintIndented(const std::string& item, int depth) void KMLVectorDataIO::WalkFeature(const kmldom::FeaturePtr& feature, DataNodePointerType father) { - DataNodePointerType node = NULL; + DataNodePointerType node = ITK_NULLPTR; if (!feature) return; @@ -127,7 +127,7 @@ void KMLVectorDataIO::WalkContainer(const kmldom::ContainerPtr& container, DataNodePointerType father) { - DataNodePointerType node = NULL; + DataNodePointerType node = ITK_NULLPTR; for (size_t i = 0; i < container->get_feature_array_size(); ++i) { @@ -201,7 +201,7 @@ KMLVectorDataIO::WalkGeometry(const kmldom::GeometryPtr& geometry, DataNodePoint { // Creation of a node - DataNodePointerType node = NULL; + DataNodePointerType node = ITK_NULLPTR; if (!geometry) { @@ -268,7 +268,7 @@ KMLVectorDataIO ::ConvertGeometryToPointNode(const kmldom::GeometryPtr& geometry) { - if (geometry == NULL) + if (geometry == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert kmldom::GeometryPtr to PointNode"); } @@ -300,7 +300,7 @@ KMLVectorDataIO ::ConvertGeometryToLineStringNode(const kmldom::GeometryPtr& geometry) { - if (geometry == NULL) + if (geometry == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert kmldom::GeometryPtr to LineNode"); } @@ -336,7 +336,7 @@ KMLVectorDataIO ::ConvertGeometryToLinearRingNode(const kmldom::GeometryPtr& geometry) { - if (geometry == NULL) + if (geometry == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert kmldom::GeometryPtr to LineNode"); } @@ -372,7 +372,7 @@ KMLVectorDataIO ::ConvertGeometryToPolygonNode(const kmldom::GeometryPtr& geometry) { - if (geometry == NULL) + if (geometry == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Failed to convert kmldom::GeometryPtr to LineNode"); } @@ -554,7 +554,7 @@ void KMLVectorDataIO::Write(const itk::DataObject* datag, char ** itkNotUsed(pap //Create the factory kmldom::KmlFactory* factory = kmldom::KmlFactory::GetFactory(); - if (factory == NULL) + if (factory == ITK_NULLPTR) { itkExceptionMacro(<< "Impossible to create the KML Factory to write file " << this->m_FileName); } @@ -570,9 +570,9 @@ void KMLVectorDataIO::Write(const itk::DataObject* datag, char ** itkNotUsed(pap TreeIteratorType it(tree); it.GoToBegin(); - kmldom::DocumentPtr currentDocument = NULL; - kmldom::FolderPtr currentFolder = NULL; - kmldom::MultiGeometryPtr currentMultiGeometry = NULL; + kmldom::DocumentPtr currentDocument = ITK_NULLPTR; + kmldom::FolderPtr currentFolder = ITK_NULLPTR; + kmldom::MultiGeometryPtr currentMultiGeometry = ITK_NULLPTR; InternalTreeNodeType * inputRoot = const_cast<InternalTreeNodeType *>(tree->GetRoot()); ProcessNodeWrite(inputRoot, factory, kml, currentDocument, currentFolder, currentMultiGeometry); @@ -671,7 +671,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, kmldom::PointPtr point = factory->CreatePoint(); point->set_coordinates(coordinates); - if (currentMultiGeometry != NULL) + if (currentMultiGeometry != ITK_NULLPTR) { currentMultiGeometry->add_geometry(point); } @@ -680,7 +680,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, kmldom::PlacemarkPtr placemark = factory->CreatePlacemark(); placemark->set_geometry(point); - if (currentFolder != NULL) + if (currentFolder != ITK_NULLPTR) { currentFolder->add_feature(placemark); } @@ -718,7 +718,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, ++vIt; } - if (currentMultiGeometry != NULL) + if (currentMultiGeometry != ITK_NULLPTR) { currentMultiGeometry->add_geometry(line); } @@ -726,7 +726,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, { kmldom::PlacemarkPtr placemark = factory->CreatePlacemark(); placemark->set_geometry(line); - if (currentFolder != NULL) + if (currentFolder != ITK_NULLPTR) { currentFolder->add_feature(placemark); } @@ -837,7 +837,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, innerboundaryis->clear_linearring(); } - if (currentMultiGeometry != NULL) + if (currentMultiGeometry != ITK_NULLPTR) { currentMultiGeometry->add_geometry(polygon); } @@ -845,7 +845,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, { kmldom::PlacemarkPtr placemark = factory->CreatePlacemark(); placemark->set_geometry(polygon); - if (currentFolder != NULL) + if (currentFolder != ITK_NULLPTR) { currentFolder->add_feature(placemark); } @@ -863,7 +863,7 @@ void KMLVectorDataIO::ProcessNodeWrite(InternalTreeNodeType * source, currentMultiGeometry = multi; kmldom::PlacemarkPtr placemark = factory->CreatePlacemark(); placemark->set_geometry(multi); - if (currentFolder != NULL) + if (currentFolder != ITK_NULLPTR) { currentFolder->add_feature(placemark); } diff --git a/Modules/IO/IOLUM/include/otbLUMImageIO.h b/Modules/IO/IOLUM/include/otbLUMImageIO.h index 689d8f9c4f0536f4d5270019b3835c21779767f6..c737370124de14ea2bbe8116336b3a8b2934460b 100644 --- a/Modules/IO/IOLUM/include/otbLUMImageIO.h +++ b/Modules/IO/IOLUM/include/otbLUMImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLUMImageIO_h -#define __otbLUMImageIO_h +#ifndef otbLUMImageIO_h +#define otbLUMImageIO_h #include "otbImageIOBase.h" #include <fstream> @@ -59,19 +59,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -80,27 +80,27 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; // JULIEN: NOT USED, NOT IMPLEMENTED //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -109,7 +109,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -117,14 +117,14 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ LUMImageIO(); /** Destructor.*/ - virtual ~LUMImageIO(); + ~LUMImageIO() ITK_OVERRIDE; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -133,7 +133,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LUMImageIO(const Self &); //purposely not implemented @@ -192,4 +192,4 @@ private: } // end namespace otb -#endif // __otbLUMImageIO_h +#endif // otbLUMImageIO_h diff --git a/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h b/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h index 4383998365bccbb20e90a4f501ebf3f04dfd6c7c..d82cdf0009214f51c7174008ff2c43d04cf62436 100644 --- a/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h +++ b/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLUMImageIOFactory_h -#define __otbLUMImageIOFactory_h +#ifndef otbLUMImageIOFactory_h +#define otbLUMImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: LUMImageIOFactory(); - virtual ~LUMImageIOFactory(); + ~LUMImageIOFactory() ITK_OVERRIDE; private: LUMImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOLUM/src/otbLUMImageIO.cxx b/Modules/IO/IOLUM/src/otbLUMImageIO.cxx index 1e4378c0b19257e943395469fb9ca8d00c87db77..451c73a12fc974c22b2fa3a6819349b2661517f1 100644 --- a/Modules/IO/IOLUM/src/otbLUMImageIO.cxx +++ b/Modules/IO/IOLUM/src/otbLUMImageIO.cxx @@ -412,7 +412,7 @@ void LUMImageIO::WriteImageInformation() m_File.write(value, headerLength); } delete[] value; - value = NULL; + value = ITK_NULLPTR; //Set m_TypeLum if (0) {} otbSetTypeLumMacro(CHAR, "08BI", "08LI") @@ -464,7 +464,7 @@ int LUMImageIO::CaiGetTypeLum(const char * type_code, taille = -1; int nbbits = -1; ind = 0; - pch0 = NULL; + pch0 = ITK_NULLPTR; std::string str_type_code(type_code); while ((trouve == -1) && (ind < m_CaiLumTyp.size())) @@ -499,17 +499,17 @@ int LUMImageIO::CaiGetTypeLum(const char * type_code, pch0 = const_cast<char *>(strstr(type_code, "U")); if (taille == 1) { - if (pch0 == NULL) sprintf(cod_pix, "OCT"); + if (pch0 == ITK_NULLPTR) sprintf(cod_pix, "OCT"); else sprintf(cod_pix, "UOCT"); } else if (taille == 2) { - if (pch0 == NULL) sprintf(cod_pix, "I2"); + if (pch0 == ITK_NULLPTR) sprintf(cod_pix, "I2"); else sprintf(cod_pix, "UI2"); } else if (taille == 4) { - if (pch0 == NULL) sprintf(cod_pix, "I4"); + if (pch0 == ITK_NULLPTR) sprintf(cod_pix, "I4"); else sprintf(cod_pix, "UI4"); } else taille = -1; diff --git a/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h b/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h index 539f4c30baeab1d55ce2238fedb90dd6962bbe22..5089e3370129bc20da6861aceb0ba4d28023b7b7 100644 --- a/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h +++ b/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMSTARImageIO_h -#define __otbMSTARImageIO_h +#ifndef otbMSTARImageIO_h +#define otbMSTARImageIO_h #include "otbImageIOBase.h" @@ -52,47 +52,47 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimension information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can write the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Set the spacing and dimension information for the set filename. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegions has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; MSTARImageIO(); - virtual ~MSTARImageIO(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MSTARImageIO() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -101,7 +101,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -109,8 +109,8 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} private: MSTARImageIO(const Self &); //purposely not implemented @@ -155,4 +155,4 @@ private: } // end namespace otb -#endif // __otbMSTARImageIO_h +#endif // otbMSTARImageIO_h diff --git a/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h b/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h index 62f509c6176c902290d2a72e9306ee22200d5990..d77c1a0bda45aae08ff692737860fc396dfc6cbf 100644 --- a/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h +++ b/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMSTARImageIOFactory_h -#define __otbMSTARImageIOFactory_h +#ifndef otbMSTARImageIOFactory_h +#define otbMSTARImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: MSTARImageIOFactory(); - virtual ~MSTARImageIOFactory(); + ~MSTARImageIOFactory() ITK_OVERRIDE; private: MSTARImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx index 7ac218c33b3dde7341661cb4ff75d4323d138a08..b5112efe57b07a9563b580442e9a27128e53fdf9 100644 --- a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx +++ b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx @@ -60,9 +60,9 @@ MSTARImageIO::MSTARImageIO() m_BytePerPixel = 0; - MSTARfp = NULL; /* Input FILE ptr to MSTAR image file */ - HDRfp = NULL; /* Output FILE ptr to MSTAR header file */ - RAWfp = NULL; + MSTARfp = ITK_NULLPTR; /* Input FILE ptr to MSTAR image file */ + HDRfp = ITK_NULLPTR; /* Output FILE ptr to MSTAR header file */ + RAWfp = ITK_NULLPTR; i = 0; j = 0; @@ -83,13 +83,13 @@ MSTARImageIO::MSTARImageIO() littleushortval = 0; littlefloatval = 0.; - MSTARname = NULL; /* Input MSTAR filename */ + MSTARname = ITK_NULLPTR; /* Input MSTAR filename */ - tptr = NULL; /* Temp buffer ptr */ - phdr = NULL; /* Ptr to buffer to hold Phoenix header */ + tptr = ITK_NULLPTR; /* Temp buffer ptr */ + phdr = ITK_NULLPTR; /* Ptr to buffer to hold Phoenix header */ - FSCENEdata = NULL; /* Ptr to Fullscene data buffer */ - CHIPdata = NULL; /* Ptr to CHIp data buffer */ + FSCENEdata = ITK_NULLPTR; /* Ptr to Fullscene data buffer */ + CHIPdata = ITK_NULLPTR; /* Ptr to CHIp data buffer */ @@ -98,10 +98,10 @@ MSTARImageIO::MSTARImageIO() /** Destructor */ MSTARImageIO::~MSTARImageIO() { - if (phdr != NULL) + if (phdr != ITK_NULLPTR) { free(phdr); - phdr = NULL; + phdr = ITK_NULLPTR; } } @@ -117,7 +117,7 @@ bool MSTARImageIO::CanReadFile(const char* filename) MSTARname = filename; MSTARfp = fopen(MSTARname, "rb"); - if (MSTARfp == NULL) + if (MSTARfp == ITK_NULLPTR) { otbMsgDevMacro(<< "\nError: Unable to open [" << MSTARname << "] for reading!\n"); return false; @@ -133,18 +133,18 @@ bool MSTARImageIO::CanReadFile(const char* filename) { otbMsgDevMacro(<< "\nError: Unable in reading [" << MSTARname << "] header... Only read ["<< returnVal <<" of 1024 bytes !\n"); fclose(MSTARfp); - MSTARfp = NULL; + MSTARfp = ITK_NULLPTR; return false; } rewind(MSTARfp); /* Extract Phoenix Summary header length */ tptr = (char *) strstr(tbuff, "PhoenixHeaderLength= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { // fprintf(stderr,"Can not determine Phoenix header length!\n"); fclose(MSTARfp); - MSTARfp = NULL; + MSTARfp = ITK_NULLPTR; return false; } else @@ -154,11 +154,11 @@ bool MSTARImageIO::CanReadFile(const char* filename) /* Check for and extract native header length */ tptr = (char *) strstr(tbuff, "native_header_length= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { // fprintf(stderr,"Can not determine native header length!\n"); fclose(MSTARfp); - MSTARfp = NULL; + MSTARfp = ITK_NULLPTR; return false; } else @@ -168,7 +168,7 @@ bool MSTARImageIO::CanReadFile(const char* filename) /* Extract MSTAR column width */ tptr = (char *) strstr(tbuff, "NumberOfColumns= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { otbMsgDevMacro(<< "Error: Can not determine MSTAR image width"); fclose(MSTARfp); @@ -182,11 +182,11 @@ bool MSTARImageIO::CanReadFile(const char* filename) /* Extract MSTAR row height */ tptr = (char *) strstr(tbuff, "NumberOfRows= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { otbMsgDevMacro(<< "Error: Can not determine MSTAR image height!"); fclose(MSTARfp); - MSTARfp = NULL; + MSTARfp = ITK_NULLPTR; return false; } else @@ -237,7 +237,7 @@ bool MSTARImageIO::CanReadFile(const char* filename) // free(phdr); fclose(MSTARfp); - MSTARfp = NULL; + MSTARfp = ITK_NULLPTR; otbMsgDevMacro(<< "Can read MSTAR"); return bool(true); } @@ -267,7 +267,7 @@ void MSTARImageIO::Read(void* buffer) { MSTARfp = fopen(MSTARname, "rb"); - if (MSTARfp == NULL) + if (MSTARfp == ITK_NULLPTR) { itkExceptionMacro(<< "Error: Unable to open file for reading!\n\n " << m_FileName.c_str() << ")."); } @@ -287,7 +287,7 @@ void MSTARImageIO::Read(void* buffer) /* Extract Phoenix Summary header length */ tptr = (char *) strstr(tbuff, "PhoenixHeaderLength= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine Phoenix header length!"); @@ -299,7 +299,7 @@ void MSTARImageIO::Read(void* buffer) /* Check for and extract native header length */ tptr = (char *) strstr(tbuff, "native_header_length= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Can not determine native header length!\n"); @@ -311,7 +311,7 @@ void MSTARImageIO::Read(void* buffer) /* Extract MSTAR column width */ tptr = (char *) strstr(tbuff, "NumberOfColumns= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine MSTAR image width"); @@ -324,7 +324,7 @@ void MSTARImageIO::Read(void* buffer) /* Extract MSTAR row height */ tptr = (char *) strstr(tbuff, "NumberOfRows= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine MSTAR image height!"); @@ -431,7 +431,7 @@ void MSTARImageIO::Read(void* buffer) bytesPerImage = totchunks * sizeof(float); CHIPdata = (float *) malloc(bytesPerImage); - if (CHIPdata == (float *) NULL) + if (CHIPdata == (float *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro("Error: Unable to malloc CHIP memory!\n"); @@ -476,7 +476,7 @@ void MSTARImageIO::Read(void* buffer) case FSCENE_IMAGE: bytesPerImage = nchunks * sizeof(short); FSCENEdata = (unsigned short *) malloc(bytesPerImage); - if (FSCENEdata == (unsigned short *) NULL) + if (FSCENEdata == (unsigned short *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Unable to malloc fullscene memory!\n"); @@ -587,7 +587,7 @@ void MSTARImageIO::ReadImageInformation() MSTARname = m_FileName.c_str(); MSTARfp = fopen(MSTARname, "rb"); - if (MSTARfp == NULL) + if (MSTARfp == ITK_NULLPTR) { itkExceptionMacro(<< "Error: Unable to open file for reading!\n\n " << m_FileName.c_str()); } @@ -607,7 +607,7 @@ void MSTARImageIO::ReadImageInformation() /* Extract Phoenix Summary header length */ tptr = (char *) strstr(tbuff, "PhoenixHeaderLength= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine Phoenix header length!"); @@ -619,7 +619,7 @@ void MSTARImageIO::ReadImageInformation() /* Check for and extract native header length */ tptr = (char *) strstr(tbuff, "native_header_length= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Can not determine native header length!\n"); @@ -631,7 +631,7 @@ void MSTARImageIO::ReadImageInformation() /* Extract MSTAR column width */ tptr = (char *) strstr(tbuff, "NumberOfColumns= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine MSTAR image width"); @@ -644,7 +644,7 @@ void MSTARImageIO::ReadImageInformation() /* Extract MSTAR row height */ tptr = (char *) strstr(tbuff, "NumberOfRows= "); - if (tptr == (char *) NULL) + if (tptr == (char *) ITK_NULLPTR) { fclose(MSTARfp); itkExceptionMacro(<< "Error: Can not determine MSTAR image height!"); diff --git a/Modules/IO/IOMW/include/otbMWImageIO.h b/Modules/IO/IOMW/include/otbMWImageIO.h index 06cae9a52252f0b03e20adf638da1bb686580d37..8d1aafb5d470e41f7230ab68e32296930a9ea42c 100644 --- a/Modules/IO/IOMW/include/otbMWImageIO.h +++ b/Modules/IO/IOMW/include/otbMWImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMWImageIO_h -#define __otbMWImageIO_h +#ifndef otbMWImageIO_h +#define otbMWImageIO_h #include "otbImageIOBase.h" #include <fstream> @@ -59,19 +59,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -80,27 +80,27 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; // JULIEN: NOT USED, NOT IMPLEMENTED //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -109,7 +109,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -117,14 +117,14 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ MWImageIO(); /** Destructor.*/ - virtual ~MWImageIO(); + ~MWImageIO() ITK_OVERRIDE; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -133,7 +133,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: MWImageIO(const Self &); //purposely not implemented @@ -184,4 +184,4 @@ private: } // end namespace otb -#endif // __otbMWImageIO_h +#endif // otbMWImageIO_h diff --git a/Modules/IO/IOMW/include/otbMWImageIOFactory.h b/Modules/IO/IOMW/include/otbMWImageIOFactory.h index 8b9c2548f81c750eab7c369b5384017d6c043f6f..261cb79636d0df4da013ca20e8e70ec5b876107e 100644 --- a/Modules/IO/IOMW/include/otbMWImageIOFactory.h +++ b/Modules/IO/IOMW/include/otbMWImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMWImageIOFactory_h -#define __otbMWImageIOFactory_h +#ifndef otbMWImageIOFactory_h +#define otbMWImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: MWImageIOFactory(); - virtual ~MWImageIOFactory(); + ~MWImageIOFactory() ITK_OVERRIDE; private: MWImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOONERA/include/otbONERAImageIO.h b/Modules/IO/IOONERA/include/otbONERAImageIO.h index 592d69af70428e4b8d26fd84149ae26fe787b1bd..394b27ff63efbe53ab07f4cc9a7c31c3652b47d1 100644 --- a/Modules/IO/IOONERA/include/otbONERAImageIO.h +++ b/Modules/IO/IOONERA/include/otbONERAImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbONERAImageIO_h -#define __otbONERAImageIO_h +#ifndef otbONERAImageIO_h +#define otbONERAImageIO_h #include "itkByteSwapper.h" #include "otbImageIOBase.h" @@ -57,19 +57,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -78,27 +78,27 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; // JULIEN: NOT USED, NOT IMPLEMENTED //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -107,7 +107,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -115,14 +115,14 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ ONERAImageIO(); /** Destructor.*/ - virtual ~ONERAImageIO(); + ~ONERAImageIO() ITK_OVERRIDE; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -133,7 +133,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Dimension along Ox of the image*/ int m_width; @@ -188,4 +188,4 @@ private: } // end namespace otb -#endif // __otbONERAImageIO_h +#endif // otbONERAImageIO_h diff --git a/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h b/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h index 8d712a606fd97963c45995a9a8b4583ce5c6e55c..b1ffd7501ede767961253c095f1d61102faa5f56 100644 --- a/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h +++ b/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbONERAImageIOFactory_h -#define __otbONERAImageIOFactory_h +#ifndef otbONERAImageIOFactory_h +#define otbONERAImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: ONERAImageIOFactory(); - virtual ~ONERAImageIOFactory(); + ~ONERAImageIOFactory() ITK_OVERRIDE; private: ONERAImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOONERA/src/otbONERAImageIO.cxx b/Modules/IO/IOONERA/src/otbONERAImageIO.cxx index 02357654298a30e4bb033875c1323c6cc149c179..b4766e4ff38d87e2800ef695c05e4616067a1c71 100644 --- a/Modules/IO/IOONERA/src/otbONERAImageIO.cxx +++ b/Modules/IO/IOONERA/src/otbONERAImageIO.cxx @@ -230,7 +230,7 @@ void ONERAImageIO::Read(void* buffer) } delete[] value; - value = NULL; + value = ITK_NULLPTR; } @@ -514,7 +514,7 @@ void ONERAImageIO::Write(const void* buffer) } delete[] tempmemory; - tempmemory = NULL; + tempmemory = ITK_NULLPTR; } // To be consistent with the behavior of GDALImageIO diff --git a/Modules/IO/IORAD/include/otbRADImageIO.h b/Modules/IO/IORAD/include/otbRADImageIO.h index 08deb7f124c7fbcd7d7fb793846b04ff9dced259..3f3e3cd41da6b4889c68bec977571be5dd940432 100644 --- a/Modules/IO/IORAD/include/otbRADImageIO.h +++ b/Modules/IO/IORAD/include/otbRADImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRADImageIO_h -#define __otbRADImageIO_h +#ifndef otbRADImageIO_h +#define otbRADImageIO_h #include "otbImageIOBase.h" #include <fstream> @@ -59,19 +59,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimention information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -80,28 +80,28 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; // JULIEN: NOT USED, NOT IMPLEMENTED // void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -110,7 +110,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -118,14 +118,14 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ RADImageIO(); /** Destructor.*/ - virtual ~RADImageIO(); + ~RADImageIO() ITK_OVERRIDE; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -135,7 +135,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RADImageIO(const Self &); //purposely not implemented @@ -185,4 +185,4 @@ private: } // end namespace otb -#endif // __otbRADImageIO_h +#endif // otbRADImageIO_h diff --git a/Modules/IO/IORAD/include/otbRADImageIOFactory.h b/Modules/IO/IORAD/include/otbRADImageIOFactory.h index 4078c40954d4ab53db38f64928c898c561270648..0fa2c7ab3ee27cd2fd7df2bafaab335ca7ea7f79 100644 --- a/Modules/IO/IORAD/include/otbRADImageIOFactory.h +++ b/Modules/IO/IORAD/include/otbRADImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRADImageIOFactory_h -#define __otbRADImageIOFactory_h +#ifndef otbRADImageIOFactory_h +#define otbRADImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -37,8 +37,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -56,7 +56,7 @@ public: protected: RADImageIOFactory(); - virtual ~RADImageIOFactory(); + ~RADImageIOFactory() ITK_OVERRIDE; private: RADImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IORAD/src/otbRADImageIO.cxx b/Modules/IO/IORAD/src/otbRADImageIO.cxx index acea472769aa0ebc0efa7ae636088f6dd1a4f422..98fcf67ea9533c5589aef75a7dbca45dcf151d0a 100644 --- a/Modules/IO/IORAD/src/otbRADImageIO.cxx +++ b/Modules/IO/IORAD/src/otbRADImageIO.cxx @@ -61,7 +61,7 @@ RADImageIO::RADImageIO() // (consistency between ImageIO, see Mantis #942) m_Origin[0] = 0.5; m_Origin[1] = 0.5; - m_ChannelsFile = NULL; + m_ChannelsFile = ITK_NULLPTR; m_FlagWriteImageInformation = true; this->AddSupportedWriteExtension(".rad"); @@ -79,7 +79,7 @@ RADImageIO::~RADImageIO() { m_HeaderFile.close(); } - if (m_ChannelsFile != NULL) + if (m_ChannelsFile != ITK_NULLPTR) { for (unsigned int numChannel = 0; numChannel < m_NbOfChannels; ++numChannel) { @@ -158,7 +158,7 @@ void RADImageIO::Read(void* buffer) step = step * (unsigned long) (this->GetComponentSize()); char * value = new char[numberOfBytesToBeRead]; - if (value == NULL) + if (value == ITK_NULLPTR) { itkExceptionMacro(<< "RADImageIO::Read(): Bad alloc"); return; @@ -220,7 +220,7 @@ void RADImageIO::Read(void* buffer) } delete[] value; - value = NULL; + value = ITK_NULLPTR; } @@ -544,7 +544,7 @@ void RADImageIO::Write(const void* buffer) const char * p = static_cast<const char *>(buffer); char* value = new char[numberOfBytesToBeWrite]; - if (value == NULL) + if (value == ITK_NULLPTR) { itkExceptionMacro(<< "RADImageIO::Write : Bad Alloc"); return; diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h index 49015a5a89799e9a3b194448741717c59fae53e8..63cace866ad408ce57c5a2f49006342380abc54a 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileMapImageIO_h -#define __otbTileMapImageIO_h +#ifndef otbTileMapImageIO_h +#define otbTileMapImageIO_h /* C++ Libraries */ @@ -87,41 +87,41 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*); + bool CanReadFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - virtual bool CanStreamRead() + bool CanStreamRead() ITK_OVERRIDE { return true; } /** Set the spacing and dimension information for the set filename. */ - virtual void ReadImageInformation(); + void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer); + void Read(void* buffer) ITK_OVERRIDE; /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*); + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - virtual bool CanStreamWrite() + bool CanStreamWrite() ITK_OVERRIDE { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer); + void Write(const void* buffer) ITK_OVERRIDE; /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - virtual unsigned int GetOverviewsCount() + unsigned int GetOverviewsCount() ITK_OVERRIDE { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -130,7 +130,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - virtual std::vector<std::string> GetOverviewsInfo() + std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE { std::vector<std::string> desc; return desc; @@ -138,27 +138,27 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ - virtual void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)){} + void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), + bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} protected: /** Constructor.*/ TileMapImageIO(); /** Destructor.*/ - virtual ~TileMapImageIO(); + ~TileMapImageIO() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Read all information on the image*/ void InternalReadImageInformation(); /** Write all information on the image*/ void InternalWriteImageInformation(); - virtual unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits, - const ImageIORegion& pasteRegion) const; + unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits, + const ImageIORegion& pasteRegion) const ITK_OVERRIDE; - virtual ImageIORegion GetSplitRegionForWritingCanStreamWrite(unsigned int ithPiece, + ImageIORegion GetSplitRegionForWritingCanStreamWrite(unsigned int ithPiece, unsigned int numberOfActualSplits, - const ImageIORegion& pasteRegion) const; + const ImageIORegion& pasteRegion) const ITK_OVERRIDE; /** Number of bands of the image*/ int m_NbBands; @@ -225,4 +225,4 @@ private: } // end namespace otb -#endif // __otbTileMapImageIO_h +#endif // otbTileMapImageIO_h diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h index 15125c3be1310ea6d6fcd141f7a0a33960c6d65b..eb934255b0d3d13daf4560340dca52db459d0874 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbTileMapImageIOFactory_h -#define __otbTileMapImageIOFactory_h +#ifndef otbTileMapImageIOFactory_h +#define otbTileMapImageIOFactory_h #include "itkObjectFactoryBase.h" @@ -38,8 +38,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: TileMapImageIOFactory(); - virtual ~TileMapImageIOFactory(); + ~TileMapImageIOFactory() ITK_OVERRIDE; private: TileMapImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h index 92b68ddbd451134e10c4a2aae26a50546bc4a6c3..e4f645cb374c3457f6761d146b3e70b6b6356074 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileMapImageIOHelper_h -#define __otbTileMapImageIOHelper_h +#ifndef otbTileMapImageIOHelper_h +#define otbTileMapImageIOHelper_h #include "itkObject.h" @@ -53,7 +53,7 @@ public: protected: TileMapImageIOHelper() {} - ~TileMapImageIOHelper() {} + ~TileMapImageIOHelper() ITK_OVERRIDE {} private: TileMapImageIOHelper(const Self &); //purposely not implemented diff --git a/Modules/IO/IOTileMap/src/otbTileMapImageIO.cxx b/Modules/IO/IOTileMap/src/otbTileMapImageIO.cxx index 38205436c17995f6712c19d3a81067e3fdc8573a..41d6044df7dd285e6168ce92edb9ec9a5030515d 100644 --- a/Modules/IO/IOTileMap/src/otbTileMapImageIO.cxx +++ b/Modules/IO/IOTileMap/src/otbTileMapImageIO.cxx @@ -105,7 +105,7 @@ TileMapImageIO::~TileMapImageIO() bool TileMapImageIO::CanReadFile(const char* file) { // First check the extension - if (file == NULL) + if (file == ITK_NULLPTR) { itkDebugMacro(<< "No filename specified."); return false; @@ -146,7 +146,7 @@ void TileMapImageIO::PrintSelf(std::ostream& os, itk::Indent indent) const void TileMapImageIO::Read(void* buffer) { unsigned char * p = static_cast<unsigned char *>(buffer); - if (p == NULL) + if (p == ITK_NULLPTR) { itkExceptionMacro(<< "Memory allocation error"); return; @@ -353,7 +353,7 @@ void TileMapImageIO::GenerateBuffer(unsigned char *p) void TileMapImageIO::ReadTile(const std::string& filename, void * buffer) { otbMsgDevMacro(<< "Retrieving " << filename); - unsigned char * bufferCacheFault = NULL; + unsigned char * bufferCacheFault = ITK_NULLPTR; otb::ImageIOBase::Pointer imageIO; imageIO = otb::GDALImageIO::New(); @@ -529,7 +529,7 @@ void TileMapImageIO::ReadImageInformation() bool TileMapImageIO::CanWriteFile(const char* name) { // First if filename is provided - if (name == NULL) + if (name == ITK_NULLPTR) { itkDebugMacro(<< "No filename specified."); return false; @@ -554,7 +554,7 @@ void TileMapImageIO::Write(const void* buffer) { const unsigned char * p = static_cast<const unsigned char *>(buffer); - if (p == NULL) + if (p == ITK_NULLPTR) { itkExceptionMacro(<< "Memory allocation error"); return; diff --git a/Modules/IO/IOTileMap/src/otbTileMapImageIOHelper.cxx b/Modules/IO/IOTileMap/src/otbTileMapImageIOHelper.cxx index c638db66fbba47246b5a878b8b5e6424256d8c05..0cb0ce312ceec3fe31b1c4e82df49c78492e68f5 100644 --- a/Modules/IO/IOTileMap/src/otbTileMapImageIOHelper.cxx +++ b/Modules/IO/IOTileMap/src/otbTileMapImageIOHelper.cxx @@ -15,9 +15,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTileMapImageIOHelper_cxx -#define __otbTileMapImageIOHelper_cxx - #include "otbTileMapImageIOHelper.h" namespace otb { @@ -94,5 +91,3 @@ const std::string TileMapImageIOHelper::ConvertDepthToScale(const unsigned int d } } // end namespace otb - -#endif diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h index f0df2b82e57fd107ebd33d0908201c85bf8ed774..371b8b40e88c8161ce5e5bf4a570aafca3480f7f 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsXMLFileReader_h -#define __otbStatisticsXMLFileReader_h +#ifndef otbStatisticsXMLFileReader_h +#define otbStatisticsXMLFileReader_h #include "itkProcessObject.h" @@ -61,7 +61,7 @@ public: typedef std::map<std::string , std::string> GenericMapType; typedef std::map<std::string , GenericMapType> GenericMapContainer; - virtual void Modified() const + void Modified() const ITK_OVERRIDE { m_IsUpdated = false; } @@ -92,8 +92,8 @@ protected: virtual void Read(); StatisticsXMLFileReader(); - virtual ~StatisticsXMLFileReader() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~StatisticsXMLFileReader() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StatisticsXMLFileReader(const Self&); //purposely not implemented diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.txx b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.txx index 11d8ef26a669ab223422b823a8c4876710486812..92824197c7f7240e67294d24ca9ebc3dbbc563ac 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.txx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsXMLFileReader_txx -#define __otbStatisticsXMLFileReader_txx +#ifndef otbStatisticsXMLFileReader_txx +#define otbStatisticsXMLFileReader_txx #include "otbStatisticsXMLFileReader.h" #include "itkMacro.h" @@ -155,9 +155,10 @@ StatisticsXMLFileReader<TMeasurementVector> itkExceptionMacro(<<"The XML output FileName is empty, please set the filename via the method SetFileName"); // Check that the right extension is given : expected .xml */ - if (itksys::SystemTools::GetFilenameLastExtension(m_FileName) != ".xml") + std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); + if (itksys::SystemTools::LowerCase(extension) != ".xml") { - itkExceptionMacro(<<itksys::SystemTools::GetFilenameLastExtension(m_FileName) + itkExceptionMacro(<<extension <<" is a wrong Extension FileName : Expected .xml"); } @@ -179,7 +180,7 @@ StatisticsXMLFileReader<TMeasurementVector> { // Iterate through the tree to get all the stats for( TiXmlElement* currentStat = root->FirstChildElement(); - currentStat != NULL; + currentStat != ITK_NULLPTR; currentStat = currentStat->NextSiblingElement() ) { InputDataType currentStatisticVector; @@ -193,7 +194,7 @@ StatisticsXMLFileReader<TMeasurementVector> std::vector<double> tempMeasurementVector; for( TiXmlElement* sample = currentStat->FirstChildElement("StatisticVector"); - sample != NULL; + sample != ITK_NULLPTR; sample = sample->NextSiblingElement() ) { // Get the current value of the statistic vector @@ -220,24 +221,24 @@ StatisticsXMLFileReader<TMeasurementVector> { // Iterate through the tree to get all the stats for( TiXmlElement* currentStat = root->FirstChildElement(); - currentStat != NULL; + currentStat != ITK_NULLPTR; currentStat = currentStat->NextSiblingElement() ) { GenericMapType currentMap; std::string currentName(currentStat->Attribute("name")); for( TiXmlElement* sample = currentStat->FirstChildElement("StatisticMap"); - sample != NULL; + sample != ITK_NULLPTR; sample = sample->NextSiblingElement() ) { // Get the current pair of the statistic map const char *c_key = sample->Attribute("key"); const char *c_value = sample->Attribute("value"); - if (c_key == NULL) + if (c_key == ITK_NULLPTR) { itkExceptionMacro("'key' attribute not found in StatisticMap !"); } - if (c_value == NULL) + if (c_value == ITK_NULLPTR) { itkExceptionMacro("'value' attribute not found in StatisticMap !"); } diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h index 80256c2eb43ca75c81933538b5566a9ae932207e..419c76dacd6d84ab260d6f19fd51cfc61a0ae4ae 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsXMLFileWriter_h -#define __otbStatisticsXMLFileWriter_h +#ifndef otbStatisticsXMLFileWriter_h +#define otbStatisticsXMLFileWriter_h #include "itkProcessObject.h" #include <utility> @@ -89,8 +89,8 @@ protected: virtual void GenerateData(); StatisticsXMLFileWriter(); - virtual ~StatisticsXMLFileWriter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~StatisticsXMLFileWriter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StatisticsXMLFileWriter(const Self&); //purposely not implemented diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx index 742635253813b130749d26679c40793cb7109ee6..11d38b72d8fd91b33e5cbd2c2e09e30b3d73c2c0 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStatisticsXMLFileWriter_txx -#define __otbStatisticsXMLFileWriter_txx +#ifndef otbStatisticsXMLFileWriter_txx +#define otbStatisticsXMLFileWriter_txx #include "otbStatisticsXMLFileWriter.h" #include "itkMacro.h" @@ -69,9 +69,10 @@ StatisticsXMLFileWriter<TMeasurementVector> itkExceptionMacro(<<"The XML output FileName is empty, please set the filename via the method SetFileName"); // Check that the right extension is given : expected .xml */ - if (itksys::SystemTools::GetFilenameLastExtension(m_FileName) != ".xml") + std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); + if (itksys::SystemTools::LowerCase(extension) != ".xml") { - itkExceptionMacro(<<itksys::SystemTools::GetFilenameLastExtension(m_FileName) + itkExceptionMacro(<<extension <<" is a wrong Extension FileName : Expected .xml"); } @@ -81,7 +82,7 @@ StatisticsXMLFileWriter<TMeasurementVector> TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); doc.LinkEndChild( decl ); - TiXmlElement * root = NULL; + TiXmlElement * root = ITK_NULLPTR; if (m_MeasurementVectorContainer.size()) { root = new TiXmlElement( "FeatureStatistics"); @@ -110,7 +111,7 @@ StatisticsXMLFileWriter<TMeasurementVector> } // Iterate on map containers - TiXmlElement * mapRoot = NULL; + TiXmlElement * mapRoot = ITK_NULLPTR; if (m_GenericMapContainer.size()) { mapRoot = new TiXmlElement( "GeneralStatistics"); diff --git a/Modules/IO/IOXML/test/CMakeLists.txt b/Modules/IO/IOXML/test/CMakeLists.txt index 43714a9979b3a9d891e3a5773f079314ea5d8bf8..869367708d57ac2c302cf3eb74a82a550311c9e9 100644 --- a/Modules/IO/IOXML/test/CMakeLists.txt +++ b/Modules/IO/IOXML/test/CMakeLists.txt @@ -17,5 +17,5 @@ otb_add_test(NAME ioTvStatisticsXMLReaderWriter COMMAND otbIOXMLTestDriver ${TEMP}/ioTvStatisticsXMLReaderWriterOut3.xml otbStatisticsXMLFileWriteAndRead ${TEMP}/ioTvStatisticsXMLReaderWriterOut1.xml - ${TEMP}/ioTvStatisticsXMLReaderWriterOut2.xml + ${TEMP}/ioTvStatisticsXMLReaderWriterOut2.XML ${TEMP}/ioTvStatisticsXMLReaderWriterOut3.xml) diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.h b/Modules/IO/ImageIO/include/otbImageFileReader.h index 8ad06ee8d46f78f878b572124067a8db647bab4a..a7d4ab9150c46ee8bec38bea57a5502ed47e6a70 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageFileReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFileReader_h -#define __otbImageFileReader_h +#ifndef otbImageFileReader_h +#define otbImageFileReader_h #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -120,17 +120,17 @@ public: typedef ExtendedFilenameToReaderOptions FNameHelperType; /** Prepare image allocation at the first call of the pipeline processing */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Does the real work. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Give the reader a chance to indicate that it will produce more * output than it was requested to produce. ImageFileReader cannot * currently read a portion of an image (since the ImageIO objects * cannot read a portion of an image), so the ImageFileReader must * enlarge the RequestedRegion to the size of the image on disk. */ - virtual void EnlargeOutputRequestedRegion(itk::DataObject *output); + void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; /** Set/Get the ImageIO helper class. Often this is created via the object * factory mechanism that determines whether a particular ImageIO can @@ -160,8 +160,8 @@ public: protected: ImageFileReader(); - virtual ~ImageFileReader(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageFileReader() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Convert a block of pixels from one type to another. */ void DoConvertBuffer(void* buffer, size_t numberOfPixels); @@ -207,4 +207,4 @@ private: #include "otbImageFileReader.txx" #endif -#endif // __otbImageFileReader_h +#endif // otbImageFileReader_h diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.txx b/Modules/IO/ImageIO/include/otbImageFileReader.txx index 9b8a6a09b0a53be76bf21fc6ec16afa0c74261e5..8bd6e7ad45b35ff1163fad5887058002e043fd44 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFileReader_txx -#define __otbImageFileReader_txx +#ifndef otbImageFileReader_txx +#define otbImageFileReader_txx #include "otbImageFileReader.h" #include "otbConfigure.h" @@ -435,7 +435,7 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> } // Don't add an empty ossim keyword list - if( otb_kwl.GetSize() != 0 ) + if(!otb_kwl.Empty()) { itk::EncapsulateMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, otb_kwl); diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.h b/Modules/IO/ImageIO/include/otbImageFileWriter.h index 17b4d357641bc012e7c1c3d1219b0f193b3d1cf6..07aedabf8973d09307a7f0b544930d9d5fb5ecf7 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFileWriter_h -#define __otbImageFileWriter_h +#ifndef otbImageFileWriter_h +#define otbImageFileWriter_h #include "otbImageIOBase.h" #include "itkProcessObject.h" @@ -165,7 +165,7 @@ public: /** Override Update() from ProcessObject because this filter * has no output. */ - virtual void Update(); + void Update() ITK_OVERRIDE; /** ImageFileWriter Methods */ virtual void SetFileName(const char* extendedFileName); @@ -198,11 +198,11 @@ public: protected: ImageFileWriter(); - virtual ~ImageFileWriter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ImageFileWriter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Does the real work. */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: ImageFileWriter(const ImageFileWriter &); //purposely not implemented diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx index 8979a01e0235c37ba00663f26d2d12d11d7262b1..0798c41ac8c7bee360e83d08697138c88faf3571 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageFileWriter_txx -#define __otbImageFileWriter_txx +#ifndef otbImageFileWriter_txx +#define otbImageFileWriter_txx #include "otbImageFileWriter.h" #include "itkImageFileWriter.h" @@ -256,7 +256,7 @@ ImageFileWriter<TInputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType*>(this->ProcessObject::GetInput(0)); @@ -803,7 +803,7 @@ ImageFileWriter<TInputImage> { this->m_FilenameHelper->SetExtendedFileName(extendedFileName); m_FileName = this->m_FilenameHelper->GetSimpleFileName(); - m_ImageIO = NULL; + m_ImageIO = ITK_NULLPTR; this->Modified(); } diff --git a/Modules/IO/ImageIO/include/otbImageIOFactory.h b/Modules/IO/ImageIO/include/otbImageIOFactory.h index c9cdbf3e4256b7b1bc65e62b171b0a358814c5cf..282da7119b0515cf55be790c7528175e4c252606 100644 --- a/Modules/IO/ImageIO/include/otbImageIOFactory.h +++ b/Modules/IO/ImageIO/include/otbImageIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageIOFactory_h -#define __otbImageIOFactory_h +#ifndef otbImageIOFactory_h +#define otbImageIOFactory_h #include "itkObject.h" #include "otbImageIOBase.h" @@ -56,7 +56,7 @@ public: protected: ImageIOFactory(); - ~ImageIOFactory(); + ~ImageIOFactory() ITK_OVERRIDE; private: ImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h index 3d6eb560ed1b4e092614ea41402317d601ae5cf4..b9ce01a814be361110cb0b24ed57dc4ebbec76d0 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbImageSeriesFileReader_h -#define __otbImageSeriesFileReader_h +#ifndef otbImageSeriesFileReader_h +#define otbImageSeriesFileReader_h #include "otbImageSeriesFileReaderBase.h" @@ -426,12 +426,12 @@ public: protected: ImageSeriesFileReader(); - virtual ~ImageSeriesFileReader () {} + ~ImageSeriesFileReader () ITK_OVERRIDE {} /** * Tests the coherency of the Meta File (especifically band selection) with the image types */ - virtual void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)){} + void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) ITK_OVERRIDE{} /** GenerateData * This method will be specialised if template definitions follow: @@ -439,7 +439,7 @@ protected: * - TImage is an Image and TInteranalImage is a VectorImage * - TImage and TInternalImage are of Image type. */ - virtual void GenerateData(DataObjectPointerArraySizeType idx); + void GenerateData(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::GenerateData; /** @@ -447,10 +447,10 @@ protected: * This allows specific (or global) initialization in the GenerateData methods, * that the user may invoke throught GenerateOutput() or GenerateOutput( idx ). */ - virtual void AllocateListOfComponents(void); + void AllocateListOfComponents(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { return Superclass::PrintSelf(os, indent); } diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx index 0bafea5e66ea865e0479e0cad576cdf0fe9c246b..4ecc611d5441592710897f8d17da8a7793eceebd 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbImageSeriesFileReader_txx -#define __otbImageSeriesFileReader_txx +#ifndef otbImageSeriesFileReader_txx +#define otbImageSeriesFileReader_txx #include "otbImageSeriesFileReader.h" namespace otb { diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h index dcbb7cc4bcc1694310846beb5ad86446eb141908..50c579fab19cc73040516fe917c11b4941a35a39 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbImageSeriesFileReaderBase_h -#define __otbImageSeriesFileReaderBase_h +#ifndef otbImageSeriesFileReaderBase_h +#define otbImageSeriesFileReaderBase_h #include <iostream> #include <fstream> @@ -131,7 +131,7 @@ public: { return m_ListOfFileNames.size(); } - virtual OutputImageListType * GetOutput(void); + OutputImageListType * GetOutput(void) ITK_OVERRIDE; virtual OutputImageType * GetOutput(DataObjectPointerArraySizeType idx); /** Performs selective file extraction */ @@ -139,14 +139,14 @@ public: virtual OutputImageType * GenerateOutput(DataObjectPointerArraySizeType idx); /** Synchronization */ - void Update() + void Update() ITK_OVERRIDE { this->GenerateData(); } protected: ImageSeriesFileReaderBase(); - virtual ~ImageSeriesFileReaderBase () {} + ~ImageSeriesFileReaderBase () ITK_OVERRIDE {} enum FileType { kFileName = 0, kImageFileName, kAnyFileName }; /** @@ -157,7 +157,7 @@ protected: virtual void TestFileExistanceAndReadability(std::string& file, FileType fileType); virtual void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) {} - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** GenerateData * This method will be specialised if template definitions follow: @@ -179,7 +179,7 @@ protected: virtual void AllocateListOfComponents(void); /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; std::string m_FileName; OutputImageListPointerType m_OutputList; diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx index 60ddc4d1c5d7986289de9e861a75fd0eab185093..4ca00ae8679859863769a80b6977309a3f3816c3 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbImageSeriesFileReaderBase_txx -#define __otbImageSeriesFileReaderBase_txx +#ifndef otbImageSeriesFileReaderBase_txx +#define otbImageSeriesFileReaderBase_txx #include "otbImageSeriesFileReaderBase.h" namespace otb { diff --git a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h index d3836bc39305c2521ec2431257c6a62072d28711..e5080bfc15c665c4d1e29b664290cbde6f59af13 100644 --- a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbScalarBufferToImageFileWriter_h -#define __otbScalarBufferToImageFileWriter_h +#ifndef otbScalarBufferToImageFileWriter_h +#define otbScalarBufferToImageFileWriter_h #include "otbVectorImage.h" @@ -88,17 +88,17 @@ public: m_Buffer = pBuff; } - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - virtual void Update() + void Update() ITK_OVERRIDE { this->GenerateData(); } protected: ScalarBufferToImageFileWriter(); - virtual ~ScalarBufferToImageFileWriter() { /* don't call ClearBuffer, user's care */} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ScalarBufferToImageFileWriter() ITK_OVERRIDE { /* don't call ClearBuffer, user's care */} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.txx b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.txx index 2c788496d31c9403ef0bedd75de5330ccd677c4b..5f79e408a5ade34f93e4d7b3882bc0ac02fd6916 100644 --- a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.txx @@ -15,7 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ - +#ifndef otbScalarBufferToImageFileWriter_txx +#define otbScalarBufferToImageFileWriter_txx #include "otbMacro.h" @@ -27,7 +28,7 @@ namespace otb { template<class TBufferType, class TOutputPixelType> ScalarBufferToImageFileWriter<TBufferType, TOutputPixelType> -::ScalarBufferToImageFileWriter() : m_Buffer(NULL), m_NumberOfChannels(0), m_InverseXSpacing(false) +::ScalarBufferToImageFileWriter() : m_Buffer(ITK_NULLPTR), m_NumberOfChannels(0), m_InverseXSpacing(false) { m_Writer = WriterType::New(); m_ImageSize.Fill(0); @@ -122,3 +123,4 @@ ScalarBufferToImageFileWriter<TBufferType, TOutputPixelType> } // end namespace otb +#endif diff --git a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx index 82967f8c1a891568bd044c1ad40cf569fb959bfb..ab5701227068dae285da26bd6fab53277028548b 100644 --- a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx +++ b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx @@ -82,7 +82,7 @@ ImageIOFactory::CreateImageIO(const char* path, FileModeType mode) } } - return 0; + return ITK_NULLPTR; } void diff --git a/Modules/IO/ImageIO/test/otbImageIOFactoryNew.cxx b/Modules/IO/ImageIO/test/otbImageIOFactoryNew.cxx index 28eb252d3ce9c0b4100e980208151e24d44021f1..7c1eec765cac076b2da15a57a363c2990d858509 100644 --- a/Modules/IO/ImageIO/test/otbImageIOFactoryNew.cxx +++ b/Modules/IO/ImageIO/test/otbImageIOFactoryNew.cxx @@ -25,6 +25,6 @@ int otbImageIOFactoryNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::ImageIOFactory *lImageIOFactory; - lImageIOFactory = NULL; - return lImageIOFactory != NULL; //to avoid unused variable warning + lImageIOFactory = ITK_NULLPTR; + return lImageIOFactory != ITK_NULLPTR; //to avoid unused variable warning } diff --git a/Modules/IO/ImageIO/test/otbScalarBufferToImageFileWriterTest.cxx b/Modules/IO/ImageIO/test/otbScalarBufferToImageFileWriterTest.cxx index 1961cd4e439c1f4b60924bf4ddec7cf3859bce5e..9c7ff8bff373a2a4957ea1ac975946728e6c0cd7 100644 --- a/Modules/IO/ImageIO/test/otbScalarBufferToImageFileWriterTest.cxx +++ b/Modules/IO/ImageIO/test/otbScalarBufferToImageFileWriterTest.cxx @@ -57,7 +57,7 @@ int otbScalarBufferToImageFileWriterTest(int itkNotUsed(argc), char* argv[]) filter->Update(); delete[] tab; - tab = NULL; + tab = ITK_NULLPTR; return EXIT_SUCCESS; } diff --git a/Modules/IO/KMZWriter/include/otbKmzProductWriter.h b/Modules/IO/KMZWriter/include/otbKmzProductWriter.h index 316abad838cb6aa4d368127453340072dbe51b48..26f26ad4661bfa81384b11ae9f34134e57d4f762 100644 --- a/Modules/IO/KMZWriter/include/otbKmzProductWriter.h +++ b/Modules/IO/KMZWriter/include/otbKmzProductWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKmzProductWriter_h -#define __otbKmzProductWriter_h +#ifndef otbKmzProductWriter_h +#define otbKmzProductWriter_h #include <fstream> @@ -133,7 +133,7 @@ public: itkSetStringMacro(Path); /** Update Method */ - virtual void Update() + void Update() ITK_OVERRIDE { this->Write(); } @@ -164,8 +164,8 @@ public: protected: KmzProductWriter(); - virtual ~KmzProductWriter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~KmzProductWriter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /**Method for Tiling the input image*/ virtual void Tiling(); diff --git a/Modules/IO/KMZWriter/include/otbKmzProductWriter.txx b/Modules/IO/KMZWriter/include/otbKmzProductWriter.txx index 0e5622ee5c758f0784c6335c861e8c44c4bd9cae..be2875927df2790e07c2885d7728b75ec9da292b 100644 --- a/Modules/IO/KMZWriter/include/otbKmzProductWriter.txx +++ b/Modules/IO/KMZWriter/include/otbKmzProductWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKmzProductWriter_txx -#define __otbKmzProductWriter_txx +#ifndef otbKmzProductWriter_txx +#define otbKmzProductWriter_txx #include <string> @@ -47,7 +47,7 @@ KmzProductWriter<TInputImage> { // Reset the boost::intrusive_ptr<KmzFile> : // TODO : when upgrading boost > 1.42 use method release(). - m_KmzFile = NULL; + m_KmzFile = ITK_NULLPTR; } /** @@ -84,7 +84,7 @@ KmzProductWriter<TInputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage * > @@ -270,7 +270,7 @@ KmzProductWriter<TInputImage> // Build wgs ref to compute long/lat OGRSpatialReference oSRS; oSRS.SetWellKnownGeogCS("WGS84"); - char * wgsRef = NULL; + char * wgsRef = ITK_NULLPTR; oSRS.exportToWkt(&wgsRef); // Update image base information diff --git a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h index 73fbb330659f6b55fcae911880b2362dfb383375..55a04a4e51c7da1def86c68f1d68ce4ab4f9b88a 100644 --- a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h +++ b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h @@ -1,5 +1,5 @@ -#ifndef __otbDifferenceImageFilter_h -#define __otbDifferenceImageFilter_h +#ifndef otbDifferenceImageFilter_h +#define otbDifferenceImageFilter_h #include "itkImageToImageFilter.h" #include "itkNumericTraits.h" @@ -71,9 +71,9 @@ public: protected: DifferenceImageFilter(); - virtual ~DifferenceImageFilter() {} + ~DifferenceImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** DifferenceImageFilter can be implemented as a multithreaded * filter. Therefore, this implementation provides a @@ -87,11 +87,11 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& threadRegion, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; - void BeforeThreadedGenerateData(); - void AfterThreadedGenerateData(); - virtual void GenerateOutputInformation(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; ScalarRealType m_DifferenceThreshold; RealType m_MeanDifference; diff --git a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.txx b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.txx index 141b9167a4b9adf5a0ba482d0d6b575c082613dc..8da4ed9322ccbe8922c977726869d69a6c443ac9 100644 --- a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.txx +++ b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.txx @@ -1,5 +1,5 @@ -#ifndef __otbDifferenceImageFilter_txx -#define __otbDifferenceImageFilter_txx +#ifndef otbDifferenceImageFilter_txx +#define otbDifferenceImageFilter_txx #include "otbDifferenceImageFilter.h" diff --git a/Modules/IO/TestKernel/include/otbTestHelper.h b/Modules/IO/TestKernel/include/otbTestHelper.h index 203c31b36f340812b9794f1e7cb78a7d41b6db2c..f7efa67a880e873e7aaf4d9b82b4db1763f68261 100644 --- a/Modules/IO/TestKernel/include/otbTestHelper.h +++ b/Modules/IO/TestKernel/include/otbTestHelper.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTestHelper_h -#define __otbTestHelper_h +#ifndef otbTestHelper_h +#define otbTestHelper_h #include <map> #include <string> @@ -66,7 +66,7 @@ public: m_MaxArea(1024*1024) {} - ~TestHelper(){} + ~TestHelper() ITK_OVERRIDE{} int RegressionTestAllImages(const StringList& baselineFilenamesImage, const StringList& testFilenamesImage); @@ -141,8 +141,8 @@ private: OGRLayer * test_poLayer, const char *test_pszWHERE, OGRGeometry *test_poSpatialFilter, int& nbdiff) const; - static void DumpOGRFeature(FILE* fileid, OGRFeature* feature, char** papszOptions = NULL); - static void DumpOGRGeometry(FILE* fileid, OGRGeometry* geometry, const char * pszPrefix, char** papszOptions = NULL); + static void DumpOGRFeature(FILE* fileid, OGRFeature* feature, char** papszOptions = ITK_NULLPTR); + static void DumpOGRGeometry(FILE* fileid, OGRGeometry* geometry, const char * pszPrefix, char** papszOptions = ITK_NULLPTR); double m_ToleranceDiffValue; double m_Epsilon; diff --git a/Modules/IO/TestKernel/include/otbTestMain.h b/Modules/IO/TestKernel/include/otbTestMain.h index 2ec5b71cfbcc140a23e400fae82468f406fd52dd..3dd3dbfe25581d41742ae83afefe43e65271a109 100644 --- a/Modules/IO/TestKernel/include/otbTestMain.h +++ b/Modules/IO/TestKernel/include/otbTestMain.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTestMain_h -#define __otbTestMain_h +#ifndef otbTestMain_h +#define otbTestMain_h #include "otbConfigure.h" @@ -32,6 +32,9 @@ #include "itkMersenneTwisterRandomVariateGenerator.h" +#ifdef OTB_USE_MPI +#include "otbMPIConfig.h" +#endif typedef int (*MainFuncPointer)(int, char*[]); std::map<std::string, MainFuncPointer> StringToTestFunctionMap; @@ -64,6 +67,10 @@ void LoadTestEnv() int main(int ac, char* av[]) { + #ifdef OTB_USE_MPI + otb::MPIConfig::Instance()->Init(ac,av); + #endif + bool lFlagRegression(false); double lToleranceDiffValue(0); double lEpsilon(0); @@ -332,6 +339,11 @@ int main(int ac, char* av[]) result = EXIT_SUCCESS; +#ifdef OTB_USE_MPI + otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + if (mpiConfig->GetMyRank() == 0) + { +#endif std::cout << " -> Test EXIT SUCCESS." << std::endl; if (lFlagRegression == false) { @@ -410,6 +422,9 @@ int main(int ac, char* av[]) } std::cout << "------------- End control baseline tests -------------" << std::endl; +#ifdef OTB_USE_MPI + } +#endif return result; } } diff --git a/Modules/IO/TestKernel/otb-module.cmake b/Modules/IO/TestKernel/otb-module.cmake index 75394e3339cdaf0d3182f7cac599a9a6add3d117..84539bc935ce491a317efe243339ee58c70ad6ae 100644 --- a/Modules/IO/TestKernel/otb-module.cmake +++ b/Modules/IO/TestKernel/otb-module.cmake @@ -15,6 +15,9 @@ otb_module(OTBTestKernel OTBOSSIMAdapters OTBImageManipulation + OPTIONAL_DEPENDS + OTBMPIConfig + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/IO/TestKernel/src/CMakeLists.txt b/Modules/IO/TestKernel/src/CMakeLists.txt index a804f0b172821c5574a5c6e27c31c496aac28382..6bdb764db56959f7f4b10078cc5c9d3099421a91 100644 --- a/Modules/IO/TestKernel/src/CMakeLists.txt +++ b/Modules/IO/TestKernel/src/CMakeLists.txt @@ -7,6 +7,7 @@ target_link_libraries(OTBTestKernel ${OTBGDAL_LIBRARIES} ${OTBOSSIMAdapters_LIBRARIES} ${OTBImageManipulation_LIBRARIES} + ${OTBMPIConfig_LIBRARIES} ) otb_module_target(OTBTestKernel) diff --git a/Modules/IO/TestKernel/src/otbTestDriver.cxx b/Modules/IO/TestKernel/src/otbTestDriver.cxx index 4fbeeb755b34d97d8eff4a2887e1fbccc87721b8..a47c16c6d306b4be1e1042a45b9e549b82a4a60f 100644 --- a/Modules/IO/TestKernel/src/otbTestDriver.cxx +++ b/Modules/IO/TestKernel/src/otbTestDriver.cxx @@ -28,6 +28,7 @@ #include <iostream> #include <fstream> #include "itksys/SystemTools.hxx" +#include "itkMacro.h" // include SharedForward to avoid duplicating the code which find the library path variable // name and the path separator @@ -176,7 +177,7 @@ int main(int ac, char* av[]) { argv[i + 1] = remainingArgs[i]; } - argv[remainingArgs.size() + 1] = NULL; + argv[remainingArgs.size() + 1] = ITK_NULLPTR; /** Call to the otbTestMain */ return otbTestMain(static_cast<int>(remainingArgs.size()), argv); @@ -194,7 +195,7 @@ int Execute(int argc, char * argv[]) itksysProcess_SetPipeShared(process, itksysProcess_Pipe_STDOUT, true); itksysProcess_SetPipeShared(process, itksysProcess_Pipe_STDERR, true); itksysProcess_Execute(process); - itksysProcess_WaitForExit(process, NULL); + itksysProcess_WaitForExit(process, ITK_NULLPTR); int retCode = itksysProcess_GetExitValue(process); return retCode; } diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx index a10623362fb4d57475e5bce773c8df8929cf6c49..6dae89b62f79cd226c543be12c181692abb593a0 100644 --- a/Modules/IO/TestKernel/src/otbTestHelper.cxx +++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx @@ -1076,31 +1076,31 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b /* -------------------------------------------------------------------- */ /* Open data source. */ /* -------------------------------------------------------------------- */ - otb::ogr::version_proxy::GDALDatasetType *ref_poDS = NULL; - otb::ogr::version_proxy::GDALDriverType * ref_poDriver = NULL; + otb::ogr::version_proxy::GDALDatasetType *ref_poDS = ITK_NULLPTR; + otb::ogr::version_proxy::GDALDriverType * ref_poDriver = ITK_NULLPTR; //OGRGeometry * ref_poSpatialFilter = NULL; - otb::ogr::version_proxy::GDALDatasetType *test_poDS = NULL; - otb::ogr::version_proxy::GDALDriverType * test_poDriver = NULL; + otb::ogr::version_proxy::GDALDatasetType *test_poDS = ITK_NULLPTR; + otb::ogr::version_proxy::GDALDriverType * test_poDriver = ITK_NULLPTR; //OGRGeometry * test_poSpatialFilter = NULL; ref_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, false); - if (ref_poDS == NULL && !bReadOnly) + if (ref_poDS == ITK_NULLPTR && !bReadOnly) { ref_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, true); bReadOnly = TRUE; - if (ref_poDS != NULL && m_ReportErrors) + if (ref_poDS != ITK_NULLPTR && m_ReportErrors) { std::cout << "Had to open REF data source read-only."<<std::endl; } } test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly); - if (test_poDS == NULL && !bReadOnly) + if (test_poDS == ITK_NULLPTR && !bReadOnly) { test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly); bReadOnly = TRUE; - if (test_poDS != NULL && m_ReportErrors) + if (test_poDS != ITK_NULLPTR && m_ReportErrors) { std::cout << "Had to open TEST data source read-only."<<std::endl; } @@ -1108,7 +1108,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b /* -------------------------------------------------------------------- */ /* Report failure */ /* -------------------------------------------------------------------- */ - if (ref_poDS == NULL) + if (ref_poDS == ITK_NULLPTR) { if (m_ReportErrors) @@ -1127,7 +1127,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b ref_poDriver = ref_poDS->GetDriver(); CPLAssert(ref_poDriver != NULL); - if (test_poDS == NULL) + if (test_poDS == ITK_NULLPTR) { if (m_ReportErrors) { @@ -1183,14 +1183,14 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b OGRLayer *ref_poLayer = ref_poDS->GetLayer(iLayer); OGRLayer *test_poLayer = test_poDS->GetLayer(iLayer); - if (ref_poLayer == NULL) + if (ref_poLayer == ITK_NULLPTR) { if (m_ReportErrors) std::cout << "FAILURE: Couldn't fetch advertised layer " << iLayer << " for REF data source" << std::endl; return (1); } - if (test_poLayer == NULL) + if (test_poLayer == ITK_NULLPTR) { if (m_ReportErrors) std::cout << "FAILURE: Couldn't fetch advertised layer " << iLayer << @@ -1199,20 +1199,20 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b } //Check Layer inforamtion - ogrReportOnLayer(ref_poLayer, NULL, NULL, test_poLayer, NULL, NULL, nbdiff); + ogrReportOnLayer(ref_poLayer, ITK_NULLPTR, ITK_NULLPTR, test_poLayer, ITK_NULLPTR, ITK_NULLPTR, nbdiff); //If no difference, check the feature if (nbdiff == 0) { - OGRFeature * ref_poFeature = NULL; - OGRFeature * test_poFeature = NULL; + OGRFeature * ref_poFeature = ITK_NULLPTR; + OGRFeature * test_poFeature = ITK_NULLPTR; std::string basefilename(test_pszDataSource); int nbFeature(0); std::stringstream oss2; oss2.str(""); oss2 << iLayer; - while ((ref_poFeature = ref_poLayer->GetNextFeature()) != NULL) + while ((ref_poFeature = ref_poLayer->GetNextFeature()) != ITK_NULLPTR) { test_poFeature = test_poLayer->GetNextFeature(); std::stringstream oss; @@ -1223,9 +1223,9 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b + "_ref.txt"; std::string test_filename = basefilename + "_temporary_layer_" + oss2.str() + "_feature_" + oss.str() + "_test.txt"; - FILE *ref_f(NULL); + FILE *ref_f(ITK_NULLPTR); ref_f = fopen(ref_filename.c_str(), "w"); - if (ref_f == NULL) + if (ref_f == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Impossible to create ASCII file <" << ref_filename << ">."); } @@ -1233,9 +1233,9 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b OGRFeature::DestroyFeature( ref_poFeature ); fclose(ref_f); - FILE *test_f(NULL); + FILE *test_f(ITK_NULLPTR); test_f = fopen(test_filename.c_str(), "w"); - if (test_f == NULL) + if (test_f == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Impossible to create ASCII file <" << test_filename << ">."); } @@ -1268,7 +1268,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOptions) { - if (fpOut == NULL) fpOut = stdout; + if (fpOut == ITK_NULLPTR) fpOut = stdout; if(!feature) { @@ -1280,7 +1280,7 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp const char* pszDisplayFields = CSLFetchNameValue(papszOptions, "DISPLAY_FIELDS"); - if (pszDisplayFields == NULL || CSLTestBoolean(pszDisplayFields)) + if (pszDisplayFields == ITK_NULLPTR || CSLTestBoolean(pszDisplayFields)) { for (int iField = 0; iField < feature->GetFieldCount(); iField++) { @@ -1296,21 +1296,21 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp } } - if (feature->GetStyleString() != NULL) + if (feature->GetStyleString() != ITK_NULLPTR) { const char* pszDisplayStyle = CSLFetchNameValue(papszOptions, "DISPLAY_STYLE"); - if (pszDisplayStyle == NULL || CSLTestBoolean(pszDisplayStyle)) + if (pszDisplayStyle == ITK_NULLPTR || CSLTestBoolean(pszDisplayStyle)) { fprintf(fpOut, " Style = %s\n", feature->GetStyleString()); } } - if (feature->GetGeometryRef() != NULL) + if (feature->GetGeometryRef() != ITK_NULLPTR) { const char* pszDisplayGeometry = CSLFetchNameValue(papszOptions, "DISPLAY_GEOMETRY"); - if (!(pszDisplayGeometry != NULL && EQUAL(pszDisplayGeometry, "NO"))) + if (!(pszDisplayGeometry != ITK_NULLPTR && EQUAL(pszDisplayGeometry, "NO"))) { DumpOGRGeometry(fpOut, feature->GetGeometryRef(), " ", papszOptions); } @@ -1321,15 +1321,15 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp void TestHelper::DumpOGRGeometry(FILE* fp, OGRGeometry* geometry, const char * pszPrefix, char** papszOptions) { - char *pszWkt = NULL; + char *pszWkt = ITK_NULLPTR; - if (pszPrefix == NULL) pszPrefix = ""; + if (pszPrefix == ITK_NULLPTR) pszPrefix = ""; - if (fp == NULL) fp = stdout; + if (fp == ITK_NULLPTR) fp = stdout; const char* pszDisplayGeometry = CSLFetchNameValue(papszOptions, "DISPLAY_GEOMETRY"); - if (pszDisplayGeometry != NULL && EQUAL(pszDisplayGeometry, "SUMMARY")) + if (pszDisplayGeometry != ITK_NULLPTR && EQUAL(pszDisplayGeometry, "SUMMARY")) { OGRLineString * poLine; OGRPolygon * poPoly; @@ -1398,7 +1398,7 @@ void TestHelper::DumpOGRGeometry(FILE* fp, OGRGeometry* geometry, const char * p break; } } - else if (pszDisplayGeometry == NULL || CSLTestBoolean(pszDisplayGeometry) || + else if (pszDisplayGeometry == ITK_NULLPTR || CSLTestBoolean(pszDisplayGeometry) || EQUAL(pszDisplayGeometry, "WKT")) { if (geometry->exportToWkt(&pszWkt) == OGRERR_NONE) @@ -1856,13 +1856,13 @@ void TestHelper::ogrReportOnLayer(OGRLayer * ref_poLayer, /* -------------------------------------------------------------------- */ otbCheckStringValue("pszWHERE", ref_pszWHERE, test_pszWHERE, nbdiff, m_ReportErrors); - if (ref_pszWHERE != NULL) ref_poLayer->SetAttributeFilter(ref_pszWHERE); + if (ref_pszWHERE != ITK_NULLPTR) ref_poLayer->SetAttributeFilter(ref_pszWHERE); - if (ref_poSpatialFilter != NULL) ref_poLayer->SetSpatialFilter(ref_poSpatialFilter); + if (ref_poSpatialFilter != ITK_NULLPTR) ref_poLayer->SetSpatialFilter(ref_poSpatialFilter); - if (test_pszWHERE != NULL) test_poLayer->SetAttributeFilter(test_pszWHERE); + if (test_pszWHERE != ITK_NULLPTR) test_poLayer->SetAttributeFilter(test_pszWHERE); - if (test_poSpatialFilter != NULL) test_poLayer->SetSpatialFilter(test_poSpatialFilter); + if (test_poSpatialFilter != ITK_NULLPTR) test_poLayer->SetSpatialFilter(test_poSpatialFilter); /* -------------------------------------------------------------------- */ /* Report various overall information. */ @@ -1893,12 +1893,12 @@ void TestHelper::ogrReportOnLayer(OGRLayer * ref_poLayer, char *ref_pszWKT; char *test_pszWKT; - if (ref_poLayer->GetSpatialRef() == NULL) ref_pszWKT = CPLStrdup("(unknown)"); + if (ref_poLayer->GetSpatialRef() == ITK_NULLPTR) ref_pszWKT = CPLStrdup("(unknown)"); else { ref_poLayer->GetSpatialRef()->exportToPrettyWkt(&ref_pszWKT); } - if (test_poLayer->GetSpatialRef() == NULL) test_pszWKT = CPLStrdup("(unknown)"); + if (test_poLayer->GetSpatialRef() == ITK_NULLPTR) test_pszWKT = CPLStrdup("(unknown)"); else { test_poLayer->GetSpatialRef()->exportToPrettyWkt(&test_pszWKT); diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h index 84457d064bcff185ae64edcb6989aa14ce6e4dc0..930ad72b16a0749505fd6ca902ec41506d3fb073 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataFileReader_h -#define __otbVectorDataFileReader_h +#ifndef otbVectorDataFileReader_h +#define otbVectorDataFileReader_h #include "otbVectorDataSource.h" #include "otbVectorDataIOBase.h" @@ -117,20 +117,20 @@ public: /** Prepare the allocation of the output vector data during the first back * propagation of the pipeline. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Does the real work. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: VectorDataFileReader(); - virtual ~VectorDataFileReader(); + ~VectorDataFileReader() ITK_OVERRIDE; std::string m_ExceptionMessage; typename VectorDataIOBaseType::Pointer m_VectorDataIO; bool m_UserSpecifiedVectorDataIO; // keep track whether the - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; std::string m_FileName; // The file to be read @@ -151,4 +151,4 @@ private: #include "otbVectorDataFileReader.txx" #endif -#endif // __otbVectorDataFileReader_h +#endif // otbVectorDataFileReader_h diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.txx b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.txx index a7e97946f0493825108038b976431927b5a8e233..88b92507cbe9137963f988de3c8265229ee1c701 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.txx +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataFileReader_txx -#define __otbVectorDataFileReader_txx +#ifndef otbVectorDataFileReader_txx +#define otbVectorDataFileReader_txx #include <fstream> @@ -37,7 +37,7 @@ namespace otb template <class TOutputVectorData> VectorDataFileReader<TOutputVectorData> ::VectorDataFileReader() : - m_VectorDataIO(NULL), + m_VectorDataIO(ITK_NULLPTR), m_UserSpecifiedVectorDataIO(false), m_FileName("") { diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h index 8faca223c7b0b939ce06a6bdc0665cc70ecc02f3..76b08b5f85e7e5eb52c5f05bf480e47579ca4e1e 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataFileWriter_h -#define __otbVectorDataFileWriter_h +#ifndef otbVectorDataFileWriter_h +#define otbVectorDataFileWriter_h #include "itkProcessObject.h" #include "itkMacro.h" @@ -90,9 +90,9 @@ public: /** Does the real work. */ virtual void Write(); - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - virtual void Update() + void Update() ITK_OVERRIDE { this->Write(); } @@ -103,9 +103,9 @@ public: protected: VectorDataFileWriter(); - virtual ~VectorDataFileWriter(); + ~VectorDataFileWriter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; std::string m_FileName; // The file to be read typename VectorDataIOBaseType::Pointer m_VectorDataIO; @@ -124,4 +124,4 @@ private: #include "otbVectorDataFileWriter.txx" #endif -#endif // __otbVectorDataFileWriter_h +#endif // otbVectorDataFileWriter_h diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.txx b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.txx index 0606ad431387b33167128b5d5783c2e67f4348a6..ee9d9935ad6ac668e51c4ed6aea28eb1f0452bef 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.txx +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataFileWriter_txx -#define __otbVectorDataFileWriter_txx +#ifndef otbVectorDataFileWriter_txx +#define otbVectorDataFileWriter_txx #include "otbMacro.h" #include "otbVectorDataFileWriter.h" @@ -34,7 +34,7 @@ template <class TInputVectorData> VectorDataFileWriter<TInputVectorData> ::VectorDataFileWriter() : m_FileName(""), - m_VectorDataIO(0), + m_VectorDataIO(ITK_NULLPTR), m_UserSpecifiedVectorDataIO(false), m_FactorySpecifiedVectorDataIO(false) { @@ -67,7 +67,7 @@ VectorDataFileWriter<TInputVectorData> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TInputVectorData*> @@ -94,7 +94,7 @@ VectorDataFileWriter<TInputVectorData> itkDebugMacro(<< "Writing a vector data file"); // Make sure input is available - if (input == 0) + if (input == ITK_NULLPTR) { itkExceptionMacro(<< "No input to writer!"); } diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h b/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h index ed84fedfd32e8d64910f7a0e684153bf463e9048..073681f2b1639820613187ce928e9d989b9211ae 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataIOFactory_h -#define __otbVectorDataIOFactory_h +#ifndef otbVectorDataIOFactory_h +#define otbVectorDataIOFactory_h #include "itkObject.h" #include "otbVectorDataIOBase.h" @@ -59,7 +59,7 @@ public: protected: VectorDataIOFactory(); - ~VectorDataIOFactory(); + ~VectorDataIOFactory() ITK_OVERRIDE; private: VectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/VectorDataIO/src/otbVectorDataIOFactory.cxx b/Modules/IO/VectorDataIO/src/otbVectorDataIOFactory.cxx index 3ce568ab0000652baec9e557c8cdb5f74bf90013..82993d2789f11b71f3f5ea032e4477360b7376dc 100644 --- a/Modules/IO/VectorDataIO/src/otbVectorDataIOFactory.cxx +++ b/Modules/IO/VectorDataIO/src/otbVectorDataIOFactory.cxx @@ -74,7 +74,7 @@ VectorDataIOFactory } } - return 0; + return ITK_NULLPTR; } void diff --git a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h index 427303d96f93c41c612feeb4ac44f50b37866285..de0a90af4f39b74876351f32cd55911c624b800a 100644 --- a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h +++ b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConfusionMatrixToMassOfBelief_h -#define __otbConfusionMatrixToMassOfBelief_h +#ifndef otbConfusionMatrixToMassOfBelief_h +#define otbConfusionMatrixToMassOfBelief_h // First make sure that the configuration is available. // This line can be removed once the optimized versions @@ -82,7 +82,7 @@ public: enum MassOfBeliefDefinitionMethod {PRECISION, RECALL, ACCURACY, KAPPA}; - virtual void Update(); + void Update() ITK_OVERRIDE; /** Accessors */ itkSetMacro(ConfusionMatrix, ConfusionMatrixType); @@ -138,10 +138,10 @@ protected: ConfusionMatrixToMassOfBelief(); /** Destructor */ - virtual ~ConfusionMatrixToMassOfBelief() {}; + ~ConfusionMatrixToMassOfBelief() ITK_OVERRIDE {}; /** Triggers the computation of the confusion matrix */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; private: ConfusionMatrixToMassOfBelief(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.txx b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.txx index 18bb0d6e39b03e3bce13460ef167a9f0a6c8fc91..f1d7fcd762d80bf16958dbcf4d93f9348b84920b 100644 --- a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.txx +++ b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConfusionMatrixToMassOfBelief_txx -#define __otbConfusionMatrixToMassOfBelief_txx +#ifndef otbConfusionMatrixToMassOfBelief_txx +#define otbConfusionMatrixToMassOfBelief_txx #include "otbConfusionMatrixToMassOfBelief.h" diff --git a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h index 84b093f8c167c6985890be5a9e9c888b4dd2c8d6..48a3eccefe28d07a040b1e736f66765f483bd25d 100644 --- a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDSFusionOfClassifiersImageFilter_h -#define __otbDSFusionOfClassifiersImageFilter_h +#ifndef otbDSFusionOfClassifiersImageFilter_h +#define otbDSFusionOfClassifiersImageFilter_h #include "itkImageToImageFilter.h" #include "otbVectorImage.h" @@ -137,16 +137,16 @@ protected: /** Constructor */ DSFusionOfClassifiersImageFilter(); /** Destructor */ - virtual ~DSFusionOfClassifiersImageFilter() {} + ~DSFusionOfClassifiersImageFilter() ITK_OVERRIDE {} /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: DSFusionOfClassifiersImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx index bb71f7790c461ec6fcd1375fe0fd3f3d5e254c79..f05b56e40458ced1e93d35458d91a1833e4aefa0 100644 --- a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx +++ b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDSFusionOfClassifiersImageFilter_txx -#define __otbDSFusionOfClassifiersImageFilter_txx +#ifndef otbDSFusionOfClassifiersImageFilter_txx +#define otbDSFusionOfClassifiersImageFilter_txx #include "otbDSFusionOfClassifiersImageFilter.h" #include "itkImageRegionIterator.h" @@ -59,7 +59,7 @@ DSFusionOfClassifiersImageFilter<TInputImage, TOutputImage, TMaskImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h index 98e3d036b3a77ad9772b019076f8a93923555612..0f3643f8cb8962fd84a7bda82421caa6e34c67f1 100644 --- a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJointMassOfBeliefFilter_h -#define __otbJointMassOfBeliefFilter_h +#ifndef otbJointMassOfBeliefFilter_h +#define otbJointMassOfBeliefFilter_h #include "itkProcessObject.h" @@ -68,11 +68,11 @@ public: /** Remove the last input */ using Superclass::PopBackInput; - virtual void PopBackInput(); + void PopBackInput() ITK_OVERRIDE; /** Remove the first input */ using Superclass::PopFrontInput; - virtual void PopFrontInput(); + void PopFrontInput() ITK_OVERRIDE; /** Get the idx th input */ const MassFunctionType * GetInput(unsigned int idx); @@ -85,13 +85,13 @@ protected: JointMassOfBeliefFilter(); /** Destructor */ - ~JointMassOfBeliefFilter() {} + ~JointMassOfBeliefFilter() ITK_OVERRIDE {} /** GenerateData */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: JointMassOfBeliefFilter(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.txx b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.txx index 5690fefcd5cff3088d3ab38a2c4ec6e283710519..d45ccde5b205ed4517e7b6fb79642804e414ea00 100644 --- a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.txx +++ b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbJointMassOfBeliefFilter_txx -#define __otbJointMassOfBeliefFilter_txx +#ifndef otbJointMassOfBeliefFilter_txx +#define otbJointMassOfBeliefFilter_txx #include "otbJointMassOfBeliefFilter.h" @@ -83,7 +83,7 @@ JointMassOfBeliefFilter<TMassFunction> { if(this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<MassFunctionType *>(this->itk::ProcessObject::GetOutput(0)); } diff --git a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h index 2f21fda44c86de63a3b04cd58d960533557d98ec..6979f33e5fcc21ebe72366a5f23f3c3eb7c780b7 100644 --- a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h +++ b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMassOfBelief_h -#define __otbMassOfBelief_h +#ifndef otbMassOfBelief_h +#define otbMassOfBelief_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -177,10 +177,10 @@ protected: MassOfBelief() {} /** Desctructor */ - virtual ~MassOfBelief() {} + ~MassOfBelief() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: MassOfBelief(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.txx b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.txx index 6a453de2ae9296fbc1700536ebbb5b4f1f45e238..6717226e3795a4f528336f2b41d9d86015433d2c 100644 --- a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.txx +++ b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMassOfBelief_txx -#define __otbMassOfBelief_txx +#ifndef otbMassOfBelief_txx +#define otbMassOfBelief_txx #include "otbMassOfBelief.h" diff --git a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h index 7c3c11c362d22799f92c32639eec19777dda4283..e56b75033ddc01fbdc63b0755e969b0749c86396 100644 --- a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h +++ b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardDSCostFunction_h -#define __otbStandardDSCostFunction_h +#ifndef otbStandardDSCostFunction_h +#define otbStandardDSCostFunction_h #include "itkSingleValuedCostFunction.h" @@ -92,14 +92,14 @@ public: /** This method returns the value of the cost function corresponding * to the specified parameters. */ - virtual MeasureType GetValue( const ParametersType & parameters ) const; + MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; /** This method returns the derivative of the cost function corresponding * to the specified parameters. */ - virtual void GetDerivative( const ParametersType & parameters, - DerivativeType & derivative ) const; + void GetDerivative( const ParametersType & parameters, + DerivativeType & derivative ) const ITK_OVERRIDE; - virtual unsigned int GetNumberOfParameters(void) const; + unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE; itkSetMacro(Weight, double); itkGetConstMacro(Weight, double); @@ -148,9 +148,9 @@ protected: /** Constructor */ StandardDSCostFunction(); /** Destructor */ - virtual ~StandardDSCostFunction() {} + ~StandardDSCostFunction() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: StandardDSCostFunction(const Self &); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.txx b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.txx index f47c10db7dc6dae675512434745015619905ec3e..6eb70e5a6bc4efbb3c71b318d8510f809f8b6022 100644 --- a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.txx +++ b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStandardDSCostFunction_txx -#define __otbStandardDSCostFunction_txx +#ifndef otbStandardDSCostFunction_txx +#define otbStandardDSCostFunction_txx #include "otbStandardDSCostFunction.h" diff --git a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h index 2fdec1e6698ad43b42dbdcb5ffed558dafb6ba15..715f33416b08e1a46a56d3e2d9d67f6c135eb744 100644 --- a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToDSValidatedVectorDataFilter_h -#define __otbVectorDataToDSValidatedVectorDataFilter_h +#ifndef otbVectorDataToDSValidatedVectorDataFilter_h +#define otbVectorDataToDSValidatedVectorDataFilter_h #include "otbMassOfBelief.h" @@ -158,13 +158,13 @@ public: protected: /** Triggers the Computation */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ VectorDataToDSValidatedVectorDataFilter(); /** Destructor */ - virtual ~VectorDataToDSValidatedVectorDataFilter() {} + ~VectorDataToDSValidatedVectorDataFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; std::string GetNextID() { diff --git a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.txx b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.txx index 2054231407ba977ab4865fc662cd87cf29a88a22..746433b8e322fc490a6d0b57e435b69898de1788 100644 --- a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.txx +++ b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToDSValidatedVectorDataFilter_txx -#define __otbVectorDataToDSValidatedVectorDataFilter_txx +#ifndef otbVectorDataToDSValidatedVectorDataFilter_txx +#define otbVectorDataToDSValidatedVectorDataFilter_txx #include "otbVectorDataToDSValidatedVectorDataFilter.h" #include <iostream> diff --git a/Modules/Learning/LearningBase/include/otbDecisionTree.h b/Modules/Learning/LearningBase/include/otbDecisionTree.h index e782ba0f13aa4a782f5406d186513a6edd17c482..d8f6378f5cc24ab0aaf8a5b3a1e3cd83367be910 100644 --- a/Modules/Learning/LearningBase/include/otbDecisionTree.h +++ b/Modules/Learning/LearningBase/include/otbDecisionTree.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDecisionTree_h -#define __otbDecisionTree_h +#ifndef otbDecisionTree_h +#define otbDecisionTree_h #include <map> #include "itkObjectFactory.h" @@ -97,11 +97,11 @@ protected: /** Constructor */ DecisionTree(); /** Destructor */ - virtual ~DecisionTree(); + ~DecisionTree() ITK_OVERRIDE; /** Output information redefinition */ /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: DecisionTree(const Self &); // purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbDecisionTree.txx b/Modules/Learning/LearningBase/include/otbDecisionTree.txx index 6265ad29b3a619ef8b192c08b21777d4c44bffa0..2b4d8d61a9d3f8193d29f51c61c0663db388c35d 100644 --- a/Modules/Learning/LearningBase/include/otbDecisionTree.txx +++ b/Modules/Learning/LearningBase/include/otbDecisionTree.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDecisionTree_txx -#define __otbDecisionTree_txx +#ifndef otbDecisionTree_txx +#define otbDecisionTree_txx #include "otbDecisionTree.h" #include "otbMacro.h" diff --git a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h index ecc4cb26515708e2408e3d0948bf60c511f56d4b..31915c70c86dbd32c33cf68447e786faf5cd971e 100644 --- a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h +++ b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaussianModelComponent_h -#define __otbGaussianModelComponent_h +#ifndef otbGaussianModelComponent_h +#define otbGaussianModelComponent_h #include "itkCovarianceSampleFilter.h" #include "itkGaussianMembershipFunction.h" @@ -78,21 +78,21 @@ public: typedef typename CovarianceEstimatorType::MatrixType CovarianceType; /** Sets the input sample */ - virtual void SetSample(const TSample* sample); + void SetSample(const TSample* sample) ITK_OVERRIDE; /** Sets the component's distribution parameters. * e.g. Then user can call directly Pdf( MeasurementVectorType & ) */ void SetParameters(const ParametersType& parameters); /** Show the parameters in a minimal form in comparison to PrintSelf */ - virtual void ShowParameters(std::ostream& os, itk::Indent indent) const; + void ShowParameters(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; protected: GaussianModelComponent(); - virtual ~GaussianModelComponent() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~GaussianModelComponent() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: GaussianModelComponent(const Self &); //purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx index d420d84070ee859167619653435c97ff3c093c9c..d4ab209ef3b1e0f51ca2a25f80f12642a16d7857 100644 --- a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx +++ b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGaussianModelComponent_txx -#define __otbGaussianModelComponent_txx +#ifndef otbGaussianModelComponent_txx +#define otbGaussianModelComponent_txx #include <iostream> @@ -35,8 +35,8 @@ template<class TSample> GaussianModelComponent<TSample> ::GaussianModelComponent() { - m_CovarianceEstimator = 0; - m_GaussianMembershipFunction = 0; + m_CovarianceEstimator = ITK_NULLPTR; + m_GaussianMembershipFunction = ITK_NULLPTR; } template<class TSample> diff --git a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h index b8b95d5c28316c1e0fee8a7f70c126d8039c8b1b..4ddf04a079dc8eae33c8a63cc98e360536a4d1b4 100644 --- a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h +++ b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMeansImageClassificationFilter_h -#define __otbKMeansImageClassificationFilter_h +#ifndef otbKMeansImageClassificationFilter_h +#define otbKMeansImageClassificationFilter_h #include "itkInPlaceImageFilter.h" #include "itkListSample.h" @@ -103,14 +103,14 @@ protected: /** Constructor */ KMeansImageClassificationFilter(); /** Destructor */ - virtual ~KMeansImageClassificationFilter() {} + ~KMeansImageClassificationFilter() ITK_OVERRIDE {} /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: KMeansImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.txx b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.txx index 258134e685d10cb6b9e5b10463d12496f2262142..9a4a3146b6b85cafb558756e02535af8ef2f6cb9 100644 --- a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.txx +++ b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKMeansImageClassificationFilter_txx -#define __otbKMeansImageClassificationFilter_txx +#ifndef otbKMeansImageClassificationFilter_txx +#define otbKMeansImageClassificationFilter_txx #include "otbKMeansImageClassificationFilter.h" #include "itkImageRegionIterator.h" @@ -52,7 +52,7 @@ KMeansImageClassificationFilter<TInputImage, TOutputImage, VMaxSampleDimension, { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/LearningBase/include/otbSEMClassifier.h b/Modules/Learning/LearningBase/include/otbSEMClassifier.h index e23db49440f1168fa424d2a7e8665b09c770aec7..43c5daa27c919271dc88c8a25e7d1e99e827d624 100644 --- a/Modules/Learning/LearningBase/include/otbSEMClassifier.h +++ b/Modules/Learning/LearningBase/include/otbSEMClassifier.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSEMClassifier_h -#define __otbSEMClassifier_h +#ifndef otbSEMClassifier_h +#define otbSEMClassifier_h #include "itkListSample.h" #include "itkSampleClassifierFilter.h" @@ -154,7 +154,7 @@ public: int AddComponent(int id, ComponentType* component); /** Runs the optimization process. */ - void Update(); + void Update() ITK_OVERRIDE; /** Termination status after running optimization */ typedef enum { CONVERGED = 0, NOT_CONVERGED = 1 } TerminationCodeType; @@ -174,12 +174,12 @@ public: /* Return the classification result (as an image) */ TOutputImage * GetOutputImage(); - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; protected: SEMClassifier(); - virtual ~SEMClassifier() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SEMClassifier() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Initialize the first segmentation, either randomly or by using * a ClassLabelVectorType given in SetClassLabels. */ diff --git a/Modules/Learning/LearningBase/include/otbSEMClassifier.txx b/Modules/Learning/LearningBase/include/otbSEMClassifier.txx index 9222684ae6399ff6e5c4c3440b045934b800dc0e..28ae59d6db5246eba647c98ec6bdadcb77ad5841 100644 --- a/Modules/Learning/LearningBase/include/otbSEMClassifier.txx +++ b/Modules/Learning/LearningBase/include/otbSEMClassifier.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSEMClassifier_txx -#define __otbSEMClassifier_txx +#ifndef otbSEMClassifier_txx +#define otbSEMClassifier_txx #include <cstdlib> @@ -42,15 +42,15 @@ SEMClassifier<TInputImage, TOutputImage> m_TerminationCode = NOT_CONVERGED; m_ExternalLabels = 0; m_ComponentDeclared = 0; - m_Sample = 0; + m_Sample = ITK_NULLPTR; m_NbSamples = 0; - m_SampleList = 0; + m_SampleList = ITK_NULLPTR; m_NbChange = 0; m_TerminationThreshold = 1E-5; m_Neighborhood = 1; - m_OutputImage = 0; - m_Output = 0; + m_OutputImage = ITK_NULLPTR; + m_Output = ITK_NULLPTR; } @@ -164,7 +164,7 @@ SEMClassifier<TInputImage, TOutputImage> typename TInputImage::SizeType size = imgLabels->GetBufferedRegion().GetSize(); int theSize = (int) size[0] * size[1]; - if (m_Sample == NULL) + if (m_Sample == ITK_NULLPTR) { m_ClassLabels.resize(theSize); diff --git a/Modules/Learning/Markov/include/otbMRFEnergy.h b/Modules/Learning/Markov/include/otbMRFEnergy.h index a1830d5cbcfea7f004ce20dbd52e62baa8e6d5b9..f2af4cf962c425b806fb07c7ca4246aa52e3e47d 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergy.h +++ b/Modules/Learning/Markov/include/otbMRFEnergy.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFEnergy_h -#define __otbMRFEnergy_h +#ifndef otbMRFEnergy_h +#define otbMRFEnergy_h #include "itkConstNeighborhoodIterator.h" #include "itkObject.h" @@ -139,7 +139,7 @@ protected: MRFEnergy() : m_NumberOfParameters(1), m_Parameters(0) {}; - virtual ~MRFEnergy() {} + ~MRFEnergy() ITK_OVERRIDE {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; }; @@ -221,7 +221,7 @@ protected: m_NumberOfParameters(1), m_Parameters(0) {}; - virtual ~MRFEnergy() {} + ~MRFEnergy() ITK_OVERRIDE {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; }; diff --git a/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h b/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h index 8fca36556d398d7a2135a578aba240ccd6836849..fa3df033cca15aa1861601ece77694a0db044bc0 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFEnergyEdgeFidelity_h -#define __otbMRFEnergyEdgeFidelity_h +#ifndef otbMRFEnergyEdgeFidelity_h +#define otbMRFEnergyEdgeFidelity_h #include "otbMRFEnergy.h" @@ -60,7 +60,7 @@ public: itkTypeMacro(MRFEnergyEdgeFidelity, MRFEnergy); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE { double val1 = static_cast<double>(value1); double val2 = static_cast<double>(value2); @@ -71,7 +71,7 @@ public: protected: // The constructor and destructor. MRFEnergyEdgeFidelity() {}; - virtual ~MRFEnergyEdgeFidelity() {} + ~MRFEnergyEdgeFidelity() ITK_OVERRIDE {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h index 171d21fcfc7d806d06f86f531088791b54a04d09..f0aaae39dac4487f12ae194a42be9ba91e035f85 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFEnergyFisherClassification_h -#define __otbMRFEnergyFisherClassification_h +#ifndef otbMRFEnergyFisherClassification_h +#define otbMRFEnergyFisherClassification_h #include "otbMRFEnergy.h" #include "otbMath.h" @@ -58,14 +58,14 @@ public: itkNewMacro(Self); itkTypeMacro(MRFEnergyFisherClassification, MRFEnergy); - void SetNumberOfParameters(const unsigned int nParameters) + void SetNumberOfParameters(const unsigned int nParameters) ITK_OVERRIDE { Superclass::SetNumberOfParameters(nParameters); this->m_Parameters.SetSize(nParameters); this->Modified(); } - double GetSingleValue(const InputImagePixelType & value1, const LabelledImagePixelType & value2) + double GetSingleValue(const InputImagePixelType & value1, const LabelledImagePixelType & value2) ITK_OVERRIDE { if ((unsigned int)value2 >= this->GetNumberOfParameters()/3) { @@ -87,7 +87,7 @@ public: protected: // The constructor and destructor. MRFEnergyFisherClassification() {}; - virtual ~MRFEnergyFisherClassification() {}; + ~MRFEnergyFisherClassification() ITK_OVERRIDE {}; }; } #endif diff --git a/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h b/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h index 64a8b3be4690ea46b0815a558f290cfdf533132b..b4b86e0264b8b1d89a72b881bce39a9838894292 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFEnergyGaussian_h -#define __otbMRFEnergyGaussian_h +#ifndef otbMRFEnergyGaussian_h +#define otbMRFEnergyGaussian_h #include "otbMRFEnergy.h" @@ -65,7 +65,7 @@ public: itkNewMacro(Self); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE { return vnl_math_sqr((static_cast<double>(value1)) - (static_cast<double>(value2))); @@ -78,7 +78,7 @@ protected: this->m_NumberOfParameters = 0; this->m_Parameters.SetSize(this->m_NumberOfParameters); }; - virtual ~MRFEnergyGaussian() {} + ~MRFEnergyGaussian() ITK_OVERRIDE {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h b/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h index f576df6b739f58dcbd521b2915f2a00436daa57c..ccea47d6a04f031c314f6ce5bfbdbebc621f8339 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFEnergyGaussianClassification_h -#define __otbMRFEnergyGaussianClassification_h +#ifndef otbMRFEnergyGaussianClassification_h +#define otbMRFEnergyGaussianClassification_h #include "otbMRFEnergy.h" #include "otbMath.h" @@ -61,14 +61,14 @@ public: itkTypeMacro(MRFEnergyGaussianClassification, MRFEnergy); - void SetNumberOfParameters(const unsigned int nParameters) + void SetNumberOfParameters(const unsigned int nParameters) ITK_OVERRIDE { Superclass::SetNumberOfParameters(nParameters); this->m_Parameters.SetSize(nParameters); this->Modified(); } - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE { if ((unsigned int) value2 >= this->GetNumberOfParameters() / 2) { @@ -86,7 +86,7 @@ public: protected: // The constructor and destructor. MRFEnergyGaussianClassification() {}; - virtual ~MRFEnergyGaussianClassification() {} + ~MRFEnergyGaussianClassification() ITK_OVERRIDE {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyPotts.h b/Modules/Learning/Markov/include/otbMRFEnergyPotts.h index 108da52247b25c88b03a565cef63715e0ab301f3..565c42f7f494b9ef7d924db613a2c6928aed686d 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyPotts.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyPotts.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFEnergyPotts_h -#define __otbMRFEnergyPotts_h +#ifndef otbMRFEnergyPotts_h +#define otbMRFEnergyPotts_h #include "otbMRFEnergy.h" @@ -63,7 +63,7 @@ public: itkNewMacro(Self); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE { if (value1 != value2) { @@ -83,7 +83,7 @@ protected: this->m_Parameters.SetSize(this->m_NumberOfParameters); this->m_Parameters[0] = 1.0; }; - virtual ~MRFEnergyPotts() {} + ~MRFEnergyPotts() ITK_OVERRIDE {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFOptimizer.h b/Modules/Learning/Markov/include/otbMRFOptimizer.h index 10878ea50fd56f92fc047154975c5fa8cb83d372..ee1dbb943af8cf97db73fc6c3ee42cae6bd59629 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizer.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizer.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFOptimizer_h -#define __otbMRFOptimizer_h +#ifndef otbMRFOptimizer_h +#define otbMRFOptimizer_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -73,7 +73,7 @@ protected: MRFOptimizer() : m_NumberOfParameters(1), m_Parameters(1) {} - virtual ~MRFOptimizer() {} + ~MRFOptimizer() ITK_OVERRIDE {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; diff --git a/Modules/Learning/Markov/include/otbMRFOptimizerICM.h b/Modules/Learning/Markov/include/otbMRFOptimizerICM.h index c14e9d8ddcdfd6a6f6f62c63c70cf60a49535607..28974c31d6156257b6752d0f5b190a3760a95416 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizerICM.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizerICM.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFOptimizerICM_h -#define __otbMRFOptimizerICM_h +#ifndef otbMRFOptimizerICM_h +#define otbMRFOptimizerICM_h #include "otbMRFOptimizer.h" @@ -49,7 +49,7 @@ public: itkTypeMacro(MRFOptimizerICM, MRFOptimizer); - inline bool Compute(double deltaEnergy) + inline bool Compute(double deltaEnergy) ITK_OVERRIDE { if (deltaEnergy < 0) { @@ -63,7 +63,7 @@ public: protected: MRFOptimizerICM() {} - virtual ~MRFOptimizerICM() {} + ~MRFOptimizerICM() ITK_OVERRIDE {} }; diff --git a/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h b/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h index 8723fca4f22c7e2b48e7247b6f1bcc4181e2e93d..52f2c01adf8ab8cde11bb31312fa9d932df5e2c9 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFOptimizerMetropolis_h -#define __otbMRFOptimizerMetropolis_h +#ifndef otbMRFOptimizerMetropolis_h +#define otbMRFOptimizerMetropolis_h #include "otbMRFOptimizer.h" #include "otbMath.h" @@ -69,7 +69,7 @@ public: this->Modified(); } - inline bool Compute(double deltaEnergy) + inline bool Compute(double deltaEnergy) ITK_OVERRIDE { if (deltaEnergy < 0) { @@ -109,7 +109,7 @@ protected: m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - virtual ~MRFOptimizerMetropolis() {} + ~MRFOptimizerMetropolis() ITK_OVERRIDE {} RandomGeneratorType::Pointer m_Generator; }; diff --git a/Modules/Learning/Markov/include/otbMRFSampler.h b/Modules/Learning/Markov/include/otbMRFSampler.h index d07a9d7ddc1f3335de84bb13de20ef003d27cf09..3cca0414ac5bc643ba2f5eeda2a6b4dba24c7a8c 100644 --- a/Modules/Learning/Markov/include/otbMRFSampler.h +++ b/Modules/Learning/Markov/include/otbMRFSampler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFSampler_h -#define __otbMRFSampler_h +#ifndef otbMRFSampler_h +#define otbMRFSampler_h #include "otbMRFEnergy.h" #include "itkNeighborhoodIterator.h" @@ -108,7 +108,7 @@ protected: m_EnergyRegularization = EnergyRegularizationType::New(); m_EnergyFidelity = EnergyFidelityType::New(); }; - virtual ~MRFSampler() {} + ~MRFSampler() ITK_OVERRIDE {} }; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerMAP.h b/Modules/Learning/Markov/include/otbMRFSamplerMAP.h index e24ca281d3fca843f546f134b071660d817af890..26c5614ac11a8c03bb10194214ab2829efa839ce 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerMAP.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerMAP.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFSamplerMAP_h -#define __otbMRFSamplerMAP_h +#ifndef otbMRFSamplerMAP_h +#define otbMRFSamplerMAP_h #include "otbMRFSampler.h" @@ -62,7 +62,7 @@ public: itkTypeMacro(MRFSamplerMAP, MRFSampler); inline int Compute(const InputImageNeighborhoodIterator& itData, - const LabelledImageNeighborhoodIterator& itRegul) + const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE { if (this->m_NumberOfClasses == 0) { @@ -100,7 +100,7 @@ public: protected: // The constructor and destructor. MRFSamplerMAP() {}; - virtual ~MRFSamplerMAP() {} + ~MRFSamplerMAP() ITK_OVERRIDE {} }; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerRandom.h b/Modules/Learning/Markov/include/otbMRFSamplerRandom.h index fbd9f3a95bcf7750a5ee64db5ff0b07e8a30ed9b..bdf2714d61f1c9fe03d34f923a42129e9b5387d9 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerRandom.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerRandom.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMRFSamplerRandom_h -#define __otbMRFSamplerRandom_h +#ifndef otbMRFSamplerRandom_h +#define otbMRFSamplerRandom_h #include "otbMRFSampler.h" #include "itkMersenneTwisterRandomVariateGenerator.h" @@ -63,7 +63,7 @@ public: itkTypeMacro(MRFSamplerRandom, MRFSampler); - inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) + inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE { this->m_EnergyBefore = this->m_EnergyFidelity->GetValue(itData, itRegul.GetCenterPixel()); this->m_EnergyBefore += this->m_Lambda @@ -94,7 +94,7 @@ protected: m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - virtual ~MRFSamplerRandom() {} + ~MRFSamplerRandom() ITK_OVERRIDE {} private: RandomGeneratorType::Pointer m_Generator; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h b/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h index 284b6203386e25cdabc0bff947f95fb691aaf869..1b8a953a656a2ef757b480dde4591c340a6778e1 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMRFSamplerRandomMAP_h -#define __otbMRFSamplerRandomMAP_h +#ifndef otbMRFSamplerRandomMAP_h +#define otbMRFSamplerRandomMAP_h #include "itkMersenneTwisterRandomVariateGenerator.h" #include "otbMRFSampler.h" @@ -69,20 +69,20 @@ public: itkTypeMacro(MRFSamplerRandomMAP, MRFSampler); - void SetNumberOfClasses(const unsigned int nClasses) + void SetNumberOfClasses(const unsigned int nClasses) ITK_OVERRIDE { if ((nClasses != this->m_NumberOfClasses) || (m_EnergiesInvalid == true)) { this->m_NumberOfClasses = nClasses; - if (m_Energy != NULL) free(m_Energy); - if (m_RepartitionFunction != NULL) free(m_RepartitionFunction); + if (m_Energy != ITK_NULLPTR) free(m_Energy); + if (m_RepartitionFunction != ITK_NULLPTR) free(m_RepartitionFunction); m_Energy = (double *) calloc(this->m_NumberOfClasses, sizeof(double)); m_RepartitionFunction = (double *) calloc(this->m_NumberOfClasses, sizeof(double)); this->Modified(); } } - inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) + inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE { if (this->m_NumberOfClasses == 0) { @@ -156,17 +156,17 @@ public: protected: // The constructor and destructor. MRFSamplerRandomMAP() : - m_RepartitionFunction(NULL), - m_Energy(NULL), + m_RepartitionFunction(ITK_NULLPTR), + m_Energy(ITK_NULLPTR), m_EnergiesInvalid(true) { m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - virtual ~MRFSamplerRandomMAP() + ~MRFSamplerRandomMAP() ITK_OVERRIDE { - if (m_Energy != NULL) free(m_Energy); - if (m_RepartitionFunction != NULL) free(m_RepartitionFunction); + if (m_Energy != ITK_NULLPTR) free(m_Energy); + if (m_RepartitionFunction != ITK_NULLPTR) free(m_RepartitionFunction); } private: diff --git a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h index 6beaa6d2bf4a2181d6938547a69e20766051070f..1b7d2050e14f0d6c734ce8520843b2a2a3895337 100644 --- a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h +++ b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMarkovRandomFieldFilter_h -#define __otbMarkovRandomFieldFilter_h +#ifndef otbMarkovRandomFieldFilter_h +#define otbMarkovRandomFieldFilter_h #include "otbMacro.h" @@ -316,8 +316,8 @@ public: protected: MarkovRandomFieldFilter(); - virtual ~MarkovRandomFieldFilter(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~MarkovRandomFieldFilter() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Allocate memory for labelled images. This is automatically called * in GenerateData(). @@ -332,10 +332,10 @@ protected: virtual void ApplyMarkovRandomFieldFilter(); - virtual void GenerateData(); - virtual void GenerateInputRequestedRegion(); - virtual void EnlargeOutputRequestedRegion(itk::DataObject *); - virtual void GenerateOutputInformation(); + void GenerateData() ITK_OVERRIDE; + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; MarkovRandomFieldFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.txx b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.txx index e7660a677fa291c857d1138098f16e8fb071f5a1..804a4df1aa2be7d8a049feed96f35df21b033b62 100644 --- a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.txx +++ b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbMarkovRandomFieldFilter_txx -#define __otbMarkovRandomFieldFilter_txx +#ifndef otbMarkovRandomFieldFilter_txx +#define otbMarkovRandomFieldFilter_txx #include "otbMarkovRandomFieldFilter.h" namespace otb @@ -79,7 +79,7 @@ MarkovRandomFieldFilter<TInputImage, TClassifiedImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TrainingImageType *> (this->itk::ProcessObject::GetInput(1)); @@ -318,7 +318,7 @@ MarkovRandomFieldFilter<TInputImage, TClassifiedImage> - 2 * m_InputImageNeighborhoodRadius[i]); } - srand((unsigned) time(0)); + srand((unsigned) time(ITK_NULLPTR)); if (!m_EnergyRegularization) { diff --git a/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h b/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h index 19fdf31beb0bc714980a6edc086894887b3afd6c..2b8161a2e56c8fab5c84b6328ca5c79ca515ba29 100644 --- a/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h +++ b/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbCzihoSOMLearningBehaviorFunctor_h -#define __otbCzihoSOMLearningBehaviorFunctor_h +#ifndef otbCzihoSOMLearningBehaviorFunctor_h +#define otbCzihoSOMLearningBehaviorFunctor_h #include "itkSize.h" #include "otbMath.h" diff --git a/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h b/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h index a364d57dc905d8a07259df1891503966f5d0760f..d8190d78b87737e413967c106c6bd265b0b69709 100644 --- a/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h +++ b/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbCzihoSOMNeighborhoodBehaviorFunctor_h -#define __otbCzihoSOMNeighborhoodBehaviorFunctor_h +#ifndef otbCzihoSOMNeighborhoodBehaviorFunctor_h +#define otbCzihoSOMNeighborhoodBehaviorFunctor_h #include "itkSize.h" #include "itkMath.h" diff --git a/Modules/Learning/SOM/include/otbPeriodicSOM.h b/Modules/Learning/SOM/include/otbPeriodicSOM.h index f2c68b51a042f8933728e4d26ceb39a0cb745e4a..c2c9a27649ea1eed26bf5c3329f0ce0f874b9c5f 100644 --- a/Modules/Learning/SOM/include/otbPeriodicSOM.h +++ b/Modules/Learning/SOM/include/otbPeriodicSOM.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbPeriodicSOM_h -#define __otbPeriodicSOM_h +#ifndef otbPeriodicSOM_h +#define otbPeriodicSOM_h #include "otbSOM.h" @@ -89,19 +89,19 @@ protected: /** Constructor */ PeriodicSOM() {} /** Destructor */ - virtual ~PeriodicSOM() {} + ~PeriodicSOM() ITK_OVERRIDE {} /** Output information redefinition */ - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation (); } /** Output allocation redefinition */ - virtual void AllocateOutputs() + void AllocateOutputs() ITK_OVERRIDE { Superclass::AllocateOutputs(); } /** Main computation method */ - virtual void GenerateData(void) + void GenerateData(void) ITK_OVERRIDE { Superclass::GenerateData(); } @@ -111,16 +111,16 @@ protected: * \param beta The learning coefficient, * \param radius The radius of the nieghbourhood. */ - virtual void UpdateMap(const NeuronType& sample, double beta, SizeType& radius); + void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) ITK_OVERRIDE; /** * Step one iteration. */ - virtual void Step(unsigned int currentIteration) + void Step(unsigned int currentIteration) ITK_OVERRIDE { Superclass::Step(currentIteration); } /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Learning/SOM/include/otbPeriodicSOM.txx b/Modules/Learning/SOM/include/otbPeriodicSOM.txx index 4876824b15856cd2ce2cbbd178dd2032253a1f0a..1121298e2190afee4cb6c370637e3c6c90dd2c6d 100644 --- a/Modules/Learning/SOM/include/otbPeriodicSOM.txx +++ b/Modules/Learning/SOM/include/otbPeriodicSOM.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbPeriodicSOM_txx -#define __otbPeriodicSOM_txx +#ifndef otbPeriodicSOM_txx +#define otbPeriodicSOM_txx #include "itkNumericTraits.h" #include "itkNeighborhoodIterator.h" diff --git a/Modules/Learning/SOM/include/otbSOM.h b/Modules/Learning/SOM/include/otbSOM.h index 646488f58638ea9744bd4314f8cdf96bbab6a2be..ea7cf7cd09e7f23bb2f77a3acb049e4b56859c0a 100644 --- a/Modules/Learning/SOM/include/otbSOM.h +++ b/Modules/Learning/SOM/include/otbSOM.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOM_h -#define __otbSOM_h +#ifndef otbSOM_h +#define otbSOM_h #include "itkImageToImageFilter.h" #include "itkEuclideanDistanceMetric.h" @@ -123,13 +123,13 @@ protected: /** Constructor */ SOM(); /** Destructor */ - virtual ~SOM(); + ~SOM() ITK_OVERRIDE; /** Output information redefinition */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Output allocation redefinition */ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** * Update the output map with a new sample. * \param sample The new sample to learn, @@ -142,7 +142,7 @@ protected: */ virtual void Step(unsigned int currentIteration); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SOM(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOM.txx b/Modules/Learning/SOM/include/otbSOM.txx index cdc5066cfd1197122946331dd6bc69ee369c0a45..2f811d68e7bc32b5963f40a5e68617d029dbfe12 100644 --- a/Modules/Learning/SOM/include/otbSOM.txx +++ b/Modules/Learning/SOM/include/otbSOM.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOM_txx -#define __otbSOM_txx +#ifndef otbSOM_txx +#define otbSOM_txx #include "otbSOM.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Learning/SOM/include/otbSOMActivationBuilder.h b/Modules/Learning/SOM/include/otbSOMActivationBuilder.h index 3232e4d9c57d7cf4a5ee2cee632b9b5f40c8c027..fd88a2c145c5ac4fe5baefb6eae21f87676f06c0 100644 --- a/Modules/Learning/SOM/include/otbSOMActivationBuilder.h +++ b/Modules/Learning/SOM/include/otbSOMActivationBuilder.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMActivationBuilder_h -#define __otbSOMActivationBuilder_h +#ifndef otbSOMActivationBuilder_h +#define otbSOMActivationBuilder_h #include "itkImageToImageFilter.h" @@ -71,11 +71,11 @@ protected: /** Constructor */ SOMActivationBuilder(); /** Destructor */ - ~SOMActivationBuilder(); + ~SOMActivationBuilder() ITK_OVERRIDE; /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SOMActivationBuilder(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMActivationBuilder.txx b/Modules/Learning/SOM/include/otbSOMActivationBuilder.txx index e8048291e0e59f30311451043c173f79a82a94cf..feaa5c9dc3948b88a9a231e2c1611794e806ae67 100644 --- a/Modules/Learning/SOM/include/otbSOMActivationBuilder.txx +++ b/Modules/Learning/SOM/include/otbSOMActivationBuilder.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMActivationBuilder_txx -#define __otbSOMActivationBuilder_txx +#ifndef otbSOMActivationBuilder_txx +#define otbSOMActivationBuilder_txx +#include "otbSOMActivationBuilder.h" #include "itkImageRegionIterator.h" namespace otb diff --git a/Modules/Learning/SOM/include/otbSOMClassifier.h b/Modules/Learning/SOM/include/otbSOMClassifier.h index 1fa9479a6783776a1eb1428928d5d80bf4b44b19..ed1bd2f6cbbf34c14d0d51a5bedcd0d0db727137 100644 --- a/Modules/Learning/SOM/include/otbSOMClassifier.h +++ b/Modules/Learning/SOM/include/otbSOMClassifier.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMClassifier_h -#define __otbSOMClassifier_h +#ifndef otbSOMClassifier_h +#define otbSOMClassifier_h #include "itkProcessObject.h" #include "itkMembershipSample.h" @@ -85,11 +85,11 @@ protected: /** Constructor */ SOMClassifier(); /** Destructor */ - virtual ~SOMClassifier() {} + ~SOMClassifier() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Starts the classification process */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: /// The input sample diff --git a/Modules/Learning/SOM/include/otbSOMClassifier.txx b/Modules/Learning/SOM/include/otbSOMClassifier.txx index a6d13ee0ae98aaecb92966956800ccef136b744d..2c9e8189e587f042d44b6d6955ec8e2cea72b910 100644 --- a/Modules/Learning/SOM/include/otbSOMClassifier.txx +++ b/Modules/Learning/SOM/include/otbSOMClassifier.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMClassifier_txx -#define __otbSOMClassifier_txx +#ifndef otbSOMClassifier_txx +#define otbSOMClassifier_txx #include "otbSOMClassifier.h" #include "otbMacro.h" diff --git a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h index 111d470af625c2940263389763026f4179654b5b..54d5187c1a77d63d7bc8e5be4af7f9f777f67c4b 100644 --- a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h +++ b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMImageClassificationFilter_h -#define __otbSOMImageClassificationFilter_h +#ifndef otbSOMImageClassificationFilter_h +#define otbSOMImageClassificationFilter_h #include "otbSOMClassifier.h" #include "itkInPlaceImageFilter.h" @@ -101,14 +101,14 @@ protected: /** Constructor */ SOMImageClassificationFilter(); /** Destructor */ - virtual ~SOMImageClassificationFilter() {} + ~SOMImageClassificationFilter() ITK_OVERRIDE {} /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SOMImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.txx b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.txx index 7b2331eed9249908369e716778fe434ddff8e7e1..36dfa8b430ab0fcae6d9ff417665e4e7c43b21e1 100644 --- a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.txx +++ b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMImageClassificationFilter_txx -#define __otbSOMImageClassificationFilter_txx +#ifndef otbSOMImageClassificationFilter_txx +#define otbSOMImageClassificationFilter_txx #include "otbSOMImageClassificationFilter.h" #include "itkImageRegionIterator.h" @@ -52,7 +52,7 @@ SOMImageClassificationFilter<TInputImage, TOutputImage, TSOMMap, TMaskImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h b/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h index 4e38167100cdf4fca1e5a3ed7c441d99186a2698..0ebe5efab813988fa81df90a49d687b088c57e55 100644 --- a/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h +++ b/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSOMLearningBehaviorFunctor_h -#define __otbSOMLearningBehaviorFunctor_h +#ifndef otbSOMLearningBehaviorFunctor_h +#define otbSOMLearningBehaviorFunctor_h namespace otb { diff --git a/Modules/Learning/SOM/include/otbSOMMap.h b/Modules/Learning/SOM/include/otbSOMMap.h index 886e2de5987949b2c8ce86e6368915966d00a9b4..b6c3e3731662015de5a6ed7023c10ca43459d3c5 100644 --- a/Modules/Learning/SOM/include/otbSOMMap.h +++ b/Modules/Learning/SOM/include/otbSOMMap.h @@ -18,8 +18,8 @@ See IMTCopyright.txt for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMMap_h -#define __otbSOMMap_h +#ifndef otbSOMMap_h +#define otbSOMMap_h #include "itkVariableLengthVector.h" #include "itkEuclideanDistanceMetric.h" @@ -91,9 +91,9 @@ protected: /** Constructor */ SOMMap(); /** Destructor */ - virtual ~SOMMap(); + ~SOMMap() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SOMMap(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMMap.txx b/Modules/Learning/SOM/include/otbSOMMap.txx index e36e4d6a66a045afd7ea6f04e1662572b840c9d2..c741be139fd3b18b26b7cbdc0bea41d5726d8a05 100644 --- a/Modules/Learning/SOM/include/otbSOMMap.txx +++ b/Modules/Learning/SOM/include/otbSOMMap.txx @@ -18,9 +18,10 @@ See IMTCopyright.txt for details. PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMMap_txx -#define __otbSOMMap_txx +#ifndef otbSOMMap_txx +#define otbSOMMap_txx +#include "otbSOMMap.h" #include "itkImageRegionIteratorWithIndex.h" namespace otb diff --git a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h index 854bed69c72c02c1fee1475100c16048c1247efa..948e18d6a2998b244b952377666be268a032a27d 100644 --- a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h +++ b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMWithMissingValue_h -#define __otbSOMWithMissingValue_h +#ifndef otbSOMWithMissingValue_h +#define otbSOMWithMissingValue_h #include "otbPeriodicSOM.h" @@ -79,34 +79,34 @@ protected: /** Constructor */ SOMWithMissingValue (); /** Destructor */ - virtual ~SOMWithMissingValue(); + ~SOMWithMissingValue() ITK_OVERRIDE; /** Output information redefinition */ - virtual void GenerateOutputInformation() + void GenerateOutputInformation() ITK_OVERRIDE { Superclass::GenerateOutputInformation (); } /** Output allocation redefinition */ - virtual void AllocateOutputs() + void AllocateOutputs() ITK_OVERRIDE { Superclass::AllocateOutputs(); } /** Main computation method */ - virtual void GenerateData(void) + void GenerateData(void) ITK_OVERRIDE { Superclass::GenerateData(); } /** * Update the output map with a new sample, depending on the availability of the data */ - virtual void UpdateMap(const NeuronType& sample, double beta, SizeType& radius); + void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) ITK_OVERRIDE; /** Step one iteration. */ - virtual void Step(unsigned int currentIteration) + void Step(unsigned int currentIteration) ITK_OVERRIDE { Superclass::Step(currentIteration); } /** PrintSelf method */ -void PrintSelf(std::ostream& os, itk::Indent indent) const; +void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx b/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx index 841dbda280c188228ac3b6d769cb008697457284..5e99c1902437da2b341a79a4797f59dfca63a452 100644 --- a/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx +++ b/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx @@ -17,8 +17,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMWithMissingValue_txx -#define __otbSOMWithMissingValue_txx +#ifndef otbSOMWithMissingValue_txx +#define otbSOMWithMissingValue_txx #include "otbSOMWithMissingValue.h" diff --git a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h index 5935f10ec167d5d27698a3592f8ecfeb415d302c..a2a23c625aa1394ce8a154f32e0c8ede818a9dce 100644 --- a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h +++ b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMbasedImageFilter_h -#define __otbSOMbasedImageFilter_h +#ifndef otbSOMbasedImageFilter_h +#define otbSOMbasedImageFilter_h #include "itkMacro.h" #include "itkUnaryFunctorImageFilter.h" @@ -143,10 +143,10 @@ public: protected: // throw the Map to the functor - virtual void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; SOMbasedImageFilter (); - virtual ~SOMbasedImageFilter () {} + ~SOMbasedImageFilter () ITK_OVERRIDE {} private: SOMbasedImageFilter (const Self &); diff --git a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx index 6e6e4f1a625514aefec8cdb02c4758f89982b936..467981834f2104d9e7fca77941d57d8d1db14af0 100644 --- a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx +++ b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx @@ -18,10 +18,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSOMbasedImageFilter_txx -#define __otbSOMbasedImageFilter_txx +#ifndef otbSOMbasedImageFilter_txx +#define otbSOMbasedImageFilter_txx -#include "otbSOMbasedImageFilter.txx" +#include "otbSOMbasedImageFilter.h" namespace otb { diff --git a/Modules/Learning/SVMLearning/include/otbExhaustiveExponentialOptimizer.h b/Modules/Learning/SVMLearning/include/otbExhaustiveExponentialOptimizer.h index ed26781f16a8696c3228f73f1a8e53d05f90eabd..5a375420c0b3dfbcc5f14ce3dda12c29fd12e8af 100644 --- a/Modules/Learning/SVMLearning/include/otbExhaustiveExponentialOptimizer.h +++ b/Modules/Learning/SVMLearning/include/otbExhaustiveExponentialOptimizer.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbExhaustiveExponentialOptimizer_h -#define __otbExhaustiveExponentialOptimizer_h +#ifndef otbExhaustiveExponentialOptimizer_h +#define otbExhaustiveExponentialOptimizer_h #include "itkSingleValuedNonLinearOptimizer.h" @@ -58,7 +58,7 @@ public: /** Run-time type information (and related methods). */ itkTypeMacro(ExhaustiveExponentialOptimizer, SingleValuedNonLinearOptimizer); - virtual void StartOptimization(void); + void StartOptimization(void) ITK_OVERRIDE; void StartWalking(void); void ResumeWalking(void); @@ -80,8 +80,8 @@ public: protected: ExhaustiveExponentialOptimizer(); - virtual ~ExhaustiveExponentialOptimizer() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ExhaustiveExponentialOptimizer() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Advance to the next grid position. */ void AdvanceOneStep(void); diff --git a/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.h b/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.h index b289706f3d4f4072bdf638f29117c04af7ced39e..deecd347641b28ee05f835bdd48f92a2101516d0 100644 --- a/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.h +++ b/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapSVMClassifier_h -#define __otbLabelMapSVMClassifier_h +#ifndef otbLabelMapSVMClassifier_h +#define otbLabelMapSVMClassifier_h #include "itkInPlaceLabelMapFilter.h" #include "otbSVMModel.h" @@ -87,11 +87,11 @@ public: protected: LabelMapSVMClassifier(); - ~LabelMapSVMClassifier() {}; + ~LabelMapSVMClassifier() ITK_OVERRIDE {}; - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; - virtual void ReleaseInputs(); + void ReleaseInputs() ITK_OVERRIDE; private: diff --git a/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.txx b/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.txx index ff13977208a5ccfa4c97c9bc06453a8c170b78a1..040f46f34d33c83b9581a24be1f4409aa32f1d65 100644 --- a/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.txx +++ b/Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapSVMClassifier_txx -#define __otbLabelMapSVMClassifier_txx +#ifndef otbLabelMapSVMClassifier_txx +#define otbLabelMapSVMClassifier_txx #include "otbLabelMapSVMClassifier.h" diff --git a/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.h b/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.h index 368a80abd99e638385702f9711b0478da3d06ef6..38fcf35cba1717a86f3d789609bfc5145cf2281e 100644 --- a/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.h +++ b/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectDetectionClassifier_h -#define __otbObjectDetectionClassifier_h +#ifndef otbObjectDetectionClassifier_h +#define otbObjectDetectionClassifier_h #include <vector> @@ -120,7 +120,7 @@ public: typedef itk::Statistics::ListSample<DescriptorType> ListSampleType; - void AddInput(itk::DataObject * dataObject) + void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE { this->Superclass::AddInput(dataObject); } @@ -156,29 +156,29 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx); + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; - void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void Reset(void); + void Reset(void) ITK_OVERRIDE; - void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; protected: PersistentObjectDetectionClassifier(); - virtual ~PersistentObjectDetectionClassifier(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~PersistentObjectDetectionClassifier() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId); + itk::ThreadIdType threadId) ITK_OVERRIDE; private: PersistentObjectDetectionClassifier(const Self &); //purposely not implemented @@ -311,7 +311,7 @@ public: return this->GetFilter()->GetOutputVectorData(); } - void AddInput(itk::DataObject * dataObject) + void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE { this->GetFilter()->AddInput(dataObject); } @@ -369,7 +369,7 @@ public: ObjectDetectionClassifier(); /** Destructor */ - virtual ~ObjectDetectionClassifier(); + ~ObjectDetectionClassifier() ITK_OVERRIDE; private: ObjectDetectionClassifier(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.txx b/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.txx index 1cad8598e1813729c518ae9f985248608e64752c..8b41cb9f77ca00e56e0a4591b5a616a8a6a0bb7e 100644 --- a/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.txx +++ b/Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbObjectDetectionClassifier_txx -#define __otbObjectDetectionClassifier_txx +#ifndef otbObjectDetectionClassifier_txx +#define otbObjectDetectionClassifier_txx #include "otbObjectDetectionClassifier.h" diff --git a/Modules/Learning/SVMLearning/include/otbSVMClassifier.h b/Modules/Learning/SVMLearning/include/otbSVMClassifier.h index 4addba806501a994c9e5cb8ce2e3a2b4401d96e2..58e3ca94839df63c559bdd554b85bf75e82d06c7 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMClassifier.h +++ b/Modules/Learning/SVMLearning/include/otbSVMClassifier.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMClassifier_h -#define __otbSVMClassifier_h +#ifndef otbSVMClassifier_h +#define otbSVMClassifier_h #include "vcl_deprecated_header.h" @@ -105,15 +105,15 @@ public: /** Get the number of classes. */ itkGetObjectMacro(Model, SVMModelType); - void Update(); + void Update() ITK_OVERRIDE; protected: SVMClassifier(); - virtual ~SVMClassifier() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SVMClassifier() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Starts the classification process */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; virtual void DoClassification(); private: diff --git a/Modules/Learning/SVMLearning/include/otbSVMClassifier.txx b/Modules/Learning/SVMLearning/include/otbSVMClassifier.txx index 6609f063ba5e1d8ef2439b6aeb19adc2d646e773..f8f65ee6746720a4807942eb858af62bed687f21 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMClassifier.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMClassifier.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMClassifier_txx -#define __otbSVMClassifier_txx +#ifndef otbSVMClassifier_txx +#define otbSVMClassifier_txx #include "otbSVMClassifier.h" #include "otbMacro.h" diff --git a/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.h b/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.h index 50ed01504b46b3699eea107fd404d478a6805331..72d33538acedf45237b6e5a2fff14d4d990189de 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.h +++ b/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMCrossValidationCostFunction_h -#define __otbSVMCrossValidationCostFunction_h +#ifndef otbSVMCrossValidationCostFunction_h +#define otbSVMCrossValidationCostFunction_h #include "otbSVMModel.h" #include "itkSingleValuedCostFunction.h" @@ -84,19 +84,19 @@ public: itkGetMacro(DerivativeStep, ParametersValueType); /** \return The accuracy value corresponding the parameters */ - virtual MeasureType GetValue(const ParametersType& parameters) const; + MeasureType GetValue(const ParametersType& parameters) const ITK_OVERRIDE; /** \return The accuracy derivative corresponding to the parameters */ - virtual void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const; + void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const ITK_OVERRIDE; /** \return the number of parameters to optimize */ - virtual unsigned int GetNumberOfParameters(void) const; + unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE; protected: /// Constructor SVMCrossValidationCostFunction(); /// Destructor - virtual ~SVMCrossValidationCostFunction(); + ~SVMCrossValidationCostFunction() ITK_OVERRIDE; /** Update svm parameters struct according to the input parameters */ diff --git a/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.txx b/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.txx index e09dd8248e530e79e876fd9509a15501b9fd6301..54cc670d0100a991ec3b230c08851150f478acfc 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMCrossValidationCostFunction_txx -#define __otbSVMCrossValidationCostFunction_txx +#ifndef otbSVMCrossValidationCostFunction_txx +#define otbSVMCrossValidationCostFunction_txx #include "otbSVMCrossValidationCostFunction.h" diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.h b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.h index 197f7b536e2c856ae63dcccc797e76a40773e0fc..5513fe4a7c53d1ff94146cad7f00af667447b8a7 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.h +++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMImageClassificationFilter_h -#define __otbSVMImageClassificationFilter_h +#ifndef otbSVMImageClassificationFilter_h +#define otbSVMImageClassificationFilter_h #include "vcl_deprecated_header.h" @@ -104,14 +104,14 @@ protected: /** Constructor */ SVMImageClassificationFilter(); /** Destructor */ - virtual ~SVMImageClassificationFilter() {} + ~SVMImageClassificationFilter() ITK_OVERRIDE {} /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SVMImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.txx b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.txx index 03b9d141f323595359178e4375e42e59026c0646..7c1d5e2717e6e6640c02f8d897e1ed872c82b400 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMImageClassificationFilter_txx -#define __otbSVMImageClassificationFilter_txx +#ifndef otbSVMImageClassificationFilter_txx +#define otbSVMImageClassificationFilter_txx #include "otbSVMImageClassificationFilter.h" #include "itkImageRegionIterator.h" @@ -52,7 +52,7 @@ SVMImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h index 87b9ced538c486766a0a539b9255d6a76f28ca22..04429d0d0cbea0ea2e46369fd78c8c68738ee79c 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h +++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSVMImageClassificationWithRuleFilter_h -#define __otbSVMImageClassificationWithRuleFilter_h +#ifndef otbSVMImageClassificationWithRuleFilter_h +#define otbSVMImageClassificationWithRuleFilter_h #include "otbSVMImageClassificationFilter.h" #include "otbVectorImage.h" @@ -91,21 +91,21 @@ protected: /** Constructor */ SVMImageClassificationWithRuleFilter(); /** Destructor */ - virtual ~SVMImageClassificationWithRuleFilter() {} + ~SVMImageClassificationWithRuleFilter() ITK_OVERRIDE {} /** GenerateOutputInformation * Set the number of bands of the output rule image. * Copy information from the input image if existing. **/ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** AllocateOutputs * Output allocation redefinition for VectorImage (used in TOutputRuleImage) **/ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: SVMImageClassificationWithRuleFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx index cc7ad7f23fe526b3054fdf791783192cc1d412ce..a682561743257fb952451f267e4e8ef47753e7ea 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx @@ -18,8 +18,8 @@ =========================================================================*/ -#ifndef __otbSVMImageClassificationWithRuleFilter_txx -#define __otbSVMImageClassificationWithRuleFilter_txx +#ifndef otbSVMImageClassificationWithRuleFilter_txx +#define otbSVMImageClassificationWithRuleFilter_txx #include "otbSVMImageClassificationWithRuleFilter.h" #include "itkNumericTraits.h" @@ -40,7 +40,7 @@ SVMImageClassificationWithRuleFilter<TInputImage, TOutputImage, TMaskImage> { Superclass::GenerateOutputInformation(); - if (this->GetModel() == NULL) + if (this->GetModel() == ITK_NULLPTR) { itkGenericExceptionMacro(<< "No model for classification"); } @@ -60,7 +60,7 @@ SVMImageClassificationWithRuleFilter<TInputImage, TOutputImage, TMaskImage> { Superclass::AllocateOutputs(); - if (this->GetModel() == NULL) + if (this->GetModel() == ITK_NULLPTR) { itkGenericExceptionMacro(<< "No model for classification"); } diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.h b/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.h index 86232de21a17149507a6a06655f910ed136350df..22818a796c17a37c2b971d988fed4bd5a2da2729 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.h +++ b/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMImageModelEstimator_h -#define __otbSVMImageModelEstimator_h +#ifndef otbSVMImageModelEstimator_h +#define otbSVMImageModelEstimator_h #include "vcl_deprecated_header.h" @@ -108,12 +108,12 @@ protected: /** Constructor */ SVMImageModelEstimator(); /** Destructor */ - virtual ~SVMImageModelEstimator(); + ~SVMImageModelEstimator() ITK_OVERRIDE; /** PrintSelf */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Implement the prepare data step from SVMModelEstimator */ - virtual void PrepareData(); + void PrepareData() ITK_OVERRIDE; private: SVMImageModelEstimator(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.txx b/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.txx index edb0f12c30024e7abaa5c6615cc971bfa2729f1f..082138ca37ea3b69abf3338af49082e15c1bc889 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMImageModelEstimator_txx -#define __otbSVMImageModelEstimator_txx +#ifndef otbSVMImageModelEstimator_txx +#define otbSVMImageModelEstimator_txx #include "otbSVMImageModelEstimator.h" #include "otbMacro.h" @@ -75,7 +75,7 @@ SVMImageModelEstimator<TInputImage, TTrainingImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -87,7 +87,7 @@ SVMImageModelEstimator<TInputImage, TTrainingImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<TTrainingImage *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.h b/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.h index 4c41bcd68a93fae161b8436cda7ce7e7b51f4a14..ad9e72e92ea3263037b2b1cf90bba23b6b9e6153 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.h +++ b/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMMarginSampler_h -#define __otbSVMMarginSampler_h +#ifndef otbSVMMarginSampler_h +#define otbSVMMarginSampler_h #include "itkSampleClassifierFilter.h" #include "itkVectorImage.h" @@ -84,11 +84,11 @@ public: protected: SVMMarginSampler(); - virtual ~SVMMarginSampler() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SVMMarginSampler() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Starts the classification process */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; virtual void DoMarginSampling(); private: diff --git a/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.txx b/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.txx index 48f617a1496f107d1e91dff9ca3fdfb5af85441c..513b09ce50b2634ad1a171413d0ff4427704fd06 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMMarginSampler.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMMarginSampler_txx -#define __otbSVMMarginSampler_txx +#ifndef otbSVMMarginSampler_txx +#define otbSVMMarginSampler_txx #include "otbSVMMarginSampler.h" #include "otbMacro.h" diff --git a/Modules/Learning/SVMLearning/include/otbSVMModel.h b/Modules/Learning/SVMLearning/include/otbSVMModel.h index f64af6c8dd751048e3db01a74d539cbdbd467cd3..030abc9df4a532ffe75456e5dd452baecd111d2a 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMModel.h +++ b/Modules/Learning/SVMLearning/include/otbSVMModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMModel_h -#define __otbSVMModel_h +#ifndef otbSVMModel_h +#define otbSVMModel_h #include "itkObjectFactory.h" #include "itkDataObject.h" @@ -324,13 +324,13 @@ public: double * GetRho(void) const { if (m_Model) return m_Model->rho; - return NULL; + return ITK_NULLPTR; } /** Return the support vectors */ svm_node ** GetSupportVectors(void) { if (m_Model) return m_Model->SV; - return NULL; + return ITK_NULLPTR; } /** Set the support vectors and changes the l number of support vectors accordind to sv.*/ void SetSupportVectors(svm_node ** sv, int nbOfSupportVector); @@ -339,7 +339,7 @@ public: double ** GetAlpha(void) { if (m_Model) return m_Model->sv_coef; - return NULL; + return ITK_NULLPTR; } /** Set the alphas values (SV Coef) */ void SetAlpha(double ** alpha, int nbOfSupportVector); @@ -348,14 +348,14 @@ public: int * GetLabels() { if (m_Model) return m_Model->label; - return NULL; + return ITK_NULLPTR; } /** Get the number of SV per classes */ int * GetNumberOfSVPerClasse() { if (m_Model) return m_Model->nSV; - return NULL; + return ITK_NULLPTR; } struct svm_problem& GetProblem() @@ -412,9 +412,9 @@ protected: /** Constructor */ SVMModel(); /** Destructor */ - virtual ~SVMModel(); + ~SVMModel() ITK_OVERRIDE; /** Display infos */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Delete any allocated problem */ void DeleteProblem(); @@ -423,7 +423,7 @@ protected: void DeleteModel(); /** Initializes default parameters */ - void Initialize(); + void Initialize() ITK_OVERRIDE; private: SVMModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMModel.txx b/Modules/Learning/SVMLearning/include/otbSVMModel.txx index d7a59f3b8e891c3e3b1f05696949e130a9254606..a0b5abb5809a1c010acaa700d6baf692da9d7ba1 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMModel.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMModel_txx -#define __otbSVMModel_txx +#ifndef otbSVMModel_txx +#define otbSVMModel_txx #include "otbSVMModel.h" #include "otbMacro.h" @@ -43,10 +43,10 @@ SVMModel<TValue, TLabel>::SVMModel() this->DoProbabilityEstimates(false); m_Parameters.nr_weight = 0; - m_Parameters.weight_label = NULL; - m_Parameters.weight = NULL; + m_Parameters.weight_label = ITK_NULLPTR; + m_Parameters.weight = ITK_NULLPTR; - m_Model = NULL; + m_Model = ITK_NULLPTR; this->Initialize(); } @@ -83,8 +83,8 @@ SVMModel<TValue, TLabel>::Initialize() // Intialize problem m_Problem.l = 0; - m_Problem.y = NULL; - m_Problem.x = NULL; + m_Problem.y = ITK_NULLPTR; + m_Problem.x = ITK_NULLPTR; m_ProblemUpToDate = false; } @@ -111,7 +111,7 @@ SVMModel<TValue, TLabel>::DeleteModel() { svm_free_and_destroy_model(&m_Model); } - m_Model = NULL; + m_Model = ITK_NULLPTR; } template <class TValue, class TLabel> @@ -122,7 +122,7 @@ SVMModel<TValue, TLabel>::DeleteProblem() if (m_Problem.y) { delete[] m_Problem.y; - m_Problem.y = NULL; + m_Problem.y = ITK_NULLPTR; } if (m_Problem.x) @@ -135,7 +135,7 @@ SVMModel<TValue, TLabel>::DeleteProblem() } } delete[] m_Problem.x; - m_Problem.x = NULL; + m_Problem.x = ITK_NULLPTR; } m_Problem.l = 0; m_ProblemUpToDate = false; @@ -358,7 +358,7 @@ SVMModel<TValue, TLabel>::EvaluateLabel(const MeasurementType& measure) const int nr_class = svm_get_nr_class(m_Model); // Allocate space for labels - double *prob_estimates = NULL; + double *prob_estimates = ITK_NULLPTR; // Eventually allocate space for probabilities if (predict_probability) @@ -532,7 +532,7 @@ SVMModel<TValue, TLabel>::LoadModel(const char* model_file_name) { this->DeleteModel(); m_Model = svm_load_model(model_file_name); - if (m_Model == 0) + if (m_Model == ITK_NULLPTR) { itkExceptionMacro(<< "Problem while loading SVM model " << std::string(model_file_name)); @@ -563,10 +563,10 @@ SVMModel<TValue, TLabel>::SetSupportVectors(svm_node ** sv, int nbOfSupportVecto for (int n = 0; n < m_Model->l; ++n) { - m_Model->SV[n] = NULL; + m_Model->SV[n] = ITK_NULLPTR; } delete[] (m_Model->SV); - m_Model->SV = NULL; + m_Model->SV = ITK_NULLPTR; m_Model->SV = new struct svm_node*[m_Model->l]; diff --git a/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.h b/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.h index 3c944874d1c279e0e1bb7371b70cd777bd04877d..6d899bc3efeca8dd9376605e3ee518e57f459323 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.h +++ b/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMModelEstimator_h -#define __otbSVMModelEstimator_h +#ifndef otbSVMModelEstimator_h +#define otbSVMModelEstimator_h #include "otbSVMModel.h" #include "itkProcessObject.h" @@ -287,11 +287,11 @@ protected: /** Constructor */ SVMModelEstimator(); /** Destructor */ - virtual ~SVMModelEstimator(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SVMModelEstimator() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Starts the modelling process */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** This virtual function must be implemented in subclasses to populate the model with samples */ diff --git a/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.txx b/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.txx index 97a97932616d10d9c9e0a4c44fe8a73fdf8fa360..6e1ffe113b9f79a6653aa6578934c781b17238a0 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMModelEstimator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMModelEstimator_txx -#define __otbSVMModelEstimator_txx +#ifndef otbSVMModelEstimator_txx +#define otbSVMModelEstimator_txx #include "otbSVMModelEstimator.h" #include "otbSVMCrossValidationCostFunction.h" @@ -52,7 +52,7 @@ SVMModelEstimator<InputPixelType, LabelPixelType> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<ModelType *>(this->itk::ProcessObject::GetOutput(0)); } diff --git a/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.h b/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.h index 8f7799c71de17211ac7d72b7a826146c3d629eff..868556e48db1cec7b41e6e3ff20ce9e58f2ac852 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.h +++ b/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMPointSetModelEstimator_h -#define __otbSVMPointSetModelEstimator_h +#ifndef otbSVMPointSetModelEstimator_h +#define otbSVMPointSetModelEstimator_h #include "vcl_deprecated_header.h" @@ -109,11 +109,11 @@ protected: /** Constructor */ SVMPointSetModelEstimator(); /** Destructor */ - virtual ~SVMPointSetModelEstimator(); + ~SVMPointSetModelEstimator() ITK_OVERRIDE; /** PrintSelf */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Prepare data */ - virtual void PrepareData(); + void PrepareData() ITK_OVERRIDE; private: SVMPointSetModelEstimator(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.txx b/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.txx index 0c6cabbc8c63de3c4e469394a47eba4ec20efe28..e4e3e6b0c0cd2c51151f29d3a22f7de45b5f4b03 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMPointSetModelEstimator_txx -#define __otbSVMPointSetModelEstimator_txx +#ifndef otbSVMPointSetModelEstimator_txx +#define otbSVMPointSetModelEstimator_txx #include "otbSVMPointSetModelEstimator.h" #include "itkCommand.h" @@ -74,7 +74,7 @@ SVMPointSetModelEstimator<TInputPointSet, TTrainingPointSet> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TInputPointSet *>(this->itk::ProcessObject::GetInput(0)); } @@ -86,7 +86,7 @@ SVMPointSetModelEstimator<TInputPointSet, TTrainingPointSet> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<TTrainingPointSet *>(this->itk::ProcessObject::GetInput(1)); } diff --git a/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.h b/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.h index 6b86a2ada6e034c84040bd59f1ae07adf9de851b..a2484976ac04c9e9df73d501e94fffb807be0799 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.h +++ b/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMSampleListModelEstimator_h -#define __otbSVMSampleListModelEstimator_h +#ifndef otbSVMSampleListModelEstimator_h +#define otbSVMSampleListModelEstimator_h #include "vcl_deprecated_header.h" @@ -178,12 +178,12 @@ protected: /** Constructor */ SVMSampleListModelEstimator(); /** Destructor */ - virtual ~SVMSampleListModelEstimator(); + ~SVMSampleListModelEstimator() ITK_OVERRIDE; /** PrintSelf */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** PrepareData method */ - virtual void PrepareData(); + void PrepareData() ITK_OVERRIDE; private: SVMSampleListModelEstimator(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.txx b/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.txx index b62a91cb17f8551f58a442bce64d1510cc92bdf4..a379ab5dddb61bba83a8ad410e7bc440f8f76566 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSVMSampleListModelEstimator_txx -#define __otbSVMSampleListModelEstimator_txx +#ifndef otbSVMSampleListModelEstimator_txx +#define otbSVMSampleListModelEstimator_txx #include "otbSVMSampleListModelEstimator.h" #include "itkCommand.h" @@ -79,7 +79,7 @@ SVMSampleListModelEstimator<TInputSampleList, TTrainingSampleList, TMeasurementF { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputSampleListType* > @@ -98,7 +98,7 @@ SVMSampleListModelEstimator<TInputSampleList, TTrainingSampleList, TMeasurementF { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TrainingSampleListType* > diff --git a/Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerTest.cxx b/Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerTest.cxx index dbb718bf271d9a0fe67b50b7f68e49bbc6c9d52e..5a473558dc7c5fade99c1be45c1071bfb847653b 100644 --- a/Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerTest.cxx +++ b/Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerTest.cxx @@ -69,7 +69,7 @@ public: }; /** \return The accuracy value corresponding the parameters */ - virtual MeasureType GetValue(const ParametersType& parameters) const + MeasureType GetValue(const ParametersType& parameters) const ITK_OVERRIDE { return static_cast<MeasureType> ( m_FunctionInternalParameters.GetElement(0) * parameters.GetElement(0) * parameters.GetElement(0) + m_FunctionInternalParameters.GetElement(1) * parameters.GetElement(1) * parameters.GetElement(1) + @@ -80,10 +80,10 @@ public: }; /** \return the number of parameters to optimize */ - virtual unsigned int GetNumberOfParameters(void) const {return 2; }; + unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE {return 2; }; /** \return The accuracy derivative corresponding to the parameters */ - virtual void GetDerivative(const ParametersType& itkNotUsed(parameters), DerivativeType& itkNotUsed(derivative)) const {}; + void GetDerivative(const ParametersType& itkNotUsed(parameters), DerivativeType& itkNotUsed(derivative)) const ITK_OVERRIDE {}; /// Constructor Quadratic2DCostFunction() @@ -92,7 +92,7 @@ public: m_FunctionInternalParameters.Fill(0.0); }; /// Destructor - virtual ~Quadratic2DCostFunction(){}; + ~Quadratic2DCostFunction() ITK_OVERRIDE{}; private: Quadratic2DCostFunction(const Self &); //purposely not implemented diff --git a/Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorModelAccessor.cxx b/Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorModelAccessor.cxx index 7bfa58be34b3ac8177bafebfdc4effe9c0c3812c..b8804b12b32f29e3fab4ecb2cd3565d859d2e984 100644 --- a/Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorModelAccessor.cxx +++ b/Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorModelAccessor.cxx @@ -82,13 +82,13 @@ int otbSVMImageModelEstimatorModelAccessor(int itkNotUsed(argc), char* argv[]) f << " - GetSupportVectors() [nb support vector][]" << std::endl; svm_node ** SVs = ptrModel->GetSupportVectors(); - if (SVs == NULL) + if (SVs == ITK_NULLPTR) { itkGenericExceptionMacro(<< "SVs NULL"); } for (unsigned int i = 0; i < nbSupportVector; ++i) { - if (SVs[i] == NULL) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); + if (SVs[i] == ITK_NULLPTR) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); f << std::endl; f << " SV[" << i << "]:"; const svm_node *p = SVs[i]; @@ -115,7 +115,7 @@ int otbSVMImageModelEstimatorModelAccessor(int itkNotUsed(argc), char* argv[]) f << " - GetRho() [nr_class*(nr_class-1)/2]" << std::endl; unsigned int taille = nbClass * (nbClass - 1) / 2; double * rhos = ptrModel->GetRho(); - if (rhos == NULL) + if (rhos == ITK_NULLPTR) { itkGenericExceptionMacro(<< "rhos NULL"); } @@ -128,13 +128,13 @@ int otbSVMImageModelEstimatorModelAccessor(int itkNotUsed(argc), char* argv[]) f << std::endl; f << " - GetAlpha() [nb class-1][nb support vector]" << std::endl; double ** alphas = ptrModel->GetAlpha(); - if (alphas == NULL) + if (alphas == ITK_NULLPTR) { itkGenericExceptionMacro(<< "alphas NULL"); } for (unsigned int i = 0; i < nbClass - 1; ++i) { - if (alphas[i] == NULL) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); + if (alphas[i] == ITK_NULLPTR) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); f << " "; for (unsigned int j = 0; j < nbSupportVector; ++j) { diff --git a/Modules/Learning/SVMLearning/test/otbSVMModelAccessor.cxx b/Modules/Learning/SVMLearning/test/otbSVMModelAccessor.cxx index 4549a9c732ff60d59f2565b648da694d7f1e3d6e..5523f789697d79a15fc95be3c2a6ac2f3f7a052a 100644 --- a/Modules/Learning/SVMLearning/test/otbSVMModelAccessor.cxx +++ b/Modules/Learning/SVMLearning/test/otbSVMModelAccessor.cxx @@ -48,13 +48,13 @@ int otbSVMModelAccessor(int itkNotUsed(argc), char* argv[]) f << " - GetSupportVectors() [nb support vector][]" << std::endl; svm_node ** SVs = ptrModel->GetSupportVectors(); - if (SVs == NULL) + if (SVs == ITK_NULLPTR) { itkGenericExceptionMacro(<< "SVs NULL"); } for (unsigned int i = 0; i < nbSupportVector; ++i) { - if (SVs[i] == NULL) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); + if (SVs[i] == ITK_NULLPTR) itkGenericExceptionMacro(<< "SVs " << i << " NULL"); f << std::endl; f << " SV[" << i << "]:"; const svm_node *p = SVs[i]; @@ -69,7 +69,7 @@ int otbSVMModelAccessor(int itkNotUsed(argc), char* argv[]) f << " - GetRho() [nr_class*(nr_class-1)/2]" << std::endl; unsigned int taille = nbClass * (nbClass - 1) / 2; double * rhos = ptrModel->GetRho(); - if (rhos == NULL) + if (rhos == ITK_NULLPTR) { itkGenericExceptionMacro(<< "rhos NULL"); } @@ -82,13 +82,13 @@ int otbSVMModelAccessor(int itkNotUsed(argc), char* argv[]) f << std::endl; f << " - GetAlpha() [nb class-1][nb support vector]" << std::endl; double ** alphas = ptrModel->GetAlpha(); - if (alphas == NULL) + if (alphas == ITK_NULLPTR) { itkGenericExceptionMacro(<< "alphas NULL"); } for (unsigned int i = 0; i < nbClass - 1; ++i) { - if (alphas[i] == NULL) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); + if (alphas[i] == ITK_NULLPTR) itkGenericExceptionMacro(<< "alphas " << i << " NULL"); f << " "; for (unsigned int j = 0; j < nbSupportVector; ++j) { diff --git a/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..b561c7896e1f1b2690843453d33ced91d2424963 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h @@ -0,0 +1,191 @@ +/*========================================================================= + + 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 otbImageSampleExtractorFilter_h +#define otbImageSampleExtractorFilter_h + +#include "otbPersistentSamplingFilterBase.h" +#include "otbPersistentFilterStreamingDecorator.h" +#include "otbOGRDataSourceWrapper.h" +#include "otbImage.h" + +namespace otb +{ + +/** + * \class PersistentImageSampleExtractorFilter + * + * \brief Persistent filter to extract sample values from an image + * + * \ingroup OTBSampling + */ +template<class TInputImage> +class ITK_EXPORT PersistentImageSampleExtractorFilter : + public PersistentSamplingFilterBase<TInputImage> +{ +public: + /** Standard Self typedef */ + typedef PersistentImageSampleExtractorFilter Self; + typedef PersistentSamplingFilterBase<TInputImage> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::RegionType RegionType; + typedef typename InputImageType::PointType PointType; + typedef typename InputImageType::IndexType IndexType; + typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::InternalPixelType InternalPixelType; + + typedef ogr::DataSource OGRDataType; + typedef ogr::DataSource::Pointer OGRDataPointer; + + typedef itk::DataObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(PersistentImageSampleExtractorFilter, PersistentSamplingFilterBase); + + /** Set the output samples OGR container + * (shall be equal to the input container for an 'update' mode) */ + void SetOutputSamples(ogr::DataSource* data); + + /** Get the output samples OGR container */ + ogr::DataSource* GetOutputSamples(); + + virtual void Synthetize(void); + + /** Reset method called before starting the streaming*/ + virtual void Reset(void); + + itkSetMacro(SampleFieldPrefix, std::string); + itkGetMacro(SampleFieldPrefix, std::string); + + /** Directly set the output field names (the prefix won't be used) */ + void SetSampleFieldNames(std::vector<std::string> &names); + + /** Get the sample names */ + const std::vector<std::string> & GetSampleFieldNames(); + +protected: + /** Constructor */ + PersistentImageSampleExtractorFilter(); + /** Destructor */ + virtual ~PersistentImageSampleExtractorFilter() {} + + virtual void GenerateOutputInformation(); + + virtual void GenerateInputRequestedRegion(); + + /** process only points */ + virtual void ThreadedGenerateData(const RegionType&, itk::ThreadIdType threadid); + +private: + PersistentImageSampleExtractorFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** Initialize fields to store extracted values (Real type) */ + void InitializeFields(); + + /** Prefix to generate field names for each input channel + * (ignored if the field names are given directly) */ + std::string m_SampleFieldPrefix; + + /** List of field names for each component */ + std::vector<std::string> m_SampleFieldNames; +}; + +/** + * \class ImageSampleExtractorFilter + * + * \brief Extract sample values from an image into an OGRDataSource using a persistent filter + * + * \sa PersistentImageSampleExtractorFilter + * + * \ingroup OTBSampling + */ +template<class TInputImage> +class ITK_EXPORT ImageSampleExtractorFilter : + public PersistentFilterStreamingDecorator<PersistentImageSampleExtractorFilter<TInputImage> > +{ +public: + /** Standard Self typedef */ + typedef ImageSampleExtractorFilter Self; + typedef PersistentFilterStreamingDecorator + <PersistentImageSampleExtractorFilter + <TInputImage> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TInputImage InputImageType; + typedef otb::ogr::DataSource OGRDataType; + + typedef typename Superclass::FilterType FilterType; + + /** Type macro */ + itkNewMacro(Self); + + /** Creation through object factory macro */ + itkTypeMacro(ImageSampleExtractorFilter, PersistentFilterStreamingDecorator); + + using Superclass::SetInput; + virtual void SetInput(const TInputImage* image); + + const TInputImage* GetInput(); + + void SetSamplePositions(const otb::ogr::DataSource* data); + const otb::ogr::DataSource* GetSamplePositions(); + + void SetOutputSamples(OGRDataType::Pointer data); + const otb::ogr::DataSource* GetOutputSamples(); + + void SetOutputFieldPrefix(const std::string &key); + std::string GetOutputFieldPrefix(); + + /** Set the output field names */ + void SetOutputFieldNames(std::vector<std::string> &names); + + /** Get the output field names */ + const std::vector<std::string> & GetOutputFieldNames(); + + void SetLayerIndex(int index); + int GetLayerIndex(); + + void SetClassFieldName(const std::string &name); + std::string GetClassFieldName(void); + +protected: + /** Constructor */ + ImageSampleExtractorFilter() {} + /** Destructor */ + virtual ~ImageSampleExtractorFilter() {} + +private: + ImageSampleExtractorFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented +}; + +} // end of namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbImageSampleExtractorFilter.txx" +#endif + +#endif diff --git a/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.txx b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..cf26b14261f2be795277b117b251c63fe2582cd0 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.txx @@ -0,0 +1,361 @@ +/*========================================================================= + + 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 otbImageSampleExtractorFilter_txx +#define otbImageSampleExtractorFilter_txx + +#include "otbImageSampleExtractorFilter.h" +#include "itkDefaultConvertPixelTraits.h" +#include "itkProgressReporter.h" + +namespace otb +{ +// --------- otb::PersistentImageSampleExtractorFilter --------------------- + +template<class TInputImage> +PersistentImageSampleExtractorFilter<TInputImage> +::PersistentImageSampleExtractorFilter() : + m_SampleFieldPrefix(std::string("band_")) +{ + this->SetNumberOfRequiredOutputs(2); + this->SetNthOutput(0,TInputImage::New()); +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::SetOutputSamples(ogr::DataSource* data) +{ + this->SetNthOutput(1,data); +} + +template<class TInputImage> +ogr::DataSource* +PersistentImageSampleExtractorFilter<TInputImage> +::GetOutputSamples() +{ + if (this->GetNumberOfOutputs() < 2) + { + return 0; + } + return static_cast<ogr::DataSource *>(this->itk::ProcessObject::GetOutput(1)); +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::Synthetize(void) +{ + // clear temporary outputs + this->m_InMemoryOutputs.clear(); +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::Reset(void) +{ + // Check output field names + TInputImage* inputImage = const_cast<TInputImage*>(this->GetInput()); + inputImage->UpdateOutputInformation(); + unsigned int nbBand = inputImage->GetNumberOfComponentsPerPixel(); + if (m_SampleFieldNames.size()) + { + if ( m_SampleFieldNames.size() != nbBand) + { + itkExceptionMacro(<< "Wrong number of field names given, got " + <<m_SampleFieldNames.size() << ", expected "<< nbBand); + } + } + else + { + // use the prefix to create field names + std::ostringstream oss; + for (unsigned int i=0 ; i<nbBand ; ++i) + { + oss.str(""); + oss << this->GetSampleFieldPrefix() << i; + m_SampleFieldNames.push_back(oss.str()); + } + } + // initialize additional fields for output + this->InitializeFields(); + + // initialize output DataSource + ogr::DataSource* inputDS = const_cast<ogr::DataSource*>(this->GetOGRData()); + ogr::DataSource* output = this->GetOutputSamples(); + this->InitializeOutputDataSource(inputDS,output); +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::SetSampleFieldNames(std::vector<std::string> &names) +{ + m_SampleFieldNames.clear(); + for (unsigned int i=0 ; i<names.size() ; i++) + { + m_SampleFieldNames.push_back(names[i]); + } +} + +template<class TInputImage> +const std::vector<std::string> & +PersistentImageSampleExtractorFilter<TInputImage> +::GetSampleFieldNames() +{ + return m_SampleFieldNames; +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::GenerateOutputInformation() +{ + Superclass::GenerateOutputInformation(); + + // Check SRS of input image and samples + std::string projectionRefWkt = this->GetInput()->GetProjectionRef(); + bool projectionInformationAvailable = !projectionRefWkt.empty(); + if(projectionInformationAvailable) + { + OGRSpatialReference imgSRS; + const char *projWktCstr = projectionRefWkt.c_str(); + char **projWktPointer = const_cast<char**>(&projWktCstr); + OGRErr err = imgSRS.importFromWkt( projWktPointer ); + if (err == OGRERR_NONE) + { + // get input layer + ogr::Layer inLayer = this->GetOGRData()->GetLayer(this->GetLayerIndex()); + if ( !imgSRS.IsSame(inLayer.GetSpatialRef()) ) + { + char *layerSrsWkt = NULL; + inLayer.GetSpatialRef()->exportToPrettyWkt(&layerSrsWkt); + itkExceptionMacro(<< "Spatial reference of input image and samples don't match: \n" << projectionRefWkt << "\nvs\n"<< layerSrsWkt); + } + } + } +} + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::GenerateInputRequestedRegion() +{ + InputImageType *input = const_cast<InputImageType*>(this->GetInput()); + RegionType requested = this->GetOutput()->GetRequestedRegion(); + input->SetRequestedRegion(requested); +} + + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::ThreadedGenerateData(const RegionType&, itk::ThreadIdType threadid) +{ + // Retrieve inputs + TInputImage* inputImage = const_cast<TInputImage*>(this->GetInput()); + unsigned int nbBand = inputImage->GetNumberOfComponentsPerPixel(); + + ogr::Layer layer = this->m_InMemoryInputs[threadid]->GetLayerChecked(0); + if (! layer) + { + return; + } + ogr::Layer outputLayer = this->m_InMemoryOutputs[threadid][0]->GetLayerChecked(0); + + itk::ProgressReporter progress( this, threadid, layer.GetFeatureCount(true) ); + + // Loop across the features in the layer (filtered by requested region in BeforeTGD already) + OGRGeometry *geom; + PointType imgPoint; + IndexType imgIndex; + PixelType imgPixel; + double imgComp; + ogr::Layer::const_iterator featIt = layer.begin(); + for(; featIt!=layer.end(); ++featIt) + { + geom = featIt->ogr().GetGeometryRef(); + switch (geom->getGeometryType()) + { + case wkbPoint: + case wkbPoint25D: + { + OGRPoint* castPoint = dynamic_cast<OGRPoint*>(geom); + if (castPoint == NULL) + { + // Wrong Type ! + break; + } + imgPoint[0] = castPoint->getX(); + imgPoint[1] = castPoint->getY(); + inputImage->TransformPhysicalPointToIndex(imgPoint,imgIndex); + imgPixel = inputImage->GetPixel(imgIndex); + + ogr::Feature dstFeature(outputLayer.GetLayerDefn()); + dstFeature.SetFrom( *featIt, TRUE ); + dstFeature.SetFID(featIt->GetFID()); + for (unsigned int i=0 ; i<nbBand ; ++i) + { + imgComp = static_cast<double>(itk::DefaultConvertPixelTraits<PixelType>::GetNthComponent(i,imgPixel)); + // Fill the ouptut OGRDataSource + dstFeature[m_SampleFieldNames[i]].SetValue(imgComp); + } + outputLayer.CreateFeature( dstFeature ); + break; + } + default: + { + otbWarningMacro("Geometry not handled: " << geom->getGeometryName()); + break; + } + } + progress.CompletedPixel(); + } +} + + +template<class TInputImage> +void +PersistentImageSampleExtractorFilter<TInputImage> +::InitializeFields() +{ + this->ClearAdditionalFields(); + for (unsigned int i=0 ; i<m_SampleFieldNames.size() ; ++i) + { + this->CreateAdditionalField(m_SampleFieldNames[i],OFTReal,24,15); + } +} + +// -------------- otb::ImageSampleExtractorFilter -------------------------- + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetInput(const TInputImage* image) +{ + this->GetFilter()->SetInput(image); +} + +template<class TInputImage> +const TInputImage* +ImageSampleExtractorFilter<TInputImage> +::GetInput() +{ + return this->GetFilter()->GetInput(); +} + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetSamplePositions(const otb::ogr::DataSource* data) +{ + this->GetFilter()->SetOGRData(data); +} + +template<class TInputImage> +const otb::ogr::DataSource* +ImageSampleExtractorFilter<TInputImage> +::GetSamplePositions() +{ + return this->GetFilter()->GetOGRData(); +} + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetOutputSamples(OGRDataType::Pointer data) +{ + this->GetFilter()->SetOutputSamples(data); +} + +template<class TInputImage> +const otb::ogr::DataSource* +ImageSampleExtractorFilter<TInputImage> +::GetOutputSamples() +{ + return this->GetFilter()->GetOutputSamples(); +} + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetOutputFieldPrefix(const std::string &key) +{ + this->GetFilter()->SetSampleFieldPrefix(key); +} + +template<class TInputImage> +std::string +ImageSampleExtractorFilter<TInputImage> +::GetOutputFieldPrefix() +{ + return this->GetFilter()->GetSampleFieldPrefix(); +} + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetOutputFieldNames(std::vector<std::string> &names) +{ + this->GetFilter()->SetSampleFieldNames(names); +} + +template<class TInputImage> +const std::vector<std::string> & +ImageSampleExtractorFilter<TInputImage> +::GetOutputFieldNames() +{ + return this->GetFilter()->GetSampleFieldNames(); +} + + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetLayerIndex(int index) +{ + this->GetFilter()->SetLayerIndex(index); +} + +template<class TInputImage> +int +ImageSampleExtractorFilter<TInputImage> +::GetLayerIndex() +{ + return this->GetFilter()->GetLayerIndex(); +} + +template<class TInputImage> +void +ImageSampleExtractorFilter<TInputImage> +::SetClassFieldName(const std::string &name) +{ + this->GetFilter()->SetFieldName(name); +} + +template<class TInputImage> +std::string +ImageSampleExtractorFilter<TInputImage> +::GetClassFieldName(void) +{ + return this->GetFilter()->GetFieldName(); +} + +} // end of namespace otb + +#endif diff --git a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h index 940938a8c1e0238a6d9fd670f46fb405daaf8948..fb6c29339a29cf6cc7dd8b278179fd7c8220772e 100644 --- a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h +++ b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h @@ -15,13 +15,11 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRDataToClassStatisticsFilter_h -#define __otbOGRDataToClassStatisticsFilter_h +#ifndef otbOGRDataToClassStatisticsFilter_h +#define otbOGRDataToClassStatisticsFilter_h -#include "otbPersistentImageFilter.h" +#include "otbPersistentSamplingFilterBase.h" #include "otbPersistentFilterStreamingDecorator.h" -#include "otbOGRDataSourceWrapper.h" -#include "otbPolygonClassStatisticsAccumulator.h" #include "itkSimpleDataObjectDecorator.h" namespace otb @@ -36,12 +34,14 @@ namespace otb */ template<class TInputImage, class TMaskImage> class ITK_EXPORT PersistentOGRDataToClassStatisticsFilter : - public PersistentImageFilter<TInputImage, TInputImage> + public PersistentSamplingFilterBase<TInputImage, TMaskImage> { public: /** Standard Self typedef */ typedef PersistentOGRDataToClassStatisticsFilter Self; - typedef PersistentImageFilter<TInputImage, TInputImage> Superclass; + typedef PersistentSamplingFilterBase< + TInputImage, + TMaskImage> Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -50,16 +50,9 @@ public: typedef typename InputImageType::RegionType RegionType; typedef typename InputImageType::PointType PointType; - typedef TMaskImage MaskImageType; - typedef typename MaskImageType::Pointer MaskImagePointer; - - typedef otb::ogr::DataSource OGRDataType; - typedef otb::ogr::DataSource::Pointer OGRDataPointer; - - typedef otb::PolygonClassStatisticsAccumulator::ClassCountMapType ClassCountMapType; - typedef otb::PolygonClassStatisticsAccumulator::PolygonSizeMapType PolygonSizeMapType; - /** Wrap output type as DataObject */ + typedef std::map<std::string, unsigned long> ClassCountMapType; + typedef std::map<unsigned long, unsigned long> PolygonSizeMapType; typedef itk::SimpleDataObjectDecorator<ClassCountMapType> ClassCountObjectType; typedef itk::SimpleDataObjectDecorator<PolygonSizeMapType> PolygonSizeObjectType; @@ -69,70 +62,57 @@ public: itkNewMacro(Self); /** Runtime information support. */ - itkTypeMacro(PersistentOGRDataToClassStatisticsFilter, PersistentImageFilter); - - void SetOGRData(const otb::ogr::DataSource* vector); - const otb::ogr::DataSource* GetOGRData(); - - void SetMask(const TMaskImage* mask); - const TMaskImage* GetMask(); + itkTypeMacro(PersistentOGRDataToClassStatisticsFilter, PersistentSamplingFilterBase); - void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; /** Reset method called before starting the streaming*/ - void Reset(void); + void Reset(void) ITK_OVERRIDE; - // TODO : prevent loading of data into output - - itkSetMacro(FieldName, std::string); - itkGetMacro(FieldName, std::string); - - itkSetMacro(LayerIndex, int); - itkGetMacro(LayerIndex, int); - - // TODO: store the class count map as output #2 + /** the class count map is stored as output #2 */ const ClassCountObjectType* GetClassCountOutput() const; ClassCountObjectType* GetClassCountOutput(); - // TODO: store the polygon size map as output #3 + /** the polygon size map is stored as output #3 */ const PolygonSizeObjectType* GetPolygonSizeOutput() const; PolygonSizeObjectType* GetPolygonSizeOutput(); /** Make a DataObject of the correct type to be used as the specified * output. */ - virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx); + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; protected: /** Constructor */ PersistentOGRDataToClassStatisticsFilter(); /** Destructor */ - virtual ~PersistentOGRDataToClassStatisticsFilter() {} - - virtual void GenerateOutputInformation(); + ~PersistentOGRDataToClassStatisticsFilter() ITK_OVERRIDE {} - virtual void GenerateInputRequestedRegion(); + /** Implement generic method called at each candidate position */ + void ProcessSample(const ogr::Feature& feature, + typename TInputImage::IndexType& imgIndex, + typename TInputImage::PointType& imgPoint, + itk::ThreadIdType& threadid) ITK_OVERRIDE; - //virtual void BeforeThreadedGenerateData(); - - //virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, - // itk::ThreadIdType threadId); - virtual void GenerateData(); + /** Prepare temporary variables for the current feature */ + void PrepareFeature(const ogr::Feature& feature, + itk::ThreadIdType& threadid) ITK_OVERRIDE; private: PersistentOGRDataToClassStatisticsFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - void ApplyPolygonsSpatialFilter(); - - RegionType FeatureBoundingRegion(const TInputImage* image, otb::ogr::Layer::const_iterator& featIt) const; - - std::string m_FieldName; - - PolygonClassStatisticsAccumulator::Pointer m_TemporaryStats; + /** Number of pixels in all the polygons (per thread) */ + std::vector<unsigned long> m_NbPixelsThread; + /** Number of pixels in each classes (per thread) */ + std::vector<ClassCountMapType> m_ElmtsInClassThread; + /** Number of pixels in each polygons (per thread) */ + std::vector<PolygonSizeMapType> m_PolygonThread; + /** Class name of the current feature (per thread) */ + std::vector<std::string> m_CurrentClass; + /** FID of the current feature (per thread) */ + std::vector<unsigned long> m_CurrentFID; - // Layer to use in the shape file, default to 0 - int m_LayerIndex; }; /** @@ -200,7 +180,7 @@ protected: /** Constructor */ OGRDataToClassStatisticsFilter() {} /** Destructor */ - virtual ~OGRDataToClassStatisticsFilter() {} + ~OGRDataToClassStatisticsFilter() ITK_OVERRIDE {} private: OGRDataToClassStatisticsFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.txx b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.txx index 880e1d19f1bf4484f98d5d1fb0a13aaad6513ccd..a4b3ba5ee1704726f1c389c796d1297c18f39c42 100644 --- a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.txx +++ b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.txx @@ -15,12 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRDataToClassStatisticsFilter_txx -#define __otbOGRDataToClassStatisticsFilter_txx +#ifndef otbOGRDataToClassStatisticsFilter_txx +#define otbOGRDataToClassStatisticsFilter_txx -#include "otbMaskedIteratorDecorator.h" -#include "itkImageRegionConstIteratorWithOnlyIndex.h" -#include "itkImageRegionConstIterator.h" +#include "otbOGRDataToClassStatisticsFilter.h" namespace otb { @@ -28,8 +26,7 @@ namespace otb template<class TInputImage, class TMaskImage> PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::PersistentOGRDataToClassStatisticsFilter() : - m_LayerIndex(0) +::PersistentOGRDataToClassStatisticsFilter() { this->SetNumberOfRequiredOutputs(3); this->SetNthOutput(0,TInputImage::New()); @@ -37,54 +34,14 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> this->SetNthOutput(2,PolygonSizeObjectType::New()); } -template<class TInputImage, class TMaskImage> -void -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::SetOGRData(const otb::ogr::DataSource* vector) -{ - this->SetNthInput(1, const_cast<otb::ogr::DataSource *>( vector )); -} - -template<class TInputImage, class TMaskImage> -const otb::ogr::DataSource* -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::GetOGRData() -{ - if (this->GetNumberOfInputs()<2) - { - return 0; - } - return static_cast<const otb::ogr::DataSource *>(this->itk::ProcessObject::GetInput(1)); -} - -template<class TInputImage, class TMaskImage> -void -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::SetMask(const TMaskImage* mask) -{ - this->SetNthInput(2, const_cast<TMaskImage *>( mask )); -} - -template<class TInputImage, class TMaskImage> -const TMaskImage* -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::GetMask() -{ - if (this->GetNumberOfInputs()<3) - { - return 0; - } - return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(2)); -} - template<class TInputImage, class TMaskImage> void PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> ::Synthetize(void) { otb::ogr::DataSource* vectors = const_cast<otb::ogr::DataSource*>(this->GetOGRData()); - vectors->GetLayer(m_LayerIndex).SetSpatialFilter(NULL); - + vectors->GetLayer(this->GetLayerIndex()).SetSpatialFilter(ITK_NULLPTR); + ClassCountMapType &classCount = this->GetClassCountOutput()->Get(); PolygonSizeMapType &polygonSize = this->GetPolygonSizeOutput()->Get(); @@ -92,8 +49,37 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> classCount.clear(); polygonSize.clear(); // Copy temporary stats to outputs - classCount = m_TemporaryStats->GetClassCountMap(); - polygonSize = m_TemporaryStats->GetPolygonSizeMap(); + for (unsigned int k=0 ; k < this->GetNumberOfThreads() ; k++) + { + ClassCountMapType::iterator itClass = m_ElmtsInClassThread[k].begin(); + for (; itClass != m_ElmtsInClassThread[k].end() ; ++itClass) + { + if (classCount.count(itClass->first)) + { + classCount[itClass->first] += itClass->second; + } + else + { + classCount[itClass->first] = itClass->second; + } + } + PolygonSizeMapType::iterator itPoly = m_PolygonThread[k].begin(); + for (; itPoly != m_PolygonThread[k].end() ; ++itPoly) + { + if (polygonSize.count(itPoly->first)) + { + polygonSize[itPoly->first] += itPoly->second; + } + else + { + polygonSize[itPoly->first] = itPoly->second; + } + } + } + + m_ElmtsInClassThread.clear(); + m_PolygonThread.clear(); + m_NbPixelsThread.clear(); } template<class TInputImage, class TMaskImage> @@ -101,25 +87,15 @@ void PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> ::Reset(void) { - // Get OGR field index - const otb::ogr::DataSource* vectors = this->GetOGRData(); - otb::ogr::Layer::const_iterator featIt = vectors->GetLayer(m_LayerIndex).begin(); - int fieldIndex = featIt->ogr().GetFieldIndex(this->m_FieldName.c_str()); - if (fieldIndex < 0) - { - itkGenericExceptionMacro("Field named "<<this->m_FieldName<<" not found!"); - } + m_ElmtsInClassThread.clear(); + m_PolygonThread.clear(); + m_NbPixelsThread.clear(); - // Reset list of individual containers - //m_TemporaryStats = std::vector<PolygonClassStatisticsAccumulator::Pointer>(numberOfThreads); - //std::vector<PolygonClassStatisticsAccumulator::Pointer>::iterator it = m_TemporaryStats.begin(); - //for (; it != m_TemporaryStats.end(); it++) - //{ - //*it = PolygonClassStatisticsAccumulator::New(); - //(*it)->SetFieldIndex(fieldIndex); - //} - m_TemporaryStats = PolygonClassStatisticsAccumulator::New(); - m_TemporaryStats->SetFieldIndex(fieldIndex); + m_ElmtsInClassThread.resize(this->GetNumberOfThreads()); + m_PolygonThread.resize(this->GetNumberOfThreads()); + m_NbPixelsThread.resize(this->GetNumberOfThreads()); + m_CurrentClass.resize(this->GetNumberOfThreads()); + m_CurrentFID.resize(this->GetNumberOfThreads()); } template<class TInputImage, class TMaskImage> @@ -129,7 +105,7 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const ClassCountObjectType *>(this->itk::ProcessObject::GetOutput(1)); } @@ -141,7 +117,7 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<ClassCountObjectType *>(this->itk::ProcessObject::GetOutput(1)); } @@ -153,7 +129,7 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const PolygonSizeObjectType *>(this->itk::ProcessObject::GetOutput(2)); } @@ -165,7 +141,7 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<PolygonSizeObjectType *>(this->itk::ProcessObject::GetOutput(2)); } @@ -196,170 +172,38 @@ PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> template<class TInputImage, class TMaskImage> void PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::GenerateOutputInformation() -{ - Superclass::GenerateOutputInformation(); - - const MaskImageType *mask = this->GetMask(); - if (mask) - { - const InputImageType *input = this->GetInput(); - if (mask->GetLargestPossibleRegion() != - input->GetLargestPossibleRegion() ) - { - itkGenericExceptionMacro("Mask and input image have a different size!"); - } - if (mask->GetOrigin() != input->GetOrigin()) - { - itkGenericExceptionMacro("Mask and input image have a different origin!"); - } - if (mask->GetSpacing() != input->GetSpacing()) - { - itkGenericExceptionMacro("Mask and input image have a different spacing!"); - } - } -} - -template<class TInputImage, class TMaskImage> -void -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::GenerateInputRequestedRegion() -{ - InputImageType *input = const_cast<InputImageType*>(this->GetInput()); - MaskImageType *mask = const_cast<MaskImageType*>(this->GetMask()); - - RegionType requested = this->GetOutput()->GetRequestedRegion(); - RegionType emptyRegion = input->GetLargestPossibleRegion(); - emptyRegion.SetSize(0,0); - emptyRegion.SetSize(1,0); - - input->SetRequestedRegion(emptyRegion); - - if (mask) - { - mask->SetRequestedRegion(requested); - } -} - -//template<class TInputImage, class TMaskImage> -//void -//PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -//::BeforeThreadedGenerateData() -//{ - //this->ApplyPolygonsSpatialFilter(); -//} - -template<class TInputImage, class TMaskImage> -void -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -//::ThreadedGenerateData(const RegionType& outputRegionForThread, -// itk::ThreadIdType threadId) -::GenerateData() -{ - // Retrieve inputs - TInputImage* inputImage = const_cast<TInputImage*>(this->GetInput()); - TInputImage* outputImage = this->GetOutput(); - TMaskImage* mask = const_cast<TMaskImage*>(this->GetMask()); - const otb::ogr::DataSource* vectors = this->GetOGRData(); - PointType point; - RegionType requestedRegion =outputImage->GetRequestedRegion(); - - this->ApplyPolygonsSpatialFilter(); - - ogr::Layer layer = vectors->GetLayer(m_LayerIndex); - - // Loop across the features in the layer (filtered by requested region in BeforeTGD already) - otb::ogr::Layer::const_iterator featIt = layer.begin(); - for(; featIt!=layer.end(); ++featIt) - { - // Compute the intersection of thread region and polygon bounding region, called "considered region" - // This need not be done in ThreadedGenerateData and could be pre-processed and cached before filter execution if needed - RegionType consideredRegion = FeatureBoundingRegion(inputImage, featIt); - bool regionNotEmpty = consideredRegion.Crop(requestedRegion); - if (regionNotEmpty) - { - if (mask) - { - // For pixels in consideredRegion and not masked - typedef otb::MaskedIteratorDecorator< - itk::ImageRegionConstIterator<TMaskImage>, - itk::ImageRegionConstIterator<TMaskImage> > MaskedIteratorType; - MaskedIteratorType it(mask, mask, consideredRegion); - m_TemporaryStats->Add<MaskedIteratorType>(featIt, it, mask); - } - else - { - typedef itk::ImageRegionConstIteratorWithOnlyIndex<TInputImage> NoValueIteratorType; - NoValueIteratorType it(inputImage,consideredRegion); - m_TemporaryStats->Add<NoValueIteratorType>(featIt, it, inputImage); - } - } - } +::ProcessSample( + const ogr::Feature&, + typename TInputImage::IndexType&, + typename TInputImage::PointType&, + itk::ThreadIdType& threadid) +{ + std::string& className = m_CurrentClass[threadid]; + unsigned long& fId = m_CurrentFID[threadid]; + + m_ElmtsInClassThread[threadid][className]++; + m_PolygonThread[threadid][fId]++; + m_NbPixelsThread[threadid]++; } template<class TInputImage, class TMaskImage> void PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::ApplyPolygonsSpatialFilter() +::PrepareFeature(const ogr::Feature& feature, + itk::ThreadIdType& threadid) { - TInputImage* outputImage = this->GetOutput(); - otb::ogr::DataSource* vectors = const_cast<otb::ogr::DataSource*>(this->GetOGRData()); - const RegionType& requestedRegion = outputImage->GetRequestedRegion(); - typename TInputImage::IndexType startIndex = requestedRegion.GetIndex(); - typename TInputImage::IndexType endIndex = requestedRegion.GetUpperIndex(); - - itk::Point<double, 2> startPoint; - itk::Point<double, 2> endPoint; - - outputImage->TransformIndexToPhysicalPoint(startIndex, startPoint); - outputImage->TransformIndexToPhysicalPoint(endIndex, endPoint); - - vectors->GetLayer(m_LayerIndex).SetSpatialFilterRect( - std::min(startPoint[0],endPoint[0]), - std::min(startPoint[1],endPoint[1]), - std::max(startPoint[0],endPoint[0]), - std::max(startPoint[1],endPoint[1])); -} - -template<class TInputImage, class TMaskImage> -typename PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage>::RegionType -PersistentOGRDataToClassStatisticsFilter<TInputImage,TMaskImage> -::FeatureBoundingRegion(const TInputImage* image, otb::ogr::Layer::const_iterator& featIt) const -{ - // otb::ogr wrapper is incomplete and leaky abstraction is inevitable here - OGREnvelope envelope; - featIt->GetGeometry()->getEnvelope(&envelope); - itk::Point<double, 2> lowerPoint, upperPoint; - lowerPoint[0] = envelope.MinX; - lowerPoint[1] = envelope.MinY; - upperPoint[0] = envelope.MaxX; - upperPoint[1] = envelope.MaxY; - - typename TInputImage::IndexType lowerIndex; - typename TInputImage::IndexType upperIndex; - - image->TransformPhysicalPointToIndex(lowerPoint, lowerIndex); - image->TransformPhysicalPointToIndex(upperPoint, upperIndex); - - // swap coordinate to keep lowerIndex as start index - if (lowerIndex[0] > upperIndex[0]) + std::string className(feature.ogr().GetFieldAsString(this->GetFieldIndex())); + unsigned long fId = feature.ogr().GetFID(); + if (!m_ElmtsInClassThread[threadid].count(className)) { - int tmp = lowerIndex[0]; - lowerIndex[0] = upperIndex[0]; - upperIndex[0] = tmp; + m_ElmtsInClassThread[threadid][className] = 0; } - if (lowerIndex[1] > upperIndex[1]) + if (!m_PolygonThread[threadid].count(fId)) { - int tmp = lowerIndex[1]; - lowerIndex[1] = upperIndex[1]; - upperIndex[1] = tmp; + m_PolygonThread[threadid][fId] = 0; } - - RegionType region; - region.SetIndex(lowerIndex); - region.SetUpperIndex(upperIndex); - - return region; + m_CurrentClass[threadid] = className; + m_CurrentFID[threadid] = fId; } // -------------- otb::OGRDataToClassStatisticsFilter -------------------------- diff --git a/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..10e23d11b3622b6b5a467f0833d4e9d41440690e --- /dev/null +++ b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h @@ -0,0 +1,266 @@ +/*========================================================================= + + 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 otbOGRDataToSamplePositionFilter_h +#define otbOGRDataToSamplePositionFilter_h + +#include "otbPersistentSamplingFilterBase.h" +#include "otbPersistentFilterStreamingDecorator.h" +#include "otbSamplingRateCalculator.h" +#include "otbPeriodicSampler.h" +#include "otbImage.h" + +namespace otb +{ + +/** + * \class PersistentOGRDataToSamplePositionFilter + * + * \brief Persistent filter to extract sample position from an image + * + * This filter uses an input image (to define the sampling grid), an optional + * input mask, and a set of input vectors that define the sampling regions for + * each class. + * + * The filter has a set of samplers (one for each class), they define what + * sampling rate and strategy should be performed. + * + * Several levels of output are supported. For instance, with two outputs : + * when the sampler from level 1 discards a sample, the sampler from level 2 is + * called. + * + * \ingroup OTBSampling + */ +template<class TInputImage, class TMaskImage, class TSampler> +class ITK_EXPORT PersistentOGRDataToSamplePositionFilter : + public PersistentSamplingFilterBase<TInputImage, TMaskImage> +{ +public: + /** Standard Self typedef */ + typedef PersistentOGRDataToSamplePositionFilter Self; + typedef PersistentSamplingFilterBase< + TInputImage, + TMaskImage> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::RegionType RegionType; + typedef typename InputImageType::PointType PointType; + + typedef TMaskImage MaskImageType; + typedef typename MaskImageType::Pointer MaskImagePointer; + + typedef ogr::DataSource OGRDataType; + typedef ogr::DataSource::Pointer OGRDataPointer; + + typedef TSampler SamplerType; + typedef typename SamplerType::Pointer SamplerPointerType; + typedef typename SamplerType::ParameterType SamplerParameterType; + typedef typename std::map + <std::string, SamplerPointerType> SamplerMapType; + + typedef std::map<std::string, unsigned int> ClassPartitionType; + + typedef itk::DataObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(PersistentOGRDataToSamplePositionFilter, PersistentSamplingFilterBase); + + /** Synthetize the persistent filter*/ + virtual void Synthetize(void); + + /** Reset method called before starting the streaming*/ + virtual void Reset(void); + + /** Get a reference to the internal samplers at a given level */ + SamplerMapType& GetSamplers(unsigned int level); + + /** Set an output container for sample position associated + * with corresponding rates, for a given level.*/ + void SetOutputPositionContainerAndRates( + otb::ogr::DataSource* data, + const SamplingRateCalculator::MapRateType& map, + unsigned int level); + + /** Get the output position container of a given level */ + const otb::ogr::DataSource* GetOutputPositionContainer(unsigned int level) const; + otb::ogr::DataSource* GetOutputPositionContainer(unsigned int level); + + /** Get the number of sampling levels used in this filter.*/ + unsigned int GetNumberOfLevels(); + + /** Clear all output position containers */ + void ClearOutputs(); + + /** Make a DataObject of the correct type to be used as the specified + * output. */ + virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx); + using Superclass::MakeOutput; + + /** Get/Set of the field name storing the original FID of each sample */ + itkSetMacro(OriginFieldName, std::string); + itkGetMacro(OriginFieldName, std::string); + +protected: + /** Constructor */ + PersistentOGRDataToSamplePositionFilter(); + /** Destructor */ + virtual ~PersistentOGRDataToSamplePositionFilter() {} + + /** Call samplers on a current position, for a given class */ + virtual void ProcessSample(const ogr::Feature& feature, + typename TInputImage::IndexType& imgIndex, + typename TInputImage::PointType& imgPoint, + itk::ThreadIdType& threadid); + + /** Method to split the input OGRDataSource + * according to the class partition + */ + virtual void DispatchInputVectors(ogr::Layer &inLayer, std::vector<ogr::Layer> &tmpLayers); + +private: + PersistentOGRDataToSamplePositionFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + void ComputeClassPartition(void); + + /** (internal) map associating a class name with a thread number */ + ClassPartitionType m_ClassPartition; + + /** Internal samplers*/ + std::vector<SamplerMapType> m_Samplers; + + /** Field name to store the FID of the geometry each sample comes from */ + std::string m_OriginFieldName; +}; + +/** + * \class OGRDataToSamplePositionFilter + * + * \brief Extracts sample position from an image using a persistent filter + * + * \sa PersistentOGRDataToSamplePositionFilter + * + * \ingroup OTBSampling + */ +template<class TInputImage, class TMaskImage = otb::Image<unsigned char> , class TSampler = otb::PeriodicSampler > +class ITK_EXPORT OGRDataToSamplePositionFilter : + public PersistentFilterStreamingDecorator<PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> > +{ +public: + /** Standard Self typedef */ + typedef OGRDataToSamplePositionFilter Self; + typedef PersistentFilterStreamingDecorator + <PersistentOGRDataToSamplePositionFilter + <TInputImage,TMaskImage,TSampler> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TInputImage InputImageType; + typedef TMaskImage MaskImageType; + typedef otb::ogr::DataSource OGRDataType; + + typedef typename Superclass::FilterType FilterType; + + typedef TSampler SamplerType; + typedef typename SamplerType::Pointer SamplerPointerType; + typedef typename SamplerType::ParameterType SamplerParameterType; + typedef typename std::map + <std::string, SamplerPointerType> SamplerMapType; + + /** Type macro */ + itkNewMacro(Self); + + /** Creation through object factory macro */ + itkTypeMacro(OGRDataToSamplePositionFilter, PersistentFilterStreamingDecorator); + + using Superclass::SetInput; + + /** Set the input image */ + virtual void SetInput(const TInputImage* image); + + /** Get the input image*/ + const TInputImage* GetInput(); + + /** Set the input OGRDataSource containing sampling areas */ + void SetOGRData(const otb::ogr::DataSource* data); + + /** Get the input OGRDataSource containing sampling areas */ + const otb::ogr::DataSource* GetOGRData(); + + /** Set the input mask (optional) */ + void SetMask(const TMaskImage* mask); + + /** Get input mask (may be null)*/ + const TMaskImage* GetMask(); + + /** Set the field name containing class names*/ + void SetFieldName(std::string key); + + /** Get the field name containing class names*/ + std::string GetFieldName(); + + /** Set the layer index containing sampling areas*/ + void SetLayerIndex(int index); + + /** Get the layer index containing sampling areas*/ + int GetLayerIndex(); + + /** Set the sampling parameters for all classes at a given level.*/ + void SetSamplerParameters(SamplerParameterType param, unsigned int level=0); + + /** Get a reference to the internal sampler map at a given level.*/ + SamplerMapType& GetSamplers(unsigned int level=0); + + /** Set the output container with the associated rates at a given level.*/ + void SetOutputPositionContainerAndRates( + otb::ogr::DataSource* data, + const SamplingRateCalculator::MapRateType& map, + unsigned int level=0); + + /** Get the output position container at a given level.*/ + otb::ogr::DataSource* GetOutputPositionContainer(unsigned int level=0); + + /** Set the field name storing the original FID of each sample*/ + void SetOriginFieldName(std::string key); + + /** Get the field name storing the original FID of each sample*/ + std::string GetOriginFieldName(); + +protected: + /** Constructor */ + OGRDataToSamplePositionFilter() {} + /** Destructor */ + virtual ~OGRDataToSamplePositionFilter() {} + +private: + OGRDataToSamplePositionFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented +}; + +} // end of namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbOGRDataToSamplePositionFilter.txx" +#endif + +#endif diff --git a/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..f932ca0e73b11c9d970fc9ba5166b2bb091234ed --- /dev/null +++ b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx @@ -0,0 +1,412 @@ +/*========================================================================= + + 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 otbOGRDataToSamplePositionFilter_txx +#define otbOGRDataToSamplePositionFilter_txx + +#include "otbOGRDataToSamplePositionFilter.h" +#include "itkTimeProbe.h" + +namespace otb +{ +// --------- otb::PersistentOGRDataToSamplePositionFilter --------------------- + +template<class TInputImage, class TMaskImage, class TSampler> +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::PersistentOGRDataToSamplePositionFilter() +{ + this->SetNumberOfRequiredOutputs(2); + m_OriginFieldName = std::string("originfid"); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::Synthetize(void) +{ + // clear temporary outputs + this->m_InMemoryOutputs.clear(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::Reset(void) +{ + // Reset samplers + for (unsigned int i=0 ; i < m_Samplers.size() ; ++i) + { + for (typename SamplerMapType::iterator iter = m_Samplers[i].begin(); + iter != m_Samplers[i].end(); + ++iter) + { + iter->second->Reset(); + } + } + + // Add an extra field for the original FID + this->ClearAdditionalFields(); + this->CreateAdditionalField(this->GetOriginFieldName(),OFTInteger,12); + + // compute label mapping + this->ComputeClassPartition(); + + // Prepare outputs + ogr::DataSource* inputDS = const_cast<ogr::DataSource*>(this->GetOGRData()); + for (unsigned int k=0 ; k < this->GetNumberOfLevels() ; k++) + { + otb::ogr::DataSource* output = this->GetOutputPositionContainer(k); + if (output) + { + this->InitializeOutputDataSource(inputDS, output); + } + } +} + +template<class TInputImage, class TMaskImage, class TSampler> +typename PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler>::SamplerMapType& +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetSamplers(unsigned int level) +{ + if (m_Samplers.size() < (level + 1)) + { + itkExceptionMacro("The sampler level "<< level << " doesn't exist !"); + } + return m_Samplers[level]; +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetOutputPositionContainerAndRates( + otb::ogr::DataSource* data, + const SamplingRateCalculator::MapRateType& map, + unsigned int level) +{ + // set the output dataset + this->SetNthOutput(1+level,data); + // instanciate the corresponding samplers + if (m_Samplers.size() < (level + 1)) + { + m_Samplers.resize(level + 1); + } + m_Samplers[level].clear(); + for (SamplingRateCalculator::MapRateType::const_iterator it = map.begin() ; + it != map.end(); + ++it) + { + SamplerPointerType sampler = SamplerType::New(); + sampler->SetNumberOfElements(it->second.Required,it->second.Tot); + m_Samplers[level][it->first] = sampler; + } +} + +template<class TInputImage, class TMaskImage, class TSampler> +otb::ogr::DataSource* +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetOutputPositionContainer(unsigned int level) +{ + if (this->GetNumberOfOutputs() < (level + 2)) + { + return 0; + } + return static_cast<otb::ogr::DataSource *>(this->itk::ProcessObject::GetOutput(level + 1)); +} + +template<class TInputImage, class TMaskImage, class TSampler> +unsigned int +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetNumberOfLevels() +{ + return (this->GetNumberOfOutputs() - 1); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::ClearOutputs() +{ + // remove output position containers + for (unsigned int i = (this->GetNumberOfOutputs() - 1) ; i > 0 ; --i) + { + this->itk::ProcessObject::RemoveOutput(i); + } + // remove samplers + m_Samplers.clear(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +itk::DataObject::Pointer +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::MakeOutput(DataObjectPointerArraySizeType idx) +{ + if (idx == 0) + { + // the output image + return static_cast<itk::DataObject*>(TInputImage::New().GetPointer()); + } + else if (idx > 0) + { + // sample position containers + return static_cast<itk::DataObject*>(otb::ogr::DataSource::New().GetPointer()); + } + // might as well make an image + return static_cast<itk::DataObject*>(TInputImage::New().GetPointer()); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::ProcessSample(const ogr::Feature& feature, + typename TInputImage::IndexType&, + typename TInputImage::PointType& imgPoint, + itk::ThreadIdType& threadid) +{ + std::string className(feature.ogr().GetFieldAsString(this->GetFieldIndex())); + for (unsigned int i=0 ; i<this->GetNumberOfLevels() ; ++i) + { + if (m_Samplers[i][className]->TakeSample()) + { + OGRPoint ogrTmpPoint; + ogrTmpPoint.setX(imgPoint[0]); + ogrTmpPoint.setY(imgPoint[1]); + + ogr::Layer outputLayer = this->m_InMemoryOutputs[threadid][i]->GetLayerChecked(0); + ogr::Feature feat(outputLayer.GetLayerDefn()); + feat.SetFrom(feature); + feat[this->GetOriginFieldName()].SetValue(static_cast<int>(feature.GetFID())); + feat.SetGeometry(&ogrTmpPoint); + outputLayer.CreateFeature(feat); + break; + } + } +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::DispatchInputVectors(ogr::Layer &inLayer, std::vector<ogr::Layer> &tmpLayers) +{ + OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); + ogr::Layer::const_iterator featIt = inLayer.begin(); + std::string className; + for(; featIt!=inLayer.end(); ++featIt) + { + ogr::Feature dstFeature(layerDefn); + dstFeature.SetFrom( *featIt, TRUE ); + dstFeature.SetFID(featIt->GetFID()); + className = featIt->ogr().GetFieldAsString(this->GetFieldIndex()); + tmpLayers[m_ClassPartition[className]].CreateFeature( dstFeature ); + } +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +PersistentOGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::ComputeClassPartition(void) +{ + m_ClassPartition.clear(); + typedef std::map<std::string, unsigned long> ClassCountMapType; + ClassCountMapType classCounts; + for (typename SamplerMapType::const_iterator it = m_Samplers[0].begin() ; + it != m_Samplers[0].end(); + ++it) + { + classCounts[it->first] = it->second->GetTotalElements(); + } + + int numberOfThreads = this->GetNumberOfThreads(); + typedef std::vector<unsigned long> LoadVectorType; + LoadVectorType currentLoad; + currentLoad.resize(numberOfThreads, 0UL); + + ClassCountMapType::iterator largestClass; + unsigned long minLoad; + unsigned int destThread; + while (classCounts.size()) + { + // find class with highest number of total elements + largestClass = classCounts.begin(); + for (ClassCountMapType::iterator iter = classCounts.begin() ; + iter != classCounts.end() ; + ++iter) + { + if (iter->second > largestClass->second) + { + largestClass = iter; + } + } + + // affect this class to the thread with lowest load + minLoad = currentLoad[0]; + destThread = 0; + for (unsigned int k = 0 ; k < currentLoad.size() ; ++k) + { + if (currentLoad[k] < minLoad) + { + minLoad = currentLoad[k]; + destThread = k; + } + } + m_ClassPartition[largestClass->first] = destThread; + currentLoad[destThread] += largestClass->second; + + // remove class from classCounts + classCounts.erase(largestClass); + } +} + +// -------------- otb::OGRDataToSamplePositionFilter -------------------------- + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetInput(const TInputImage* image) +{ + this->GetFilter()->SetInput(image); +} + +template<class TInputImage, class TMaskImage, class TSampler> +const TInputImage* +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetInput() +{ + return this->GetFilter()->GetInput(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetOGRData(const otb::ogr::DataSource* data) +{ + this->GetFilter()->SetOGRData(data); +} + +template<class TInputImage, class TMaskImage, class TSampler> +const otb::ogr::DataSource* +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetOGRData() +{ + return this->GetFilter()->GetOGRData(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetMask(const TMaskImage* mask) +{ + this->GetFilter()->SetMask(mask); +} + +template<class TInputImage, class TMaskImage, class TSampler> +const TMaskImage* +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetMask() +{ + return this->GetFilter()->GetMask(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetFieldName(std::string key) +{ + this->GetFilter()->SetFieldName(key); +} + +template<class TInputImage, class TMaskImage, class TSampler> +std::string +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetFieldName() +{ + return this->GetFilter()->GetFieldName(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetLayerIndex(int index) +{ + this->GetFilter()->SetLayerIndex(index); +} + +template<class TInputImage, class TMaskImage, class TSampler> +int +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetLayerIndex() +{ + return this->GetFilter()->GetLayerIndex(); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetSamplerParameters(SamplerParameterType param, unsigned int level) +{ + SamplerMapType &samplers = this->GetSamplers(level); + for (typename SamplerMapType::iterator it = samplers.begin() ; it != samplers.end() ; ++it) + { + it->second->SetParameters(param); + } +} + +template<class TInputImage, class TMaskImage, class TSampler> +typename OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler>::SamplerMapType& +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetSamplers(unsigned int level) +{ + return this->GetFilter()->GetSamplers(level); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetOutputPositionContainerAndRates( + otb::ogr::DataSource* data, + const SamplingRateCalculator::MapRateType& map, + unsigned int level) +{ + this->GetFilter()->SetOutputPositionContainerAndRates(data,map,level); +} + +template<class TInputImage, class TMaskImage, class TSampler> +otb::ogr::DataSource* +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetOutputPositionContainer(unsigned int level) +{ + return this->GetFilter()->GetOutputPositionContainer(level); +} + +template<class TInputImage, class TMaskImage, class TSampler> +void +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::SetOriginFieldName(std::string key) +{ + this->GetFilter()->SetOriginFieldName(key); +} + +template<class TInputImage, class TMaskImage, class TSampler> +std::string +OGRDataToSamplePositionFilter<TInputImage,TMaskImage,TSampler> +::GetOriginFieldName() +{ + return this->GetFilter()->GetOriginFieldName(); +} + +} // end of namespace otb + +#endif diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h new file mode 100644 index 0000000000000000000000000000000000000000..498dfe5383693cdcac7fe22ab7673bedb9970330 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h @@ -0,0 +1,228 @@ +/*========================================================================= + + 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 otbPersistentSamplingFilterBase_h +#define otbPersistentSamplingFilterBase_h + +#include "otbPersistentImageFilter.h" +#include "otbOGRDataSourceWrapper.h" +#include "otbImage.h" + +namespace otb +{ +/** \class PersistentSamplingFilterBase + * \brief Base class for persistent filter doing sampling tasks + * + * \note This class contains pure virtual method, and can not be instantiated. + * + * \sa PersistentOGRDataToClassStatisticsFilter + * \sa PersistentOGRDataToSamplePositionFilter + * + * \ingroup OTBSampling + */ +template <class TInputImage, class TMaskImage = otb::Image<unsigned char,2> > +class ITK_EXPORT PersistentSamplingFilterBase + : public otb::PersistentImageFilter<TInputImage, TInputImage> +{ +public: + /** Standard typedefs */ + typedef PersistentSamplingFilterBase Self; + typedef PersistentImageFilter<TInputImage, TInputImage> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Creation through object factory macro */ + itkTypeMacro(PersistentSamplingFilterBase, PersistentImageFilter); + + /** Template parameters typedefs */ + typedef TInputImage InputImageType; + typedef TMaskImage MaskImageType; + + typedef typename TInputImage::RegionType RegionType; + + typedef ogr::DataSource::Pointer OGRDataPointer; + + /** Set the input OGRDataSource that contains sampling areas for each class*/ + void SetOGRData(const ogr::DataSource* vector); + + /** Get the input OGRDataSource with sampling regions*/ + const ogr::DataSource* GetOGRData(); + + /** Set an input mask (optional) */ + void SetMask(const TMaskImage* mask); + + /** Get the input mask (may be null) */ + const TMaskImage* GetMask(); + + /** Set the OGR layer creation options */ + void SetOGRLayerCreationOptions(const std::vector<std::string> & options); + + /** Get the OGR layer creation options */ + const std::vector<std::string>& GetOGRLayerCreationOptions(); + + /** Set/Get macro for the field name containing class names + * in the input vectors.*/ + itkSetMacro(FieldName, std::string); + itkGetMacro(FieldName, std::string); + + /** Get macro for the field index (deduced from the field name) */ + itkGetMacro(FieldIndex, int); + + /** Set/Get macro for the layer index containing the sampling areas */ + itkSetMacro(LayerIndex, int); + itkGetMacro(LayerIndex, int); + + /** Set/Get macro for the layer name */ + itkSetMacro(OutLayerName, std::string); + itkGetMacro(OutLayerName, std::string); + +protected: + /** Constructor */ + PersistentSamplingFilterBase(); + /** Destructor */ + virtual ~PersistentSamplingFilterBase() {} + + /** Use the same output information as input image, check the field index + * and the mask footprint */ + virtual void GenerateOutputInformation(); + + /** Use an empty region to input image (pixel values not needed) and set + * the requested region for the mask */ + virtual void GenerateInputRequestedRegion(); + + /** Prepare temporary input and output OGR data sources */ + virtual void BeforeThreadedGenerateData(void); + + /** Gather data from multiple threads and + * write to output OGRDataSource (if any) */ + virtual void AfterThreadedGenerateData(void); + + /** Start of main processing loop */ + virtual void ThreadedGenerateData(const RegionType&, itk::ThreadIdType threadid); + + /** Process a geometry, recursive method when the geometry is a collection */ + void ExploreGeometry(const ogr::Feature& feature, + OGRGeometry* geom, + RegionType& region, + itk::ThreadIdType& threadid); + + /** Process a line string : use pixels that cross the line */ + virtual void ProcessLine(const ogr::Feature& feature, + OGRLineString* line, + RegionType& region, + itk::ThreadIdType& threadid); + + /** Process a polygon : use pixels inside the polygon */ + virtual void ProcessPolygon(const ogr::Feature& feature, + OGRPolygon* polygon, + RegionType& region, + itk::ThreadIdType& threadid); + + /** Generic method called for each matching pixel position (NOT IMPLEMENTED)*/ + virtual void ProcessSample(const ogr::Feature& feature, + typename TInputImage::IndexType& imgIndex, + typename TInputImage::PointType& imgPoint, + itk::ThreadIdType& threadid); + + /** Generic method called once before processing each feature */ + virtual void PrepareFeature(const ogr::Feature& feature, + itk::ThreadIdType& threadid); + + /** Common function to test if a point is inside a polygon */ + bool IsSampleInsidePolygon(OGRPolygon* poly, + OGRPoint* tmpPoint); + + /** Common function to test if a pixel crosses the line */ + bool IsSampleOnLine(OGRLineString* line, + typename TInputImage::PointType& position, + typename TInputImage::SpacingType& absSpacing, + OGRPolygon& tmpPolygon); + + /** Get the region bounding a set of features */ + RegionType FeatureBoundingRegion(const TInputImage* image, otb::ogr::Layer::const_iterator& featIt) const; + + /** Prepares in-memory layers for each thread, + * then calls DispatchInputVectors() for the actual dispatch */ + virtual void PrepareInputVectors(); + + /** Method to split the input OGRDataSource between several containers + * for each thread. Default is to put the same number of features for + * each thread.*/ + virtual void DispatchInputVectors(ogr::Layer &inLayer, std::vector<ogr::Layer> &tmpLayers); + + /** Prepare output feature containers for each thread and each output + * OGRDataSource*/ + virtual void PrepareOutputVectors(); + + /** Utility method to add new fields on an output layer */ + virtual void InitializeOutputDataSource(ogr::DataSource* inputDS, ogr::DataSource* outputDS); + + /** In-memory containers storing input geometries for each thread*/ + std::vector<OGRDataPointer> m_InMemoryInputs; + + /** In-memory containers storing position during iteration loop*/ + std::vector<std::vector<OGRDataPointer> > m_InMemoryOutputs; + + typedef struct { + std::string Name; + OGRFieldType Type; + int Width; + int Precision; + } SimpleFieldDefn; + + /** Clear current additional fields */ + void ClearAdditionalFields(); + + /** Create a new additional field */ + void CreateAdditionalField(std::string name, + OGRFieldType type, + int width=0, + int precision=0); + + /** Get a reference over the additional fields */ + const std::vector<SimpleFieldDefn>& GetAdditionalFields(); + +private: + PersistentSamplingFilterBase(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** Field name containing the class name*/ + std::string m_FieldName; + + /** Field index corresponding to the field name m_FieldName */ + int m_FieldIndex; + + /** Layer to use in the input vector file, default to 0 */ + int m_LayerIndex; + + /** name of the output layers */ + std::string m_OutLayerName; + + /** Creation option for output layers */ + std::vector<std::string> m_OGRLayerCreationOptions; + + /** Additional field definitions to add in output data sources */ + std::vector<SimpleFieldDefn> m_AdditionalFields; + +}; +} // End namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbPersistentSamplingFilterBase.txx" +#endif + +#endif diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx new file mode 100644 index 0000000000000000000000000000000000000000..d5b04ef547dd71da99a333cc32295259453b9075 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx @@ -0,0 +1,863 @@ +/*========================================================================= + + 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 otbPersistentSamplingFilterBase_txx +#define otbPersistentSamplingFilterBase_txx + +#include "otbPersistentSamplingFilterBase.h" +#include "otbMaskedIteratorDecorator.h" +#include "itkImageRegionConstIteratorWithOnlyIndex.h" +#include "itkImageRegionConstIterator.h" +#include "otbMacro.h" +#include "itkTimeProbe.h" +#include "itkProgressReporter.h" + +namespace otb +{ + +template<class TInputImage, class TMaskImage> +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::PersistentSamplingFilterBase() + : m_FieldName(std::string("class")) + , m_FieldIndex(0) + , m_LayerIndex(0) + , m_OutLayerName(std::string("output")) + , m_OGRLayerCreationOptions() + , m_AdditionalFields() +{ + this->SetNthOutput(0,TInputImage::New()); +} + + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::SetOGRData(const otb::ogr::DataSource* vector) +{ + this->SetNthInput(1, const_cast<otb::ogr::DataSource *>( vector )); +} + +template<class TInputImage, class TMaskImage> +const otb::ogr::DataSource* +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GetOGRData() +{ + if (this->GetNumberOfInputs()<2) + { + return 0; + } + return static_cast<const otb::ogr::DataSource *>(this->itk::ProcessObject::GetInput(1)); +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::SetMask(const TMaskImage* mask) +{ + this->SetNthInput(2, const_cast<TMaskImage *>( mask )); +} + +template<class TInputImage, class TMaskImage> +const TMaskImage* +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GetMask() +{ + if (this->GetNumberOfInputs()<3) + { + return 0; + } + return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(2)); +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::SetOGRLayerCreationOptions(const std::vector<std::string> & options) +{ + m_OGRLayerCreationOptions.clear(); + m_OGRLayerCreationOptions = options; +} + +template<class TInputImage, class TMaskImage> +const std::vector<std::string>& +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GetOGRLayerCreationOptions() +{ + return m_OGRLayerCreationOptions; +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GenerateOutputInformation() +{ + Superclass::GenerateOutputInformation(); + + // Get OGR field index + const otb::ogr::DataSource* vectors = this->GetOGRData(); + otb::ogr::Layer::const_iterator featIt = vectors->GetLayer(m_LayerIndex).begin(); + int fieldIndex = featIt->ogr().GetFieldIndex(this->m_FieldName.c_str()); + if (fieldIndex < 0) + { + itkGenericExceptionMacro("Field named "<<this->m_FieldName<<" not found!"); + } + this->m_FieldIndex = fieldIndex; + + const MaskImageType *mask = this->GetMask(); + if (mask) + { + const InputImageType *input = this->GetInput(); + if (mask->GetLargestPossibleRegion() != + input->GetLargestPossibleRegion() ) + { + itkGenericExceptionMacro("Mask and input image have a different size!"); + } + if (mask->GetOrigin() != input->GetOrigin()) + { + itkGenericExceptionMacro("Mask and input image have a different origin!"); + } + if (mask->GetSpacing() != input->GetSpacing()) + { + itkGenericExceptionMacro("Mask and input image have a different spacing!"); + } + } +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GenerateInputRequestedRegion() +{ + InputImageType *input = const_cast<InputImageType*>(this->GetInput()); + MaskImageType *mask = const_cast<MaskImageType*>(this->GetMask()); + + RegionType requested = this->GetOutput()->GetRequestedRegion(); + RegionType emptyRegion = input->GetLargestPossibleRegion(); + emptyRegion.SetSize(0,0); + emptyRegion.SetSize(1,0); + + input->SetRequestedRegion(emptyRegion); + + if (mask) + { + mask->SetRequestedRegion(requested); + } +} + + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::BeforeThreadedGenerateData(void) +{ + this->PrepareInputVectors(); + + this->PrepareOutputVectors(); +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::AfterThreadedGenerateData(void) +{ + // clean temporary inputs + this->m_InMemoryInputs.clear(); + + unsigned int numberOfThreads = this->GetNumberOfThreads(); + + unsigned int actualNumberOfThreads = numberOfThreads; + + if(numberOfThreads > this->GetOutput()->GetRequestedRegion().GetSize()[1]) + { + actualNumberOfThreads = this->GetOutput()->GetRequestedRegion().GetSize()[1]; + } + + + // gather temporary outputs and write to output + const otb::ogr::DataSource* vectors = this->GetOGRData(); + itk::TimeProbe chrono; + chrono.Start(); + unsigned int count = 0; + for (unsigned int k=0 ; k < this->GetNumberOfOutputs() ; k++) + { + ogr::DataSource* realOutput = dynamic_cast<ogr::DataSource *>( + this->itk::ProcessObject::GetOutput(k)); + if (realOutput) + { + ogr::Layer outLayer = realOutput->GetLayersCount() == 1 + ? realOutput->GetLayer(0) + : realOutput->GetLayer(m_OutLayerName); + + OGRErr err = outLayer.ogr().StartTransaction(); + if (err != OGRERR_NONE) + { + itkExceptionMacro(<< "Unable to start transaction for OGR layer " << outLayer.ogr().GetName() << "."); + } + + for (unsigned int thread=0 ; thread < actualNumberOfThreads ; thread++) + { + ogr::Layer inLayer = this->m_InMemoryOutputs[thread][count]->GetLayerChecked(0); + if (!inLayer) + { + continue; + } + + ogr::Layer::const_iterator tmpIt = inLayer.begin(); + // This test only uses 1 input, not compatible with multiple OGRData inputs + if (vectors == realOutput) + { + // Update mode + for(; tmpIt!=inLayer.end(); ++tmpIt) + { + outLayer.SetFeature( *tmpIt ); + } + } + else + { + // Copy mode + for(; tmpIt!=inLayer.end(); ++tmpIt) + { + ogr::Feature dstFeature(outLayer.GetLayerDefn()); + dstFeature.SetFrom( *tmpIt, TRUE ); + outLayer.CreateFeature( dstFeature ); + } + } + } + + err = outLayer.ogr().CommitTransaction(); + if (err != OGRERR_NONE) + { + itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << outLayer.ogr().GetName() << "."); + } + count++; + } + } + chrono.Stop(); + otbMsgDebugMacro(<< "write ogr points took " << chrono.GetTotal() << " sec"); +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ThreadedGenerateData(const RegionType&, itk::ThreadIdType threadid) +{ + // Retrieve inputs + TInputImage* inputImage = const_cast<TInputImage*>(this->GetInput()); + TInputImage* outputImage = this->GetOutput(); + RegionType requestedRegion = outputImage->GetRequestedRegion(); + + ogr::Layer layer = this->m_InMemoryInputs.at(threadid)->GetLayerChecked(0); + if (! layer) + { + return; + } + + itk::ProgressReporter progress( this, threadid, layer.GetFeatureCount(true) ); + + // Loop across the features in the layer (filtered by requested region in BeforeTGD already) + ogr::Layer::const_iterator featIt = layer.begin(); + for(; featIt!=layer.end(); ++featIt) + { + // Compute the intersection of thread region and polygon bounding region, called "considered region" + // This need not be done in ThreadedGenerateData and could be pre-processed and cached before filter execution if needed + RegionType consideredRegion = FeatureBoundingRegion(inputImage, featIt); + bool regionNotEmpty = consideredRegion.Crop(requestedRegion); + if (regionNotEmpty) + { + this->PrepareFeature(*featIt,threadid); + this->ExploreGeometry(*featIt, featIt->ogr().GetGeometryRef(),consideredRegion,threadid); + } + progress.CompletedPixel(); + } +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ExploreGeometry(const ogr::Feature& feature, + OGRGeometry* geom, + RegionType& region, + itk::ThreadIdType& threadid) +{ + typename TInputImage::PointType imgPoint; + typename TInputImage::IndexType imgIndex; + + switch (geom->getGeometryType()) + { + case wkbPoint: + case wkbPoint25D: + { + OGRPoint* castPoint = dynamic_cast<OGRPoint*>(geom); + if (castPoint == ITK_NULLPTR) break; + + imgPoint[0] = castPoint->getX(); + imgPoint[1] = castPoint->getY(); + const TInputImage* img = this->GetInput(); + const TMaskImage* mask = this->GetMask(); + img->TransformPhysicalPointToIndex(imgPoint,imgIndex); + if ((mask == ITK_NULLPTR) || mask->GetPixel(imgIndex)) + { + this->ProcessSample(feature, imgIndex, imgPoint, threadid); + } + break; + } + case wkbLineString: + case wkbLineString25D: + { + OGRLineString* castLineString = dynamic_cast<OGRLineString*>(geom); + + if (castLineString == ITK_NULLPTR) break; + this->ProcessLine(feature,castLineString,region,threadid); + break; + } + case wkbPolygon: + case wkbPolygon25D: + { + OGRPolygon* castPolygon = dynamic_cast<OGRPolygon*>(geom); + if (castPolygon == ITK_NULLPTR) break; + this->ProcessPolygon(feature,castPolygon,region,threadid); + break; + } + case wkbMultiPoint: + case wkbMultiPoint25D: + case wkbMultiLineString: + case wkbMultiLineString25D: + case wkbMultiPolygon: + case wkbMultiPolygon25D: + case wkbGeometryCollection: + case wkbGeometryCollection25D: + { + OGRGeometryCollection *geomCollection = dynamic_cast<OGRGeometryCollection*>(geom); + if (geomCollection) + { + unsigned int nbGeom = geomCollection->getNumGeometries(); + for (unsigned int i=0 ; i < nbGeom ; ++i) + { + this->ExploreGeometry(feature, + geomCollection->getGeometryRef(i), + region, + threadid); + } + } + else + { + otbWarningMacro("Geometry not recognized as a collection : " << geom->getGeometryName()); + } + break; + } + default: + { + otbWarningMacro("Geometry not handled: " << geom->getGeometryName()); + break; + } + } +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ProcessLine(const ogr::Feature& feature, + OGRLineString* line, + RegionType& region, + itk::ThreadIdType& threadid) +{ + OGRPolygon tmpPolygon; + OGRLinearRing ring; + ring.addPoint(0.0,0.0,0.0); + ring.addPoint(1.0,0.0,0.0); + ring.addPoint(1.0,1.0,0.0); + ring.addPoint(0.0,1.0,0.0); + ring.addPoint(0.0,0.0,0.0); + tmpPolygon.addRing(&ring); + const TInputImage* img = this->GetInput(); + TMaskImage* mask = const_cast<TMaskImage*>(this->GetMask()); + typename TInputImage::IndexType imgIndex; + typename TInputImage::PointType imgPoint; + typename TInputImage::SpacingType imgAbsSpacing = img->GetSpacing(); + if (imgAbsSpacing[0] < 0) imgAbsSpacing[0] = -imgAbsSpacing[0]; + if (imgAbsSpacing[1] < 0) imgAbsSpacing[1] = -imgAbsSpacing[1]; + + if (mask) + { + // For pixels in consideredRegion and not masked + typedef MaskedIteratorDecorator< + itk::ImageRegionConstIterator<TMaskImage>, + itk::ImageRegionConstIterator<TMaskImage> > MaskedIteratorType; + MaskedIteratorType it(mask, mask, region); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + imgIndex = it.GetIndex(); + img->TransformIndexToPhysicalPoint(imgIndex,imgPoint); + bool isInside = this->IsSampleOnLine(line,imgPoint,imgAbsSpacing,tmpPolygon); + if (isInside) + { + this->ProcessSample(feature,imgIndex, imgPoint, threadid); + } + ++it; + } + } + else + { + typedef itk::ImageRegionConstIteratorWithOnlyIndex<TInputImage> NoValueIteratorType; + NoValueIteratorType it(img,region); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + imgIndex = it.GetIndex(); + img->TransformIndexToPhysicalPoint(imgIndex,imgPoint); + bool isInside = this->IsSampleOnLine(line,imgPoint,imgAbsSpacing,tmpPolygon); + if (isInside) + { + this->ProcessSample(feature,imgIndex, imgPoint, threadid); + } + ++it; + } + } +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ProcessPolygon(const ogr::Feature& feature, + OGRPolygon* polygon, + RegionType& region, + itk::ThreadIdType& threadid) +{ + const TInputImage* img = this->GetInput(); + TMaskImage* mask = const_cast<TMaskImage*>(this->GetMask()); + typename TInputImage::IndexType imgIndex; + typename TInputImage::PointType imgPoint; + OGRPoint tmpPoint; + + if (mask) + { + // For pixels in consideredRegion and not masked + typedef MaskedIteratorDecorator< + itk::ImageRegionConstIterator<TMaskImage>, + itk::ImageRegionConstIterator<TMaskImage> > MaskedIteratorType; + MaskedIteratorType it(mask, mask, region); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + imgIndex = it.GetIndex(); + img->TransformIndexToPhysicalPoint(imgIndex,imgPoint); + tmpPoint.setX(imgPoint[0]); + tmpPoint.setY(imgPoint[1]); + bool isInside = this->IsSampleInsidePolygon(polygon,&tmpPoint); + if (isInside) + { + this->ProcessSample(feature,imgIndex, imgPoint, threadid); + } + ++it; + } + } + else + { + typedef itk::ImageRegionConstIteratorWithOnlyIndex<TInputImage> NoValueIteratorType; + NoValueIteratorType it(img,region); + it.GoToBegin(); + while (!it.IsAtEnd()) + { + imgIndex = it.GetIndex(); + img->TransformIndexToPhysicalPoint(imgIndex,imgPoint); + tmpPoint.setX(imgPoint[0]); + tmpPoint.setY(imgPoint[1]); + bool isInside = this->IsSampleInsidePolygon(polygon,&tmpPoint); + if (isInside) + { + this->ProcessSample(feature,imgIndex, imgPoint, threadid); + } + ++it; + } + } +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ProcessSample(const ogr::Feature& , + typename TInputImage::IndexType& , + typename TInputImage::PointType& , + itk::ThreadIdType& ) +{ + itkExceptionMacro("Method ProcessSample not implemented !"); +} + +template <class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::PrepareFeature(const ogr::Feature&, + itk::ThreadIdType&) +{ + // Nothing to do here +} + +template <class TInputImage, class TMaskImage> +inline bool +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::IsSampleInsidePolygon(OGRPolygon* poly, + OGRPoint* tmpPoint) +{ + bool ret = poly->getExteriorRing()->isPointInRing(tmpPoint); + if (ret) + { + for (int k=0 ; k<poly->getNumInteriorRings() ; k++) + { + if (poly->getInteriorRing(k)->isPointInRing(tmpPoint)) + { + ret = false; + break; + } + } + } + return ret; +} + +template <class TInputImage, class TMaskImage> +inline bool +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::IsSampleOnLine(OGRLineString* line, + typename TInputImage::PointType& position, + typename TInputImage::SpacingType& absSpacing, + OGRPolygon& tmpPolygon) +{ + tmpPolygon.getExteriorRing()->setPoint(0 + ,position[0]-0.5*absSpacing[0] + ,position[1]-0.5*absSpacing[1] + ,0.0); + tmpPolygon.getExteriorRing()->setPoint(1 + ,position[0]+0.5*absSpacing[0] + ,position[1]-0.5*absSpacing[1] + ,0.0); + tmpPolygon.getExteriorRing()->setPoint(2 + ,position[0]+0.5*absSpacing[0] + ,position[1]+0.5*absSpacing[1] + ,0.0); + tmpPolygon.getExteriorRing()->setPoint(3 + ,position[0]-0.5*absSpacing[0] + ,position[1]+0.5*absSpacing[1] + ,0.0); + tmpPolygon.getExteriorRing()->setPoint(4 + ,position[0]-0.5*absSpacing[0] + ,position[1]-0.5*absSpacing[1] + ,0.0); + return line->Intersects(&tmpPolygon); +} + +template<class TInputImage, class TMaskImage> +typename PersistentSamplingFilterBase<TInputImage,TMaskImage>::RegionType +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::FeatureBoundingRegion(const TInputImage* image, otb::ogr::Layer::const_iterator& featIt) const +{ + // otb::ogr wrapper is incomplete and leaky abstraction is inevitable here + OGREnvelope envelope; + featIt->GetGeometry()->getEnvelope(&envelope); + itk::Point<double, 2> lowerPoint, upperPoint; + lowerPoint[0] = envelope.MinX; + lowerPoint[1] = envelope.MinY; + upperPoint[0] = envelope.MaxX; + upperPoint[1] = envelope.MaxY; + + typename TInputImage::IndexType lowerIndex; + typename TInputImage::IndexType upperIndex; + + image->TransformPhysicalPointToIndex(lowerPoint, lowerIndex); + image->TransformPhysicalPointToIndex(upperPoint, upperIndex); + + // swap coordinate to keep lowerIndex as start index + if (lowerIndex[0] > upperIndex[0]) + { + int tmp = lowerIndex[0]; + lowerIndex[0] = upperIndex[0]; + upperIndex[0] = tmp; + } + if (lowerIndex[1] > upperIndex[1]) + { + int tmp = lowerIndex[1]; + lowerIndex[1] = upperIndex[1]; + upperIndex[1] = tmp; + } + + RegionType region; + region.SetIndex(lowerIndex); + region.SetUpperIndex(upperIndex); + + return region; +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::PrepareInputVectors() +{ + TInputImage* outputImage = this->GetOutput(); + ogr::DataSource* vectors = const_cast<ogr::DataSource*>(this->GetOGRData()); + ogr::Layer inLayer = vectors->GetLayer(m_LayerIndex); + + const RegionType& requestedRegion = outputImage->GetRequestedRegion(); + itk::ContinuousIndex<double> startIndex(requestedRegion.GetIndex()); + itk::ContinuousIndex<double> endIndex(requestedRegion.GetUpperIndex()); + startIndex[0] += -0.5; + startIndex[1] += -0.5; + endIndex[0] += 0.5; + endIndex[1] += 0.5; + itk::Point<double, 2> startPoint; + itk::Point<double, 2> endPoint; + outputImage->TransformContinuousIndexToPhysicalPoint(startIndex, startPoint); + outputImage->TransformContinuousIndexToPhysicalPoint(endIndex, endPoint); + + // create geometric extent + OGRPolygon tmpPolygon; + OGRLinearRing ring; + ring.addPoint(startPoint[0],startPoint[1],0.0); + ring.addPoint(startPoint[0],endPoint[1] ,0.0); + ring.addPoint(endPoint[0] ,endPoint[1] ,0.0); + ring.addPoint(endPoint[0] ,startPoint[1],0.0); + ring.addPoint(startPoint[0],startPoint[1],0.0); + tmpPolygon.addRing(&ring); + + inLayer.SetSpatialFilter(&tmpPolygon); + + unsigned int numberOfThreads = this->GetNumberOfThreads(); + + unsigned int actualNumberOfThreads = numberOfThreads; + + if(numberOfThreads > this->GetOutput()->GetRequestedRegion().GetSize()[1]) + { + actualNumberOfThreads = this->GetOutput()->GetRequestedRegion().GetSize()[1]; + } + + // prepare temporary input : split input features between available threads + this->m_InMemoryInputs.clear(); + std::string tmpLayerName("thread"); + OGRSpatialReference * oSRS = ITK_NULLPTR; + if (inLayer.GetSpatialRef()) + { + oSRS = inLayer.GetSpatialRef()->Clone(); + } + OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); + std::vector<ogr::Layer> tmpLayers; + for (unsigned int i=0 ; i < actualNumberOfThreads ; i++) + { + ogr::DataSource::Pointer tmpOgrDS = ogr::DataSource::New(); + ogr::Layer tmpLayer = tmpOgrDS->CreateLayer( + tmpLayerName, + oSRS, + inLayer.GetGeomType()); + // add field definitions + for (int k=0 ; k < layerDefn.GetFieldCount() ; k++) + { + OGRFieldDefn originDefn(layerDefn.GetFieldDefn(k)); + ogr::FieldDefn fieldDefn(originDefn); + tmpLayer.CreateField(fieldDefn); + } + this->m_InMemoryInputs.push_back(tmpOgrDS); + tmpLayers.push_back(tmpLayer); + } + + this->DispatchInputVectors(inLayer,tmpLayers); + + inLayer.SetSpatialFilter(ITK_NULLPTR); +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::DispatchInputVectors(ogr::Layer &inLayer, std::vector<ogr::Layer> &tmpLayers) +{ + OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); + ogr::Layer::const_iterator featIt = inLayer.begin(); + unsigned int counter=0; + for(; featIt!=inLayer.end(); ++featIt) + { + ogr::Feature dstFeature(layerDefn); + dstFeature.SetFrom( *featIt, TRUE ); + dstFeature.SetFID(featIt->GetFID()); + tmpLayers[counter].CreateFeature( dstFeature ); + counter++; + if (counter >= tmpLayers.size()) + counter = 0; + } +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::PrepareOutputVectors() +{ + // Prepare in-memory outputs + unsigned int numberOfThreads = this->GetNumberOfThreads(); + + unsigned int actualNumberOfThreads = numberOfThreads; + + if(numberOfThreads > this->GetOutput()->GetRequestedRegion().GetSize()[1]) + { + actualNumberOfThreads = this->GetOutput()->GetRequestedRegion().GetSize()[1]; + } + + this->m_InMemoryOutputs.clear(); + std::string tmpLayerName("threadOut"); + for (unsigned int i=0 ; i < actualNumberOfThreads ; i++) + { + std::vector<OGRDataPointer> tmpContainer; + // iterate over outputs, only process ogr::DataSource + for (unsigned int k=0 ; k < this->GetNumberOfOutputs() ; k++) + { + ogr::DataSource* realOutput = dynamic_cast<ogr::DataSource *>( + this->itk::ProcessObject::GetOutput(k)); + if (realOutput) + { + ogr::Layer realLayer = realOutput->GetLayersCount() == 1 + ? realOutput->GetLayer(0) + : realOutput->GetLayer(m_OutLayerName); + OGRSpatialReference * oSRS = ITK_NULLPTR; + if (realLayer.GetSpatialRef()) + { + oSRS = realLayer.GetSpatialRef()->Clone(); + } + OGRFeatureDefn &layerDefn = realLayer.GetLayerDefn(); + ogr::DataSource::Pointer tmpOutput = ogr::DataSource::New(); + ogr::Layer tmpLayer = tmpOutput->CreateLayer( + tmpLayerName, oSRS, realLayer.GetGeomType()); + // add field definitions + for (int f=0 ; f < layerDefn.GetFieldCount() ; f++) + { + OGRFieldDefn originDefn(layerDefn.GetFieldDefn(f)); + tmpLayer.CreateField(originDefn); + } + tmpContainer.push_back(tmpOutput); + } + } + this->m_InMemoryOutputs.push_back(tmpContainer); + } +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::InitializeOutputDataSource(ogr::DataSource* inputDS, ogr::DataSource* outputDS) +{ + TInputImage *inputImage = const_cast<TInputImage*>(this->GetInput()); + inputImage->UpdateOutputInformation(); + + ogr::Layer inLayer = inputDS->GetLayer(this->GetLayerIndex()); + + bool updateMode = false; + if (inputDS == outputDS) + { + updateMode = true; + // Check m_OutLayerName is same as input layer name + m_OutLayerName = inLayer.GetName(); + } + + // First get list of current fields + OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); + std::map<std::string, OGRFieldType> currentFields; + for (int k=0 ; k<layerDefn.GetFieldCount() ; k++) + { + OGRFieldDefn fieldDefn(layerDefn.GetFieldDefn(k)); + std::string currentName(fieldDefn.GetNameRef()); + currentFields[currentName] = fieldDefn.GetType(); + } + + ogr::Layer outLayer = inLayer; + if (!updateMode) + { + std::string projectionRefWkt = this->GetInput()->GetProjectionRef(); + bool projectionInformationAvailable = !projectionRefWkt.empty(); + OGRSpatialReference * oSRS = ITK_NULLPTR; + if(projectionInformationAvailable) + { + oSRS = static_cast<OGRSpatialReference *>(OSRNewSpatialReference(projectionRefWkt.c_str())); + } + // Create layer + outLayer = outputDS->CreateLayer( + this->GetOutLayerName(), + oSRS, + wkbPoint, + this->GetOGRLayerCreationOptions()); + // Copy existing fields + for (int k=0 ; k<layerDefn.GetFieldCount() ; k++) + { + OGRFieldDefn fieldDefn(layerDefn.GetFieldDefn(k)); + outLayer.CreateField(fieldDefn); + } + } + + // Add new fields + for (unsigned int k=0 ; k<m_AdditionalFields.size() ; k++) + { + OGRFieldDefn ogrFieldDefinition(m_AdditionalFields[k].Name.c_str(),m_AdditionalFields[k].Type); + ogrFieldDefinition.SetWidth( m_AdditionalFields[k].Width ); + ogrFieldDefinition.SetPrecision( m_AdditionalFields[k].Precision ); + ogr::FieldDefn fieldDef(ogrFieldDefinition); + // test if field is already present + if (currentFields.count(fieldDef.GetName())) + { + // test the field type + if (currentFields[fieldDef.GetName()] != fieldDef.GetType()) + { + itkExceptionMacro("Field name "<< fieldDef.GetName() << " already exists with a different type!"); + } + } + else + { + outLayer.CreateField(fieldDef); + } + } +} + + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::ClearAdditionalFields() +{ + this->m_AdditionalFields.clear(); +} + +template<class TInputImage, class TMaskImage> +void +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::CreateAdditionalField(std::string name, + OGRFieldType type, + int width, + int precision) +{ + SimpleFieldDefn defn; + defn.Name = name; + defn.Type = type; + defn.Width = width; + defn.Precision = precision; + this->m_AdditionalFields.push_back(defn); +} + +template<class TInputImage, class TMaskImage> +const std::vector< + typename PersistentSamplingFilterBase<TInputImage,TMaskImage> + ::SimpleFieldDefn>& +PersistentSamplingFilterBase<TInputImage,TMaskImage> +::GetAdditionalFields() +{ + return this->m_AdditionalFields; +} + + +} // end namespace otb + +#endif diff --git a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h b/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h deleted file mode 100644 index 0a1e1c2d501812e3a8521c8e5455d905aea72f6e..0000000000000000000000000000000000000000 --- a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h +++ /dev/null @@ -1,98 +0,0 @@ -/*========================================================================= - - 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 __otbPolygonClassStatisticsAccumulator_h -#define __otbPolygonClassStatisticsAccumulator_h - -#include "otbOGRDataSourceWrapper.h" - -namespace otb -{ - -/** - * \class PolygonClassStatisticsAccumulator - * - * \brief This class stores statistics of OGR data for each thread - * - * \ingroup OTBSampling - */ -class PolygonClassStatisticsAccumulator : public itk::Object -{ -public: - typedef PolygonClassStatisticsAccumulator Self; - typedef itk::SmartPointer<Self> Pointer; - itkNewMacro(Self); - - typedef std::map<std::string, unsigned long> ClassCountMapType; - typedef std::map<unsigned long, unsigned long> PolygonSizeMapType; - - /** Runtime information support. */ - itkTypeMacro(PolygonClassStatisticsAccumulator, itk::Object); - - template <typename TIterator> - void Add(otb::ogr::Layer::const_iterator& featIt, - TIterator& imgIt, - const typename TIterator::ImageType *img); - - /** Reset the accumulator */ - void Reset(); - - const ClassCountMapType& GetClassCountMap(); - - const PolygonSizeMapType& GetPolygonSizeMap(); - - unsigned long GetNumberOfPixels(); - - itkSetMacro(FieldIndex, int); - itkGetMacro(FieldIndex, int); - -protected: - /** Constructor */ - PolygonClassStatisticsAccumulator(); - - /** Destructor */ - virtual ~PolygonClassStatisticsAccumulator(); - -private: - //Number of pixels in all the polygons - unsigned long m_NbPixelsGlobal; - //Number of pixels in each classes - ClassCountMapType m_ElmtsInClass; - //Number of pixels in each polygons - PolygonSizeMapType m_Polygon; // check the feature id - - int m_FieldIndex; - - template <typename TIterator> - void AddGeometry(OGRGeometry *geom, - TIterator& imgIt, - const typename TIterator::ImageType *img, - unsigned long &fId, - std::string &className); - - // Not implemented - PolygonClassStatisticsAccumulator(const Self&); - void operator=(const Self&); -}; - -} // end of namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbPolygonClassStatisticsAccumulator.txx" -#endif - -#endif diff --git a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.txx b/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.txx deleted file mode 100644 index d0812e3a07cb2c887e5fe703246ddd3baef7c2b5..0000000000000000000000000000000000000000 --- a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.txx +++ /dev/null @@ -1,197 +0,0 @@ -/*========================================================================= - - 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 __otbPolygonClassStatisticsAccumulator_txx -#define __otbPolygonClassStatisticsAccumulator_txx - -#include "otbPolygonClassStatisticsAccumulator.h" -#include "otbMacro.h" - -namespace otb -{ - -template <typename TIterator> -void -PolygonClassStatisticsAccumulator -::Add(otb::ogr::Layer::const_iterator& featIt, - TIterator& imgIt, - const typename TIterator::ImageType *img) -{ - // Get class name - std::string className(featIt->ogr().GetFieldAsString(this->m_FieldIndex)); - // Get Feature Id - unsigned long featureId = featIt->ogr().GetFID(); - - if (m_ElmtsInClass.count(className) == 0) - { - m_ElmtsInClass[className] = 0UL; - } - if (m_Polygon.count(featureId) == 0) - { - m_Polygon[featureId] = 0UL; - } - - this->AddGeometry(featIt->ogr().GetGeometryRef(), - imgIt, - img, - featureId, - className); -} - -template <typename TIterator> -void -PolygonClassStatisticsAccumulator -::AddGeometry(OGRGeometry *geom, - TIterator& imgIt, - const typename TIterator::ImageType *img, - unsigned long &fId, - std::string &className) -{ - typename TIterator::ImageType::PointType imgPoint; - typename TIterator::IndexType imgIndex; - OGRPoint tmpPoint(0.0,0.0,0.0); - imgIt.GoToBegin(); - switch (geom->getGeometryType()) - { - case wkbPoint: - case wkbPoint25D: - { - OGRPoint* castPoint = dynamic_cast<OGRPoint*>(geom); - if (castPoint == NULL) - { - // Wrong Type ! - break; - } - imgPoint[0] = castPoint->getX(); - imgPoint[1] = castPoint->getY(); - img->TransformPhysicalPointToIndex(imgPoint,imgIndex); - while (!imgIt.IsAtEnd()) - { - if (imgIndex == imgIt.GetIndex()) - { - m_NbPixelsGlobal++; - m_ElmtsInClass[className]++; - m_Polygon[fId]++; - break; - } - } - break; - } - case wkbLineString: - case wkbLineString25D: - { - OGRPolygon tmpPolygon; - OGRLinearRing ring; - ring.addPoint(0.0,0.0,0.0); - ring.addPoint(1.0,0.0,0.0); - ring.addPoint(1.0,1.0,0.0); - ring.addPoint(0.0,1.0,0.0); - ring.addPoint(0.0,0.0,0.0); - tmpPolygon.addRing(&ring); - typename TIterator::ImageType::SpacingType imgAbsSpacing = img->GetSpacing(); - if (imgAbsSpacing[0] < 0) imgAbsSpacing[0] = -imgAbsSpacing[0]; - if (imgAbsSpacing[1] < 0) imgAbsSpacing[1] = -imgAbsSpacing[1]; - while (!imgIt.IsAtEnd()) - { - img->TransformIndexToPhysicalPoint(imgIt.GetIndex(),imgPoint); - tmpPolygon.getExteriorRing()->setPoint(0 - ,imgPoint[0]-0.5*imgAbsSpacing[0] - ,imgPoint[1]-0.5*imgAbsSpacing[1] - ,0.0); - tmpPolygon.getExteriorRing()->setPoint(1 - ,imgPoint[0]+0.5*imgAbsSpacing[0] - ,imgPoint[1]-0.5*imgAbsSpacing[1] - ,0.0); - tmpPolygon.getExteriorRing()->setPoint(2 - ,imgPoint[0]+0.5*imgAbsSpacing[0] - ,imgPoint[1]+0.5*imgAbsSpacing[1] - ,0.0); - tmpPolygon.getExteriorRing()->setPoint(3 - ,imgPoint[0]-0.5*imgAbsSpacing[0] - ,imgPoint[1]+0.5*imgAbsSpacing[1] - ,0.0); - tmpPolygon.getExteriorRing()->setPoint(4 - ,imgPoint[0]-0.5*imgAbsSpacing[0] - ,imgPoint[1]-0.5*imgAbsSpacing[1] - ,0.0); - if (geom->Intersects(&tmpPolygon)) - { - m_NbPixelsGlobal++; - m_ElmtsInClass[className]++; - m_Polygon[fId]++; - } - ++imgIt; - } - break; - } - case wkbPolygon: - case wkbPolygon25D: - { - while (!imgIt.IsAtEnd()) - { - img->TransformIndexToPhysicalPoint(imgIt.GetIndex(),imgPoint); - tmpPoint.setX(imgPoint[0]); - tmpPoint.setY(imgPoint[1]); - if (geom->Contains(&tmpPoint)) - { - m_NbPixelsGlobal++; - m_ElmtsInClass[className]++; - m_Polygon[fId]++; - } - ++imgIt; - } - break; - } - case wkbMultiPoint: - case wkbMultiPoint25D: - case wkbMultiLineString: - case wkbMultiLineString25D: - case wkbMultiPolygon: - case wkbMultiPolygon25D: - case wkbGeometryCollection: - case wkbGeometryCollection25D: - { - OGRGeometryCollection *geomCollection = dynamic_cast<OGRGeometryCollection*>(geom); - if (geomCollection) - { - unsigned int nbGeom = geomCollection->getNumGeometries(); - for (unsigned int i=0 ; i < nbGeom ; ++i) - { - this->AddGeometry(geomCollection->getGeometryRef(i), - imgIt, - img, - fId, - className); - } - } - else - { - otbWarningMacro("Geometry not recognized as a collection : " << geom->getGeometryName()); - } - break; - } - default: - { - otbWarningMacro("Geometry not handled: " << geom->getGeometryName()); - break; - } - } -} - -} // end of namespace otb - -#endif diff --git a/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h b/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..bb66f69478be08073eeca38b12294ba3745de5f6 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h @@ -0,0 +1,119 @@ +/*========================================================================= + + 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 otbSamplingRateCalculator_h +#define otbSamplingRateCalculator_h + +#include "itkImageRegion.h" +#include "itkVectorContainer.h" +#include <set> + +namespace otb +{ +/** \class SamplingRateCalculator + * \brief This class is a sampling rate calculator. + * + * It computes sampling rates for each class, given input statistics on + * available samples, and a sampling strategy. + * + * \ingroup OTBSampling + */ + +class ITK_EXPORT SamplingRateCalculator + : public itk::Object +{ +public: + /** Standard typedefs */ + typedef SamplingRateCalculator Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** typdefs **/ + typedef std::map<std::string, unsigned long> ClassCountMapType; + typedef ClassCountMapType::const_iterator constItMapType; + typedef struct Triplet + { + unsigned long Required; + unsigned long Tot; + double Rate; + bool operator==(const struct Triplet & triplet) const; + } TripletType; + + typedef std::map<std::string, TripletType > MapRateType; + + /** Type macro */ + itkNewMacro(Self); + + /** Creation through object factory macro */ + itkTypeMacro(SamplingRateCalculator, itk::Object); + + /** Method to manually set the number of samples required in each class */ + void SetNbOfSamplesByClass(const ClassCountMapType &required); + + /** Method to set the same number of required samples in each class */ + void SetNbOfSamplesAllClasses(unsigned long); + + /** Method to choose a sampling strategy based on the smallest class. + * The number of samples in each class is set to this minimum size*/ + void SetMinimumNbOfSamplesByClass(void); + + /** Method to select all available samples */ + void SetAllSamples(void); + + /** Method to export sampling rates in a CSV file. + * Columns are : class name, required samples, total samples, rate.*/ + void Write(std::string filename); + + /** Method to import sampling rates from a CSV file. + * Columns are : class name, required samples, total samples, rate.*/ + void Read(std::string filename); + + /** Get macro to the computed sampling rates.*/ + itkGetConstReferenceMacro(RatesByClass,MapRateType); + + /** Set method to input the total number of samples in each class. + * This method should be called before the other Set... methods + * that apply a sampling strategy */ + void SetClassCount(const ClassCountMapType& map); + + /** Clear internal data */ + void ClearRates(void); + +protected: + /** Constructor */ + SamplingRateCalculator(); + + /** Destructor */ + virtual ~SamplingRateCalculator() {} + + /**PrintSelf method */ + virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + +private: + SamplingRateCalculator(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** Update the computed rate for a given class.*/ + void UpdateRate(const std::string &name); + + /** Internal sampling rates.*/ + MapRateType m_RatesByClass; +}; +} // End namespace otb + +#endif diff --git a/Modules/Learning/Sampling/otb-module.cmake b/Modules/Learning/Sampling/otb-module.cmake index 285ce6062f63da9a24612d1f073f2f871bac3f0c..e032dfcae49009d5d869d2871e631ed6893c538d 100644 --- a/Modules/Learning/Sampling/otb-module.cmake +++ b/Modules/Learning/Sampling/otb-module.cmake @@ -3,6 +3,7 @@ set(DOCUMENTATION "This module contains OTB sampling framework.") otb_module(OTBSampling DEPENDS OTBCommon + OTBConversion OTBImageManipulation OTBITK OTBStatistics @@ -11,6 +12,7 @@ otb_module(OTBSampling OTBTestKernel OTBImageIO OTBImageBase + OTBIOXML DESCRIPTION "${DOCUMENTATION}" diff --git a/Modules/Learning/Sampling/src/CMakeLists.txt b/Modules/Learning/Sampling/src/CMakeLists.txt index f353c0f051dd1cdef15b7bd0cb9c27c4553cee16..90087a2744a9e007261d971e807d54ca7cca3d23 100644 --- a/Modules/Learning/Sampling/src/CMakeLists.txt +++ b/Modules/Learning/Sampling/src/CMakeLists.txt @@ -1,12 +1,13 @@ set(OTBSampling_SRC - otbPolygonClassStatisticsAccumulator.cxx - ) + otbSamplingRateCalculator.cxx +) add_library(OTBSampling ${OTBSampling_SRC}) target_link_libraries(OTBSampling ${OTBCommon_LIBRARIES} ${OTBImageManipulation_LIBRARIES} ${OTBStatistics_LIBRARIES} + ${OTBIOGDAL_LBRARIES} ) otb_module_target(OTBSampling) diff --git a/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx b/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx deleted file mode 100644 index 0652e9b3a95f768381a918e114eec22928b63b28..0000000000000000000000000000000000000000 --- a/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx +++ /dev/null @@ -1,64 +0,0 @@ -/*========================================================================= - - 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 "otbPolygonClassStatisticsAccumulator.h" - -namespace otb -{ - -PolygonClassStatisticsAccumulator::PolygonClassStatisticsAccumulator() : - m_NbPixelsGlobal(0UL), - m_ElmtsInClass(), - m_Polygon() -{} - -PolygonClassStatisticsAccumulator::~PolygonClassStatisticsAccumulator() -{} - -void -PolygonClassStatisticsAccumulator -::Reset() -{ - m_NbPixelsGlobal = 0UL; - m_ElmtsInClass.clear(); - m_Polygon.clear(); -} - -const PolygonClassStatisticsAccumulator::ClassCountMapType& -PolygonClassStatisticsAccumulator -::GetClassCountMap() -{ - return m_ElmtsInClass; -} - -const PolygonClassStatisticsAccumulator::PolygonSizeMapType& -PolygonClassStatisticsAccumulator -::GetPolygonSizeMap() -{ - return m_Polygon; -} - -unsigned long -PolygonClassStatisticsAccumulator -::GetNumberOfPixels() -{ - return m_NbPixelsGlobal; -} - - -} // end of namespace otb diff --git a/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx b/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2378ff1e42bc4e76dea516b9526050f7160b0bbf --- /dev/null +++ b/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx @@ -0,0 +1,261 @@ +/*========================================================================= + + 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 "otbSamplingRateCalculator.h" +#include "otbStringUtils.h" +#include "otbMacro.h" +#include <sstream> +#include <fstream> +#include <iterator> +#include "itksys/SystemTools.hxx" + + +namespace otb +{ + +bool +SamplingRateCalculator::TripletType::operator==(const SamplingRateCalculator::TripletType & triplet) const +{ + return bool((Required == triplet.Required)|| + (Tot == triplet.Tot)|| + (Rate == triplet.Rate)); +} + +SamplingRateCalculator +::SamplingRateCalculator() +{ +} + +void +SamplingRateCalculator +::SetMinimumNbOfSamplesByClass(void) +{ + unsigned long smallestNbofSamples = itk::NumericTraits<unsigned long>::max(); + MapRateType::iterator it = m_RatesByClass.begin(); + for (; it != m_RatesByClass.end() ; ++it) + { + if (smallestNbofSamples > it->second.Tot) + { + smallestNbofSamples = it->second.Tot; + } + } + // Check if there is an empty class + if (smallestNbofSamples == 0UL) + { + otbWarningMacro("There is an empty class, sample size is set to zero!"); + } + this->SetNbOfSamplesAllClasses( smallestNbofSamples ); +} + +void +SamplingRateCalculator +::SetNbOfSamplesAllClasses(unsigned long dRequiredNbSamples) +{ + MapRateType::iterator it = m_RatesByClass.begin(); + for (; it != m_RatesByClass.end() ; ++it) + { + it->second.Required = dRequiredNbSamples; + this->UpdateRate(it->first); + } +} + +void +SamplingRateCalculator +::SetNbOfSamplesByClass(const ClassCountMapType &required) +{ + ClassCountMapType::const_iterator it = required.begin(); + for (; it != required.end() ; ++it) + { + if (m_RatesByClass.count(it->first)) + { + m_RatesByClass[it->first].Required = it->second; + this->UpdateRate(it->first); + } + else + { + TripletType triplet; + triplet.Tot = it->second; + triplet.Required = 0UL; + triplet.Rate = 0.0; + m_RatesByClass[it->first] = triplet; + } + } +} + +void +SamplingRateCalculator +::SetAllSamples(void) +{ + MapRateType::iterator it = m_RatesByClass.begin(); + for (; it != m_RatesByClass.end() ; ++it) + { + it->second.Required = it->second.Tot; + it->second.Rate = 1.0; + } +} + +void +SamplingRateCalculator +::Write(std::string filename) +{ + std::ofstream file(filename.c_str(), std::ios::out | std::ios::trunc); + + if (file) + { + itk::Indent indent(0); + this->PrintSelf(file,indent); + file.close(); + } + else + { + itkExceptionMacro(<< " Couldn't open " << filename); + } +} + +void +SamplingRateCalculator +::Read(std::string filename) +{ + std::ifstream ifs(filename.c_str()); + + if (ifs) + { + this->ClearRates(); + std::string line; + TripletType tpt; + std::string sep(""); + while(!ifs.eof()) + { + std::getline(ifs,line); + if (line.empty()) continue; + std::string::size_type pos = line.find_first_not_of(" \t"); + if (pos != std::string::npos && line[pos] == '#') continue; + + if (sep.size() == 0) + { + // Try to detect the separator + std::string separators("\t;,"); + for (unsigned int k=0 ; k<separators.size() ; k++) + { + std::vector<itksys::String> words = itksys::SystemTools::SplitString(line,separators[k]); + if (words.size() == 4) + { + sep.push_back(separators[k]); + break; + } + } + if (sep.size() == 0) continue; + } + // parse the line + std::vector<itksys::String> parts = itksys::SystemTools::SplitString(line,sep[0]); + if (parts.size() == 4) + { + std::string::size_type pos1 = parts[0].find_first_not_of(" \t"); + std::string::size_type pos2 = parts[0].find_last_not_of(" \t"); + std::string::size_type pos3 = parts[1].find_first_not_of(" \t"); + std::string::size_type pos4 = parts[1].find_last_not_of(" \t"); + std::string::size_type pos5 = parts[2].find_first_not_of(" \t"); + std::string::size_type pos6 = parts[2].find_last_not_of(" \t"); + std::string::size_type pos7 = parts[3].find_first_not_of(" \t"); + std::string::size_type pos8 = parts[3].find_last_not_of(" \t"); + if (pos1 != std::string::npos && pos3 != std::string::npos && + pos5 != std::string::npos && pos7 != std::string::npos) + { + std::string name = parts[0].substr(pos1, pos2 - pos1 + 1); + std::string val1 = parts[1].substr(pos3, pos4 - pos3 + 1); + std::string val2 = parts[2].substr(pos5, pos6 - pos5 + 1); + std::string val3 = parts[3].substr(pos7, pos8 - pos7 + 1); + tpt.Required = boost::lexical_cast<unsigned long>(val1); + tpt.Tot = boost::lexical_cast<unsigned long>(val2); + tpt.Rate = boost::lexical_cast<double>(val3); + m_RatesByClass[name] = tpt; + } + } + } + ifs.close(); + } + else + { + itkExceptionMacro(<< " Couldn't open " << filename); + } +} + +void +SamplingRateCalculator +::SetClassCount(const ClassCountMapType& map) +{ + ClassCountMapType::const_iterator it = map.begin(); + for (; it != map.end() ; ++it) + { + if (m_RatesByClass.count(it->first)) + { + m_RatesByClass[it->first].Tot = it->second; + this->UpdateRate(it->first); + } + else + { + TripletType triplet; + triplet.Tot = it->second; + triplet.Required = 0UL; + triplet.Rate = 0.0; + m_RatesByClass[it->first] = triplet; + } + } +} + +void +SamplingRateCalculator +::ClearRates(void) +{ + m_RatesByClass.clear(); +} + +void +SamplingRateCalculator +::UpdateRate(const std::string &name) +{ + if (m_RatesByClass[name].Tot) + { + m_RatesByClass[name].Rate = std::min( + static_cast<double>(m_RatesByClass[name].Required) / + static_cast<double>(m_RatesByClass[name].Tot), + 1.0); + } + else + { + // Set to 0 as rate is undefined + m_RatesByClass[name].Rate = 0.0; + } +} + +void +SamplingRateCalculator +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + os << indent << "#className requiredSamples totalSamples rate" << std::endl; + MapRateType::const_iterator itRates = m_RatesByClass.begin(); + for(; itRates != m_RatesByClass.end(); ++itRates) + { + TripletType tpt=itRates->second; + os << indent << itRates->first << "\t" << tpt.Required << "\t" << tpt.Tot << "\t" << tpt.Rate << std::endl; + } +} + +} // End namespace otb + diff --git a/Modules/Learning/Sampling/test/CMakeLists.txt b/Modules/Learning/Sampling/test/CMakeLists.txt index 51d7848001526c0eede178d0b5c21d0fec587196..7c7fd77347377ad6c7265285b0004834b2455632 100644 --- a/Modules/Learning/Sampling/test/CMakeLists.txt +++ b/Modules/Learning/Sampling/test/CMakeLists.txt @@ -2,7 +2,10 @@ otb_module_test() set(OTBSamplingTests otbSamplingTestDriver.cxx +otbOGRDataToSamplePositionFilterTest.cxx +otbSamplingRateCalculatorTest.cxx otbOGRDataToClassStatisticsFilterTest.cxx +otbImageSampleExtractorFilterTest.cxx ) add_executable(otbSamplingTestDriver ${OTBSamplingTests}) @@ -10,7 +13,55 @@ target_link_libraries(otbSamplingTestDriver ${OTBSampling-Test_LIBRARIES}) otb_module_target_label(otbSamplingTestDriver) # Tests Declaration +# ---------------- SamplingRateCalculator ------------------------------------ +otb_add_test(NAME leTuSamplingRateCalculatorNew COMMAND otbSamplingTestDriver + otbSamplingRateCalculatorNew + + ) +otb_add_test(NAME leTvSamplingRateCalculator COMMAND otbSamplingTestDriver + --compare-ascii ${NOTOL} + ${BASELINE_FILES}/leTvSamplingRateCalculator.txt + ${TEMP}/leTvSamplingRateCalculator.txt + otbSamplingRateCalculator + ${TEMP}/leTvSamplingRateCalculator.txt) + +# ----------------- OGRDataToSamplePositionFilter ---------------------------- +otb_add_test(NAME leTuOGRDataToSamplePositionFilterNew COMMAND otbSamplingTestDriver + otbOGRDataToSamplePositionFilterNew ) + +otb_add_test(NAME leTvOGRDataToSamplePositionFilterPoly COMMAND otbSamplingTestDriver + otbOGRDataToSamplePositionFilter + ${INPUTDATA}/variousVectors.sqlite + 0 + ${TEMP}/leTvOGRDataToSamplePositionFilterOutput_Poly.sqlite + ${BASELINE_FILES}/leTvOGRDataToSamplePositionFilterOutput_Poly.sqlite + ) + +otb_add_test(NAME leTvOGRDataToSamplePositionFilterPolyPattern COMMAND otbSamplingTestDriver + otbOGRDataToSamplePositionFilterPattern + ${INPUTDATA}/variousVectors.sqlite + ${TEMP}/leTvOGRDataToSamplePositionFilterOutput_PolyPattern.sqlite + ${BASELINE_FILES}/leTvOGRDataToSamplePositionFilterOutput_PolyPattern.sqlite + ) + +otb_add_test(NAME leTvOGRDataToSamplePositionFilterLines COMMAND otbSamplingTestDriver + otbOGRDataToSamplePositionFilter + ${INPUTDATA}/variousVectors.sqlite + 1 + ${TEMP}/leTvOGRDataToSamplePositionFilterOutput_Lines.sqlite + ${BASELINE_FILES}/leTvOGRDataToSamplePositionFilterOutput_Lines.sqlite + ) + +otb_add_test(NAME leTvOGRDataToSamplePositionFilterPoints COMMAND otbSamplingTestDriver + otbOGRDataToSamplePositionFilter + ${INPUTDATA}/variousVectors.sqlite + 2 + ${TEMP}/leTvOGRDataToSamplePositionFilterOutput_Points.sqlite + ${BASELINE_FILES}/leTvOGRDataToSamplePositionFilterOutput_Points.sqlite + ) + +# --------------- OGRDataToClassStatisticsFilter ----------------------------- otb_add_test(NAME leTuOGRDataToClassStatisticsFilterNew COMMAND otbSamplingTestDriver otbOGRDataToClassStatisticsFilterNew ) @@ -21,3 +72,23 @@ otb_add_test(NAME leTvOGRDataToClassStatisticsFilter COMMAND otbSamplingTestDriv otbOGRDataToClassStatisticsFilter ${INPUTDATA}/variousVectors.sqlite ${TEMP}/leTvOGRDataToClassStatisticsFilterOutput.txt) + +# --------------- ImageSampleExtractorFilter ----------------------------- +otb_add_test(NAME leTuImageSampleExtractorFilterNew COMMAND otbSamplingTestDriver + otbImageSampleExtractorFilterNew ) + +otb_add_test(NAME leTvImageSampleExtractorFilter COMMAND otbSamplingTestDriver + --compare-ogr ${EPSILON_6} + ${BASELINE_FILES}/leTvImageSampleExtractorFilterTest.sqlite + ${TEMP}/leTvImageSampleExtractorFilterTest.sqlite + otbImageSampleExtractorFilter + ${INPUTDATA}/variousVectors.sqlite + ${TEMP}/leTvImageSampleExtractorFilterTest.sqlite) + +otb_add_test(NAME leTvImageSampleExtractorFilterUpdate COMMAND otbSamplingTestDriver + --compare-ogr ${EPSILON_6} + ${BASELINE_FILES}/leTvImageSampleExtractorFilterUpdateTest.shp + ${TEMP}/leTvImageSampleExtractorFilterUpdateTest.shp + otbImageSampleExtractorFilterUpdate + ${INPUTDATA}/variousVectors.sqlite + ${TEMP}/leTvImageSampleExtractorFilterUpdateTest.shp) diff --git a/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx b/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..74b542e7109b8fdaa6036170f96c7a291000ad8b --- /dev/null +++ b/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx @@ -0,0 +1,187 @@ +/*========================================================================= + + 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 "otbImageSampleExtractorFilter.h" +#include "otbVectorImage.h" +#include "otbImage.h" +#include "itkPhysicalPointImageSource.h" +#include "itkTimeProbe.h" +#include <fstream> + +int otbImageSampleExtractorFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::ImageSampleExtractorFilter<InputImageType> FilterType; + + FilterType::Pointer filter = FilterType::New(); + std::cout << filter << std::endl; + return EXIT_SUCCESS; +} + +int otbImageSampleExtractorFilter(int argc, char* argv[]) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::ImageSampleExtractorFilter<InputImageType> FilterType; + + if (argc < 3) + { + std::cout << "Usage : "<<argv[0]<< " input_vector output" << std::endl; + } + + std::string vectorPath(argv[1]); + std::string outputPath(argv[2]); + + otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(vectorPath); + otb::ogr::DataSource::Pointer output = + otb::ogr::DataSource::New(outputPath,otb::ogr::DataSource::Modes::Overwrite); + + InputImageType::RegionType region; + region.SetSize(0,99); + region.SetSize(1,50); + + InputImageType::PointType origin; + origin.Fill(0.5); + + InputImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = -1.0; + + std::string classFieldName("label"); + std::string outputPrefix("measure_"); + + typedef itk::PhysicalPointImageSource<InputImageType> ImageSourceType; + ImageSourceType::Pointer imgSource = ImageSourceType::New(); + imgSource->SetSize(region.GetSize()); + imgSource->SetSpacing(spacing); + imgSource->SetOrigin(origin); + + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(imgSource->GetOutput()); + filter->SetLayerIndex(2); + filter->SetSamplePositions(vectors); + filter->SetOutputSamples(output); + filter->SetClassFieldName(classFieldName); + filter->SetOutputFieldPrefix(outputPrefix); + + itk::TimeProbe chrono; + chrono.Start(); + + filter->Update(); + + chrono.Stop(); + std::cout << "Extraction took "<< chrono.GetTotal() << " sec" << std::endl; + + return EXIT_SUCCESS; +} + +int otbImageSampleExtractorFilterUpdate(int argc, char* argv[]) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::ImageSampleExtractorFilter<InputImageType> FilterType; + + if (argc < 3) + { + std::cout << "Usage : "<<argv[0]<< " input_vector output" << std::endl; + } + + std::string vectorPath(argv[1]); + std::string outputPath(argv[2]); + + otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(vectorPath); + otb::ogr::DataSource::Pointer output = + otb::ogr::DataSource::New(outputPath,otb::ogr::DataSource::Modes::Overwrite); + + InputImageType::RegionType region; + region.SetSize(0,99); + region.SetSize(1,50); + + InputImageType::PointType origin; + origin.Fill(0.5); + + InputImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = -1.0; + + std::string classFieldName("label"); + std::string outputPrefix("measure_"); + + // first copy the input layer #3 to output + otb::ogr::Layer inLayer = vectors->GetLayer(2); + OGRSpatialReference * oSRS = inLayer.GetSpatialRef()->Clone(); + output->CreateLayer( inLayer.GetName(), + oSRS, + inLayer.GetLayerDefn().GetGeomType()); + otb::ogr::Layer dstLayer = output->GetLayer(0); + OGRFieldDefn labelField(classFieldName.c_str(),OFTString); + dstLayer.CreateField(labelField, true); + const OGRErr err = dstLayer.ogr().StartTransaction(); + + if (err == OGRERR_NONE) { + + otb::ogr::Layer::const_iterator featIt = inLayer.begin(); + for(; featIt!=inLayer.end(); ++featIt) + { + otb::ogr::Feature dstFeature(dstLayer.GetLayerDefn()); + dstFeature.SetFrom( *featIt, TRUE ); + dstLayer.CreateFeature( dstFeature ); + } + + const OGRErr err2 = dstLayer.ogr().CommitTransaction(); + if (err2 == OGRERR_NONE) + { + + output->Clear(); + + otb::ogr::DataSource::Pointer outputUpdate = + otb::ogr::DataSource::New(outputPath,otb::ogr::DataSource::Modes::Update_LayerUpdate); + + typedef itk::PhysicalPointImageSource<InputImageType> ImageSourceType; + ImageSourceType::Pointer imgSource = ImageSourceType::New(); + imgSource->SetSize(region.GetSize()); + imgSource->SetSpacing(spacing); + imgSource->SetOrigin(origin); + + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(imgSource->GetOutput()); + filter->SetLayerIndex(0); + filter->SetSamplePositions(outputUpdate); + filter->SetOutputSamples(outputUpdate); + filter->SetClassFieldName(classFieldName); + filter->SetOutputFieldPrefix(outputPrefix); + + itk::TimeProbe chrono; + chrono.Start(); + + filter->Update(); + + chrono.Stop(); + std::cout << "Extraction took "<< chrono.GetTotal() << " sec" << std::endl; + } + else { + std::cout<< "Unable to commit transaction for OGR layer " << dstLayer.ogr().GetName() << "." << std::endl; + return EXIT_FAILURE; + } + + } + else { + std::cout << "Unable to start transaction for OGR layer " << dstLayer.ogr().GetName() << "." << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx b/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..afca8401f90601a8b65a48cf2829225185ab568d --- /dev/null +++ b/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx @@ -0,0 +1,325 @@ +/*========================================================================= + + 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 "otbOGRDataToSamplePositionFilter.h" +#include "otbPatternSampler.h" +#include "otbVectorImage.h" +#include "otbImage.h" +#include <fstream> + +// hard-coded rates for the multi-layer OGRDataSource (polygon/lines/points) +otb::SamplingRateCalculator::MapRateType GetRatesForMinimumSamples(unsigned int index) +{ + otb::SamplingRateCalculator::MapRateType ratesByClass; + otb::SamplingRateCalculator::TripletType triplet; + if (index == 0) + { + // Polygons + triplet.Tot = 104; + triplet.Required = 104; + triplet.Rate = 1.0; + ratesByClass[std::string("1")] = triplet; + triplet.Tot = 160; + triplet.Required = 104; + triplet.Rate = 0.65; + ratesByClass[std::string("2")] = triplet; + triplet.Tot = 211; + triplet.Required = 104; + triplet.Rate = 0.49289; + ratesByClass[std::string("3")] = triplet; + } + else if (index == 1) + { + // Lines + triplet.Tot = 63; + triplet.Required = 27; + triplet.Rate = 0.42857; + ratesByClass[std::string("1")] = triplet; + triplet.Tot = 100; + triplet.Required = 27; + triplet.Rate = 0.27; + ratesByClass[std::string("2")] = triplet; + triplet.Tot = 27; + triplet.Required = 27; + triplet.Rate = 1.0; + ratesByClass[std::string("3")] = triplet; + } + else if (index == 2) + { + // Points + triplet.Tot = 2; + triplet.Required = 1; + triplet.Rate = 0.5; + ratesByClass[std::string("1")] = triplet; + triplet.Tot = 1; + triplet.Required = 1; + triplet.Rate = 1.0; + ratesByClass[std::string("2")] = triplet; + triplet.Tot = 2; + triplet.Required = 1; + triplet.Rate = 0.5; + ratesByClass[std::string("3")] = triplet; + } + return ratesByClass; +} + +int TestPositionContainers(otb::ogr::DataSource *output, otb::ogr::DataSource *baseline) +{ + double epsilon=0.01; + otb::ogr::Layer baselineLayer = baseline->GetLayer(0); + otb::ogr::Layer outputLayer = output->GetLayer(0); + + otb::ogr::Layer::iterator itBase = baselineLayer.begin(); + for (;itBase != baselineLayer.end(); ++itBase) + { + const OGRGeometry* cstpgeomBase = itBase->GetGeometry(); + OGRGeometry* pgeomBase = cstpgeomBase->clone(); + OGRPoint* castPointBase = dynamic_cast<OGRPoint*>(pgeomBase); + if (castPointBase == NULL) + { + std::cerr << "Could not dynamic_cast pgeomBase" << std::endl; + return EXIT_FAILURE; + } + else + { + bool found=false; + otb::ogr::Layer::iterator itOutput = outputLayer.begin(); + for (;itOutput != outputLayer.end(); ++itOutput) + { + const OGRGeometry* cstpgeomOutput = itOutput->GetGeometry(); + OGRGeometry* pgeomOutput = cstpgeomOutput->clone(); + OGRPoint* castPointOutput = dynamic_cast<OGRPoint*>(pgeomOutput); + if (castPointOutput == NULL) + { + std::cerr << "Could not dynamic_cast pgeomOutput" << std::endl; + return EXIT_FAILURE; + } + else + { + if ( (fabs(castPointBase->getX()-castPointOutput->getX())<epsilon) && (fabs(castPointBase->getY()-castPointOutput->getY())<epsilon) ) + { + found=true; + break; + } + } + } + if(!found) + { + unsigned long featureId = itBase->ogr().GetFID(); + std::cerr << "Could not find point ("<< castPointBase->getX() << "," << castPointBase->getY() << "); feature ID = " << featureId << "." << std::endl; + return EXIT_FAILURE; + } + } + } + return EXIT_SUCCESS; +} + +int otbOGRDataToSamplePositionFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::Image<unsigned char> MaskImageType; + typedef otb::OGRDataToSamplePositionFilter<InputImageType , MaskImageType> FilterType; + + FilterType::Pointer filter = FilterType::New(); + std::cout << filter << std::endl; + return EXIT_SUCCESS; +} + +int otbOGRDataToSamplePositionFilter(int argc, char* argv[]) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::Image<unsigned char> MaskImageType; + + if (argc < 5) + { + std::cout << "Usage : "<<argv[0]<< " input_vector_path LayerIndex output_path baseline_path" << std::endl; + } + + std::string vectorPath(argv[1]); + int LayerIndex = atoi(argv[2]); + std::string outputPath(argv[3]); + std::string baselineVectorPath(argv[4]); + + otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(vectorPath); + + // --------------------- Prepare input data -------------------------------- + InputImageType::RegionType region; + region.SetSize(0,99); + region.SetSize(1,50); + + InputImageType::PointType origin; + origin.Fill(0.5); + + InputImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = -1.0; + + InputImageType::PixelType pixel(3); + pixel.Fill(1); + + InputImageType::Pointer inputImage = InputImageType::New(); + inputImage->SetNumberOfComponentsPerPixel(3); + inputImage->SetLargestPossibleRegion(region); + inputImage->SetOrigin(origin); + inputImage->SetSpacing(spacing); + // Don't allocate the input image, the filter should not need it + //inputImage->Allocate(); + //inputImage->FillBuffer(pixel); + + MaskImageType::Pointer mask = MaskImageType::New(); + mask->SetRegions(region); + mask->SetOrigin(origin); + mask->SetSpacing(spacing); + mask->Allocate(); + itk::ImageRegionIterator<MaskImageType> it(mask,region); + unsigned int count = 0; + for (it.GoToBegin(); !it.IsAtEnd() ; ++it, ++count) + { + it.Set(count % 2); + } + + std::string fieldName("Label"); + + otb::SamplingRateCalculator::MapRateType ratesByClass = + GetRatesForMinimumSamples(LayerIndex); + + otb::ogr::DataSource::Pointer output = + otb::ogr::DataSource::New(outputPath,otb::ogr::DataSource::Modes::Overwrite); + + itk::MetaDataDictionary dict; + inputImage->SetMetaDataDictionary(dict); + mask->SetMetaDataDictionary(dict); + + //-------------------------------------------------------------- + typedef otb::OGRDataToSamplePositionFilter< + InputImageType,MaskImageType> SelectionFilterType; + + SelectionFilterType::Pointer selector = SelectionFilterType::New(); + selector->SetInput(inputImage); + selector->SetMask(mask); + selector->SetOGRData(vectors); + selector->SetOutputPositionContainerAndRates(output,ratesByClass); + selector->SetFieldName(fieldName); + selector->SetLayerIndex(LayerIndex); + + selector->Update(); + + otb::ogr::DataSource::Pointer baseline = otb::ogr::DataSource::New(baselineVectorPath, otb::ogr::DataSource::Modes::Read); + + return TestPositionContainers(output,baseline); +} + +int otbOGRDataToSamplePositionFilterPattern(int argc, char* argv[]) +{ + typedef otb::VectorImage<float> InputImageType; + typedef otb::Image<unsigned char> MaskImageType; + + if (argc < 4) + { + std::cout << "Usage : "<<argv[0]<< " input_vector_path output_path baseline_path" << std::endl; + } + + std::string vectorPath(argv[1]); + int LayerIndex = 0; + std::string outputPath(argv[2]); + std::string baselineVectorPath(argv[3]); + + otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(vectorPath); + + // --------------------- Prepare input data -------------------------------- + InputImageType::RegionType region; + region.SetSize(0,99); + region.SetSize(1,50); + + InputImageType::PointType origin; + origin.Fill(0.5); + + InputImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = -1.0; + + InputImageType::PixelType pixel(3); + pixel.Fill(1); + + InputImageType::Pointer inputImage = InputImageType::New(); + inputImage->SetNumberOfComponentsPerPixel(3); + inputImage->SetLargestPossibleRegion(region); + inputImage->SetOrigin(origin); + inputImage->SetSpacing(spacing); + // Don't allocate the input image, the filter should not need it + //inputImage->Allocate(); + //inputImage->FillBuffer(pixel); + + MaskImageType::Pointer mask = MaskImageType::New(); + mask->SetRegions(region); + mask->SetOrigin(origin); + mask->SetSpacing(spacing); + mask->Allocate(); + itk::ImageRegionIterator<MaskImageType> it(mask,region); + unsigned int count = 0; + for (it.GoToBegin(); !it.IsAtEnd() ; ++it, ++count) + { + it.Set(count % 2); + } + + std::string fieldName("Label"); + + otb::SamplingRateCalculator::MapRateType ratesByClass = + GetRatesForMinimumSamples(LayerIndex); + + otb::ogr::DataSource::Pointer output = + otb::ogr::DataSource::New(outputPath,otb::ogr::DataSource::Modes::Overwrite); + + //-------------------------------------------------------------- + typedef otb::OGRDataToSamplePositionFilter< + InputImageType,MaskImageType,otb::PatternSampler> SelectionFilterType; + + SelectionFilterType::Pointer selector = SelectionFilterType::New(); + selector->SetInput(inputImage); + selector->SetMask(mask); + selector->SetOGRData(vectors); + selector->SetOutputPositionContainerAndRates(output,ratesByClass); + selector->SetFieldName(fieldName); + selector->SetLayerIndex(LayerIndex); + + // set sampling patterns for polygon layer + std::string patternClass1("1111"); + std::string patternClass2("1001011011111011011011111011100100111001101110101111110110111110101101011110000110111111100111111110010001011010101101111110011101110011001111111110000101000110"); + std::string patternClass3("1000011011111001011011001011100100110001101100101110110110101110101101001100000110011111100111011000010001011010101100011000011100100011001111110110000101000110101101101000001001010010011001010100101000010010110"); + + otb::PatternSampler::ParameterType param1, param2, param3; + param1.Seed = 0UL; + param1.MaxPatternSize=0UL; + param1.Pattern1 = std::vector<bool>(); + param1.Pattern2 = std::vector<bool>(); + param2 = param1; + param3 = param1; + otb::PatternSampler::ImportPatterns(patternClass1,param1); + otb::PatternSampler::ImportPatterns(patternClass2,param2); + otb::PatternSampler::ImportPatterns(patternClass3,param3); + + (selector->GetSamplers())[std::string("1")]->SetParameters(param1); + (selector->GetSamplers())[std::string("2")]->SetParameters(param2); + (selector->GetSamplers())[std::string("3")]->SetParameters(param3); + + selector->Update(); + + otb::ogr::DataSource::Pointer baseline = otb::ogr::DataSource::New(baselineVectorPath, otb::ogr::DataSource::Modes::Read); + + return TestPositionContainers(output,baseline); +} diff --git a/Modules/Learning/Sampling/test/otbSamplingRateCalculatorTest.cxx b/Modules/Learning/Sampling/test/otbSamplingRateCalculatorTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..89322b438c9812093bb6102e5acdbede9d835c95 --- /dev/null +++ b/Modules/Learning/Sampling/test/otbSamplingRateCalculatorTest.cxx @@ -0,0 +1,63 @@ +/*========================================================================= + + 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 "otbSamplingRateCalculator.h" + +#include "otbStatisticsXMLFileReader.h" +#include "itkVariableLengthVector.h" + +int otbSamplingRateCalculatorNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) +{ + typedef otb::SamplingRateCalculator RateCalculatorype; + + RateCalculatorype::Pointer rateCalculator = RateCalculatorype::New(); + std::cout << rateCalculator << std::endl; + return EXIT_SUCCESS; +} + +int otbSamplingRateCalculator(int itkNotUsed(argc), char* argv[]) +{ + std::string outputRatesTxt(argv[1]); + + typedef otb::SamplingRateCalculator::ClassCountMapType ClassCountMapType; + + ClassCountMapType classCount; + classCount[std::string("1")] = 104; + classCount[std::string("2")] = 160; + classCount[std::string("3")] = 211; + + unsigned int nbSamples = 83; + + typedef otb::SamplingRateCalculator RateCalculatorype; + RateCalculatorype::Pointer rateCalculator = RateCalculatorype::New(); + rateCalculator->SetClassCount(classCount); + rateCalculator->SetNbOfSamplesAllClasses(nbSamples); + rateCalculator->Write(outputRatesTxt); + rateCalculator->Print(std::cout); + + // Read back + RateCalculatorype::Pointer rateCalculatorCheck = RateCalculatorype::New(); + rateCalculatorCheck->Read(outputRatesTxt); + if ( rateCalculator->GetRatesByClass() != rateCalculatorCheck->GetRatesByClass() ) + { + std::cout << "Imported rates by class are different from exported ones!" << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Modules/Learning/Sampling/test/otbSamplingTestDriver.cxx b/Modules/Learning/Sampling/test/otbSamplingTestDriver.cxx index 9201df427a1db6a1e6d0b16b9c38247be16d334f..20a48dc1de860e25d0a0eb78326ad4a9b277d77b 100644 --- a/Modules/Learning/Sampling/test/otbSamplingTestDriver.cxx +++ b/Modules/Learning/Sampling/test/otbSamplingTestDriver.cxx @@ -1,6 +1,14 @@ #include "otbTestMain.h" void RegisterTests() { + REGISTER_TEST(otbSamplingRateCalculatorNew); + REGISTER_TEST(otbSamplingRateCalculator); + REGISTER_TEST(otbOGRDataToSamplePositionFilterNew); + REGISTER_TEST(otbOGRDataToSamplePositionFilter); + REGISTER_TEST(otbOGRDataToSamplePositionFilterPattern); REGISTER_TEST(otbOGRDataToClassStatisticsFilterNew); REGISTER_TEST(otbOGRDataToClassStatisticsFilter); + REGISTER_TEST(otbImageSampleExtractorFilterNew); + REGISTER_TEST(otbImageSampleExtractorFilter); + REGISTER_TEST(otbImageSampleExtractorFilterUpdate); } diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h index a812eca2b8f36708b19e186d7221a0a23cc07f4f..ba95eeaa148f39d7c3beccd505529b6d9daaf964 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoostMachineLearningModel_h -#define __otbBoostMachineLearningModel_h +#ifndef otbBoostMachineLearningModel_h +#define otbBoostMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -93,23 +93,23 @@ public: itkSetMacro(MaxDepth, int); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -117,10 +117,10 @@ protected: BoostMachineLearningModel(); /** Destructor */ - virtual ~BoostMachineLearningModel(); + ~BoostMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: BoostMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx index 15a9d5c293b8fa61a87b2f714aef15d0379a0686..8d20ca5f7f5d16068ed2b136e6e53791d59c71d8 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoostMachineLearningModel_txx -#define __otbBoostMachineLearningModel_txx +#ifndef otbBoostMachineLearningModel_txx +#define otbBoostMachineLearningModel_txx #include "otbBoostMachineLearningModel.h" #include "otbOpenCVUtils.h" @@ -61,7 +61,7 @@ BoostMachineLearningModel<TInputValue,TOutputValue> cv::Mat labels; otb::ListSampleToMat<TargetListSampleType>(this->GetTargetListSample(),labels); - CvBoostParams params = CvBoostParams(m_BoostType, m_WeakCount, m_WeightTrimRate, m_MaxDepth, false, 0); + CvBoostParams params = CvBoostParams(m_BoostType, m_WeakCount, m_WeightTrimRate, m_MaxDepth, false, ITK_NULLPTR); params.split_criteria = m_SplitCrit; //train the Boost model @@ -92,7 +92,7 @@ BoostMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { (*quality) = static_cast<ConfidenceValueType>( m_BoostModel->predict(sample,missing,cv::Range::all(),false,true)); @@ -107,7 +107,7 @@ BoostMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_BoostModel->save(filename.c_str(), 0); + m_BoostModel->save(filename.c_str(), ITK_NULLPTR); else m_BoostModel->save(filename.c_str(), name.c_str()); } @@ -118,7 +118,7 @@ BoostMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_BoostModel->load(filename.c_str(), 0); + m_BoostModel->load(filename.c_str(), ITK_NULLPTR); else m_BoostModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h index eb65e79f18c6a29550fd190ac4fd7609e22c36ac..27f3251405cf80c3f12c737d502723924c5c5c8f 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoostMachineLearningModelFactory_h -#define __otbBoostMachineLearningModelFactory_h +#ifndef otbBoostMachineLearningModelFactory_h +#define otbBoostMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: BoostMachineLearningModelFactory(); - virtual ~BoostMachineLearningModelFactory(); + ~BoostMachineLearningModelFactory() ITK_OVERRIDE; private: BoostMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.txx index a31617b1a3036a298c57965cfa76ca8b37891684..855b94bb1cc99a35e8d8f1dc6a668e10372268d2 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbBoostMachineLearningModelFactory_txx +#define otbBoostMachineLearningModelFactory_txx + #include "otbBoostMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ BoostMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h index 6c349b7ce44fa1f7ba13f3d75f951202e5b1c9e9..8f1390c144a1cb5eb3155253a82b78dfe10d5395 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbConfusionMatrixCalculator_h -#define __otbConfusionMatrixCalculator_h +#ifndef otbConfusionMatrixCalculator_h +#define otbConfusionMatrixCalculator_h #include "otbMacro.h" #include "otbConfusionMatrixMeasurements.h" @@ -140,8 +140,8 @@ public: protected: ConfusionMatrixCalculator(); - virtual ~ConfusionMatrixCalculator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ConfusionMatrixCalculator() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx index 305220a9191744f330997eb2106c24af640e5ab1..e3806533c702a808a88b9c159c20a4007a8bfba2 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConfusionMatrixCalculator_txx -#define __otbConfusionMatrixCalculator_txx +#ifndef otbConfusionMatrixCalculator_txx +#define otbConfusionMatrixCalculator_txx +#include "otbConfusionMatrixCalculator.h" namespace otb { diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h index 2863d0ad8122ba7e0b2654b6bba1d6ba72357659..e2dd235ee9f30ffa6bc1e88e60a2e6b8769a74f4 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbConfusionMatrixMeasurements_h -#define __otbConfusionMatrixMeasurements_h +#ifndef otbConfusionMatrixMeasurements_h +#define otbConfusionMatrixMeasurements_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -140,7 +140,7 @@ public: protected: ConfusionMatrixMeasurements(); - virtual ~ConfusionMatrixMeasurements() {} + ~ConfusionMatrixMeasurements() ITK_OVERRIDE {} //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.txx b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.txx index da4dcb4940682d4acba7aa56d2f62641aa65b29d..6f3389e8b7818fb038b1779627c517c55df47a9b 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.txx +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConfusionMatrixMeasurements_txx -#define __otbConfusionMatrixMeasurements_txx +#ifndef otbConfusionMatrixMeasurements_txx +#define otbConfusionMatrixMeasurements_txx +#include "otbConfusionMatrixMeasurements.h" namespace otb { diff --git a/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h index 536a7608a9720fdfa1e14e07f2d2e84707cb8f1c..3494a4e67061f8592173a34ca4cf3a02ceb3f891 100644 --- a/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h +++ b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbCvRTreesWrapper_h -#define __otbCvRTreesWrapper_h +#ifndef otbCvRTreesWrapper_h +#define otbCvRTreesWrapper_h #include "otbOpenCVUtils.h" #include <vector> @@ -34,7 +34,7 @@ class CV_EXPORTS_W CvRTreesWrapper : public CvRTrees public: typedef std::vector<unsigned int> VotesVectorType; CvRTreesWrapper(); - virtual ~CvRTreesWrapper(); + ~CvRTreesWrapper() ITK_OVERRIDE; /** Compute the number of votes for each class. */ void get_votes(const cv::Mat& sample, diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h index d7ce6d530c30bbf1047217a2219d1e1dbbaf773e..571bbd597a2c21a821ccd6a8d403a38718814c8f 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDecisionTreeMachineLearningModel_h -#define __otbDecisionTreeMachineLearningModel_h +#ifndef otbDecisionTreeMachineLearningModel_h +#define otbDecisionTreeMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -148,23 +148,23 @@ public: } /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -172,10 +172,10 @@ protected: DecisionTreeMachineLearningModel(); /** Destructor */ - virtual ~DecisionTreeMachineLearningModel(); + ~DecisionTreeMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: DecisionTreeMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx index 283fb039c35fd04aea4cc2a63c580ee665014ab4..07ce3a1129c93a9225e9dae06b4c208779a6093b 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDecisionTreeMachineLearningModel_txx -#define __otbDecisionTreeMachineLearningModel_txx +#ifndef otbDecisionTreeMachineLearningModel_txx +#define otbDecisionTreeMachineLearningModel_txx #include "otbDecisionTreeMachineLearningModel.h" #include "otbOpenCVUtils.h" @@ -64,7 +64,7 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue> cv::Mat labels; otb::ListSampleToMat<TargetListSampleType>(this->GetTargetListSample(),labels); - float * priors = m_Priors.empty() ? 0 : &m_Priors.front(); + float * priors = m_Priors.empty() ? ITK_NULLPTR : &m_Priors.front(); CvDTreeParams params = CvDTreeParams(m_MaxDepth, m_MinSampleCount, m_RegressionAccuracy, m_UseSurrogates, m_MaxCategories, m_CVFolds, m_Use1seRule, m_TruncatePrunedTree, priors); @@ -96,7 +96,7 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { if (!this->m_ConfidenceIndex) { @@ -113,7 +113,7 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_DTreeModel->save(filename.c_str(), 0); + m_DTreeModel->save(filename.c_str(), ITK_NULLPTR); else m_DTreeModel->save(filename.c_str(), name.c_str()); } @@ -124,7 +124,7 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_DTreeModel->load(filename.c_str(), 0); + m_DTreeModel->load(filename.c_str(), ITK_NULLPTR); else m_DTreeModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h index 54e3341041cb7301d6ba2ff009100e958592b00e..c38907a8724fadcaedde64c7d2e6187a456b9f08 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDecisionTreeMachineLearningModelFactory_h -#define __otbDecisionTreeMachineLearningModelFactory_h +#ifndef otbDecisionTreeMachineLearningModelFactory_h +#define otbDecisionTreeMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: DecisionTreeMachineLearningModelFactory(); - virtual ~DecisionTreeMachineLearningModelFactory(); + ~DecisionTreeMachineLearningModelFactory() ITK_OVERRIDE; private: DecisionTreeMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.txx index 578e867366607fc2d53d43a00a5d46cd504f8f23..9e289752acf917e4015e5e0f09207aeda07bd404 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbDecisionTreeMachineLearningModelFactory_txx +#define otbDecisionTreeMachineLearningModelFactory_txx + #include "otbDecisionTreeMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ DecisionTreeMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h index 30baf7aa302c1b0dee8d2f26b16a7d0f9f8a4c59..4221da6df8b58ba195c75347507665df8bd845f8 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGradientBoostedTreeMachineLearningModel_h -#define __otbGradientBoostedTreeMachineLearningModel_h +#ifndef otbGradientBoostedTreeMachineLearningModel_h +#define otbGradientBoostedTreeMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -101,23 +101,23 @@ public: itkSetMacro(UseSurrogates, bool); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -125,10 +125,10 @@ protected: GradientBoostedTreeMachineLearningModel(); /** Destructor */ - virtual ~GradientBoostedTreeMachineLearningModel(); + ~GradientBoostedTreeMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GradientBoostedTreeMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx index d08abec0290776a5d6a7ddfd3df27e6b5216d620..53e6931575e6f134115a21d5587fa7a006a8f173 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGradientBoostedTreeMachineLearningModel_txx -#define __otbGradientBoostedTreeMachineLearningModel_txx +#ifndef otbGradientBoostedTreeMachineLearningModel_txx +#define otbGradientBoostedTreeMachineLearningModel_txx #include "otbGradientBoostedTreeMachineLearningModel.h" #include "otbOpenCVUtils.h" @@ -92,7 +92,7 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { if (!this->m_ConfidenceIndex) { @@ -109,7 +109,7 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_GBTreeModel->save(filename.c_str(), 0); + m_GBTreeModel->save(filename.c_str(), ITK_NULLPTR); else m_GBTreeModel->save(filename.c_str(), name.c_str()); } @@ -120,7 +120,7 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_GBTreeModel->load(filename.c_str(), 0); + m_GBTreeModel->load(filename.c_str(), ITK_NULLPTR); else m_GBTreeModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h index a1c915dc95dec6894ffd6cc4c6913f0b877110da..1e7f11a7f65a5639b6d58c3b6894b21591c4b5cb 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGradientBoostedTreeMachineLearningModelFactory_h -#define __otbGradientBoostedTreeMachineLearningModelFactory_h +#ifndef otbGradientBoostedTreeMachineLearningModelFactory_h +#define otbGradientBoostedTreeMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: GradientBoostedTreeMachineLearningModelFactory(); - virtual ~GradientBoostedTreeMachineLearningModelFactory(); + ~GradientBoostedTreeMachineLearningModelFactory() ITK_OVERRIDE; private: GradientBoostedTreeMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.txx index 6d6fda5ab95b112de2400ce4aa79be9bbdee4b6b..de861f1dde39b9b0526c3e13386a857b1ec4e324 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbGradientBoostedTreeMachineLearningModelFactory_txx +#define otbGradientBoostedTreeMachineLearningModelFactory_txx + #include "otbGradientBoostedTreeMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ GradientBoostedTreeMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbImageClassificationFilter.h b/Modules/Learning/Supervised/include/otbImageClassificationFilter.h index f6ed68aa1db6cec92aa37bdc870f0e19cbd59651..e8ee652f0fccb863fe6ce9c819f86fd6e8bcdc5e 100644 --- a/Modules/Learning/Supervised/include/otbImageClassificationFilter.h +++ b/Modules/Learning/Supervised/include/otbImageClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageClassificationFilter_h -#define __otbImageClassificationFilter_h +#ifndef otbImageClassificationFilter_h +#define otbImageClassificationFilter_h #include "itkImageToImageFilter.h" #include "otbMachineLearningModel.h" @@ -106,14 +106,14 @@ protected: /** Constructor */ ImageClassificationFilter(); /** Destructor */ - virtual ~ImageClassificationFilter() {} + ~ImageClassificationFilter() ITK_OVERRIDE {} /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx index b0a5d5e3e842ec986dfc2400736b84e2a405bb53..72614862a991acc87bd75ed14ff4e6d3fdc103cb 100644 --- a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx +++ b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageClassificationFilter_txx -#define __otbImageClassificationFilter_txx +#ifndef otbImageClassificationFilter_txx +#define otbImageClassificationFilter_txx #include "otbImageClassificationFilter.h" #include "itkImageRegionIterator.h" @@ -57,7 +57,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); } @@ -70,7 +70,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<ConfidenceImageType *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h index 3f29a10af3ed6b46d700684eddeab80a5076c17a..bc5e58697295e96ac44ff0d63c87acfabc095a98 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKNearestNeighborsMachineLearningModel_h -#define __otbKNearestNeighborsMachineLearningModel_h +#ifndef otbKNearestNeighborsMachineLearningModel_h +#define otbKNearestNeighborsMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -72,23 +72,23 @@ public: itkSetMacro(DecisionRule, int); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -96,10 +96,10 @@ protected: KNearestNeighborsMachineLearningModel(); /** Destructor */ - virtual ~KNearestNeighborsMachineLearningModel(); + ~KNearestNeighborsMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: KNearestNeighborsMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx index fd33b7c9061fc3ce66c70cf9ea5c4c7780c42dc8..2a6705d1aa1aa5093d50201fe06731318f97ce38 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKNearestNeighborsMachineLearningModel_txx -#define __otbKNearestNeighborsMachineLearningModel_txx +#ifndef otbKNearestNeighborsMachineLearningModel_txx +#define otbKNearestNeighborsMachineLearningModel_txx #include <boost/lexical_cast.hpp> #include "otbKNearestNeighborsMachineLearningModel.h" @@ -93,10 +93,10 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue> float result; cv::Mat nearest(1,m_K,CV_32FC1); - result = m_KNearestModel->find_nearest(sample, m_K,0,0,&nearest,0); + result = m_KNearestModel->find_nearest(sample, m_K,ITK_NULLPTR,ITK_NULLPTR,&nearest,ITK_NULLPTR); // compute quality if asked (only happens in classification mode) - if (quality != NULL) + if (quality != ITK_NULLPTR) { assert(!this->m_RegressionMode); unsigned int accuracy = 0; diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h index 068efe098a80ee63dcd0d5bdb574075590301ea2..c8a96eadeab2039180f86444007555bb315530cb 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbKNearestNeighborsMachineLearningModelFactory_h -#define __otbKNearestNeighborsMachineLearningModelFactory_h +#ifndef otbKNearestNeighborsMachineLearningModelFactory_h +#define otbKNearestNeighborsMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: KNearestNeighborsMachineLearningModelFactory(); - virtual ~KNearestNeighborsMachineLearningModelFactory(); + ~KNearestNeighborsMachineLearningModelFactory() ITK_OVERRIDE; private: KNearestNeighborsMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.txx index 70499ac015c9f89ec7dc36852556b22289d5496f..d5a8c2ead90dc92d5f10bf2e1bc37bde1dfb90f9 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbKNearestNeighborsMachineLearningModelFactory_txx +#define otbKNearestNeighborsMachineLearningModelFactory_txx + #include "otbKNearestNeighborsMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ KNearestNeighborsMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h index 622923753e37d1216de669a9724c72b979015f83..b398f7d640a1f3c0add82222a56e31baeabb0fac 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLibSVMMachineLearningModel_h -#define __otbLibSVMMachineLearningModel_h +#ifndef otbLibSVMMachineLearningModel_h +#define otbLibSVMMachineLearningModel_h #include "itkLightObject.h" #include "itkFixedArray.h" @@ -60,23 +60,23 @@ public: itkTypeMacro(SVMMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string &filename, const std::string & name=""); + void Save(const std::string &filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} //Setters/Getters to SVM model @@ -120,10 +120,10 @@ protected: LibSVMMachineLearningModel(); /** Destructor */ - virtual ~LibSVMMachineLearningModel(); + ~LibSVMMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LibSVMMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx index e95e97543d3a67537c848c8933165d5907370400..70da67ed4ef9dea8dd124f0b6e5844f9545bcf13 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLibSVMMachineLearningModel_txx -#define __otbLibSVMMachineLearningModel_txx +#ifndef otbLibSVMMachineLearningModel_txx +#define otbLibSVMMachineLearningModel_txx #include <fstream> #include "otbLibSVMMachineLearningModel.h" @@ -79,7 +79,7 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue> target = m_SVMestimator->GetModel()->EvaluateLabel(mfunctor(input)); - if (quality != NULL) + if (quality != ITK_NULLPTR) { if (!this->m_ConfidenceIndex) { diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h index 13dbb91892c0f62d040a506549de78f5b63b070c..5b72bf775b09136eff9a5d3d774fd906f66bec0b 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLibSVMMachineLearningModelFactory_h -#define __otbLibSVMMachineLearningModelFactory_h +#ifndef otbLibSVMMachineLearningModelFactory_h +#define otbLibSVMMachineLearningModelFactory_h #include "itkObjectFactoryBase.h" #include "itkImageIOBase.h" @@ -39,8 +39,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -57,7 +57,7 @@ public: protected: LibSVMMachineLearningModelFactory(); - virtual ~LibSVMMachineLearningModelFactory(); + ~LibSVMMachineLearningModelFactory() ITK_OVERRIDE; private: LibSVMMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.txx index fd5f7bcca173ec4f5810a8cc173686b9f6cccc36..a4771f102b964376f84a0e85fb04575786fcba44 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbLibSVMMachineLearningModelFactory_txx +#define otbLibSVMMachineLearningModelFactory_txx + #include "otbLibSVMMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ LibSVMMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModel.h b/Modules/Learning/Supervised/include/otbMachineLearningModel.h index b18e39e15c89fabff9ff2c640122740e710972f5..3bc693cbc459fa35cb39821fe19ceed663b210ec 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMachineLearningModel_h -#define __otbMachineLearningModel_h +#ifndef otbMachineLearningModel_h +#define otbMachineLearningModel_h #include "itkObject.h" #include "itkVariableLengthVector.h" @@ -100,7 +100,7 @@ public: virtual void Train() =0; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality = NULL) const = 0; + virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality = ITK_NULLPTR) const = 0; /** Classify all samples in InputListSample and fill TargetListSample with the associated label */ void PredictAll(); @@ -151,10 +151,10 @@ protected: MachineLearningModel(); /** Destructor */ - virtual ~MachineLearningModel(); + ~MachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Input list sample */ typename InputListSampleType::Pointer m_InputListSample; diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbMachineLearningModel.txx index 8cc82055fe1a7a08594a01f3d9aeba6dfc12d927..c3954072ccda0e90733f6299db5767540983475f 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMachineLearningModel_txx -#define __otbMachineLearningModel_txx +#ifndef otbMachineLearningModel_txx +#define otbMachineLearningModel_txx #include "otbMachineLearningModel.h" diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h index 94a72511521dce0789e2a75a657c2c7d719c21ab..8941bc44e8c192228ac3f0114d876894f4ee354b 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMachineLearningModelFactory_h -#define __otbMachineLearningModelFactory_h +#ifndef otbMachineLearningModelFactory_h +#define otbMachineLearningModelFactory_h #include "otbMachineLearningModel.h" #include "otbMachineLearningModelFactoryBase.h" @@ -53,9 +53,11 @@ public: /** Create the appropriate MachineLearningModel depending on the particulars of the file. */ static MachineLearningModelTypePointer CreateMachineLearningModel(const std::string& path, FileModeType mode); + static void CleanFactories(); + protected: MachineLearningModelFactory(); - ~MachineLearningModelFactory(); + ~MachineLearningModelFactory() ITK_OVERRIDE; private: MachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.txx index 7fe0d4301ec2140673fe1add92107798edd75b38..c5c5cea552a85b2f16b244e63d339c488d239d77 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbMachineLearningModelFactory_txx +#define otbMachineLearningModelFactory_txx + #include "otbMachineLearningModelFactory.h" #include "otbConfigure.h" @@ -81,7 +84,7 @@ for(typename std::list<MachineLearningModelTypePointer>::iterator k = possibleMa } } - return 0; + return ITK_NULLPTR; } template <class TInputValue, class TOutputValue> @@ -120,4 +123,97 @@ MachineLearningModelFactory<TInputValue,TOutputValue> itk::ObjectFactoryBase::RegisterFactory(factory); } +template <class TInputValue, class TOutputValue> +void +MachineLearningModelFactory<TInputValue,TOutputValue> +::CleanFactories() +{ + itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex); + + std::list<itk::ObjectFactoryBase*> factories = itk::ObjectFactoryBase::GetRegisteredFactories(); + std::list<itk::ObjectFactoryBase*>::iterator itFac; + + for (itFac = factories.begin(); itFac != factories.end() ; ++itFac) + { +#ifdef OTB_USE_LIBSVM + LibSVMMachineLearningModelFactory<TInputValue,TOutputValue> *libsvmFactory = + dynamic_cast<LibSVMMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (libsvmFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(libsvmFactory); + continue; + } +#endif +#ifdef OTB_USE_OPENCV + // RandomForest + RandomForestsMachineLearningModelFactory<TInputValue,TOutputValue> *rfFactory = + dynamic_cast<RandomForestsMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (rfFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(rfFactory); + continue; + } + // SVM + SVMMachineLearningModelFactory<TInputValue,TOutputValue> *svmFactory = + dynamic_cast<SVMMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (svmFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(svmFactory); + continue; + } + // Boost + BoostMachineLearningModelFactory<TInputValue,TOutputValue> *boostFactory = + dynamic_cast<BoostMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (boostFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(boostFactory); + continue; + } + // ANN + NeuralNetworkMachineLearningModelFactory<TInputValue,TOutputValue> *annFactory = + dynamic_cast<NeuralNetworkMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (annFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(annFactory); + continue; + } + // Bayes + NormalBayesMachineLearningModelFactory<TInputValue,TOutputValue> *bayesFactory = + dynamic_cast<NormalBayesMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (bayesFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(bayesFactory); + continue; + } + // Decision Tree + DecisionTreeMachineLearningModelFactory<TInputValue,TOutputValue> *dtFactory = + dynamic_cast<DecisionTreeMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (dtFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(dtFactory); + continue; + } + // Gradient Boosted tree + GradientBoostedTreeMachineLearningModelFactory<TInputValue,TOutputValue> *gbtFactory = + dynamic_cast<GradientBoostedTreeMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (gbtFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(gbtFactory); + continue; + } + // KNN + KNearestNeighborsMachineLearningModelFactory<TInputValue,TOutputValue> *knnFactory = + dynamic_cast<KNearestNeighborsMachineLearningModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (knnFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(knnFactory); + continue; + } +#endif + } + +} + } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModelFactoryBase.h b/Modules/Learning/Supervised/include/otbMachineLearningModelFactoryBase.h index bffd9661366e40dc298af6fc2e1ef6503bb9dfcd..0c02236527bbbe529d93a7aee9820eda8cab64f2 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModelFactoryBase.h +++ b/Modules/Learning/Supervised/include/otbMachineLearningModelFactoryBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMachineLearningModelFactoryBase_h -#define __otbMachineLearningModelFactoryBase_h +#ifndef otbMachineLearningModelFactoryBase_h +#define otbMachineLearningModelFactoryBase_h #include "itkMutexLock.h" @@ -45,7 +45,7 @@ public: protected: MachineLearningModelFactoryBase(); - virtual ~MachineLearningModelFactoryBase(); + ~MachineLearningModelFactoryBase() ITK_OVERRIDE; static itk::SimpleMutexLock mutex; diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h index 8f4f182b0762239cb65e8636c9786da3f11be2e1..dd132b956d17a3a7a39f45d03d0a200d2b2ed3be 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeuralNetworkMachineLearningModel_h -#define __otbNeuralNetworkMachineLearningModel_h +#ifndef otbNeuralNetworkMachineLearningModel_h +#define otbNeuralNetworkMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -169,23 +169,23 @@ public: itkSetMacro(Epsilon, double); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -193,12 +193,12 @@ protected: NeuralNetworkMachineLearningModel(); /** Destructor */ - virtual ~NeuralNetworkMachineLearningModel(); + ~NeuralNetworkMachineLearningModel() ITK_OVERRIDE; void LabelsToMat(const TargetListSampleType * listSample, cv::Mat & output); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: NeuralNetworkMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx index f55eb5375c9d1f4c522cd89bfc6b25556aeddfb6..9e1e6bb8f507a01c8f4348d3e736db5fff3a5792 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeuralNetworkMachineLearningModel_txx -#define __otbNeuralNetworkMachineLearningModel_txx +#ifndef otbNeuralNetworkMachineLearningModel_txx +#define otbNeuralNetworkMachineLearningModel_txx #include <fstream> #include "otbNeuralNetworkMachineLearningModel.h" @@ -40,7 +40,7 @@ NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::NeuralNetworkMachi m_TermCriteriaType(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS), m_MaxIter(1000), m_Epsilon(0.01), - m_CvMatOfLabels(0) + m_CvMatOfLabels(ITK_NULLPTR) { this->m_ConfidenceIndex = true; this->m_IsRegressionSupported = true; @@ -74,7 +74,7 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::LabelsToMat(c cv::Mat & output) { unsigned int nbSamples = 0; - if (labels != NULL) + if (labels != ITK_NULLPTR) { nbSamples = labels->Size(); } @@ -244,7 +244,7 @@ typename NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::TargetSam } } - if (quality != NULL) + if (quality != ITK_NULLPTR) { (*quality) = static_cast<ConfidenceValueType>(maxResponse) - static_cast<ConfidenceValueType>(secondResponse); } @@ -260,15 +260,16 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Save(const st if ( !name.empty() ) lname = name.c_str(); - CvFileStorage* fs = 0; - fs = cvOpenFileStorage(filename.c_str(), 0, CV_STORAGE_WRITE); + CvFileStorage* fs = ITK_NULLPTR; + fs = cvOpenFileStorage(filename.c_str(), ITK_NULLPTR, CV_STORAGE_WRITE); if ( !fs ) { itkExceptionMacro("Could not open the file " << filename << " for writing"); } m_ANNModel->write(fs, lname); - cvWrite(fs, "class_labels", m_CvMatOfLabels); + if (m_CvMatOfLabels != ITK_NULLPTR) + cvWrite(fs, "class_labels", m_CvMatOfLabels); cvReleaseFileStorage(&fs); } @@ -277,7 +278,7 @@ template<class TInputValue, class TOutputValue> void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Load(const std::string & filename, const std::string & name) { - const char* lname = 0; + const char* lname = ITK_NULLPTR; if ( !name.empty() ) lname = name.c_str(); diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h index 60326de7a519cc90be5c6f1323b826215654c847..fbdae76395334a60b8c0389cd6ec880534ee66ea 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNeuralNetworkMachineLearningModelFactory_h -#define __otbNeuralNetworkMachineLearningModelFactory_h +#ifndef otbNeuralNetworkMachineLearningModelFactory_h +#define otbNeuralNetworkMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: NeuralNetworkMachineLearningModelFactory(); - virtual ~NeuralNetworkMachineLearningModelFactory(); + ~NeuralNetworkMachineLearningModelFactory() ITK_OVERRIDE; private: NeuralNetworkMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.txx index 83d1bc526e409638190145c5913626ab12054b79..613d1f850c323b995958bf065e1fdafafb5d4178 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbNeuralNetworkMachineLearningModelFactory_txx +#define otbNeuralNetworkMachineLearningModelFactory_txx + #include "otbNeuralNetworkMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ NeuralNetworkMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h index 8ecfcd2b51d607169b30dcc86dd59d2096d728f4..f9362e970dfbfb9b5a82b87761e0e6c4b73333de 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalBayesMachineLearningModel_h -#define __otbNormalBayesMachineLearningModel_h +#ifndef otbNormalBayesMachineLearningModel_h +#define otbNormalBayesMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -53,23 +53,23 @@ public: itkTypeMacro(NormalBayesMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} protected: @@ -77,10 +77,10 @@ protected: NormalBayesMachineLearningModel(); /** Destructor */ - virtual ~NormalBayesMachineLearningModel(); + ~NormalBayesMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: NormalBayesMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx index 7538f02c8818fcd07851f26044724992d4747af5..b4ef2c295546a8cc3b9ba003ea091f31a9d0d2a6 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalBayesMachineLearningModel_txx -#define __otbNormalBayesMachineLearningModel_txx +#ifndef otbNormalBayesMachineLearningModel_txx +#define otbNormalBayesMachineLearningModel_txx #include <fstream> #include "itkMacro.h" @@ -76,7 +76,7 @@ NormalBayesMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { if (!this->HasConfidenceIndex()) { @@ -93,7 +93,7 @@ NormalBayesMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_NormalBayesModel->save(filename.c_str(), 0); + m_NormalBayesModel->save(filename.c_str(), ITK_NULLPTR); else m_NormalBayesModel->save(filename.c_str(), name.c_str()); } @@ -104,7 +104,7 @@ NormalBayesMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_NormalBayesModel->load(filename.c_str(), 0); + m_NormalBayesModel->load(filename.c_str(), ITK_NULLPTR); else m_NormalBayesModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h index c4e5c8a5be49376947b26b23542ff64ef2a5cf0d..6067f67f35ac23795657acf61ad91229f66db981 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNormalBayesMachineLearningModelFactory_h -#define __otbNormalBayesMachineLearningModelFactory_h +#ifndef otbNormalBayesMachineLearningModelFactory_h +#define otbNormalBayesMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: NormalBayesMachineLearningModelFactory(); - virtual ~NormalBayesMachineLearningModelFactory(); + ~NormalBayesMachineLearningModelFactory() ITK_OVERRIDE; private: NormalBayesMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.txx index 879c79678f24bb0a0b31d133a69e342933b3b9c4..5c9796e2e71ad37ebecc6a39c07646a610801fcb 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbNormalBayesMachineLearningModelFactory_txx +#define otbNormalBayesMachineLearningModelFactory_txx + #include "otbNormalBayesMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ NormalBayesMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbOpenCVUtils.h b/Modules/Learning/Supervised/include/otbOpenCVUtils.h index 607c6cc559f7b78cc647522350e91de3a67e227e..01ee23f57c734c0b8d44b199c383ac1f992b2ebd 100644 --- a/Modules/Learning/Supervised/include/otbOpenCVUtils.h +++ b/Modules/Learning/Supervised/include/otbOpenCVUtils.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpenCVUtils_h -#define __otbOpenCVUtils_h +#ifndef otbOpenCVUtils_h +#define otbOpenCVUtils_h #include <opencv2/core/core_c.h> @@ -66,7 +66,7 @@ namespace otb unsigned int sampleIdx = 0; // Check for valid listSample - if(listSample != NULL && listSample->Size() > 0) + if(listSample != ITK_NULLPTR && listSample->Size() > 0) { // Retrieve samples count unsigned int sampleCount = listSample->Size(); diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h index 942e3de986956154529dbda14622de898c9d5b3e..bc2a51ab8ef12d6e8cdd8fce71afc288935648ed 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRandomForestsMachineLearningModel_h -#define __otbRandomForestsMachineLearningModel_h +#ifndef otbRandomForestsMachineLearningModel_h +#define otbRandomForestsMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" @@ -61,23 +61,23 @@ public: itkTypeMacro(RandomForestsMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} //Setters of RT parameters (documentation get from opencv doxygen 2.4) @@ -134,10 +134,10 @@ protected: RandomForestsMachineLearningModel(); /** Destructor */ - virtual ~RandomForestsMachineLearningModel(); + ~RandomForestsMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /* /\** Input list sample *\/ */ /* typename InputListSampleType::Pointer m_InputListSample; */ diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx index aa0f054aa7a13940a2cd710e2adf326f01b9f3f5..cb95be8e75b5edfaa0893c0f6f61050c3b339fb2 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRandomForestsMachineLearningModel_txx -#define __otbRandomForestsMachineLearningModel_txx +#ifndef otbRandomForestsMachineLearningModel_txx +#define otbRandomForestsMachineLearningModel_txx #include <fstream> #include "itkMacro.h" @@ -79,7 +79,7 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue> //Define random forests paramneters //FIXME do this in the constructor? - float * priors = m_Priors.empty() ? 0 : &m_Priors.front(); + float * priors = m_Priors.empty() ? ITK_NULLPTR : &m_Priors.front(); CvRTParams params = CvRTParams(m_MaxDepth, // max depth m_MinSampleCount, // min sample count @@ -124,7 +124,7 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { if(m_ComputeMargin) (*quality) = m_RFModel->predict_margin(sample); @@ -141,7 +141,7 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_RFModel->save(filename.c_str(), 0); + m_RFModel->save(filename.c_str(), ITK_NULLPTR); else m_RFModel->save(filename.c_str(), name.c_str()); } @@ -152,7 +152,7 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_RFModel->load(filename.c_str(), 0); + m_RFModel->load(filename.c_str(), ITK_NULLPTR); else m_RFModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h index 7a3e7e3a8ebeb437c189271ea4e58e0e86845619..02c97efe016551c0d9ed6b70546d0a3827728f02 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRandomForestsMachineLearningModelFactory_h -#define __otbRandomForestsMachineLearningModelFactory_h +#ifndef otbRandomForestsMachineLearningModelFactory_h +#define otbRandomForestsMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: RandomForestsMachineLearningModelFactory(); - virtual ~RandomForestsMachineLearningModelFactory(); + ~RandomForestsMachineLearningModelFactory() ITK_OVERRIDE; private: RandomForestsMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.txx index 591b5802d650a4d2dfce478685a58b96695f1bbf..dc27f006712520dcb9622d2fbcc64d305a0b8ab3 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbRandomForestsMachineLearningModelFactory_txx +#define otbRandomForestsMachineLearningModelFactory_txx + #include "otbRandomForestsMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ RandomForestsMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/Learning/Supervised/include/otbRequiresOpenCVCheck.h b/Modules/Learning/Supervised/include/otbRequiresOpenCVCheck.h index 3330d8b9cf3eb97be94c38547419e8f2e892f057..83f73b1164aab1c1006ea23a016c9d5d134aee27 100644 --- a/Modules/Learning/Supervised/include/otbRequiresOpenCVCheck.h +++ b/Modules/Learning/Supervised/include/otbRequiresOpenCVCheck.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRequiresOpenCVCheck_h -#define __otbRequiresOpenCVCheck_h +#ifndef otbRequiresOpenCVCheck_h +#define otbRequiresOpenCVCheck_h #include "otbConfigure.h" #ifndef OTB_USE_OPENCV diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h index c976d666b128ee8d84884fd886fc14c8a355513e..06131fe76b398260cdb970120504a8e2ba494d88 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h @@ -16,8 +16,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMMachineLearningModel_h -#define __otbSVMMachineLearningModel_h +#ifndef otbSVMMachineLearningModel_h +#define otbSVMMachineLearningModel_h #include "otbRequiresOpenCVCheck.h" #include "itkLightObject.h" @@ -60,23 +60,23 @@ public: itkTypeMacro(SVMMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - virtual void Train(); + void Train() ITK_OVERRIDE; /** Predict values using the model */ - virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const; + TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const ITK_OVERRIDE; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name=""); + void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name=""); + void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &); + bool CanReadFile(const std::string &) ITK_OVERRIDE; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &); + bool CanWriteFile(const std::string &) ITK_OVERRIDE; //@} //Setters/Getters to SVM model @@ -134,10 +134,10 @@ protected: SVMMachineLearningModel(); /** Destructor */ - virtual ~SVMMachineLearningModel(); + ~SVMMachineLearningModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SVMMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx index 9d0b7d685948ebf67b070c6a16fcc9e6f760ea34..57006ce0d7945dcf6fdc8a38ea28d5a5e7940d19 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMMachineLearningModel_txx -#define __otbSVMMachineLearningModel_txx +#ifndef otbSVMMachineLearningModel_txx +#define otbSVMMachineLearningModel_txx #include <fstream> #include "itkMacro.h" @@ -84,7 +84,7 @@ SVMMachineLearningModel<TInputValue,TOutputValue> // Set up SVM's parameters CvTermCriteria term_crit = cvTermCriteria(m_TermCriteriaType, m_MaxIter, m_Epsilon); - CvSVMParams params( m_SVMType, m_KernelType, m_Degree, m_Gamma, m_Coef0, m_C, m_Nu, m_P, NULL , term_crit ); + CvSVMParams params( m_SVMType, m_KernelType, m_Degree, m_Gamma, m_Coef0, m_C, m_Nu, m_P, ITK_NULLPTR , term_crit ); // Train the SVM if (!m_ParameterOptimization) @@ -131,7 +131,7 @@ SVMMachineLearningModel<TInputValue,TOutputValue> target[0] = static_cast<TOutputValue>(result); - if (quality != NULL) + if (quality != ITK_NULLPTR) { (*quality) = m_SVMModel->predict(sample,true); } @@ -145,7 +145,7 @@ SVMMachineLearningModel<TInputValue,TOutputValue> ::Save(const std::string & filename, const std::string & name) { if (name == "") - m_SVMModel->save(filename.c_str(), 0); + m_SVMModel->save(filename.c_str(), ITK_NULLPTR); else m_SVMModel->save(filename.c_str(), name.c_str()); } @@ -156,7 +156,7 @@ SVMMachineLearningModel<TInputValue,TOutputValue> ::Load(const std::string & filename, const std::string & name) { if (name == "") - m_SVMModel->load(filename.c_str(), 0); + m_SVMModel->load(filename.c_str(), ITK_NULLPTR); else m_SVMModel->load(filename.c_str(), name.c_str()); } diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h index bc911450367acee98dc8e2b8e88386baa7e6c236..caf2289ebbcc7742ae848a7a6c0faf00b935c731 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSVMMachineLearningModelFactory_h -#define __otbSVMMachineLearningModelFactory_h +#ifndef otbSVMMachineLearningModelFactory_h +#define otbSVMMachineLearningModelFactory_h #include "otbRequiresOpenCVCheck.h" @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: SVMMachineLearningModelFactory(); - virtual ~SVMMachineLearningModelFactory(); + ~SVMMachineLearningModelFactory() ITK_OVERRIDE; private: SVMMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.txx b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.txx index ddf96df72009d9fb1af3f30bc638c7297df1761b..160daeb79faf7447b80948b3912b919c2ef9f802 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.txx +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.txx @@ -15,6 +15,9 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbSVMMachineLearningModelFactory_txx +#define otbSVMMachineLearningModelFactory_txx + #include "otbSVMMachineLearningModelFactory.h" #include "itkCreateObjectFunction.h" @@ -62,3 +65,5 @@ SVMMachineLearningModelFactory<TInputValue,TOutputValue> } } // end namespace otb + +#endif diff --git a/Modules/MPI/MPIConfig/CMakeLists.txt b/Modules/MPI/MPIConfig/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5656f1bc73fcc6b4cf74789f425b17e6439fbf5 --- /dev/null +++ b/Modules/MPI/MPIConfig/CMakeLists.txt @@ -0,0 +1,7 @@ +project(MPIConfig) +set(MPIConfig_LIBRARIES MPIConfig) + +set(OTBMPIConfig_LIBRARIES OTBMPIConfig) + +otb_module_impl() + diff --git a/Modules/MPI/MPIConfig/README b/Modules/MPI/MPIConfig/README new file mode 100644 index 0000000000000000000000000000000000000000..e30ca8bb5c45886310a7eb0a9205db01e831b3b8 --- /dev/null +++ b/Modules/MPI/MPIConfig/README @@ -0,0 +1,71 @@ +General +======= + +This is a template module for the ORFEO +Toolbox(https://www.orfeo-toolbox.org/). It is designed to work with OTBv5 +modular system and to be places in OTB/Module/Remote. + +This module is empty it is just a template to be used as a starting point for a +module with actual content. It contains the template for sources (src folder), +test (test folder) and application (app folder). + +Getting Started +=============== + +The official OTB Wiki documentation on adding an external module is here: +http://wiki.orfeo-toolbox.org/index.php/How_to_write_a_remote_module + +Remote Module +------------- + +After a module has been created as a git repository it can be included +as a remote module, which enables automatic fetching. Add a file in +"OTB/Modules/Remote" called "YourModule.remote.cmake", for this module +it would be "ExternalExample.remote.cmake" with the followlowing contents: + +otb_fetch_module(ExternalTemplate + "A template for a module." + GIT_REPOSITORY https://github.com/orfeotoolbox/otbExternalModuleTemplate + GIT_TAG master + ) + +Editing +======= + +The CMakeLists.txt and otb-modules need to be modified with the name of the +module, something along the following: + +sed 's/ExternalTemplate/MyModule/g' CMakeLists.txt otb-module.cmake + +There is the inplace option to sed, but it's not portable, so do this change by +hand or look up the option in sed. + +Then hack away at you code in include, src, test and app folders. + +License +======= + +This software is distributed under the Apache License. Please see LICENSE for +details. + +Author +====== + +Manuel Grizonnet + +Thanks +====== + +It is a fork of the ITK template module provided by Bradley Lowekamp +(https://github.com/blowekamp/itkExternalTemplate.git) which was adapted for the +ORFEO ToolBox. + +Compilation des tests +===================== +module load cmake/3.4.3 openmpi/1.10.2 otb/develop +cd build +rm -rf * +cmake -DCMAKE_CXX_FLAGS="-Wno-unused-local-typedefs -std=c++11" .. +make +ctest + diff --git a/Modules/MPI/MPIConfig/include/otbMPIConfig.h b/Modules/MPI/MPIConfig/include/otbMPIConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..8f1f4c6cba23dc52396202c20b53c2a7b5f78d2e --- /dev/null +++ b/Modules/MPI/MPIConfig/include/otbMPIConfig.h @@ -0,0 +1,94 @@ +/*========================================================================= + 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 otbMPIConfig_h +#define otbMPIConfig_h + +#include "itkObject.h" +#include "itkMacro.h" +#include "itkObjectFactory.h" + +namespace otb { + +/** \class MPI config + * \brief Manage MPI ressources + * TODO + * + * + * \ingroup OTBMPIConfig + */ +class MPIConfig: public itk::LightObject +{ +public: + /** Standard class typedefs. */ + typedef MPIConfig Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Retrieve the singleton instance */ + static Pointer Instance(); + + /** Run-time type information (and related methods). */ + itkTypeMacro(MPIConfig, itk::LightObject); + + /** MPI Parameters accessors */ + itkGetMacro(MyRank, unsigned int); + itkGetMacro(NbProcs,unsigned int); + + /** Initialize MPI Processus */ + void Init(int& argc, char** &argv, bool abortOnException = true); + + /** Abort all MPI processus. */ + void abort(int errCode); + + /** Blocks until all processes have reached this routine */ + void barrier(); + + /** Log error */ + void logError(const std::string message); + + /** Log info */ + void logInfo(const std::string message); + +protected: + /** Constructor */ + MPIConfig(); + + /** Destructor */ + virtual ~MPIConfig(); + +private: + + MPIConfig(const MPIConfig &); //purposely not implemented + void operator =(const MPIConfig&); //purposely not implemented + + // MPI rank + unsigned int m_MyRank; + // Number of MPI processus + unsigned int m_NbProcs; + // Boolean to abort on exception + bool m_abortOnException; + // Boolean to test if the MPI environment is initialized + bool m_initialized; + + static Pointer m_Singleton; +}; + +} // End namespace otb + +#endif //__otbMPIConfig_h diff --git a/Modules/MPI/MPIConfig/otb-module.cmake b/Modules/MPI/MPIConfig/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..016aa13089acaf6d87a90b7b76cdb1a987c12bad --- /dev/null +++ b/Modules/MPI/MPIConfig/otb-module.cmake @@ -0,0 +1,17 @@ +set(DOCUMENTATION "Provides a helper class to configure and use MPI.") + +otb_module(OTBMPIConfig + DEPENDS + OTBITK + OTBImageIO + OTBStreaming + OTBMPI + TEST_DEPENDS + OTBBoost + OTBImageBase + OTBImageManipulation + OTBMPITiffWriter + OTBTestKernel + DESCRIPTION + "${DOCUMENTATION}" +) diff --git a/Modules/MPI/MPIConfig/src/CMakeLists.txt b/Modules/MPI/MPIConfig/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e816fbe64fb2f27629620282f9e651ee966659ec --- /dev/null +++ b/Modules/MPI/MPIConfig/src/CMakeLists.txt @@ -0,0 +1,10 @@ +#${otb-module} will be the name of this module and will not need to be +#changed when this module is renamed. + +set(${otb-module}_SRC + otbMPIConfig.cxx +) + +add_library(${otb-module} ${${otb-module}_SRC}) +target_link_libraries(${otb-module} ${OTBCommon_LIBRARIES} ${OTBMPI_LIBRARIES}) +otb_module_target(${otb-module}) diff --git a/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx b/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx new file mode 100644 index 0000000000000000000000000000000000000000..49ffb07ffc0df21083f07115224fb862ab4aad06 --- /dev/null +++ b/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx @@ -0,0 +1,170 @@ +/*========================================================================= + + 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 "otbMPIConfig.h" + +#include <exception> +#include <cstdlib> +#include <iostream> +#include <sstream> +#include <string> +#include <cassert> + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +#include <mpi.h> +# pragma GCC diagnostic pop +#else +#include <mpi.h> +#endif + + +/** + * Call the MPI routine MPIFunc with arguments Args (surrounded by + * parentheses). If the result is not MPI_SUCCESS, throw an exception. + */ +#define OTB_MPI_CHECK_RESULT( MPIFunc, Args ) \ + { \ + int _result = MPIFunc Args; \ + if (_result != MPI_SUCCESS) \ + { \ + std::stringstream message; \ + message << "otb::ERROR: " << #MPIFunc << " (Code = " << _result; \ + ::itk::ExceptionObject _e(__FILE__, __LINE__, message.str().c_str()); \ + throw _e; \ + } \ + } + + + +namespace otb { + +/** Initialize the singleton */ +MPIConfig::Pointer MPIConfig::m_Singleton = NULL; + +MPIConfig::Pointer MPIConfig::Instance() +{ + if(m_Singleton.GetPointer() == NULL) + { + m_Singleton = itk::ObjectFactory<Self>::Create(); + + if(m_Singleton.GetPointer() == NULL) + { + m_Singleton = new MPIConfig; + } + m_Singleton->UnRegister(); + } + + return m_Singleton; +} + + +/** CreateInitialize MPI environment */ +MPIConfig::MPIConfig() + : m_MyRank(-1), + m_NbProcs(0), + m_abortOnException(true), + m_initialized(false) +{ +} + +/** Shuts down the MPI environment. */ +MPIConfig::~MPIConfig() +{ + if (m_initialized) + { + if (std::uncaught_exception() && m_abortOnException) + { + abort(EXIT_FAILURE); + } + else + { + int finalized; + OTB_MPI_CHECK_RESULT(MPI_Finalized,(&finalized)); + if (!finalized) + { + OTB_MPI_CHECK_RESULT(MPI_Finalize,()); + } + } + } +} + +/** Initialize MPI environment */ +void MPIConfig::Init(int& argc, char** &argv, bool abortOnException) { + // Abort on exception + m_abortOnException = abortOnException; + // Initialize + int initialized; + OTB_MPI_CHECK_RESULT(MPI_Initialized,(&initialized)); + m_initialized = (initialized == 1); + if (!m_initialized) { + OTB_MPI_CHECK_RESULT(MPI_Init, (&argc, &argv)); + m_initialized = true; + } + // Get MPI rank + int irank = 0; + OTB_MPI_CHECK_RESULT(MPI_Comm_rank, (MPI_COMM_WORLD , &irank)); + + if(irank<0) + { + logError("Negative MPI rank"); + abort(EXIT_FAILURE); + } + + m_MyRank = static_cast<unsigned int>(irank); + + // Get MPI NbProocs + + int inbprocs=0; + + OTB_MPI_CHECK_RESULT(MPI_Comm_size, (MPI_COMM_WORLD , &inbprocs)); + + if(inbprocs<1) + { + logError("Negative or null number of processes"); + abort(EXIT_FAILURE); + } + + m_NbProcs = static_cast<unsigned int>(inbprocs); +} + +void MPIConfig::abort(int errCode) +{ + OTB_MPI_CHECK_RESULT(MPI_Abort, (MPI_COMM_WORLD, errCode)); +} + +void MPIConfig::barrier() +{ + OTB_MPI_CHECK_RESULT(MPI_Barrier, (MPI_COMM_WORLD)); +} + +void MPIConfig::logError(const std::string message) { + if (m_MyRank == 0) + { + std::cerr << message << std::endl; + } +} + +void MPIConfig::logInfo(const std::string message) { + if (m_MyRank == 0) + { + std::cout << message << std::endl; + } +} + +} // End namespace otb diff --git a/Modules/MPI/MPIConfig/test/CMakeLists.txt b/Modules/MPI/MPIConfig/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..130757142e0efa231305b8f83104102765ed1046 --- /dev/null +++ b/Modules/MPI/MPIConfig/test/CMakeLists.txt @@ -0,0 +1,18 @@ +otb_module_test() + +#${otb-module} will be the name of this module and will not need to be #changed when this module is renamed. + +set(${otb-module}Tests + otbMPIConfigTestDriver.cxx + otbMPIConfigTest.cxx +) + +add_executable(otbMPIConfigTestDriver ${${otb-module}Tests}) +target_link_libraries(otbMPIConfigTestDriver ${${otb-module}-Test_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_CHRONO_LIBRARY}) +otb_module_target_label(otbMPIConfigTestDriver) + + +# MPI Hello test +otb_add_test_mpi(NAME otbMPIConfigTest + NBPROCS 2 + COMMAND otbMPIConfigTestDriver otbMPIConfigTest ) diff --git a/Modules/MPI/MPIConfig/test/otbMPIConfigTest.cxx b/Modules/MPI/MPIConfig/test/otbMPIConfigTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ab7d3dc21291bc561a0b7ca7862c1786b57b9df4 --- /dev/null +++ b/Modules/MPI/MPIConfig/test/otbMPIConfigTest.cxx @@ -0,0 +1,35 @@ +/*========================================================================= + + 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 "otbMPIConfig.h" +#include <iostream> +#include "itkMultiThreader.h" + +int otbMPIConfigTest(int argc, char* argv[]) { + + // MPI Configuration + typedef otb::MPIConfig MPIConfigType; + MPIConfigType::Pointer config = MPIConfigType::Instance(); + config->Init(argc,argv,true); + + // Test + std::cout<<"OTB MPI config test. I am process "<<config->GetMyRank()<<" among "<<config->GetNbProcs()<<"."<<std::endl; + + return EXIT_SUCCESS; +} + diff --git a/Modules/MPI/MPIConfig/test/otbMPIConfigTestDriver.cxx b/Modules/MPI/MPIConfig/test/otbMPIConfigTestDriver.cxx new file mode 100644 index 0000000000000000000000000000000000000000..51b3948e12c9915e14a52b59c817bef82614596e --- /dev/null +++ b/Modules/MPI/MPIConfig/test/otbMPIConfigTestDriver.cxx @@ -0,0 +1,6 @@ +#include "otbTestMain.h" +void RegisterTests() +{ + REGISTER_TEST(otbMPIConfigTest); +} + diff --git a/Modules/MPI/MPITiffWriter/CMakeLists.txt b/Modules/MPI/MPITiffWriter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1de5f5e070efee8f68d27325921cfe2b09bdcc0 --- /dev/null +++ b/Modules/MPI/MPITiffWriter/CMakeLists.txt @@ -0,0 +1,2 @@ +project(OTBMPITiffWriter) +otb_module_impl() diff --git a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..92b4e7a3e7babcd798869aa738aff021769b2d7a --- /dev/null +++ b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h @@ -0,0 +1,336 @@ +/*========================================================================= + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + TODO: Add copyright notice for Remi Cresson (IRSTEA) + + 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 otbSimpleParallelTiffWriter_h +#define otbSimpleParallelTiffWriter_h + + +#include "otbImageIOBase.h" +#include "itkProcessObject.h" +#include "otbStreamingManager.h" +#include "otbExtendedFilenameToWriterOptions.h" +#include "otbMPIConfig.h" + +// Time probe +#include "itkTimeProbe.h" + + +#include "itkImageFileWriter.h" + +#include "itkObjectFactoryBase.h" + +#include "itkImageRegionMultidimensionalSplitter.h" +#include "otbImageIOFactory.h" + +#include "itkImageRegionIterator.h" + +#include "itkMetaDataObject.h" +#include "otbImageKeywordlist.h" +#include "otbMetaDataKey.h" + +#include "otbConfigure.h" + +#include "otbNumberOfDivisionsStrippedStreamingManager.h" +#include "otbNumberOfDivisionsTiledStreamingManager.h" +#include "otbNumberOfLinesStrippedStreamingManager.h" +#include "otbRAMDrivenStrippedStreamingManager.h" +#include "otbTileDimensionTiledStreamingManager.h" +#include "otbRAMDrivenTiledStreamingManager.h" +#include "otbRAMDrivenAdaptativeStreamingManager.h" + +#include <boost/foreach.hpp> +#include <boost/tokenizer.hpp> +#include <boost/algorithm/string.hpp> + +// SPTW +#include <algorithm> +#include <vector> + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +#include "sptw.h" +# pragma GCC diagnostic pop +#else +#include "sptw.h" +#endif + +// GDAL-OTB datatype brigde +#include "otbGdalDataTypeBridge.h" + +namespace otb +{ + + +/** \class SimpleParallelTiffWriter + * \brief Writes a GeoTiff image using parallel non collective operations. + * + * SimpleParallelTiffWriter writes its input data to a single output file. + * SimpleParallelTiffWriter interfaces with an MPI-IO based class to write out the + * data whith streaming process and mutliple processing nodes. + * + * SimpleParallelTiffWriter will divide the output into several pieces + * (controlled by SetNumberOfDivisionsStrippedStreaming, SetNumberOfLinesStrippedStreaming, + * SetAutomaticStrippedStreaming, SetTileDimensionTiledStreaming or SetAutomaticTiledStreaming), + * and call the upstream pipeline for each piece, tiling the individual outputs into one large + * output. This reduces the memory footprint for the application since + * each filter does not have to process the entire dataset at once. + * + * SimpleParallelTiffWriter will write directly the streaming buffer in the image file, so + * that the output image never needs to be completely allocated + * + * SimpleParallelTiffWriter implements a version of Simple Parallel Tiff Writer (SPTW, + * D.M. Mattli, USGS) + * + * Splitting strategies are close to those implemented in ImageFileWriter, except + * layout is optimized for the number of MPI processes for stripped regions. + * TODO: optimize the splitting layout for tiled regions + * + * + * \sa ImageFileWriter + * \ingroup OTBMPITiffWriter + */ +template <class TInputImage> +class ITK_EXPORT SimpleParallelTiffWriter : public itk::ProcessObject +{ +public: + /** Standard class typedefs. */ + typedef SimpleParallelTiffWriter Self; + typedef itk::ProcessObject 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(SimpleParallelTiffWriter, itk::ProcessObject); + + /** Some typedefs for the input and output. */ + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::PixelType InputImagePixelType; + typedef typename InputImageType::IndexType InputIndexType; + + typedef TInputImage OutputImageType; + typedef typename OutputImageType::Pointer OutputImagePointer; + typedef typename OutputImageType::RegionType OutputImageRegionType; + typedef typename OutputImageType::PixelType OutputImagePixelType; + typedef typename Superclass::DataObjectPointer DataObjectPointer; + + /** The Filename Helper. */ + typedef otb::ExtendedFilenameToWriterOptions FNameHelperType; + + /** Dimension of input image. */ + itkStaticConstMacro(InputImageDimension, unsigned int, + InputImageType::ImageDimension); + + /** Streaming manager base class pointer */ + typedef otb::StreamingManager<InputImageType> StreamingManagerType; + typedef typename StreamingManagerType::Pointer StreamingManagerPointerType; + + /** Return the StreamingManager object responsible for dividing + * the region to write */ + StreamingManagerType* GetStreamingManager(void) + { + return m_StreamingManager; + } + + /** Set a user-specified implementation of StreamingManager + * used to divide the largest possible region in several divisions */ + void SetStreamingManager(StreamingManagerType* streamingManager) + { + m_StreamingManager = streamingManager; + } + + /** Set the streaming mode to 'stripped' and configure the number of strips + * which will be used to stream the image */ + void SetNumberOfDivisionsStrippedStreaming(unsigned int nbDivisions); + + /** Set the streaming mode to 'tiled' and configure the number of tiles + * which will be used to stream the image */ + void SetNumberOfDivisionsTiledStreaming(unsigned int nbDivisions); + + /** Set the streaming mode to 'stripped' and configure the number of strips + * which will be used to stream the image with respect to a number of line + * per strip */ + void SetNumberOfLinesStrippedStreaming(unsigned int nbLinesPerStrip); + + /** Set the streaming mode to 'stripped' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option. + * The bias parameter is a multiplier applied on the estimated memory size + * of the pipeline and can be used to fine tune the potential gap between + * estimated memory and actual memory used, which can happen because of + * composite filters for example */ + void SetAutomaticStrippedStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + /** Set the streaming mode to 'tiled' and configure the dimension of the tiles + * in pixels for each dimension (square tiles will be generated) */ + void SetTileDimensionTiledStreaming(unsigned int tileDimension); + + /** Set the streaming mode to 'tiled' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Tiles will be square. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option + * The bias parameter is a multiplier applied on the estimated memory size + * of the pipeline and can be used to fine tune the potential gap between + * estimated memory and actual memory used, which can happen because of + * composite filters for example */ + void SetAutomaticTiledStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + /** Set the streaming mode to 'adaptative' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Tiles will try to match the input file tile scheme. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option */ + void SetAutomaticAdaptativeStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + /** Set the only input of the writer */ + using Superclass::SetInput; + virtual void SetInput(const InputImageType *input); + + /** Get writer only input */ + const InputImageType* GetInput(); + + /** Does the real work. */ + virtual void Update(); + + /** SimpleParallelTiffWriter Methods */ + virtual void SetFileName(const char* extendedFileName); + virtual void SetFileName(std::string extendedFileName); + virtual const char* GetFileName () const; + + /** Specify the region to write. If left NULL, then the whole image + * is written. */ + void SetIORegion(const itk::ImageIORegion& region); + itkGetConstReferenceMacro(IORegion, itk::ImageIORegion); + + /** By default the MetaDataDictionary is taken from the input image and + * passed to the ImageIO. In some cases, however, a user may prefer to + * introduce her/his own MetaDataDictionary. This is often the case of + * the ImageSeriesWriter. This flag defined whether the MetaDataDictionary + * to use will be the one from the input image or the one already set in + * the ImageIO object. */ + itkSetMacro(UseInputMetaDataDictionary, bool); + itkGetConstReferenceMacro(UseInputMetaDataDictionary, bool); + itkBooleanMacro(UseInputMetaDataDictionary); + + itkSetObjectMacro(ImageIO, otb::ImageIOBase); + itkGetObjectMacro(ImageIO, otb::ImageIOBase); + itkGetConstObjectMacro(ImageIO, otb::ImageIOBase); + + /* Writer modes */ + itkSetMacro(Verbose, bool); + itkGetMacro(Verbose, bool); + itkSetMacro(VirtualMode, bool); + itkGetMacro(VirtualMode, bool); + + /* GeoTiff options */ + itkSetMacro(TiffTileSize, int); + itkGetMacro(TiffTileSize, int); + itkSetMacro(TiffTiledMode, bool); + itkGetMacro(TiffTiledMode, bool); + +protected: + SimpleParallelTiffWriter(); + virtual ~SimpleParallelTiffWriter(); + void PrintSelf(std::ostream& os, itk::Indent indent) const; + +private: + SimpleParallelTiffWriter(const SimpleParallelTiffWriter &); //purposely not implemented + void operator =(const SimpleParallelTiffWriter&); //purposely not implemented + + void ObserveSourceFilterProgress(itk::Object* object, const itk::EventObject & event ) + { + if (typeid(event) != typeid(itk::ProgressEvent)) + { + return; + } + + itk::ProcessObject* processObject = dynamic_cast<itk::ProcessObject*>(object); + if (processObject) + { + m_DivisionProgress = processObject->GetProgress(); + } + + this->UpdateFilterProgress(); + } + + void UpdateFilterProgress() + { + this->UpdateProgress( (m_DivisionProgress + m_CurrentDivision) / m_NumberOfDivisions ); + } + + /* + * Returns the process id which process a given region + */ + unsigned int GetProcFromDivision(unsigned int regionIndex); + + /* + * Arranges the splitting layout to match the number of MPI processes + */ + unsigned int OptimizeStrippedSplittingLayout(unsigned int n); + + unsigned int m_NumberOfDivisions; + unsigned int m_CurrentDivision; + float m_DivisionProgress; + + /** SimpleParallelTiffWriter Parameters */ + std::string m_FileName; + + otb::ImageIOBase::Pointer m_ImageIO; + + bool m_UserSpecifiedImageIO; //track whether the ImageIO is user specified + + itk::ImageIORegion m_IORegion; + bool m_UserSpecifiedIORegion; // track whether the region is user specified + bool m_FactorySpecifiedImageIO; //track whether the factory mechanism set the ImageIO + bool m_UseInputMetaDataDictionary; // whether to use the + // MetaDataDictionary from the + // input or not. + + bool m_WriteGeomFile; // Write a geom file to store the + // kwl + + FNameHelperType::Pointer m_FilenameHelper; + + StreamingManagerPointerType m_StreamingManager; + + bool m_IsObserving; + unsigned long m_ObserverID; + InputIndexType m_ShiftOutputIndex; + + int m_TiffTileSize; + bool m_Verbose; + bool m_VirtualMode; + bool m_TiffTiledMode; +}; + + +} // end namespace itk + + + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbSimpleParallelTiffWriter.txx" +#endif + +#endif diff --git a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx new file mode 100644 index 0000000000000000000000000000000000000000..b9bd8dd1552a4d15629bb810b4370febe30fbb1a --- /dev/null +++ b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx @@ -0,0 +1,808 @@ +/*========================================================================= + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + TODO: Add copyright notice for Remi Cresson (IRSTEA) + + 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 otbSimpleParallelTiffWriter_txx +#define otbSimpleParallelTiffWriter_txx + +#include "otbSimpleParallelTiffWriter.h" +#include "itkTimeProbe.h" + +using std::vector; + +using sptw::PTIFF; +using sptw::open_raster; +using sptw::create_generic_raster; +using sptw::SPTW_ERROR; + +namespace otb +{ + +/** + * + */ +template <class TInputImage> +SimpleParallelTiffWriter<TInputImage> +::SimpleParallelTiffWriter() + : m_NumberOfDivisions(0), + m_CurrentDivision(0), + m_DivisionProgress(0.0), + m_UserSpecifiedImageIO(true), + m_UserSpecifiedIORegion(false), + m_FactorySpecifiedImageIO(false), + m_UseInputMetaDataDictionary(false), + m_WriteGeomFile(false), + m_FilenameHelper(), + m_IsObserving(true), + m_ObserverID(0) + { + //Init output index shift + m_ShiftOutputIndex.Fill(0); + + // Default TIFF tile size, can be modified later + m_TiffTileSize = 1024; + + // Strip blocks + m_TiffTiledMode = false; + + // Verbose + m_Verbose = false; + + // Virtual mode + m_VirtualMode = false; + + // By default, we use striped streaming, with automatic region size + // We don't set any parameter, so the memory size is retrieved from the OTB configuration options + //this->SetAutomaticAdaptativeStreaming(); + this->SetAutomaticStrippedStreaming(); + + m_FilenameHelper = FNameHelperType::New(); + } + +/** + * + */ +template <class TInputImage> +SimpleParallelTiffWriter<TInputImage> +::~SimpleParallelTiffWriter() +{ +} + +template <class TInputImage> +unsigned int +SimpleParallelTiffWriter<TInputImage> +::GetProcFromDivision(unsigned int regionIndex) + { + if (otb::MPIConfig::Instance()->GetNbProcs()==0) + return 0; + return ( regionIndex % otb::MPIConfig::Instance()->GetNbProcs()); + } + +/* + * Arranges the splitting layout to match the number of MPI processes + */ +template <class TInputImage> +unsigned int +SimpleParallelTiffWriter<TInputImage> +::OptimizeStrippedSplittingLayout(unsigned int n) + { + unsigned int m = static_cast<unsigned int >(otb::MPIConfig::Instance()->GetNbProcs()); + if (n > m) + { + float div = static_cast<float>(n) / static_cast<float>(otb::MPIConfig::Instance()->GetNbProcs()); + m *= static_cast<unsigned int>(div); + } + itkDebugMacro( "Changing number of split from " << n << " to " << m ); + return m; + + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetNumberOfDivisionsStrippedStreaming(unsigned int nbDivisions) + { + typedef otb::NumberOfDivisionsStrippedStreamingManager<TInputImage> NumberOfDivisionsStrippedStreamingManagerType; + typename NumberOfDivisionsStrippedStreamingManagerType::Pointer streamingManager = NumberOfDivisionsStrippedStreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbDivisions); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetNumberOfDivisionsTiledStreaming(unsigned int nbDivisions) + { + typedef otb::NumberOfDivisionsTiledStreamingManager<TInputImage> NumberOfDivisionsTiledStreamingManagerType; + typename NumberOfDivisionsTiledStreamingManagerType::Pointer streamingManager = NumberOfDivisionsTiledStreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbDivisions); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetNumberOfLinesStrippedStreaming(unsigned int nbLinesPerStrip) + { + typedef otb::NumberOfLinesStrippedStreamingManager<TInputImage> NumberOfLinesStrippedStreamingManagerType; + typename NumberOfLinesStrippedStreamingManagerType::Pointer streamingManager = NumberOfLinesStrippedStreamingManagerType::New(); + streamingManager->SetNumberOfLinesPerStrip(nbLinesPerStrip); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetAutomaticStrippedStreaming(unsigned int availableRAM, double bias) + { + typedef otb::RAMDrivenStrippedStreamingManager<TInputImage> RAMDrivenStrippedStreamingManagerType; + typename RAMDrivenStrippedStreamingManagerType::Pointer streamingManager = RAMDrivenStrippedStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetTileDimensionTiledStreaming(unsigned int tileDimension) + { + typedef otb::TileDimensionTiledStreamingManager<TInputImage> TileDimensionTiledStreamingManagerType; + typename TileDimensionTiledStreamingManagerType::Pointer streamingManager = TileDimensionTiledStreamingManagerType::New(); + streamingManager->SetTileDimension(tileDimension); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetAutomaticTiledStreaming(unsigned int availableRAM, double bias) + { + typedef otb::RAMDrivenTiledStreamingManager<TInputImage> RAMDrivenTiledStreamingManagerType; + typename RAMDrivenTiledStreamingManagerType::Pointer streamingManager = RAMDrivenTiledStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + + m_StreamingManager = streamingManager; + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetAutomaticAdaptativeStreaming(unsigned int availableRAM, double bias) + { + typedef otb::RAMDrivenAdaptativeStreamingManager<TInputImage> RAMDrivenAdaptativeStreamingManagerType; + typename RAMDrivenAdaptativeStreamingManagerType::Pointer streamingManager = RAMDrivenAdaptativeStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + + m_StreamingManager = streamingManager; + } + +#ifndef ITK_LEGACY_REMOVE + +#endif // ITK_LEGACY_REMOVE +/** + * + */ +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::PrintSelf(std::ostream& os, itk::Indent indent) const + { + Superclass::PrintSelf(os, indent); + + os << indent << "File Name: " + << (m_FileName.data() ? m_FileName.data() : "(none)") << std::endl; + + os << indent << "Image IO: "; + if (m_ImageIO.IsNull()) + { + os << "(none)\n"; + } + else + { + os << m_ImageIO << "\n"; + } + + os << indent << "IO Region: " << m_IORegion << "\n"; + + if (m_UseInputMetaDataDictionary) + { + os << indent << "UseInputMetaDataDictionary: On\n"; + } + else + { + os << indent << "UseInputMetaDataDictionary: Off\n"; + } + + if (m_FactorySpecifiedImageIO) + { + os << indent << "FactorySpecifiedmageIO: On\n"; + } + else + { + os << indent << "FactorySpecifiedmageIO: Off\n"; + } + } + +//--------------------------------------------------------- +template<class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetIORegion(const itk::ImageIORegion& region) + { + itkDebugMacro("setting IORegion to " << region); + if (m_IORegion != region) + { + m_IORegion = region; + this->Modified(); + m_UserSpecifiedIORegion = true; + } + } + +template<class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetInput(const InputImageType* input) + { + this->ProcessObject::SetNthInput(0,const_cast<InputImageType*>(input)); + } + +template<class TInputImage> +const TInputImage* +SimpleParallelTiffWriter<TInputImage> +::GetInput() + { + if (this->GetNumberOfInputs() < 1) + { + return 0; + } + + return static_cast<const InputImageType*>(this->ProcessObject::GetInput(0)); + } + +/** + * Update method : update output information of input and write to file + */ +template<class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::Update() + { + // Update output information on input image + InputImagePointer inputPtr = + const_cast<InputImageType *>(this->GetInput()); + + // Make sure input is available + if ( inputPtr.IsNull() ) + { + itkExceptionMacro(<< "No input to writer"); + } + + /** Parse streaming modes */ + if(m_FilenameHelper->StreamingTypeIsSet()) + { + itkWarningMacro(<<"Streaming configuration through extended filename is used. Any previous streaming configuration (ram value, streaming mode ...) will be ignored."); + + std::string type = m_FilenameHelper->GetStreamingType(); + + std::string sizemode = "auto"; + + if(m_FilenameHelper->StreamingSizeModeIsSet()) + { + sizemode = m_FilenameHelper->GetStreamingSizeMode(); + } + + double sizevalue = 0.; + + if(m_FilenameHelper->StreamingSizeValueIsSet()) + { + sizevalue = m_FilenameHelper->GetStreamingSizeValue(); + } + + if(type == "auto") + { + if(sizemode != "auto") + { + itkWarningMacro(<<"In auto streaming type, the sizemode option will be ignored."); + } + if(sizevalue == 0.) + { + itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); + } + this->SetAutomaticAdaptativeStreaming(sizevalue); + } + else if(type == "tiled") + { + if(sizemode == "auto") + { + if(sizevalue == 0.) + { + itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); + } + this->SetAutomaticTiledStreaming(sizevalue); + } + else if(sizemode == "nbsplits") + { + if(sizevalue == 0.) + { + itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + } + this->SetNumberOfDivisionsTiledStreaming(static_cast<unsigned int>(sizevalue)); + } + else if(sizemode == "height") + { + if(sizevalue == 0.) + { + itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + } + + this->SetTileDimensionTiledStreaming(static_cast<unsigned int>(sizevalue)); + } + } + else if(type == "stripped") + { + if(sizemode == "auto") + { + if(sizevalue == 0.) + { + itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); + } + + this->SetAutomaticStrippedStreaming(sizevalue); + } + else if(sizemode == "nbsplits") + { + if(sizevalue == 0.) + { + itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + } + this->SetNumberOfDivisionsStrippedStreaming(static_cast<unsigned int>(sizevalue)); + } + else if(sizemode == "height") + { + if(sizevalue == 0.) + { + itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + } + this->SetNumberOfLinesStrippedStreaming(static_cast<unsigned int>(sizevalue)); + } + + } + else if (type == "none") + { + if(sizemode!="" || sizevalue!=0.) + { + itkWarningMacro("Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); + } + this->SetNumberOfDivisionsTiledStreaming(0); + } + } + else + { + if(m_FilenameHelper->StreamingSizeValueIsSet() || m_FilenameHelper->StreamingSizeModeIsSet()) + { + itkWarningMacro(<<"No streaming type is set, streaming sizemode and sizevalue will be ignored."); + } + } + + this->SetAbortGenerateData(0); + this->SetProgress(0.0); + + /** + * Tell all Observers that the filter is starting + */ + this->InvokeEvent(itk::StartEvent()); + + /* + * Check filename + */ + if (m_VirtualMode) + { + m_FileName = "virtualFile.tif"; + } + if (m_FileName == "") + { + // Make sure that filename is not empty + itkExceptionMacro(<< "No filename was specified"); + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + std::string::size_type idx; + idx = m_FileName.rfind('.'); + if(idx != std::string::npos) + { + std::string extension = m_FileName.substr(idx+1); + boost::algorithm::to_lower(extension); + if (boost::iequals(extension, "tif")) + { + // Extension is TIF + } + else + { + // Other extension + itkExceptionMacro(<<"Filename must have .tif extension !"); + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + } + else + { + // Missing extension + itkWarningMacro(<<"Filename has no extension. Adding <.tif> extension."); + m_FileName += ".tif"; + } + + /** + * Grab the input + */ + inputPtr->UpdateOutputInformation(); + InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion(); + + /** Parse region size modes */ + if(m_FilenameHelper->BoxIsSet()) + { + typedef boost::tokenizer<boost::char_separator<char> > Tokenizer; + + boost::char_separator<char> sep(":"); + Tokenizer tokens(m_FilenameHelper->GetBox(), sep); + + Tokenizer::iterator it = tokens.begin(); + typename InputImageRegionType::IndexType start; + typename InputImageRegionType::SizeType size; + + start[0] = atoi(it->c_str()); // first index on X + ++it; + start[1] = atoi(it->c_str()); // first index on Y + ++it; + size[0] = atoi(it->c_str()); // size along X + ++it; + size[1] = atoi(it->c_str()); // size along Y + + inputRegion.SetSize(size); + + m_ShiftOutputIndex = start; + inputRegion.SetIndex(m_ShiftOutputIndex); + + if (!inputRegion.Crop(inputPtr->GetLargestPossibleRegion())) + { + // Couldn't crop the region (requested region is outside the largest + // possible region). Throw an exception. + + // build an exception + itk::InvalidRequestedRegionError e(__FILE__, __LINE__); + e.SetLocation(ITK_LOCATION); + e.SetDescription("Requested box region is (at least partially) outside the largest possible region."); + e.SetDataObject(inputPtr); + throw e; + } + otbMsgDevMacro(<< "inputRegion " << inputRegion); + } + + // Get number of bands & pixel data type + GDALDataType dataType; + int nBands = 1; + typedef typename InputImageType::PixelType ImagePixelType; + if (strcmp(this->GetInput()->GetNameOfClass(), "VectorImage") == 0) + { + // Input is a vector image + typedef typename InputImageType::InternalPixelType VectorImagePixelType; + typedef typename InputImageType::AccessorFunctorType AccessorFunctorType; + dataType = otb::GdalDataTypeBridge::GetGDALDataType<VectorImagePixelType>(); + nBands *= AccessorFunctorType::GetVectorLength(this->GetInput()); + } + else + { + // Input is an image + dataType = otb::GdalDataTypeBridge::GetGDALDataType<ImagePixelType>(); + } + + /************************************************************************ + * Raster creation + ************************************************************************/ + + // First, compute the block size + int block_size_x = m_TiffTiledMode; + + if (m_TiffTiledMode) + { + // When mode is tiled, check the GeoTiff tile size + int inputRegionMinSize = std::min(inputRegion.GetSize()[0], inputRegion.GetSize()[1]); + if (m_TiffTileSize > inputRegionMinSize) + { + // Find the nearest (floor) power of 2 + block_size_x = (int) std::pow(2, std::floor(std::log((double) inputRegionMinSize)/std::log(2.0))); + itkWarningMacro(<<"GeoTiff tile size is bigger than image. Setting to " << block_size_x); + } + } + else + { + // When mode is not tiled (i.e. striped) + block_size_x = inputPtr->GetLargestPossibleRegion().GetSize()[0]; + } + + // Master process (Rank 0) is responsible for the creation of the output raster. + if (otb::MPIConfig::Instance()->GetMyRank() == 0 && !m_VirtualMode) + { + // Set geotransform + double geotransform[6]; + geotransform[0] = inputPtr->GetOrigin()[0] - 0.5*inputPtr->GetSpacing()[0]; + geotransform[1] = inputPtr->GetSpacing()[0]; + geotransform[2] = 0.0; + geotransform[3] = inputPtr->GetOrigin()[1] - 0.5*inputPtr->GetSpacing()[1]; + geotransform[4] = 0.0; + geotransform[5] = inputPtr->GetSpacing()[1]; + + // Call SPTW routine that creates the output raster + SPTW_ERROR sperr = create_generic_raster(m_FileName, + inputPtr->GetLargestPossibleRegion().GetSize()[0], + inputPtr->GetLargestPossibleRegion().GetSize()[1], + nBands, + dataType, + geotransform, + inputPtr->GetProjectionRef(), + block_size_x, + m_TiffTiledMode); + + if (sperr != sptw::SP_None) + { + itkExceptionMacro(<<"Error creating raster"); + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + } + + // Wait for rank 0 to finish creating the output raster + otb::MPIConfig::Instance()->barrier(); + + /************************************************************************ + * Raster update: open raster + ************************************************************************/ + + // Open raster (if not in virtual mode) + PTIFF* output_raster = NULL; + if (!m_VirtualMode) + { + output_raster = open_raster(m_FileName); + + // First, populate blocks offsets + if (otb::MPIConfig::Instance()->GetMyRank() == 0) + { + SPTW_ERROR sperr = populate_tile_offsets(output_raster, + block_size_x, + m_TiffTiledMode); + if (sperr != sptw::SP_None) + { + itkExceptionMacro(<<"Error populating tile offsets\n"); + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + } + + // Wait for tile offsets to be populated + otb::MPIConfig::Instance()->barrier(); + close_raster(output_raster); + + // Now open it + output_raster = open_raster(m_FileName); + otb::MPIConfig::Instance()->barrier(); + + if (output_raster == NULL) + { + itkExceptionMacro(<<"Could not open output raster"); + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + } + + /************************************************************************ + * Raster update: write regions + ************************************************************************/ + + // Time probe for overall process time + itk::TimeProbe overallTime; + overallTime.Start(); + + // Check that streaming is relevant + m_StreamingManager->PrepareStreaming(inputPtr, inputRegion); + m_NumberOfDivisions = m_StreamingManager->GetNumberOfSplits(); + + // Recompute a new splitting layout which fits better the MPI number of processes + // TODO make it work on tiled splits ! + // [dirtycode] + unsigned int newNumberOfStrippedSplits = OptimizeStrippedSplittingLayout(m_NumberOfDivisions); + this->SetNumberOfDivisionsStrippedStreaming(newNumberOfStrippedSplits); + m_StreamingManager->PrepareStreaming(inputPtr, inputRegion); + m_NumberOfDivisions = m_StreamingManager->GetNumberOfSplits(); + // [/dirtycode] + + // Configure process objects + this->UpdateProgress(0); + m_CurrentDivision = 0; + m_DivisionProgress = 0; + + // Get the source process object + itk::ProcessObject* source = inputPtr->GetSource(); + m_IsObserving = false; + m_ObserverID = 0; + + // Check if source exists + if(source) + { + typedef itk::MemberCommand<Self> CommandType; + typedef typename CommandType::Pointer CommandPointerType; + + CommandPointerType command = CommandType::New(); + command->SetCallbackFunction(this, &Self::ObserveSourceFilterProgress); + + m_ObserverID = source->AddObserver(itk::ProgressEvent(), command); + m_IsObserving = true; + } + else + { + itkWarningMacro(<< "Could not get the source process object. Progress report might be buggy"); + } + + // Loop on streaming tiles + double processDuration(0), writeDuration(0), numberOfProcessedRegions(0); + InputImageRegionType streamRegion; + for (m_CurrentDivision = 0; + m_CurrentDivision < m_NumberOfDivisions && !this->GetAbortGenerateData(); + m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress()) + { + streamRegion = m_StreamingManager->GetSplit(m_CurrentDivision); + + if (GetProcFromDivision(m_CurrentDivision) == otb::MPIConfig::Instance()->GetMyRank()) + { + /* + * Processing + */ + itk::TimeProbe processingTime; + processingTime.Start(); + inputPtr->SetRequestedRegion(streamRegion); + inputPtr->PropagateRequestedRegion(); + inputPtr->UpdateOutputData(); + processingTime.Stop(); + processDuration += processingTime.GetTotal(); + + /* + * Writing using SPTW + */ + itk::TimeProbe writingTime; + writingTime.Start(); + if (!m_VirtualMode) + { + sptw::write_area(output_raster, + inputPtr->GetBufferPointer(), + streamRegion.GetIndex()[0], + streamRegion.GetIndex()[1], + streamRegion.GetIndex()[0] + streamRegion.GetSize()[0] -1, + streamRegion.GetIndex()[1] + streamRegion.GetSize()[1] -1); + } + writingTime.Stop(); + writeDuration += writingTime.GetTotal(); + numberOfProcessedRegions += 1; + } + } + + // Clean up + close_raster(output_raster); + output_raster = NULL; + + // We wait for other process + otb::MPIConfig::Instance()->barrier(); + overallTime.Stop(); + + /* TODO: Use MPIConfig helper instead of MPI methods + // Get timings + const int nValues = 3; + double runtimes[nValues] = {processDuration, writeDuration, numberOfProcessedRegions}; + std::vector<double> process_runtimes(otb::MPIConfig::Instance()->GetNbProcs()*nValues); + MPI_Gather(runtimes, + nValues, + MPI_DOUBLE, + &(process_runtimes[0]), + nValues, + MPI_DOUBLE, + 0, + MPI_COMM_WORLD); + + // Display timings + if (otb::MPIConfig::Instance()->GetMyRank() == 0 && m_Verbose) + { + itkDebugMacro( "Runtime, in seconds" ); + itkDebugMacro( "Process Id\tProcessing\tWriting" ); + for (unsigned int i = 0; i < process_runtimes.size(); i+=nValues) + { + itkDebugMacro( <<(int (i/nValues)) << + "\t" << process_runtimes[i] << + "\t" << process_runtimes[i+1] << + "\t("<< process_runtimes[i+2] << " regions)" ); + } + itkDebugMacro( "Overall time:" << overallTime.GetTotal() ); + } + */ + + /** + * If we ended due to aborting, push the progress up to 1.0 (since + * it probably didn't end there) + */ + if (!this->GetAbortGenerateData()) + { + this->UpdateProgress(1.0); + } + + // Notify end event observers + this->InvokeEvent(itk::EndEvent()); + + if (m_IsObserving) + { + m_IsObserving = false; + source->RemoveObserver(m_ObserverID); + } + + /* + * Writting the geom (only master process) + */ + if ( otb::MPIConfig::Instance()->GetMyRank() == 0 && + (m_WriteGeomFile || m_FilenameHelper->GetWriteGEOMFile()) ) + { + otb::ImageKeywordlist otb_kwl; + itk::MetaDataDictionary dict = this->GetInput()->GetMetaDataDictionary(); + itk::ExposeMetaData<otb::ImageKeywordlist>(dict, otb::MetaDataKey::OSSIMKeywordlistKey, otb_kwl); + WriteGeometry(otb_kwl, this->GetFileName()); + } + + /** + * Release any inputs if marked for release + */ + this->ReleaseInputs(); + + //Reset global shift on input region (box parameter) + //It allows calling multiple updates over the writer + m_ShiftOutputIndex.Fill(0); + + // Wait for other processes + otb::MPIConfig::Instance()->barrier(); + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetFileName(std::string extendedFileName) + { + this->SetFileName(extendedFileName.c_str()); + } + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetFileName(const char* extendedFileName) + { + this->m_FilenameHelper->SetExtendedFileName(extendedFileName); + m_FileName = this->m_FilenameHelper->GetSimpleFileName(); + m_ImageIO = NULL; + this->Modified(); + } + +template <class TInputImage> +const char* +SimpleParallelTiffWriter<TInputImage> +::GetFileName () const + { + return this->m_FilenameHelper->GetSimpleFileName(); + } + +} +#endif diff --git a/Modules/MPI/MPITiffWriter/otb-module.cmake b/Modules/MPI/MPITiffWriter/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..5d717caccbec0e8a1f79fbffa758e2bd10a864e9 --- /dev/null +++ b/Modules/MPI/MPITiffWriter/otb-module.cmake @@ -0,0 +1,23 @@ +set(DOCUMENTATION "This module contains MPI tiff writer") + +otb_module(OTBMPITiffWriter + DEPENDS + OTBBoost + OTBCommon + OTBExtendedFilename + OTBGDAL + OTBGdalAdapters + OTBITK + OTBImageBase + OTBImageIO + OTBOSSIMAdapters + OTBSPTW + OTBStreaming + OTBMPI + OTBMPIConfig + TEST_DEPENDS + OTBTestKernel + + DESCRIPTION + "${DOCUMENTATION}" +) diff --git a/Modules/MPI/MPITiffWriter/test/CMakeLists.txt b/Modules/MPI/MPITiffWriter/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5e24997b3f3f33e62643de95f78d61d86bb3ccb --- /dev/null +++ b/Modules/MPI/MPITiffWriter/test/CMakeLists.txt @@ -0,0 +1,28 @@ +otb_module_test() + +set(OTBMPITiffWriterTests +otbMPITiffWriterTestDriver.cxx +otbMPISPTWReadWriteTest.cxx +) + +add_executable(otbMPITiffWriterTestDriver ${OTBMPITiffWriterTests}) + +# target link libraries +target_link_libraries(otbMPITiffWriterTestDriver ${OTBMPITiffWriter-Test_LIBRARIES}) + + +otb_module_target_label(otbMPITiffWriterTestDriver) + +# Tests Declaration + +otb_add_test_mpi(NAME otbMPISPTWReadWriteTest + NBPROCS 2 + COMMAND otbMPITiffWriterTestDriver + --compare-image ${NOTOL} + ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/otbMPITiffWriterTestOutput.tif + otbMPISPTWReadWriteTest + ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/otbMPITiffWriterTestOutput.tif + ) + diff --git a/Modules/MPI/MPITiffWriter/test/otbMPISPTWReadWriteTest.cxx b/Modules/MPI/MPITiffWriter/test/otbMPISPTWReadWriteTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d500e8bb54e75cfe657c2963e82a249062b3bdbf --- /dev/null +++ b/Modules/MPI/MPITiffWriter/test/otbMPISPTWReadWriteTest.cxx @@ -0,0 +1,74 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + +// Includes +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbMPIConfig.h" +#include "otbSimpleParallelTiffWriter.h" + +#include <iostream> +#include <cstdlib> + +int otbMPISPTWReadWriteTest(int argc, char* argv[]) +{ + + // Initialize MPI environment + otb::MPIConfig::Pointer config = otb::MPIConfig::Instance(); + config->Init(argc,argv); + + // Get command line arguments + if (argc != 3) + { + std::cerr << "Usage: " << std::endl; + std::cerr << argv[0] << " inputImageFile outputImageFile " << std::endl; + return EXIT_SUCCESS; + } + + // Image typedefs + typedef float PixelType; + typedef otb::VectorImage<PixelType> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::SimpleParallelTiffWriter<ImageType> WriterType; + + // Reader configuration + ReaderType::Pointer reader = ReaderType::New(); + std::string inputFilename = std::string(argv[1]); + reader->SetFileName(inputFilename); + reader->GenerateOutputInformation(); + + // Writer configuration + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = std::string(argv[2]); + writer->SetFileName(outputFilename); + writer->SetInput(reader->GetOutput()); + + // Execute the MPI pipeline + try{ + writer->Update(); + } + catch (std::exception & err) { + std::cerr << "ExceptionObject caught !" << std::endl; + std::cerr << err.what() << std::endl; + + config->abort(EXIT_FAILURE); + } + + return EXIT_SUCCESS; + +} diff --git a/Modules/MPI/MPITiffWriter/test/otbMPITiffWriterTestDriver.cxx b/Modules/MPI/MPITiffWriter/test/otbMPITiffWriterTestDriver.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c2d78c892e78558b5b7dceedb101f16dc6660495 --- /dev/null +++ b/Modules/MPI/MPITiffWriter/test/otbMPITiffWriterTestDriver.cxx @@ -0,0 +1,5 @@ +#include "otbTestMain.h" +void RegisterTests() +{ + REGISTER_TEST(otbMPISPTWReadWriteTest); +} diff --git a/Modules/MPI/MPIVrtWriter/CMakeLists.txt b/Modules/MPI/MPIVrtWriter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..628970d6179cfa6ee226d75f5004af634524c722 --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/CMakeLists.txt @@ -0,0 +1,3 @@ +project(MPIVrtWriter) +otb_module_impl() + diff --git a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..9d6763bbad7f4fcc6b39a262eda08d5a5ae4f196 --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h @@ -0,0 +1,275 @@ +/*========================================================================= + + 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 otbMPIVrtWriter_h +#define otbMPIVrtWriter_h + +#include "otbMPIConfig.h" +#include "otbImageFileWriter.h" +#include "itkRegionOfInterestImageFilter.h" +#include "otbNumberOfDivisionsTiledStreamingManager.h" +#include <vector> +#include <iostream> +#include <sstream> + +#include <itksys/SystemTools.hxx> + +#include <gdal.h> +#include <gdal_priv.h> +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wshadow" +#include <vrtdataset.h> +# pragma GCC diagnostic pop +#else +#include <vrtdataset.h> +#endif + +#include <ogr_spatialref.h> + +namespace otb { + +/** + *\brief Write image data to multiple files with MPI processus and add a VRT file. + * + * The image is divided into several pieces. + * Each pieces is distributed to a MPI processus. + * Each MPI processus write their pieces into a separate + * file. + * The master processus writes a VRT file (optional). + * + *\param img Image + *\param output Output Filename + *\param availableRAM Available memory for streaming + *\param writeVRTFile Activate the VRT file writing + */ +template <typename TImage> void WriteMPI(TImage *img, const std::string &output, unsigned int availableRAM = 0, bool writeVRTFile=true) +{ + typename otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + + unsigned int myRank = mpiConfig->GetMyRank(); + unsigned int nbProcs = mpiConfig->GetNbProcs(); + + typedef otb::ImageFileWriter<TImage> WriterType; + typedef otb::NumberOfDivisionsTiledStreamingManager<TImage> StreamingManagerType; + typedef itk::RegionOfInterestImageFilter<TImage, TImage> ExtractFilterType; + + // First, update infomration from image to write + img->UpdateOutputInformation(); + + // Configure streaming manager + typename StreamingManagerType::Pointer streamingManager = StreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbProcs); + streamingManager->PrepareStreaming(img,img->GetLargestPossibleRegion()); + unsigned int numberOfSplits = streamingManager->GetNumberOfSplits(); + + // This vector will hold all regions to write for current rank + std::vector<typename TImage::RegionType> regionsToWrite; + + // Handle both cases when there are much more (resp. less) region to + // write than NbProcs + if(myRank < numberOfSplits) + { + unsigned int splitIdx = myRank; + while(splitIdx < numberOfSplits) + { + typename TImage::RegionType currentRegion = streamingManager->GetSplit(splitIdx); + regionsToWrite.push_back(currentRegion); + splitIdx+=nbProcs; + } + } + + // Output prefix + std::string extension = itksys::SystemTools::GetFilenameExtension(output); + if (extension != ".vrt") + { + + // TODO: Maybe remove this + if (extension == "") + { + // Missing extension + mpiConfig->logInfo("Filename has no extension. Adding <.vrt> extension."); + } + else + { + // Bad extension + mpiConfig->logError("Filename must have .vrt extension!"); + mpiConfig->abort(EXIT_FAILURE); + } + } + std::vector<std::string> joins; + joins.push_back(itksys::SystemTools::GetFilenamePath(output).append("/")); + joins.push_back(itksys::SystemTools::GetFilenameWithoutExtension(output)); + std::string prefix = itksys::SystemTools::JoinPath(joins); + + + // Data type + std::string dataTypeStr = "Float32"; + GDALImageIO::Pointer gdalImageIO; + + // Now write all the regions + for(typename std::vector<typename TImage::RegionType>::const_iterator it = regionsToWrite.begin(); + it!=regionsToWrite.end();++it) + { + typename ExtractFilterType::Pointer extractFilter = ExtractFilterType::New(); + extractFilter->SetInput(img); + extractFilter->SetRegionOfInterest(*it); + // Writer + // Output Filename + std::stringstream ss; + ss<<prefix<<"_"<<it->GetIndex()[0]<<"_"<<it->GetIndex()[1]<<"_"<<it->GetSize()[0]<<"_"<<it->GetSize()[1]<<".tif"; + typename WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(ss.str()); + writer->SetInput(extractFilter->GetOutput()); + // Datatype + gdalImageIO = dynamic_cast<GDALImageIO *>(writer->GetImageIO()); + if(gdalImageIO.IsNotNull()) + { + dataTypeStr = gdalImageIO->GetGdalPixelTypeAsString(); + } + + if (!availableRAM) + { + writer->SetNumberOfDivisionsTiledStreaming(0); + } + else + { + writer->SetAutomaticAdaptativeStreaming(availableRAM); + } + + // Pipeline execution + try + { + writer->Update(); + } + catch (itk::ExceptionObject& err) + { + std::stringstream message; + message << "ExceptionObject caught: " << err << std::endl; + mpiConfig->logError(message.str()); + mpiConfig->abort(EXIT_FAILURE); + } + } + + // MPI process synchronization + mpiConfig->barrier(); + + // Write VRT file + try + { + if (writeVRTFile && (myRank == 0)) + { + // VRT Filename + std::stringstream vrtfOut; + vrtfOut<< prefix << ".vrt"; + + // Data type + GDALDataType dataType; + dataType = GDALGetDataTypeByName(dataTypeStr.c_str()); + + int imageSizeY = img->GetLargestPossibleRegion().GetSize()[1]; + int imageSizeX = img->GetLargestPossibleRegion().GetSize()[0]; + const unsigned int nbBands = img->GetNumberOfComponentsPerPixel(); + + // Get VRT driver + GDALAllRegister(); + GDALDriver *driver = GetGDALDriverManager()->GetDriverByName("VRT"); + if (driver == NULL) { + mpiConfig->logError("Error opening VRT driver."); + mpiConfig->abort(EXIT_FAILURE); + } + + // Create output raster + GDALDataset *VRTOutput = driver->Create(vrtfOut.str().c_str(), + imageSizeX, + imageSizeY, + 0, + dataType, + NULL); // No options + if (VRTOutput == NULL) { + mpiConfig->logError("driver->Create call failed.\n"); + mpiConfig->abort(EXIT_FAILURE); + } + + // Set GeoTransform + double gt[6]; + gt[0] = img->GetOrigin()[0] - 0.5*img->GetSpacing()[0]; + gt[1] = img->GetSpacing()[0]; + gt[2] = 0.0; + gt[3] = img->GetOrigin()[1] - 0.5*img->GetSpacing()[1]; + gt[4] = 0.0; + gt[5] = img->GetSpacing()[1]; + VRTOutput->SetGeoTransform(gt); + + // Set projection + OGRSpatialReference out_sr; + char *wkt = NULL; + out_sr.SetFromUserInput(img->GetProjectionRef().c_str()); + out_sr.exportToWkt(&wkt); + VRTOutput->SetProjection(wkt); + + for(unsigned int band = 1; band<=nbBands;++band) + { + VRTOutput->AddBand(dataType, NULL); + + typename TImage::RegionType currentRegion; + for(unsigned int id=0; id < numberOfSplits; ++id) + { + currentRegion = streamingManager->GetSplit(id); + int tileSizeX = currentRegion.GetSize()[0]; + int tileSizeY = currentRegion.GetSize()[1]; + int tileIndexX = currentRegion.GetIndex()[0]; + int tileIndexY = currentRegion.GetIndex()[1]; + std::stringstream tileFileName; + tileFileName <<prefix<<"_"<<tileIndexX<<"_"<<tileIndexY<<"_"<<tileSizeX<<"_"<<tileSizeY<<".tif"; + std::cout<<tileFileName.str()<<std::endl; + + GDALDataset *dataset = (GDALDataset*) GDALOpen(tileFileName.str().c_str(), GA_ReadOnly); + + VRTSourcedRasterBand *VRTBand = dynamic_cast<VRTSourcedRasterBand*> (VRTOutput->GetRasterBand(band)); + VRTBand->AddSimpleSource(dataset->GetRasterBand(band), + 0, //xOffSrc + 0, //yOffSrc + tileSizeX, //xSizeSrc + tileSizeY, //ySizeSrc + tileIndexX, //xOffDest + tileIndexY, //yOffDest + tileSizeX, //xSizeDest + tileSizeY, //ySizeDest + "near", + VRT_NODATA_UNSET); + } + + } + + // Close + OGRFree(wkt); + GDALClose(VRTOutput); + } + } + catch (itk::ExceptionObject& err) + { + std::stringstream message; + message << "ExceptionObject caught: " << err << std::endl; + mpiConfig->logError(message.str()); + mpiConfig->abort(EXIT_FAILURE); + } + +} + +} // End namespace otb +#endif //__otbMPIVrtWriter_h diff --git a/Modules/MPI/MPIVrtWriter/otb-module.cmake b/Modules/MPI/MPIVrtWriter/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..5258372c82850fbb5177fecb7d5144eb5f3de97d --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/otb-module.cmake @@ -0,0 +1,13 @@ +set(DOCUMENTATION "Provides a template function for MPI writing to a VRT file") + +otb_module(OTBMPIVrtWriter + DEPENDS + OTBMPIConfig + OTBPanSharpening + OTBProjection + OTBInterpolation + OTBTestKernel + + DESCRIPTION + "${DOCUMENTATION}" +) diff --git a/Modules/MPI/MPIVrtWriter/test/CMakeLists.txt b/Modules/MPI/MPIVrtWriter/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..758ca7de7c78fe645978eb91ed15254a4c3d69f6 --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/test/CMakeLists.txt @@ -0,0 +1,25 @@ +otb_module_test() + +#${otb-module} will be the name of this module and will not need to be #changed when this module is renamed. + +set(${otb-module}Tests + otbMPIVrtWriterTestDriver.cxx + otbMPIReadWriteTest.cxx +) + +add_executable(otbMPIVrtWriterTestDriver ${${otb-module}Tests}) +target_link_libraries(otbMPIVrtWriterTestDriver ${${otb-module}-Test_LIBRARIES}) +otb_module_target_label(otbMPIVrtWriterTestDriver) + + +# MPI Hello test +otb_add_test_mpi(NAME otbMPIVrtWriterTest + NBPROCS 2 + COMMAND otbMPIVrtWriterTestDriver + --compare-image ${NOTOL} + ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/otbMPIVrtWriterTestOutput.vrt + otbMPIReadWriteTest + ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/otbMPIVrtWriterTestOutput.vrt + ) diff --git a/Modules/MPI/MPIVrtWriter/test/otbMPIReadWriteTest.cxx b/Modules/MPI/MPIVrtWriter/test/otbMPIReadWriteTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..84792f9391ea0b1dba49157fdf380ff219cc909c --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/test/otbMPIReadWriteTest.cxx @@ -0,0 +1,76 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + Some parts of this code are derived from ITK. See ITKCopyright.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. + +=========================================================================*/ + +// Includes +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbMPIConfig.h" +#include "otbMPIVrtWriter.h" + +#include <cstdlib> +#include <iostream> + +// Test +int otbMPIReadWriteTest(int argc, char * argv[]) +{ + + // Mono-thread execution + itk::MultiThreader::SetGlobalMaximumNumberOfThreads(1); + itk::MultiThreader::SetGlobalDefaultNumberOfThreads(1); + + // MPI Initialization + typedef otb::MPIConfig MPIConfigType; + MPIConfigType::Pointer config = MPIConfigType::Instance(); + config->Init(argc,argv,true); + + // Verify the number of parameters in the command line + if (argc != 3) + { + std::stringstream message; + message << "Usage: " << std::endl; + message << argv[0] << " inputImageFile outputImageFile " << std::endl; + config->logError(message.str()); + config->abort(EXIT_FAILURE); + } + + // Image types + typedef float PixelType; + const unsigned int Dimension = 2; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + + // Reader + typedef otb::ImageFileReader<ImageType> ReaderType; + ReaderType::Pointer reader = ReaderType::New(); + + // Reader configuration + std::string inputFilename = std::string(argv[1]); + reader->SetFileName(inputFilename); + + // Update MPI Pipeline + std::string outputFilename = std::string(argv[2]); + + otb::WriteMPI(reader->GetOutput(),outputFilename); + + config->barrier(); + + return EXIT_SUCCESS; +} + diff --git a/Modules/MPI/MPIVrtWriter/test/otbMPIVrtWriterTestDriver.cxx b/Modules/MPI/MPIVrtWriter/test/otbMPIVrtWriterTestDriver.cxx new file mode 100644 index 0000000000000000000000000000000000000000..66aa849c4ca5f9dd96542e178890e942b16fb6f3 --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/test/otbMPIVrtWriterTestDriver.cxx @@ -0,0 +1,7 @@ +#include "otbTestMain.h" + +void RegisterTests() +{ + REGISTER_TEST(otbMPIReadWriteTest); +} + diff --git a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h index ebd510fba5acff6f9b60aa299faee88dc74f017d..62e2448951c7f7238914edd620ff5173be457634 100644 --- a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToRCC8GraphFilter_h -#define __otbImageListToRCC8GraphFilter_h +#ifndef otbImageListToRCC8GraphFilter_h +#define otbImageListToRCC8GraphFilter_h #include "otbRCC8GraphSource.h" #include "otbImageList.h" @@ -70,9 +70,9 @@ protected: /** Constructor */ ImageListToRCC8GraphFilter(); /** Destructor */ - virtual ~ImageListToRCC8GraphFilter() {} + ~ImageListToRCC8GraphFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageListToRCC8GraphFilter(const Self &); //purposely not implemented diff --git a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.txx b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.txx index a70a25df56492e31fdf81651142fa1f2bef393d9..823c6f8ce4fd992b4b74fb0437a471f19e4cca4d 100644 --- a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.txx +++ b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageListToRCC8GraphFilter_txx -#define __otbImageListToRCC8GraphFilter_txx +#ifndef otbImageListToRCC8GraphFilter_txx +#define otbImageListToRCC8GraphFilter_txx #include "otbImageListToRCC8GraphFilter.h" @@ -56,7 +56,7 @@ ImageListToRCC8GraphFilter<TInputImage, TOutputGraph> if (this->GetNumberOfInputs() < 1) { // exit - return 0; + return ITK_NULLPTR; } // else return the first input return static_cast<InputImageListType *> diff --git a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h index 7b91712135f66f52e34ad400bbb1463d7a6c5a4f..344ee2d2aab8d182d07e32473097796458332845 100644 --- a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageMultiSegmentationToRCC8GraphFilter_h -#define __otbImageMultiSegmentationToRCC8GraphFilter_h +#ifndef otbImageMultiSegmentationToRCC8GraphFilter_h +#define otbImageMultiSegmentationToRCC8GraphFilter_h #include "otbImageListToRCC8GraphFilter.h" @@ -81,11 +81,11 @@ protected: /** Constructor */ ImageMultiSegmentationToRCC8GraphFilter(); /** Destructor */ - virtual ~ImageMultiSegmentationToRCC8GraphFilter(); + ~ImageMultiSegmentationToRCC8GraphFilter() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Get the composition knowledge. * \param r1 First RCC8 relation value, diff --git a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.txx b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.txx index 605a8ace1a1b40067dd43cf0d6794cec8bf92217..80cfc75fa9d0ba1c0058aaebc143dd0fd1583037 100644 --- a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.txx +++ b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageMultiSegmentationToRCC8GraphFilter_txx -#define __otbImageMultiSegmentationToRCC8GraphFilter_txx +#ifndef otbImageMultiSegmentationToRCC8GraphFilter_txx +#define otbImageMultiSegmentationToRCC8GraphFilter_txx #include "otbImageMultiSegmentationToRCC8GraphFilter.h" #include "itkMinimumMaximumImageCalculator.h" diff --git a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h index 38ef31760ebbc92dabe78edf18f0d0ef5c67bad7..6f6c71af38d98d975d221badcf1ac31d24bcd66c 100644 --- a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h +++ b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToImageRCC8Calculator_h -#define __otbImageToImageRCC8Calculator_h +#ifndef otbImageToImageRCC8Calculator_h +#define otbImageToImageRCC8Calculator_h #include "itkImageToImageFilter.h" #include "itkObjectFactory.h" @@ -115,7 +115,7 @@ protected: /** Constructor */ ImageToImageRCC8Calculator(); /** Destructor */ - virtual ~ImageToImageRCC8Calculator() {} + ~ImageToImageRCC8Calculator() ITK_OVERRIDE {} /** * Compute the minimal image region required. * \return The minimal region required. @@ -170,9 +170,9 @@ protected: */ BoolImagePointerType ConvertToBoolImage(ImagePointerType image, PixelType insideValue); /** Main computation method */ - void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The RCC8 relation value */ diff --git a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx index 91de9df3aa161534cc239acfcdd008eef030c872..c0dc61786854fcdc09e0fecb218c0e7b6fc6d7cc 100644 --- a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx +++ b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToImageRCC8Calculator_txx -#define __otbImageToImageRCC8Calculator_txx +#ifndef otbImageToImageRCC8Calculator_txx +#define otbImageToImageRCC8Calculator_txx #include "otbImageToImageRCC8Calculator.h" #include "itkUnaryFunctorImageFilter.h" diff --git a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h index 1ce5150418ba0d7e539c71431dc50747183706e5..86f23b833befb8094826596dd354d219ee80e754 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygonListToRCC8GraphFilter_h -#define __otbPolygonListToRCC8GraphFilter_h +#ifndef otbPolygonListToRCC8GraphFilter_h +#define otbPolygonListToRCC8GraphFilter_h #include "otbRCC8GraphSource.h" #include "otbPolygonToPolygonRCC8Calculator.h" @@ -120,9 +120,9 @@ protected: /** Constructor */ PolygonListToRCC8GraphFilter(); /** Destructor */ - virtual ~PolygonListToRCC8GraphFilter(); + ~PolygonListToRCC8GraphFilter() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Multi-threading implementation */ @@ -148,7 +148,7 @@ protected: /** End Multi-threading implementation */ /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Get the composition knowledge. * \param r1 First RCC8 relation value, diff --git a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.txx b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.txx index 4bcb28a02a93cf180d5c441b03b65ed356ab5f9b..0a23937ce71d66960d174c6729ffc26cdc265c22 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.txx +++ b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygonListToRCC8GraphFilter_txx -#define __otbPolygonListToRCC8GraphFilter_txx +#ifndef otbPolygonListToRCC8GraphFilter_txx +#define otbPolygonListToRCC8GraphFilter_txx #include "otbPolygonListToRCC8GraphFilter.h" #include "itkProgressReporter.h" @@ -59,7 +59,7 @@ PolygonListToRCC8GraphFilter<TPolygonList, TOutputGraph> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TPolygonList *> diff --git a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h index eb3fb5625c444e814c4d03c28bd35d65e4919149..2bb7acbecee9dab0b54290c297a299b444213fac 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h +++ b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygonToPolygonRCC8Calculator_h -#define __otbPolygonToPolygonRCC8Calculator_h +#ifndef otbPolygonToPolygonRCC8Calculator_h +#define otbPolygonToPolygonRCC8Calculator_h #include "itkObject.h" #include "otbRCC8Value.h" @@ -106,9 +106,9 @@ protected: /** Constructor */ PolygonToPolygonRCC8Calculator(); /** Destructor */ - virtual ~PolygonToPolygonRCC8Calculator() {} + ~PolygonToPolygonRCC8Calculator() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The RCC8 relation value */ diff --git a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.txx b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.txx index 83bddfdafc3d84b49944ade07a391659635a8c66..84095d57dc5496f973d10b1014268a2d0c63e522 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.txx +++ b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPolygonToPolygonRCC8Calculator_txx -#define __otbPolygonToPolygonRCC8Calculator_txx +#ifndef otbPolygonToPolygonRCC8Calculator_txx +#define otbPolygonToPolygonRCC8Calculator_txx #include "otbPolygonToPolygonRCC8Calculator.h" #include "otbMacro.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8Edge.h b/Modules/OBIA/RCC8/include/otbRCC8Edge.h index ade79be2262bea92f9e3058c89794a325d9c193c..dd31ad03cd6ebcf5ba18cc6e75ac2b90e96dee05 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Edge.h +++ b/Modules/OBIA/RCC8/include/otbRCC8Edge.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8Edge_h -#define __otbRCC8Edge_h +#ifndef otbRCC8Edge_h +#define otbRCC8Edge_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -53,9 +53,9 @@ protected: /** Constructor */ RCC8Edge(); /** Desctructor */ - ~RCC8Edge() {} + ~RCC8Edge() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The RCC8 value */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.h b/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.h index b7d99e51d956135a628f9b33cdc13b732461c8f4..e54f0c43648bacd638a780eec0b25a33f6e7903c 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.h +++ b/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8EdgeIterator_h -#define __otbRCC8EdgeIterator_h +#ifndef otbRCC8EdgeIterator_h +#define otbRCC8EdgeIterator_h #include "otbRCC8Graph.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.txx b/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.txx index 1072e14a3f7e2392572924abd078560a9fbfb5a8..cc2c0c72b5c9a69ff94c05cba67e4f1f74fd4785 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8EdgeIterator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8EdgeIterator_txx -#define __otbRCC8EdgeIterator_txx +#ifndef otbRCC8EdgeIterator_txx +#define otbRCC8EdgeIterator_txx #include "otbRCC8EdgeIterator.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8Graph.h b/Modules/OBIA/RCC8/include/otbRCC8Graph.h index 7b7e80ebd2114fe819a5b84794810e44372fe92b..ae50520ed2fefb24a9d281d2091b070f004ad570 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Graph.h +++ b/Modules/OBIA/RCC8/include/otbRCC8Graph.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8Graph_h -#define __otbRCC8Graph_h +#ifndef otbRCC8Graph_h +#define otbRCC8Graph_h #include "otbRCC8Edge.h" @@ -124,9 +124,9 @@ protected: /** Constructor */ RCC8Graph(); /** Destructor */ - ~RCC8Graph() {} + ~RCC8Graph() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Initialize a range of vertex. * \param num The index of the last vertices to intialize. diff --git a/Modules/OBIA/RCC8/include/otbRCC8Graph.txx b/Modules/OBIA/RCC8/include/otbRCC8Graph.txx index 9d7a508392faeef8c2ad9f226d582b7ca0eaa585..ad98bec42aec8029f7bf7ed5c73624990f278ce0 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Graph.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8Graph.txx @@ -15,8 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8Graph_txx -#define __otbRCC8Graph_txx +#ifndef otbRCC8Graph_txx +#define otbRCC8Graph_txx + +#include "otbRCC8Graph.h" namespace otb { diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h index 60b6652d54358b5fcd1fc6140e19d666682daa3d..9c6b88b6b55a8fe9e18fa12a20211b62ef64f0f7 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphFileReader_h -#define __otbRCC8GraphFileReader_h +#ifndef otbRCC8GraphFileReader_h +#define otbRCC8GraphFileReader_h #include "otbRCC8GraphSource.h" #include "itkMacro.h" @@ -89,9 +89,9 @@ protected: /** Constructor */ RCC8GraphFileReader(); /** Destructor */ - virtual ~RCC8GraphFileReader(); + ~RCC8GraphFileReader() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** * Parse edge information from a given line. * \param line The line to parse. @@ -104,7 +104,7 @@ protected: void ParseVertex(const std::string& line); /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** File name */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.txx b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.txx index 8ab351494a74733cab12aed96da5977f5dcf4043..778660c47cfadaa305d756b89e4cd0f0dd3339a5 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphFileReader_txx -#define __otbRCC8GraphFileReader_txx +#ifndef otbRCC8GraphFileReader_txx +#define otbRCC8GraphFileReader_txx #include "otbRCC8GraphFileReader.h" #include "otbRCC8VertexIterator.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h index fc3c1c9c1ace124f751bba0f26bf2e792e8c5928..73c67a9334e2d760c191914efeb9b5a698ccb76e 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphFileWriter_h -#define __otbRCC8GraphFileWriter_h +#ifndef otbRCC8GraphFileWriter_h +#define otbRCC8GraphFileWriter_h #include "itkProcessObject.h" #include "itkMacro.h" @@ -104,17 +104,17 @@ public: /** * Update method. */ - virtual void Update(void); + void Update(void) ITK_OVERRIDE; protected: /** Constructor */ RCC8GraphFileWriter(); /** Destructor */ - virtual ~RCC8GraphFileWriter(); + ~RCC8GraphFileWriter() ITK_OVERRIDE; /** * Main computation method. */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** * Write Method. * Performs checkings and invoke GenerateData(). @@ -140,7 +140,7 @@ protected: /** * PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** Filename of the graph file to write */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.txx b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.txx index a9954ebcec9fd0862feaf46459fa28f19cb674c5..abbf30b885d3d4493da708784cd907ec3adfc039 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphFileWriter_txx -#define __otbRCC8GraphFileWriter_txx +#ifndef otbRCC8GraphFileWriter_txx +#define otbRCC8GraphFileWriter_txx #include "otbRCC8GraphFileWriter.h" #include "otbRCC8VertexIterator.h" @@ -92,7 +92,7 @@ RCC8GraphFileWriter<TInputGraph> itkDebugMacro(<< "Writing a RCC8Graph file"); // Make sure input is available - if (input == 0) + if (input == ITK_NULLPTR) { itkExceptionMacro(<< "No input to writer!"); } diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h index 0006fc7d7b2a182565982feabeea7d234dd858fd..4c47c705bbd1e8247d2bdea6560e8892118ccb39 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphSource_h -#define __otbRCC8GraphSource_h +#ifndef otbRCC8GraphSource_h +#define otbRCC8GraphSource_h #include "itkProcessObject.h" @@ -54,9 +54,9 @@ protected: /** Constructor */ RCC8GraphSource(); /** Destructor */ - virtual ~RCC8GraphSource() {} + ~RCC8GraphSource() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RCC8GraphSource(const Self &); //purposely not implemented diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.txx b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.txx index 6700418fc6e29266d9ef6ea9f2aed2fe77373ed0..4768504d6f703159accec7cec08f26bd3dc1441b 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8GraphSource_txx -#define __otbRCC8GraphSource_txx +#ifndef otbRCC8GraphSource_txx +#define otbRCC8GraphSource_txx #include "otbRCC8GraphSource.h" @@ -43,7 +43,7 @@ RCC8GraphSource<TOutputGraph> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputGraphType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.h b/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.h index 0cda308201ac08af59fbd1be2494b02ae0953c1f..a14e1653a9efb56ed46a0324919a34878b37295a 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.h +++ b/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8InEdgeIterator_h -#define __otbRCC8InEdgeIterator_h +#ifndef otbRCC8InEdgeIterator_h +#define otbRCC8InEdgeIterator_h #include "otbRCC8Graph.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.txx b/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.txx index 1dcb6c62932cc2f0dd785344c54b8e98d4bf3c13..680f33ac93adbca0ebb7454e32a6204b57775eab 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8InEdgeIterator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8InEdgeIterator_txx -#define __otbRCC8InEdgeIterator_txx +#ifndef otbRCC8InEdgeIterator_txx +#define otbRCC8InEdgeIterator_txx #include "otbRCC8InEdgeIterator.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.h b/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.h index 5d2bebd0fd57b3de9dd43bddc6105735d7b7d728..4b787a8d80a0e484c5a307647f7e1a6ff0fc3f75 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.h +++ b/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8OutEdgeIterator_h -#define __otbRCC8OutEdgeIterator_h +#ifndef otbRCC8OutEdgeIterator_h +#define otbRCC8OutEdgeIterator_h #include "otbRCC8Graph.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.txx b/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.txx index 423ec0cb372d2d06660f37292c6cdc4fbefdf4d2..68d6231d103aeb5d06c6963ce598e552e375b1b0 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8OutEdgeIterator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8OutEdgeIterator_txx -#define __otbRCC8OutEdgeIterator_txx +#ifndef otbRCC8OutEdgeIterator_txx +#define otbRCC8OutEdgeIterator_txx #include "otbRCC8OutEdgeIterator.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8Value.h b/Modules/OBIA/RCC8/include/otbRCC8Value.h index b240b3a58fcf685485efed320623bab42e2b7085..b1852816897b702f002e0fed49428e3334cae49f 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Value.h +++ b/Modules/OBIA/RCC8/include/otbRCC8Value.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8Value_h -#define __otbRCC8Value_h +#ifndef otbRCC8Value_h +#define otbRCC8Value_h namespace otb { diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h index e5d390f332604f74f71ba97e2c1e8e9dbaa3b2de..14cb39813f7e10742ded0032c36e250fe0cfc480 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexBase_h -#define __otbRCC8VertexBase_h +#ifndef otbRCC8VertexBase_h +#define otbRCC8VertexBase_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -79,9 +79,9 @@ protected: /** Constructor */ RCC8VertexBase(); /** Desctructor */ - virtual ~RCC8VertexBase() {} + ~RCC8VertexBase() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The segmentation level */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.txx b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.txx index 18b277453d42cde9520bdf94af2e67bd48fd4dbb..c4d51f298c75358fda57922ce92dd6f6aeb3b545 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexBase_txx -#define __otbRCC8VertexBase_txx +#ifndef otbRCC8VertexBase_txx +#define otbRCC8VertexBase_txx #include "otbRCC8VertexBase.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.h b/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.h index dbf99dd2ab1625fedc1fbd3e62678df24db05b2c..b60cb13f1adbe70cb49ce8fbd5afdec76583c4db 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexIterator_h -#define __otbRCC8VertexIterator_h +#ifndef otbRCC8VertexIterator_h +#define otbRCC8VertexIterator_h #include "otbRCC8Graph.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.txx b/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.txx index 9be1cdd7e0fdbc5878cff4ad6d24470a8ff147d5..8c4a4ce2b60aa3ed402091eef1b288f8977d82eb 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexIterator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexIterator_txx -#define __otbRCC8VertexIterator_txx +#ifndef otbRCC8VertexIterator_txx +#define otbRCC8VertexIterator_txx #include "otbRCC8VertexIterator.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h index 7be265274e2f4888b677e8066d79525ba6dbd1f2..5a3404aa4307da7797c8de1926c3cab042716eab 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexWithCompacity_h -#define __otbRCC8VertexWithCompacity_h +#ifndef otbRCC8VertexWithCompacity_h +#define otbRCC8VertexWithCompacity_h #include "otbRCC8VertexBase.h" @@ -58,20 +58,20 @@ public: * Set the VertexWithCompacity attributes from the attributes vector. * \param attributes The vector containing the parsed attributes. */ - void SetAttributesMap(AttributesMapType attributes); + void SetAttributesMap(AttributesMapType attributes) ITK_OVERRIDE; /** * Get an attributes vector representing the VertexWithCompacity attributes. * \return The attributes vector */ - AttributesMapType GetAttributesMap(void); + AttributesMapType GetAttributesMap(void) ITK_OVERRIDE; protected: /** Constructor */ RCC8VertexWithCompacity(); /** Desctructor */ - ~RCC8VertexWithCompacity() {} + ~RCC8VertexWithCompacity() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The compacity */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.txx b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.txx index 0862f90b9e823bc401ae1ae862c4e464a7ef1559..086507f2576bba581b9897c2e534aaa54c0359cb 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexWithCompacity_txx -#define __otbRCC8VertexWithCompacity_txx +#ifndef otbRCC8VertexWithCompacity_txx +#define otbRCC8VertexWithCompacity_txx #include "otbRCC8VertexWithCompacity.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.h b/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.h index 4235a1b490d8d1f5abcdc3cf87efec9cffc95220..01d3e8e9ef079339da0ec952b5944c8901fb29c4 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexWithRegionCenter_h -#define __otbRCC8VertexWithRegionCenter_h +#ifndef otbRCC8VertexWithRegionCenter_h +#define otbRCC8VertexWithRegionCenter_h #include "otbRCC8VertexBase.h" diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.txx b/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.txx index 4a43311a98f3a1ca324dae46d6f3416195929bf5..e47ba33ae0c33650e60c47a492909581e465b06e 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.txx +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexWithRegionCenter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRCC8VertexWithRegionCenter_txx -#define __otbRCC8VertexWithRegionCenter_txx +#ifndef otbRCC8VertexWithRegionCenter_txx +#define otbRCC8VertexWithRegionCenter_txx #include "otbRCC8VertexWithRegionCenter.h" diff --git a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h index 7cd094b8645a3ba6abceca1abd2b25e94c631dba..08e7f4053afb6749c2c650678d61dbce74c6b19e 100644 --- a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBuiltUpIndicesFunctor_h -#define __otbBuiltUpIndicesFunctor_h +#ifndef otbBuiltUpIndicesFunctor_h +#define otbBuiltUpIndicesFunctor_h #include "otbVegetationIndicesFunctor.h" @@ -148,7 +148,7 @@ class NDBI : public TM4AndTM5IndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDBI"; } @@ -156,10 +156,10 @@ public: /// Constructor NDBI() {} /// Desctructor - virtual ~NDBI() {} + ~NDBI() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pTM4, const TInput2& pTM5) const + inline TOutput Evaluate(const TInput1& pTM4, const TInput2& pTM5) const ITK_OVERRIDE { double dTM4 = static_cast<double>(pTM4); double dTM5 = static_cast<double>(pTM5); @@ -187,7 +187,7 @@ class ISU : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "ISU"; } @@ -195,7 +195,7 @@ public: /// Constructor ISU() : m_A(100.), m_B(25.) {} /// Desctructor - virtual ~ISU() {} + ~ISU() ITK_OVERRIDE {} /** Set/Get A correction */ void SetA(const double pA) @@ -217,7 +217,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& pRed, const TInput2& pNIR) const + inline TOutput Evaluate(const TInput1& pRed, const TInput2& pNIR) const ITK_OVERRIDE { double dRed = static_cast<double>(pRed); double dNIR = static_cast<double>(pNIR); diff --git a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h index f109b672aa801625899fadb75f927ca0dda3c9be..da4bbf4aab42aa6c609410483fdf5b5f182d2eec 100644 --- a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGAndRIndexImageFilter_h -#define __otbGAndRIndexImageFilter_h +#ifndef otbGAndRIndexImageFilter_h +#define otbGAndRIndexImageFilter_h #include "itkBinaryFunctorImageFilter.h" #include "otbSoilIndicesFunctor.h" @@ -69,9 +69,9 @@ public: protected: GAndRIndexImageFilter(); - virtual ~GAndRIndexImageFilter() {} + ~GAndRIndexImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /* void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); diff --git a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.txx b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.txx index 37ec73ef01629de4332c193cb285efcae1214838..98ecab11826186199bbd9a2d9a07b684a8c37b4a 100644 --- a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.txx +++ b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGAndRIndexImageFilter_txx -#define __otbGAndRIndexImageFilter_txx +#ifndef otbGAndRIndexImageFilter_txx +#define otbGAndRIndexImageFilter_txx #include "otbGAndRIndexImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h b/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h index f111d9d7c0a154282367cc170990cdb37300c528..cf2f469d4e11204c719298de87643022354b7545 100644 --- a/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h +++ b/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLandsatTMIndices_h -#define __otbLandsatTMIndices_h +#ifndef otbLandsatTMIndices_h +#define otbLandsatTMIndices_h #include "otbMath.h" #include "itkVariableLengthVector.h" @@ -340,7 +340,7 @@ public: virtual std::string GetName() const = 0; LandsatTMIndex() {} - virtual ~LandsatTMIndex() {} + ~LandsatTMIndex() ITK_OVERRIDE {} }; @@ -367,13 +367,13 @@ class Bright : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "Bright"; } Bright() {} - virtual ~Bright() {} + ~Bright() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -408,13 +408,13 @@ class Vis : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "Vis"; } Vis() {} - virtual ~Vis() {} + ~Vis() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -441,13 +441,13 @@ class NIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NIR"; } NIR() {} - virtual ~NIR() {} + ~NIR() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -473,13 +473,13 @@ class MIR1 : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "MIR1"; } MIR1() {} - virtual ~MIR1() {} + ~MIR1() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -505,13 +505,13 @@ class MIR2 : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "MIR2"; } MIR2() {} - virtual ~MIR2() {} + ~MIR2() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -537,13 +537,13 @@ class TIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "TIR"; } TIR() {} - virtual ~TIR() {} + ~TIR() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -583,13 +583,13 @@ class MIRTIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "MIRTIR"; } MIRTIR() {} - virtual ~MIRTIR() {} + ~MIRTIR() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -623,13 +623,13 @@ class NDVI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDVI"; } NDVI() {} - virtual ~NDVI() {} + ~NDVI() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -670,13 +670,13 @@ class NDBSI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDBSI"; } NDBSI() {} - virtual ~NDBSI() {} + ~NDBSI() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -713,13 +713,13 @@ class BIO : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "BIO"; } BIO() {} - virtual ~BIO() {} + ~BIO() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -759,13 +759,13 @@ class NDSI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDSI"; } NDSI() {} - virtual ~NDSI() {} + ~NDSI() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -816,13 +816,13 @@ class NDSIVis : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDSIVis"; } NDSIVis() {} - virtual ~NDSIVis() {} + ~NDSIVis() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -861,13 +861,13 @@ class NDBBBI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDBBBI"; } NDBBBI() {} - virtual ~NDBBBI() {} + ~NDBBBI() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -981,7 +981,7 @@ public: m_FvNDBSI->SetMembership(Medium, -0.20, -0.20, 0.0, 0.0); m_FvNDBSI->SetMembership(High, 0.0, 0.0, maximumValue, maximumValue); } - virtual ~LinguisticVariables() {} + ~LinguisticVariables() ITK_OVERRIDE {} inline itk::FixedArray<unsigned int, 11> operator ()(const TInput& inputPixel) { @@ -1065,7 +1065,7 @@ public: } KernelSpectralRule() : m_TV1(0.7), m_TV2(0.5) { } - virtual ~KernelSpectralRule() {} + ~KernelSpectralRule() ITK_OVERRIDE {} void SetTV1(PrecisionType tv1) { @@ -1160,13 +1160,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM ThickCloudsSpectralRule"; } ThickCloudsSpectralRule() { } - virtual ~ThickCloudsSpectralRule() {} + ~ThickCloudsSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1218,13 +1218,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM ThinCloudsSpectralRule"; } ThinCloudsSpectralRule() { } - virtual ~ThinCloudsSpectralRule() {} + ~ThinCloudsSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1279,13 +1279,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM SnowOrIceSpectralRule"; } SnowOrIceSpectralRule() { } - virtual ~SnowOrIceSpectralRule() {} + ~SnowOrIceSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1338,13 +1338,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM WaterOrShadowSpectralRule"; } WaterOrShadowSpectralRule() { } - virtual ~WaterOrShadowSpectralRule() {} + ~WaterOrShadowSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1385,13 +1385,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM PitbogOrGreenhouseSpectralRule"; } PitbogOrGreenhouseSpectralRule() { } - virtual ~PitbogOrGreenhouseSpectralRule() {} + ~PitbogOrGreenhouseSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1443,13 +1443,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM DominantBlueSpectralRule"; } DominantBlueSpectralRule() { } - virtual ~DominantBlueSpectralRule() {} + ~DominantBlueSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1491,13 +1491,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM VegetationSpectralRule"; } VegetationSpectralRule() { } - virtual ~VegetationSpectralRule() {} + ~VegetationSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1551,13 +1551,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM RangelandSpectralRule"; } RangelandSpectralRule() { } - virtual ~RangelandSpectralRule() {} + ~RangelandSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1612,13 +1612,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM BarrenLandOrBuiltUpOrCloudsSpectralRule"; } BarrenLandOrBuiltUpOrCloudsSpectralRule() { } - virtual ~BarrenLandOrBuiltUpOrCloudsSpectralRule() {} + ~BarrenLandOrBuiltUpOrCloudsSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1670,13 +1670,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM FlatResponseBarrenLandOrBuiltUpSpectralRule"; } FlatResponseBarrenLandOrBuiltUpSpectralRule() { } - virtual ~FlatResponseBarrenLandOrBuiltUpSpectralRule() {} + ~FlatResponseBarrenLandOrBuiltUpSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1724,13 +1724,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM ShadowWithBarrenLandSpectralRule"; } ShadowWithBarrenLandSpectralRule() { } - virtual ~ShadowWithBarrenLandSpectralRule() {} + ~ShadowWithBarrenLandSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1771,13 +1771,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM ShadowWithVegetationSpectralRule"; } ShadowWithVegetationSpectralRule() { } - virtual ~ShadowWithVegetationSpectralRule() {} + ~ShadowWithVegetationSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1819,13 +1819,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM ShadowCloudOrSnowSpectralRule"; } ShadowCloudOrSnowSpectralRule() { } - virtual ~ShadowCloudOrSnowSpectralRule() {} + ~ShadowCloudOrSnowSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1874,13 +1874,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM WetlandSpectralRule"; } WetlandSpectralRule() { } - virtual ~WetlandSpectralRule() {} + ~WetlandSpectralRule() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h index 8f0d916b610312c4e682dcb96c21fea2bbfbdef7..7f1b1b7ed22041e4f545ddb40d37a28297c9eb29 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelGAndRIndexImageFilter_h -#define __otbMultiChannelGAndRIndexImageFilter_h +#ifndef otbMultiChannelGAndRIndexImageFilter_h +#define otbMultiChannelGAndRIndexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "otbSoilIndicesFunctor.h" @@ -95,9 +95,9 @@ protected: /// Constructor MultiChannelGAndRIndexImageFilter() : m_GreenIndex(1), m_RedIndex(2) {}; /// Destructor - virtual ~MultiChannelGAndRIndexImageFilter() {} + ~MultiChannelGAndRIndexImageFilter() ITK_OVERRIDE {} /// Before generating data, set functor parameters - virtual void BeforeThreadedGenerateData() + void BeforeThreadedGenerateData() ITK_OVERRIDE { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_GreenIndex < 1 || m_RedIndex < 1 || @@ -109,7 +109,7 @@ protected: this->GetFunctor().SetRedIndex(m_RedIndex); } /// PrintSelf Method - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { this->Superclass::PrintSelf(os, indent); os << indent << "Green index: " << m_GreenIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h index bb1340e33f28a937dd2933a831a50424ba960067..bd87c4bb62ee197d9fcfdc86b3d81e3d060207ee 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelRAndBAndNIRIndexImageFilter_h -#define __otbMultiChannelRAndBAndNIRIndexImageFilter_h +#ifndef otbMultiChannelRAndBAndNIRIndexImageFilter_h +#define otbMultiChannelRAndBAndNIRIndexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -107,9 +107,9 @@ protected: /// Constructor MultiChannelRAndBAndNIRIndexImageFilter() : m_RedIndex(3), m_BlueIndex(1), m_NIRIndex(4) {}; /// Destructor - virtual ~MultiChannelRAndBAndNIRIndexImageFilter() {} + ~MultiChannelRAndBAndNIRIndexImageFilter() ITK_OVERRIDE {} /// Before generating data, set functor parameters - virtual void BeforeThreadedGenerateData() + void BeforeThreadedGenerateData() ITK_OVERRIDE { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_RedIndex < 1 || m_BlueIndex < 1 || m_NIRIndex < 1 || @@ -122,7 +122,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h index 10c57e1efbd40b668c7a21d678458a8f50b46864..a65559daf9661e35b33e6cc64593af527f93fc27 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelRAndGAndNIRIndexImageFilter_h -#define __otbMultiChannelRAndGAndNIRIndexImageFilter_h +#ifndef otbMultiChannelRAndGAndNIRIndexImageFilter_h +#define otbMultiChannelRAndGAndNIRIndexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -107,9 +107,9 @@ protected: /// Constructor MultiChannelRAndGAndNIRIndexImageFilter() : m_RedIndex(3), m_GreenIndex(2), m_NIRIndex(4) {}; /// Destructor - virtual ~MultiChannelRAndGAndNIRIndexImageFilter() {} + ~MultiChannelRAndGAndNIRIndexImageFilter() ITK_OVERRIDE {} /// Before generating data, set functor parameters - virtual void BeforeThreadedGenerateData() + void BeforeThreadedGenerateData() ITK_OVERRIDE { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); @@ -123,7 +123,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h index 3b3cc61f46c1fa8ba2632ff005dab5fa615a20f4..8bbbe376952b61afd5bb5126cc73266cd30e5741 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelRAndNIRIndexImageFilter_h -#define __otbMultiChannelRAndNIRIndexImageFilter_h +#ifndef otbMultiChannelRAndNIRIndexImageFilter_h +#define otbMultiChannelRAndNIRIndexImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -95,9 +95,9 @@ protected: /// Constructor MultiChannelRAndNIRIndexImageFilter() : m_RedIndex(3), m_NIRIndex(4) {}; /// Destructor - virtual ~MultiChannelRAndNIRIndexImageFilter() {} + ~MultiChannelRAndNIRIndexImageFilter() ITK_OVERRIDE {} /// Before generating data, set functor parameters - virtual void BeforeThreadedGenerateData() + void BeforeThreadedGenerateData() ITK_OVERRIDE { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_RedIndex < 1 || m_NIRIndex < 1 || @@ -109,7 +109,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf Method - void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRadiometricImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRadiometricImageFilter.h index e92eecb1115c6731a06c8b4215197d167b87b98f..c0e96690de4647bed7ee6c1f4dace0dfeec5967c 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRadiometricImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRadiometricImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiChannelRadiometricImageFilter_h -#define __otbMultiChannelRadiometricImageFilter_h +#ifndef otbMultiChannelRadiometricImageFilter_h +#define otbMultiChannelRadiometricImageFilter_h #include "itkUnaryFunctorImageFilter.h" diff --git a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h index 9f7994cb4da0cc615c674d120a681eb4f37132aa..afc06ace754e3d94ffdfa4a6e6b8d511c46f55b3 100644 --- a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h +++ b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNDVIDataNodeFeatureFunction_h -#define __otbNDVIDataNodeFeatureFunction_h +#ifndef otbNDVIDataNodeFeatureFunction_h +#define otbNDVIDataNodeFeatureFunction_h #include "otbDataNodeImageFunction.h" @@ -85,7 +85,7 @@ public: typedef std::vector<PrecisionType> OutputType; - virtual OutputType Evaluate( const DataNodeType& node ) const; + OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; /** Set/Get methods */ itkGetConstMacro(NDVIThreshold, PrecisionType); @@ -114,8 +114,8 @@ public: protected: NDVIDataNodeFeatureFunction(); - ~NDVIDataNodeFeatureFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~NDVIDataNodeFeatureFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: NDVIDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.txx b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.txx index cdb5c6965b9c7f750daa1d86482d036e7a19cda5..c650c8562ba88fe900a2e141a920e2a7e33969ef 100644 --- a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.txx +++ b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNDVIDataNodeFeatureFunction_txx -#define __otbNDVIDataNodeFeatureFunction_txx +#ifndef otbNDVIDataNodeFeatureFunction_txx +#define otbNDVIDataNodeFeatureFunction_txx #include "otbNDVIDataNodeFeatureFunction.h" diff --git a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h index 2a42a0815c9abe37f469f7022f5ed93afe6cdd88..f265d2d1583cec62ad7a857deb1e82f946ee2bb1 100644 --- a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndBAndNIRIndexImageFilter_h -#define __otbRAndBAndNIRIndexImageFilter_h +#ifndef otbRAndBAndNIRIndexImageFilter_h +#define otbRAndBAndNIRIndexImageFilter_h #include "itkTernaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -71,9 +71,9 @@ public: protected: RAndBAndNIRIndexImageFilter(); - virtual ~RAndBAndNIRIndexImageFilter() {} + ~RAndBAndNIRIndexImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RAndBAndNIRIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.txx b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.txx index 6030fd1a3f2ca3b504e55c687dd155275ac68cc9..94ecdaa4be2d01037395727137dc769915702aef 100644 --- a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.txx +++ b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndBAndNIRIndexImageFilter_txx -#define __otbRAndBAndNIRIndexImageFilter_txx +#ifndef otbRAndBAndNIRIndexImageFilter_txx +#define otbRAndBAndNIRIndexImageFilter_txx #include "otbRAndBAndNIRIndexImageFilter.h" diff --git a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h index 65b44f5dfacfcb3c076b14f0c564406a7365e9a8..ba30f3730d4a7641bd3a00695b127fb8e9cc6840 100644 --- a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndGAndNIRIndexImageFilter_h -#define __otbRAndGAndNIRIndexImageFilter_h +#ifndef otbRAndGAndNIRIndexImageFilter_h +#define otbRAndGAndNIRIndexImageFilter_h #include "itkTernaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -71,9 +71,9 @@ public: protected: RAndGAndNIRIndexImageFilter(); - virtual ~RAndGAndNIRIndexImageFilter() {} + ~RAndGAndNIRIndexImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RAndGAndNIRIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.txx b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.txx index e138c4caeb6f17cb11254c9dfad016924235f491..93038fe440fa671fe39a5eaba6425b8ccaa0f2c3 100644 --- a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.txx +++ b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndGAndNIRIndexImageFilter_txx -#define __otbRAndGAndNIRIndexImageFilter_txx +#ifndef otbRAndGAndNIRIndexImageFilter_txx +#define otbRAndGAndNIRIndexImageFilter_txx #include "otbRAndGAndNIRIndexImageFilter.h" diff --git a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h index 0a61f9e95a1cf5676a86d10d942b863d16a4f103..46c157fed80292e8752d3087f95c517217501c7a 100644 --- a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndNIRIndexImageFilter_h -#define __otbRAndNIRIndexImageFilter_h +#ifndef otbRAndNIRIndexImageFilter_h +#define otbRAndNIRIndexImageFilter_h #include "itkBinaryFunctorImageFilter.h" #include "otbVegetationIndicesFunctor.h" @@ -68,9 +68,9 @@ public: protected: RAndNIRIndexImageFilter(); - virtual ~RAndNIRIndexImageFilter() {} + ~RAndNIRIndexImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /* void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); diff --git a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.txx b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.txx index b1e42689ac6bb05c7550875d856afe0bbce50d5e..9d9abfb4e4ff74c9e0774adfc5a0cfd4fddb0422 100644 --- a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.txx +++ b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRAndNIRIndexImageFilter_txx -#define __otbRAndNIRIndexImageFilter_txx +#ifndef otbRAndNIRIndexImageFilter_txx +#define otbRAndNIRIndexImageFilter_txx #include "otbRAndNIRIndexImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h index 68e2d53cbc02a1f176022ce6604cddc5baf283dc..f3b9dbc78709930dd780f2760cf412d1671cd52b 100644 --- a/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSoilIndicesFunctor_h -#define __otbSoilIndicesFunctor_h +#ifndef otbSoilIndicesFunctor_h +#define otbSoilIndicesFunctor_h #include "otbMath.h" #include "itkVariableLengthVector.h" @@ -284,7 +284,7 @@ class IR : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "IR"; } @@ -292,10 +292,10 @@ public: /// Constructor IR() {} /// Desctructor - virtual ~IR() {} + ~IR() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -327,7 +327,7 @@ class IC : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "IC"; } @@ -335,10 +335,10 @@ public: /// Constructor IC() {} /// Desctructor - virtual ~IC() {} + ~IC() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -366,7 +366,7 @@ class IB : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "IB"; } @@ -374,10 +374,10 @@ public: /// Constructor IB() {} /// Desctructor - virtual ~IB() {} + ~IB() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -401,7 +401,7 @@ class IB2 : public GAndRAndNirIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "IB2"; } @@ -409,10 +409,10 @@ public: /// Constructor IB2() {} /// Desctructor - virtual ~IB2() {} + ~IB2() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed, const TInput2& pNir) const + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed, const TInput2& pNir) const ITK_OVERRIDE { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); diff --git a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h index dbf7660fae7baf2f4023684f80ec3ae4d9b3896b..8c128d03401d08bc31d4ee9546a71ffcc61a1a9d 100644 --- a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVegetationIndicesFunctor_h -#define __otbVegetationIndicesFunctor_h +#ifndef otbVegetationIndicesFunctor_h +#define otbVegetationIndicesFunctor_h #include "otbMath.h" #include "itkVariableLengthVector.h" @@ -411,7 +411,7 @@ class NDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDVI"; } @@ -419,10 +419,10 @@ public: /// Constructor NDVI() {} /// Desctructor - virtual ~NDVI() {} + ~NDVI() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -451,15 +451,15 @@ class RVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "RVI"; } RVI() {} - virtual ~RVI() {} + ~RVI() ITK_OVERRIDE {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -490,13 +490,13 @@ class PVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "PVI"; } PVI() : m_A(0.90893), m_B(7.46216), m_Coeff(0.74) {} - virtual ~PVI() {} + ~PVI() ITK_OVERRIDE {} /** Set/Get A and B parameters */ void SetA(const double A) { @@ -516,7 +516,7 @@ public: return (m_B); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -549,13 +549,13 @@ class SAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "SAVI"; } SAVI() : m_L(0.5) {} - virtual ~SAVI() {} + ~SAVI() ITK_OVERRIDE {} /** Set/Get L correction */ void SetL(const double L) @@ -568,7 +568,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -603,13 +603,13 @@ class TSAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "TSAVI"; } TSAVI() : m_A(0.7), m_S(0.9), m_X(0.08) {} - virtual ~TSAVI() {} + ~TSAVI() ITK_OVERRIDE {} /** Set/Get S and A parameters */ void SetS(const double S) @@ -639,7 +639,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -676,7 +676,7 @@ class WDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "WDVI"; } @@ -684,7 +684,7 @@ public: /// Constructor WDVI() : m_S(0.4) {} /// Desctructor - virtual ~WDVI() {} + ~WDVI() ITK_OVERRIDE {} // Operator on r and nir single pixel values /** Set/Get Slop of soil line */ void SetS(const double s) @@ -696,7 +696,7 @@ public: return (m_S); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -724,7 +724,7 @@ class MSAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "MSAVI"; } @@ -736,7 +736,7 @@ public: { m_WDVIfunctor.SetS(m_S); } - virtual ~MSAVI() {} + ~MSAVI() ITK_OVERRIDE {} /** Set/Get Slop of soil line */ void SetS(const double s) { @@ -757,7 +757,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -799,16 +799,16 @@ class MSAVI2 : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "MSAVI2"; } MSAVI2() {} - virtual ~MSAVI2() {} + ~MSAVI2() ITK_OVERRIDE {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -837,16 +837,16 @@ class GEMI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "GEMI"; } GEMI() {} - virtual ~GEMI() {} + ~GEMI() ITK_OVERRIDE {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -891,13 +891,13 @@ class AVI : public RAndGAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "AVI"; } AVI() : m_LambdaG(560.), m_LambdaR(660.), m_LambdaNir(830.) {} - virtual ~AVI() {} + ~AVI() ITK_OVERRIDE {} /** Set/Get Lambda red parameter*/ void SetLambdaR(const double lr) { @@ -926,7 +926,7 @@ public: return (m_LambdaNir); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& g, const TInput3& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& g, const TInput3& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double dg = static_cast<double>(g); @@ -986,13 +986,13 @@ class ARVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "ARVI"; } ARVI() : m_Gamma(0.5) {} - virtual ~ARVI() {} + ~ARVI() ITK_OVERRIDE {} /** Set/Get Gamma parameter */ void SetGamma(const double gamma) @@ -1005,7 +1005,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1040,13 +1040,13 @@ class TSARVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "TSARVI"; } TSARVI() : m_A(0.0), m_B(0.0), m_X(0.08), m_Gamma(0.5) {} - virtual ~TSARVI() {} + ~TSARVI() ITK_OVERRIDE {} /** Set/Get A and B parameters */ void SetA(const double A) @@ -1085,7 +1085,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1128,13 +1128,13 @@ class EVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "EVI"; } EVI() : m_G(2.5), m_C1(6.0), m_C2(7.5), m_L(1.0) {} - virtual ~EVI() {} + ~EVI() ITK_OVERRIDE {} /** Set/Get G parameter */ void SetG(const double g) { @@ -1172,7 +1172,7 @@ public: return (m_L); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1215,16 +1215,16 @@ class IPVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "IPVI"; } IPVI() {} - virtual ~IPVI() {} + ~IPVI() ITK_OVERRIDE {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -1254,14 +1254,14 @@ class TNDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "TNDVI"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; TNDVI() {} - virtual ~TNDVI() {} + ~TNDVI() ITK_OVERRIDE {} NDVIFunctorType GetNDVI(void) const { @@ -1269,7 +1269,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dval = this->GetNDVI() (r, nir) + 0.5; if (dval < 0) @@ -1306,14 +1306,14 @@ class LAIFromNDVILogarithmic : public RAndNIRIndexBase<TInput1, TInput2, TOutput { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LAIFromNDVILogarithmic"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; LAIFromNDVILogarithmic() : m_NdviSoil(0.10), m_NdviInf(0.89), m_ExtinctionCoefficient(0.71) {} - virtual ~LAIFromNDVILogarithmic() {} + ~LAIFromNDVILogarithmic() ITK_OVERRIDE {} NDVIFunctorType GetNDVI(void) const { @@ -1348,7 +1348,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double dval = this->GetNDVI() (r, nir); if (dval < 0) @@ -1392,14 +1392,14 @@ class LAIFromReflectancesLinear : public RAndNIRIndexBase<TInput1, TInput2, TOut { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LAIFromReflectancesLinear"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; LAIFromReflectancesLinear() : m_RedCoef(-17.91), m_NirCoef(12.26) {} - virtual ~LAIFromReflectancesLinear() {} + ~LAIFromReflectancesLinear() ITK_OVERRIDE {} NDVIFunctorType GetReflectances(void) const { @@ -1425,7 +1425,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { return (static_cast<TOutput>(m_RedCoef*r+m_NirCoef*nir)); } @@ -1461,7 +1461,7 @@ private: public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LAIFromNDVIFormosat2Functor"; } @@ -1469,10 +1469,10 @@ private: /// Constructor LAIFromNDVIFormosat2Functor() {} /// Desctructor - virtual ~LAIFromNDVIFormosat2Functor() {} + ~LAIFromNDVIFormosat2Functor() ITK_OVERRIDE {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE { double a = 0.1519; double b = 3.9443; diff --git a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h index 9ace91314671534cc1d5f6fa8bdaf99c6bc2dd50..ffefc68883f18a720168ba2a46337f4ea7a3ca7d 100644 --- a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaterIndicesFunctor_h -#define __otbWaterIndicesFunctor_h +#ifndef otbWaterIndicesFunctor_h +#define otbWaterIndicesFunctor_h #include "otbMath.h" #include "itkVariableLengthVector.h" @@ -123,15 +123,15 @@ class WaterIndexFunctor : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "WaterIndexFunctor"; } WaterIndexFunctor() {} - virtual ~WaterIndexFunctor() {} + ~WaterIndexFunctor() ITK_OVERRIDE {} protected: - inline TOutput Evaluate(const TInput1& id1, const TInput2& id2) const + inline TOutput Evaluate(const TInput1& id1, const TInput2& id2) const ITK_OVERRIDE { double dindex1 = static_cast<double>(id1); double dindex2 = static_cast<double>(id2); @@ -199,7 +199,7 @@ class NDWI : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDWI"; } @@ -208,7 +208,7 @@ public: /// Constructor NDWI() {} /// Desctructor - virtual ~NDWI() {} + ~NDWI() ITK_OVERRIDE {} WIFunctorType GetWIFunctor(void) const { return (m_WIFunctor); @@ -260,7 +260,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& nir, const TInput2& mir) const + inline TOutput Evaluate(const TInput1& nir, const TInput2& mir) const ITK_OVERRIDE { return (static_cast<TOutput>(GetWIFunctor() (nir, mir))); } @@ -284,7 +284,7 @@ class NDWI2 : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "NDWI2"; } @@ -293,7 +293,7 @@ public: /// Constructor NDWI2() {} /// Desctructor - virtual ~NDWI2() {} + ~NDWI2() ITK_OVERRIDE {} WIFunctorType GetWIFunctor(void) const { return (m_WIFunctor); @@ -345,7 +345,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& g, const TInput2& nir) const + inline TOutput Evaluate(const TInput1& g, const TInput2& nir) const ITK_OVERRIDE { return (static_cast<TOutput>(GetWIFunctor() (g, nir))); } @@ -647,7 +647,7 @@ public: reference[0] = 136.0; reference[1] = 132.0; reference[2] = 47.0; reference[3] = 24.0; this->SetReferenceWaterPixel(reference); } - virtual ~WaterSqrtSpectralAngleFunctor() {} + ~WaterSqrtSpectralAngleFunctor() ITK_OVERRIDE {} /** Set Reference Pixel */ void SetReferenceWaterPixel(InputVectorPixelType ref) @@ -739,7 +739,7 @@ public: } protected: - inline TOutputPixel Evaluate(const TInputVectorPixel& inPix) const + inline TOutputPixel Evaluate(const TInputVectorPixel& inPix) const ITK_OVERRIDE { return static_cast<TOutputPixel>(Superclass::Evaluate(inPix)); } diff --git a/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h b/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h index f0d7ad4a7270d8e00e6c623af19ff596b0727d8a..a07fee24feef8e99865bf051668c169fb86a44a2 100644 --- a/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWaterSqrtSpectralAngleImageFilter_h -#define __otbWaterSqrtSpectralAngleImageFilter_h +#ifndef otbWaterSqrtSpectralAngleImageFilter_h +#define otbWaterSqrtSpectralAngleImageFilter_h #include "otbWaterIndicesFunctor.h" #include "itkUnaryFunctorImageFilter.h" @@ -70,7 +70,7 @@ public: protected: WaterSqrtSpectralAngleImageFilter() {} - virtual ~WaterSqrtSpectralAngleImageFilter() {} + ~WaterSqrtSpectralAngleImageFilter() ITK_OVERRIDE {} private: WaterSqrtSpectralAngleImageFilter(Self &); // purposely not implemented diff --git a/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h b/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h index 65cf37d303794b6c1d61d9cf9421e72580d4680d..1c9674a5e56ccec0f1176eabd37ebd07e9de84bb 100644 --- a/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h +++ b/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLandsatTMSRBC_h -#define __otbLandsatTMSRBC_h +#ifndef otbLandsatTMSRBC_h +#define otbLandsatTMSRBC_h #include "otbLandsatTMIndices.h" @@ -180,13 +180,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - virtual std::string GetName() const + std::string GetName() const ITK_OVERRIDE { return "LandsatTM SpectralRuleBasedClassifier"; } SpectralRuleBasedClassifier() { } - virtual ~SpectralRuleBasedClassifier() {} + ~SpectralRuleBasedClassifier() ITK_OVERRIDE {} inline TOutput operator ()(const TInput& inputPixel) { diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h b/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h index 06e454d9ad84cc891c998704e7b0eec9e47fe4a1..6136f8c08403f4f26f5d9f67dc254d78665776ac 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAeronetData_h -#define __otbAeronetData_h +#ifndef otbAeronetData_h +#define otbAeronetData_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -83,9 +83,9 @@ protected: /** Constructor */ AeronetData(); /** Destructor */ - ~AeronetData() {} + ~AeronetData() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** Angstrom coefficient */ diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h b/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h index bb1798a4adc5dcc7d237121fb1a831a736218bd8..75e75ffecfeb63165b03861871980458f2078c1c 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAeronetFileReader_h -#define __otbAeronetFileReader_h +#ifndef otbAeronetFileReader_h +#define otbAeronetFileReader_h #include <string> #include <vector> @@ -121,12 +121,12 @@ protected: /** Constructor */ AeronetFileReader(); /** Destructor */ - virtual ~AeronetFileReader(); + ~AeronetFileReader() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h index 7c67a4268ec0d4d3db893ca12f3844aa8ece538b..4b3d591cf8d1fd8cca7178d10c9705404f88b256 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAtmosphericCorrectionParameters_h -#define __otbAtmosphericCorrectionParameters_h +#ifndef otbAtmosphericCorrectionParameters_h +#define otbAtmosphericCorrectionParameters_h #include "itkObject.h" #include "itkVariableSizeMatrix.h" @@ -133,12 +133,12 @@ public: /** Constructor */ AtmosphericCorrectionParameters(); /** Destructor */ - ~AtmosphericCorrectionParameters() {} + ~AtmosphericCorrectionParameters() ITK_OVERRIDE {} protected: /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: AtmosphericCorrectionParameters(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h index 5cc401b58fed2ac147cd93ced33fbcc04d5a882d..c719ca9af6483b1c5050a76f5079b17b9f5cd13d 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAtmosphericRadiativeTerms_h -#define __otbAtmosphericRadiativeTerms_h +#ifndef otbAtmosphericRadiativeTerms_h +#define otbAtmosphericRadiativeTerms_h #include "itkDataObject.h" #include "itkObjectFactory.h" @@ -115,9 +115,9 @@ protected: /** Constructor */ AtmosphericRadiativeTermsSingleChannel(); /** Destructor */ - ~AtmosphericRadiativeTermsSingleChannel() {} + ~AtmosphericRadiativeTermsSingleChannel() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: AtmosphericRadiativeTermsSingleChannel(const Self &); //purposely not implemented @@ -262,9 +262,9 @@ protected: /** Constructor */ AtmosphericRadiativeTerms(); /** Destructor */ - ~AtmosphericRadiativeTerms() {} + ~AtmosphericRadiativeTerms() ITK_OVERRIDE {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: AtmosphericRadiativeTerms(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h b/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h index 5870366819f5c30749ad07081be5792cff7117b1..8d1596628b6f31e73eda9ca45ce0412c8e35400a 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageMetadataCorrectionParameters_h -#define __otbImageMetadataCorrectionParameters_h +#ifndef otbImageMetadataCorrectionParameters_h +#define otbImageMetadataCorrectionParameters_h #include "itkObject.h" #include "itkVariableSizeMatrix.h" @@ -141,12 +141,12 @@ public: /** Constructor */ ImageMetadataCorrectionParameters(); /** Destructor */ - ~ImageMetadataCorrectionParameters() {} + ~ImageMetadataCorrectionParameters() ITK_OVERRIDE {} protected: /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageMetadataCorrectionParameters(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h index 1772f930b5864724a350114ed33d9fe886d07006..0334935c2f058a12f4310e93511aa78b1361789a 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToLuminanceImageFilter_h -#define __otbImageToLuminanceImageFilter_h +#ifndef otbImageToLuminanceImageFilter_h +#define otbImageToLuminanceImageFilter_h #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "itkNumericTraits.h" @@ -171,10 +171,10 @@ protected: }; /** Destructor */ - virtual ~ImageToLuminanceImageFilter() {} + ~ImageToLuminanceImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h index 28997f1ab1c2dd631ce183d83a31be6553c9c818..2040c40204955b8aaa17fab3543fb05715c3b83d 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToReflectanceImageFilter_h -#define __otbImageToReflectanceImageFilter_h +#ifndef otbImageToReflectanceImageFilter_h +#define otbImageToReflectanceImageFilter_h #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" @@ -251,10 +251,10 @@ protected: }; /** Destructor */ - virtual ~ImageToReflectanceImageFilter() {} + ~ImageToReflectanceImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( diff --git a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h index 26121b7d89319c58fc77b2f71a549ff3930a1eb1..8f53ee7b310ae72df92ac9c0d1b80668a68737a5 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLuminanceToImageImageFilter_h -#define __otbLuminanceToImageImageFilter_h +#ifndef otbLuminanceToImageImageFilter_h +#define otbLuminanceToImageImageFilter_h #include "otb_6S.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" @@ -172,10 +172,10 @@ protected: }; /** Destructor */ - virtual ~LuminanceToImageImageFilter() {} + ~LuminanceToImageImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h index 5f7a597463dea613d7fbccee62f4d46dfc41b63b..8c28238133774868e58cce82f24f0797ad2e2a8a 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLuminanceToReflectanceImageFilter_h -#define __otbLuminanceToReflectanceImageFilter_h +#ifndef otbLuminanceToReflectanceImageFilter_h +#define otbLuminanceToReflectanceImageFilter_h #include "otbVarSol.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" @@ -247,10 +247,10 @@ protected: }; /** Destructor */ - virtual ~LuminanceToReflectanceImageFilter() {} + ~LuminanceToReflectanceImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h b/Modules/Radiometry/OpticalCalibration/include/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h index 7c47357ee1f70729d85db43a7874f5551ff4b5f9..dc584568cb6c77a9f10e4b6b0aa712c3440db634 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h -#define __otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h +#ifndef otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h +#define otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h #include "otbAtmosphericRadiativeTerms.h" #include "otbImageMetadataCorrectionParameters.h" diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h index af68323c92696276dd73a705542efb88f0da3bf0..107f07edcf24c45af078a4ecfc72ba0cc7a5dab4 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReflectanceToImageImageFilter_h -#define __otbReflectanceToImageImageFilter_h +#ifndef otbReflectanceToImageImageFilter_h +#define otbReflectanceToImageImageFilter_h #include "otbLuminanceToImageImageFilter.h" #include "otbReflectanceToLuminanceImageFilter.h" @@ -237,10 +237,10 @@ protected: }; /** Destructor */ - virtual ~ReflectanceToImageImageFilter() {} + ~ReflectanceToImageImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h index 99409bb1f7b7f07c22aa50aac03bf87181deee16..ceeac8e0ba176b12aeadcdfcbc0b2bd6084bf1fe 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReflectanceToLuminanceImageFilter_h -#define __otbReflectanceToLuminanceImageFilter_h +#ifndef otbReflectanceToLuminanceImageFilter_h +#define otbReflectanceToLuminanceImageFilter_h #include "otbVarSol.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" @@ -231,10 +231,10 @@ protected: }; /** Destructor */ - virtual ~ReflectanceToLuminanceImageFilter() {} + ~ReflectanceToLuminanceImageFilter() ITK_OVERRIDE {} /** Update the functor list and input parameters */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h index 7c86e84013ab6c998e9a64d3bee76c18b374ac74..c495e8440a5da570416e00d5278c1da7585bfeb0 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReflectanceToSurfaceReflectanceImageFilter_h -#define __otbReflectanceToSurfaceReflectanceImageFilter_h +#ifndef otbReflectanceToSurfaceReflectanceImageFilter_h +#define otbReflectanceToSurfaceReflectanceImageFilter_h #include "otbUnaryImageFunctorWithVectorImageFilter.h" @@ -240,18 +240,18 @@ protected: /** Constructor */ ReflectanceToSurfaceReflectanceImageFilter(); /** Destructor */ - virtual ~ReflectanceToSurfaceReflectanceImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~ReflectanceToSurfaceReflectanceImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Initialize the parameters of the functor before the threads run. */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.txx b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.txx index 38c6159ae916f0fc69f7e5f195427de0a58d4b97..5ca467736311c21a769c58756008dd026a330b53 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.txx +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReflectanceToSurfaceReflectanceImageFilter_txx -#define __otbReflectanceToSurfaceReflectanceImageFilter_txx +#ifndef otbReflectanceToSurfaceReflectanceImageFilter_txx +#define otbReflectanceToSurfaceReflectanceImageFilter_txx #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbOpticalImageMetadataInterfaceFactory.h" @@ -84,7 +84,7 @@ void ReflectanceToSurfaceReflectanceImageFilter<TInputImage, TOutputImage> ::UpdateAtmosphericRadiativeTerms() { - if (this->GetInput() == NULL) + if (this->GetInput() == ITK_NULLPTR) { itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); } @@ -161,7 +161,7 @@ ReflectanceToSurfaceReflectanceImageFilter<TInputImage, TOutputImage> ::UpdateFunctors() { - if (this->GetInput() == NULL) + if (this->GetInput() == ITK_NULLPTR) { itkExceptionMacro(<< "Input must be set before updating the functors"); } diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSIXSTraits.h b/Modules/Radiometry/OpticalCalibration/include/otbSIXSTraits.h index feb0c1b8e8d50cda5ba5d5e63de6a7eba081f8f0..6fc9b4505dae73d825fca45987c4f339f7b068e1 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSIXSTraits.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbSIXSTraits.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSIXSTraits_h -#define __otbSIXSTraits_h +#ifndef otbSIXSTraits_h +#define otbSIXSTraits_h #include "otbAtmosphericCorrectionParameters.h" diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h b/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h index 2f5fe34b8a3feddb5b7d6ba3d22adf96a41ce272..213fa0cc75e2600765234c747ca3b9095e24e05f 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralSensitivityReader_h -#define __otbSpectralSensitivityReader_h +#ifndef otbSpectralSensitivityReader_h +#define otbSpectralSensitivityReader_h #include "itkProcessObject.h" #include "itkImageBase.h" @@ -75,16 +75,16 @@ public: protected: SpectralSensitivityReader(); - virtual ~SpectralSensitivityReader(); + ~SpectralSensitivityReader() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Find the filename using image metadata */ void FindFileName(); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Struct use to remove multiple spaces in file */ struct BothAre diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h index c73c10b66694d71bdf201fa184b5fdc4f946b254..c896492a9f0c38fcf7d085dd431847c630d0e07d 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h -#define __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h +#ifndef otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h +#define otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h #include "itkNumericTraits.h" #include <vector> @@ -267,11 +267,11 @@ public: protected: SurfaceAdjacencyEffectCorrectionSchemeFilter(); - virtual ~SurfaceAdjacencyEffectCorrectionSchemeFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SurfaceAdjacencyEffectCorrectionSchemeFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Initialize the parameters of the functor before the threads run. */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); @@ -280,7 +280,7 @@ protected: void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx index bc19df839aa90a939673241b187773ccd5416eea..b91d7f59e611ad9d7649fa3612daf9b91e13f2a9 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx +++ b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx @@ -20,8 +20,8 @@ =========================================================================*/ -#ifndef __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx -#define __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx +#ifndef otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx +#define otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx #include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" @@ -79,7 +79,7 @@ void SurfaceAdjacencyEffectCorrectionSchemeFilter<TInputImage, TOutputImage> ::UpdateAtmosphericRadiativeTerms() { - if (this->GetInput() == NULL) + if (this->GetInput() == ITK_NULLPTR) { itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); } diff --git a/Modules/Radiometry/OpticalCalibration/include/otbVarSol.h b/Modules/Radiometry/OpticalCalibration/include/otbVarSol.h index 9d615c8d94b664804e220b6b7a7f87bb4fecf822..360c4bb9187a28b02be8b4e1c441d209132a15df 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbVarSol.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbVarSol.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVarSol_h -#define __otbVarSol_h +#ifndef otbVarSol_h +#define otbVarSol_h #include "itkMacro.h" #include "otbMath.h" diff --git a/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h b/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h index 67a642e0ed32eca98daf8a3141aea0b79c73c7e3..72c8b8bfb019118b6a6e7e94b1d4bdd8149ad250 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWavelengthSpectralBands_h -#define __otbWavelengthSpectralBands_h +#ifndef otbWavelengthSpectralBands_h +#define otbWavelengthSpectralBands_h #include "otbObjectList.h" #include "otbFilterFunctionValues.h" @@ -59,10 +59,10 @@ protected: /** Constructor */ WavelengthSpectralBands(); /** Destructor */ - ~WavelengthSpectralBands() {} + ~WavelengthSpectralBands() ITK_OVERRIDE {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: WavelengthSpectralBands(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/src/otbAeronetFileReader.cxx b/Modules/Radiometry/OpticalCalibration/src/otbAeronetFileReader.cxx index e212a8989b584317d3c5c32bc9813eebecaf377c..4d77bab074cc60aa6966e9eb628fa964fdb2b2ca 100644 --- a/Modules/Radiometry/OpticalCalibration/src/otbAeronetFileReader.cxx +++ b/Modules/Radiometry/OpticalCalibration/src/otbAeronetFileReader.cxx @@ -101,7 +101,7 @@ AeronetFileReader { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<AeronetData *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Radiometry/OpticalCalibration/src/otbSIXSTraits.cxx b/Modules/Radiometry/OpticalCalibration/src/otbSIXSTraits.cxx index 78f6a2f070c9f81c1dbc466b6b31123ce9b7a9f4..0608b85249f3162df50753b5bef9795343646958 100644 --- a/Modules/Radiometry/OpticalCalibration/src/otbSIXSTraits.cxx +++ b/Modules/Radiometry/OpticalCalibration/src/otbSIXSTraits.cxx @@ -98,9 +98,7 @@ SIXSTraits::ComputeAtmosphericParameters( otb_6s_integer iinf = static_cast<otb_6s_integer>((wlinf - (float) .25) / SIXSStepOfWavelengthSpectralBandValues + (float) 1.5); otb_6s_integer cpt = iinf - 1; - otb_6s_doublereal * s(NULL); - s = new otb_6s_doublereal[S_6S_SIZE]; - memset(s, 0, S_6S_SIZE * sizeof(otb_6s_doublereal)); + otb_6s_doublereal s[S_6S_SIZE]; const ValuesVectorType& FilterFunctionValues6S = WavelengthSpectralBand->GetFilterFunctionValues6S(); // Set the values of FilterFunctionValues6S in s between [iinf-1; isup] for (unsigned int i = 0; i < FilterFunctionValues6S.size() && cpt < S_6S_SIZE; ++i) @@ -127,8 +125,6 @@ SIXSTraits::ComputeAtmosphericParameters( &tdif_up_ray, &tdif_up_aer); otbMsgDevMacro(<< "Done call 6S main function!"); - delete[] s; - s = NULL; } catch (std::bad_alloc& err) { diff --git a/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx b/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx index 403bbe65875691356cbf36df36118b10f8fcadfe..a61a70717cf1f2460280306f37034a29fc6d749e 100644 --- a/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx +++ b/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx @@ -50,7 +50,7 @@ SpectralSensitivityReader { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<WavelengthSpectralBandVectorType *> (this->ProcessObject::GetOutput(0)); } @@ -61,7 +61,7 @@ SpectralSensitivityReader { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const WavelengthSpectralBandVectorType *> (this->ProcessObject::GetOutput(0)); } diff --git a/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt b/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt index f4c3ba559a48bde0b91623118d0be6e01043a5bf..9b8d1e479ce7fc9c6e5b3542202927d00c1ca440 100644 --- a/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt +++ b/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt @@ -131,7 +131,7 @@ otb_add_test(NAME raTvRomaniaReflectanceToImage COMMAND otbOpticalCalibrationTes --compare-image ${EPSILON_12} ${INPUTDATA}/Romania_Extract.tif ${TEMP}/raTvRomaniaImage.tif - otbReflectanceToImageImageFilter + otbReflectanceToImageImageFilter ${BASELINE}/raTvRomania_Reflectance.tif ${TEMP}/raTvRomaniaImage.tif 27.3 # = 90-62.70 : elevation et azimuth solaire @@ -176,10 +176,10 @@ otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoWV2PAN COMMAND otbOpt otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif + ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.img otbLuminanceToReflectanceImageFilterAuto LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif + ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.img ) otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver @@ -208,10 +208,10 @@ otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS COMMAND o otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif + ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.img otbLuminanceToReflectanceImageFilterAuto LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif + ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.img ) otb_add_test(NAME raTuImageToLuminanceImageFilterNew COMMAND otbOpticalCalibrationTestDriver @@ -226,8 +226,8 @@ otb_add_test(NAME raTuLuminanceToImageImageFilterNew COMMAND otbOpticalCalibrati otbLuminanceToImageImageFilterNew ) -#FIXME Those tests have performing local copies of header, baselines...They were migrate "as it" for now in version 5.0 but -# something cleaner could be done in the future. +#FIXME Those tests have performing local copies of header, baselines...They were migrate "as it" for now in version 5.0 but +# something cleaner could be done in the future. #TODO Rewrite those tests and ban local copy and cmake trickery if(OTB_DATA_USE_LARGEINPUT) @@ -235,8 +235,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF COPYONLY) @@ -255,8 +255,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF COPYONLY) @@ -274,8 +274,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${ROMEWV2DIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${ROMEWV2DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF COPYONLY) @@ -292,8 +292,8 @@ if(OTB_DATA_USE_LARGEINPUT) set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibLumToImIkonos) file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*metadata.txt ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*pan*) - foreach(f ${MTDATA}) - configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif COPYONLY) @@ -310,27 +310,27 @@ if(OTB_DATA_USE_LARGEINPUT) set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibLumToImSPOT5) file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/SPOT5/TEHERAN/*.DIM) - foreach(f ${MTDATA}) - configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF COPYONLY) otb_add_test(NAME raTvLuminanceToImageImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.tif + --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.img ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif otbLuminanceToImageImageFilterAuto - ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${TEHERANSPOT5DIR}/IMAGERY.TIF LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif - ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.img ) set(ROMEWV2DIR ${TEMP}/OpticalCalibLumToImWv2PAN) file(MAKE_DIRECTORY ${ROMEWV2DIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${ROMEWV2DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF COPYONLY) @@ -348,27 +348,27 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${SUDOUESTFORMOSATDIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/FORMOSAT/Sudouest_20071013_MS_fmsat) file(GLOB MTDATA ${MTDATADIR}/*.DIM) - foreach(f ${MTDATA}) - configure_file(${f} ${SUDOUESTFORMOSATDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${SUDOUESTFORMOSATDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF COPYONLY) otb_add_test(NAME raTvLuminanceToImageImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.tif + --compare-image ${EPSILON_12} ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.img ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif otbLuminanceToImageImageFilterAuto ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif - ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.tif + ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.img ) set(TOULOUSEQBDIR ${TEMP}/OpticalCalibRefToLumQBPAN) file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF COPYONLY) @@ -384,8 +384,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${ROMEWV2DIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${ROMEWV2DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF COPYONLY) @@ -400,24 +400,24 @@ if(OTB_DATA_USE_LARGEINPUT) set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibRefToLumSPOT5) file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/SPOT5/TEHERAN/*.DIM) - foreach(f ${MTDATA}) - configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF COPYONLY) otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif - ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.img otbReflectanceToLuminanceImageFilterAuto - ${TEHERANSPOT5DIR}/IMAGERY.TIF - ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.img ) set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibRefToLumIkonos) file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*metadata.txt ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*pan*) - foreach(f ${MTDATA}) - configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif COPYONLY) @@ -433,8 +433,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF COPYONLY) @@ -450,8 +450,8 @@ if(OTB_DATA_USE_LARGEINPUT) file(MAKE_DIRECTORY ${ROMEWV2DIR}) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) - foreach(f ${MTDATA}) - configure_file(${f} ${ROMEWV2DIR} COPYONLY) + foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) endforeach(f) configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF COPYONLY) @@ -464,7 +464,7 @@ if(OTB_DATA_USE_LARGEINPUT) ) endif() - + otb_add_test(NAME raTvAeronetExtractData_BadDate COMMAND otbOpticalCalibrationTestDriver otbAeronetExtractDataBadData ${INPUTDATA}/AERONET/090101_091231_Seysses.lev15 @@ -516,10 +516,10 @@ otb_add_test(NAME raTuSurfaceAdjacencyEffectCorrectionSchemeFilterNew COMMAND ot otb_add_test(NAME raTvImageToReflectanceImageFilterAuto COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToReflectanceImageFilterAuto.tif - ${TEMP}/raTvImageToReflectanceImageFilterAuto.tif + ${TEMP}/raTvImageToReflectanceImageFilterAuto.img otbImageToReflectanceImageFilterAuto LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEMP}/raTvImageToReflectanceImageFilterAuto.tif + ${TEMP}/raTvImageToReflectanceImageFilterAuto.img ) otb_add_test(NAME raTuImageToReflectanceImageFilterAutoFORMOSAT2 COMMAND otbOpticalCalibrationTestDriver @@ -665,13 +665,13 @@ otb_add_test(NAME raTuReflectanceToImageImageFilterAutoFORMOSAT2 COMMAND otbOpti ) otb_add_test(NAME raTvReflectanceToImageImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.tif + --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.img ${TEHERANSPOT5DIR}/raTvReflectanceToImageImageFilterAutoSpot5.tif otbReflectanceToImageImageFilterAuto - ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${TEHERANSPOT5DIR}/IMAGERY.TIF LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} ${TEHERANSPOT5DIR}/raTvReflectanceToImageImageFilterAutoSpot5.tif - ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.img ) otb_add_test(NAME raTuAeronetNew COMMAND otbOpticalCalibrationTestDriver @@ -756,13 +756,13 @@ otb_add_test(NAME raTuImageMetadataCorrectionParametersNew COMMAND otbOpticalCal otb_add_test(NAME raTvImageToLuminanceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.tif + ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.img otbImageToLuminanceImageFilterAuto LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.tif + ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.img ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver +otb_add_test(NAME raTvImageToLuminanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif ${TEMP}/raTvImageToLuminanceImageFilterAutoIkonos.tif otbImageToLuminanceImageFilterAuto @@ -796,10 +796,10 @@ otb_add_test(NAME raTvImageToLuminanceImageFilterAutoWV2MULTI COMMAND otbOptical otb_add_test(NAME raTvImageToLuminanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.tif + ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.img otbImageToLuminanceImageFilterAuto LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.tif + ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.img ) otb_add_test(NAME raTvImageToLuminanceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver @@ -926,4 +926,3 @@ otb_add_test(NAME raTvImageToLuminanceImageFilter COMMAND otbOpticalCalibrationT 3 #channel 3 beta 4 #channel 4 beta ) - diff --git a/Modules/Radiometry/OpticalCalibration/test/otbSIXSTraitsTest.cxx b/Modules/Radiometry/OpticalCalibration/test/otbSIXSTraitsTest.cxx index 1e45bbf7f0786d63a22901528ec01b0d9cf6182d..84db26dec399649133c843f31c12104ca4b69aab 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbSIXSTraitsTest.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbSIXSTraitsTest.cxx @@ -20,7 +20,7 @@ int otbSIXSTraitsTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { - otb::SIXSTraits *var(NULL); + otb::SIXSTraits *var(ITK_NULLPTR); var = new otb::SIXSTraits(); delete var; return EXIT_SUCCESS; diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h index 10e1410f23df3883a243c624d1f3ea5ba3436646..a703971b7847426c5c3ff0291f22ee8e7707fbb4 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarBrightnessFunction_h -#define __otbSarBrightnessFunction_h +#ifndef otbSarBrightnessFunction_h +#define otbSarBrightnessFunction_h #include "otbSarBrightnessFunctor.h" #include "otbSarParametricMapFunction.h" @@ -82,17 +82,17 @@ public: typedef typename ParametricFunctionType::ConstPointer ParametricFunctionConstPointer; /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -103,7 +103,7 @@ public: * \warning this method caches BufferedRegion information. * If the BufferedRegion has changed, user must call * SetInputImage again to update cached values. */ - virtual void SetInputImage( const InputImageType * ptr ); + void SetInputImage( const InputImageType * ptr ) ITK_OVERRIDE; /** Get/Set the Scale value */ @@ -137,8 +137,8 @@ public: protected: SarBrightnessFunction(); - virtual ~SarBrightnessFunction(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SarBrightnessFunction() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SarBrightnessFunction(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.txx b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.txx index d18e9f3837cb85a787d1da49f6550f554dfc06a8..3a13775e85773f6b265ac4c7b93010a54200b1d8 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSarBrightnessFunction_txx -#define __otbSarBrightnessFunction_txx +#ifndef otbSarBrightnessFunction_txx +#define otbSarBrightnessFunction_txx #include "otbSarBrightnessFunction.h" #include "itkNumericTraits.h" @@ -70,6 +70,26 @@ SarBrightnessFunction<TInputImage, TCoordRep> ::PrintSelf(std::ostream& os, itk::Indent indent) const { this->Superclass::PrintSelf(os, indent); + if (m_Noise) + { + os << indent << "Noise:\n"; + m_Noise->Print(os, indent.GetNextIndent()); + } + if (m_AntennaPatternNewGain) + { + os << indent << "AntennaPatternNewGain:\n"; + m_AntennaPatternNewGain->Print(os, indent.GetNextIndent()); + } + if (m_AntennaPatternOldGain) + { + os << indent << "AntennaPatternOldGain:\n"; + m_AntennaPatternOldGain->Print(os, indent.GetNextIndent()); + } + if (m_RangeSpreadLoss) + { + os << indent << "RangeSpreadLoss:\n"; + m_RangeSpreadLoss->Print(os, indent.GetNextIndent()); + } } /** diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunctor.h b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunctor.h index 22aecbbad5c1975ebf93825e8d252856cd03f625..88cda952fb4ac1cc40d7d5010d2e45f8219495f5 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunctor.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunctor.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSarBrightnessFunctor_h -#define __otbSarBrightnessFunctor_h +#ifndef otbSarBrightnessFunctor_h +#define otbSarBrightnessFunctor_h #include "otbMath.h" #include "itkNumericTraits.h" diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h index 8250dd52994993f2ef21310a714e1efb17ce7405..c25c699dae2ae0010467e1acd1c9e7cf817beccb 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarBrightnessToImageFilter_h -#define __otbSarBrightnessToImageFilter_h +#ifndef otbSarBrightnessToImageFilter_h +#define otbSarBrightnessToImageFilter_h #include "otbSarBrightnessFunction.h" #include "otbFunctionToImageFilter.h" @@ -83,10 +83,12 @@ public: protected: SarBrightnessToImageFilter(); - virtual ~SarBrightnessToImageFilter() {} + ~SarBrightnessToImageFilter() ITK_OVERRIDE {} /** Update the function list and input parameters*/ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SarBrightnessToImageFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.txx b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.txx index 5030eb932dcb4993abe4176103494971e185afa2..1c6b9394e6e9be3fc07349d7bea3d1afbee23184 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarBrightnessToImageFilter_txx -#define __otbSarBrightnessToImageFilter_txx +#ifndef otbSarBrightnessToImageFilter_txx +#define otbSarBrightnessToImageFilter_txx #include "otbSarBrightnessToImageFilter.h" @@ -52,30 +52,43 @@ SarBrightnessToImageFilter<TInputImage, TOutputImage> function->SetScale(imageMetadataInterface->GetRadiometricCalibrationScale()); - ParametricFunctionPointer noise; - ParametricFunctionPointer antennaPatternNewGain; - ParametricFunctionPointer antennaPatternOldGain; - ParametricFunctionPointer rangeSpreadLoss; - - noise = function->GetNoise(); + ParametricFunctionPointer noise = function->GetNoise(); noise->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationNoise()); noise->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationNoisePolynomialDegree()); noise->EvaluateParametricCoefficient(); - antennaPatternNewGain = function->GetAntennaPatternNewGain(); + ParametricFunctionPointer antennaPatternNewGain = function->GetAntennaPatternNewGain(); antennaPatternNewGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGain()); antennaPatternNewGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree()); antennaPatternNewGain->EvaluateParametricCoefficient(); - antennaPatternOldGain = function->GetAntennaPatternOldGain(); + ParametricFunctionPointer antennaPatternOldGain = function->GetAntennaPatternOldGain(); antennaPatternOldGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGain()); antennaPatternOldGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree()); antennaPatternOldGain->EvaluateParametricCoefficient(); - rangeSpreadLoss = function->GetRangeSpreadLoss(); + ParametricFunctionPointer rangeSpreadLoss = function->GetRangeSpreadLoss(); rangeSpreadLoss->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLoss()); rangeSpreadLoss->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLossPolynomialDegree()); rangeSpreadLoss->EvaluateParametricCoefficient(); + +#if 0 + this->Print(std::cout, id); +#endif +} + +template<class TInputImage, class TOutputImage> +void +SarBrightnessToImageFilter<TInputImage, TOutputImage> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + if (this->GetFunction()) + { + os << indent << "Function:\n"; + this->GetFunction()->Print(os, indent.GetNextIndent()); + } } diff --git a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h index 47be340fc5f526c6881774ac603a43dd56d1204e..526bcc57c10150bd7e67b1c0b5f01a1d56712346 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarParametricMapFunction_h -#define __otbSarParametricMapFunction_h +#ifndef otbSarParametricMapFunction_h +#define otbSarParametricMapFunction_h #include "itkImageFunction.h" #include "itkPointSet.h" @@ -76,10 +76,10 @@ public: typedef typename itk::NumericTraits<InputPixelType>::ScalarRealType RealType; /** Evaluate the function at specific positions */ - virtual RealType Evaluate(const PointType& point) const; + RealType Evaluate(const PointType& point) const ITK_OVERRIDE; /** Evalulate the function at specified index */ - virtual RealType EvaluateAtIndex(const IndexType& index) const + RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE { PointType point; point[0] = static_cast<typename PointType::ValueType>(index[0]); @@ -87,8 +87,8 @@ public: return this->Evaluate(point); } - virtual RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const + RealType EvaluateAtContinuousIndex( + const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -124,8 +124,8 @@ public: protected: SarParametricMapFunction(); - virtual ~SarParametricMapFunction(){} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SarParametricMapFunction() ITK_OVERRIDE{} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: SarParametricMapFunction(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.txx b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.txx index ed1c8c745c0ebf6d883ba40293d27e71dc1c751f..2de66788198256b678dbe3ca9d9d17d49d55c411 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSarParametricMapFunction_txx -#define __otbSarParametricMapFunction_txx +#ifndef otbSarParametricMapFunction_txx +#define otbSarParametricMapFunction_txx #include "otbSarParametricMapFunction.h" #include "itkNumericTraits.h" @@ -131,6 +131,7 @@ SarParametricMapFunction<TInputImage, TCoordRep> itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); std::string nbLinesValue = imageKeywordlist.GetMetadataByKey("number_lines"); std::string nbSamplesValue = imageKeywordlist.GetMetadataByKey("number_samples"); + // TODO: Don't use atof! m_ProductWidth = atof(nbSamplesValue.c_str()); m_ProductHeight = atof(nbLinesValue.c_str()); } diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h index 1331f740d5e4991b9d77d540019f003922baf2a6..704d90b043e60c356f941bdecab7d7a03c3fafcb 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarRadiometricCalibrationFunction_h -#define __otbSarRadiometricCalibrationFunction_h +#ifndef otbSarRadiometricCalibrationFunction_h +#define otbSarRadiometricCalibrationFunction_h #include "otbSarParametricMapFunction.h" #include "otbSarCalibrationLookupData.h" @@ -79,17 +79,17 @@ public: typedef typename ParametricFunctionType::ConstPointer ParametricFunctionConstPointer; /** Evalulate the function at specified index */ - virtual OutputType EvaluateAtIndex(const IndexType& index) const; + OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; /** Evaluate the function at non-integer positions */ - virtual OutputType Evaluate(const PointType& point) const + OutputType Evaluate(const PointType& point) const ITK_OVERRIDE { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& cindex) const + OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& cindex) const ITK_OVERRIDE { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -100,7 +100,7 @@ public: * \warning this method caches BufferedRegion information. * If the BufferedRegion has changed, user must call * SetInputImage again to update cached values. */ - virtual void SetInputImage( const InputImageType * ptr ); + void SetInputImage( const InputImageType * ptr ) ITK_OVERRIDE; /** Get/Set the Scale value */ @@ -169,10 +169,10 @@ protected: SarRadiometricCalibrationFunction(); /** default, empty, virtual dtor */ - virtual ~SarRadiometricCalibrationFunction(){} + ~SarRadiometricCalibrationFunction() ITK_OVERRIDE{} /** print method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Flags to indiciate if these values needs to be applied in calibration*/ diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx index 4e22a24c59b7c33f252a95064f96446eae88a47a..2dc5a2625c87644bf7d1eeeac8e19981f9e6fa8c 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSarRadiometricCalibrationFunction_txx -#define __otbSarRadiometricCalibrationFunction_txx +#ifndef otbSarRadiometricCalibrationFunction_txx +#define otbSarRadiometricCalibrationFunction_txx #include "otbSarRadiometricCalibrationFunction.h" #include "itkNumericTraits.h" diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h index 523cdbccb1a8a4d3c37938df7435d87e696c7820..34486aa01ec3d54c1da5a7b69dfc39831efba815 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarRadiometricCalibrationToImageFilter_h -#define __otbSarRadiometricCalibrationToImageFilter_h +#ifndef otbSarRadiometricCalibrationToImageFilter_h +#define otbSarRadiometricCalibrationToImageFilter_h #include "otbSarRadiometricCalibrationFunction.h" #include "otbFunctionToImageFilter.h" @@ -111,13 +111,13 @@ protected: SarRadiometricCalibrationToImageFilter(); /** Empty, default virtual dtor */ - virtual ~SarRadiometricCalibrationToImageFilter() {} + ~SarRadiometricCalibrationToImageFilter() ITK_OVERRIDE {} /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Update the function list and input parameters*/ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx index ad0f5b47e035d1218ea856d7788567f40c67f9f9..50b4ad850d5175b1c0a26e914c3ff601b51071b1 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSarRadiometricCalibrationToImageFilter_txx -#define __otbSarRadiometricCalibrationToImageFilter_txx +#ifndef otbSarRadiometricCalibrationToImageFilter_txx +#define otbSarRadiometricCalibrationToImageFilter_txx #include "otbSarRadiometricCalibrationToImageFilter.h" #include "otbSarImageMetadataInterfaceFactory.h" diff --git a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.h b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.h index 9ff7c1a6087afd9b41faf29c4c38af5de68b7631..d8fde3aa99af3e4c86517d082d9008832a27e3a4 100644 --- a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.h +++ b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTerraSarBrightnessFunctor_h -#define __otbTerraSarBrightnessFunctor_h +#ifndef otbTerraSarBrightnessFunctor_h +#define otbTerraSarBrightnessFunctor_h #include "otbMath.h" diff --git a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.txx b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.txx index 96a05e8c6cc3e90e7fa224b181b0722512ea15e3..6ad103ba7463fee4c13e263ce307a1f263130385 100644 --- a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.txx +++ b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessFunctor.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTerraSarBrightnessFunctor_txx -#define __otbTerraSarBrightnessFunctor_txx +#ifndef otbTerraSarBrightnessFunctor_txx +#define otbTerraSarBrightnessFunctor_txx #include "otbTerraSarBrightnessFunctor.h" diff --git a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h index 05984c7e7e8ea7c2efb8f575e1528ca01c08bce6..9e82701f04e4025d250ef099b6c4d9c780b4199e 100644 --- a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTerraSarBrightnessImageFilter_h -#define __otbTerraSarBrightnessImageFilter_h +#ifndef otbTerraSarBrightnessImageFilter_h +#define otbTerraSarBrightnessImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkMetaDataDictionary.h" @@ -143,10 +143,10 @@ protected: /** Constructor */ TerraSarBrightnessImageFilter(){}; /** Destructor */ - virtual ~TerraSarBrightnessImageFilter() {} + ~TerraSarBrightnessImageFilter() ITK_OVERRIDE {} /** Initialize the functor vector */ - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; private: TerraSarBrightnessImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.txx b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.txx index 23db6e9ba71d29b841b8c29ba719d37a28729339..b183e8a2d0e1a0db91a9e617a29b168838974e9d 100644 --- a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.txx +++ b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbTerraSarBrightnessImageFilter_txx -#define __otbTerraSarBrightnessImageFilter_txx +#ifndef otbTerraSarBrightnessImageFilter_txx +#define otbTerraSarBrightnessImageFilter_txx #include "otbTerraSarBrightnessImageFilter.h" #include "otbTerraSarImageMetadataInterface.h" diff --git a/Modules/Radiometry/SARCalibration/test/CMakeLists.txt b/Modules/Radiometry/SARCalibration/test/CMakeLists.txt index 82be99c62e514da325d29bee2fbe8d4069bc4fbb..f6ccc87ca94ee82085d126f21975218c0927a20d 100644 --- a/Modules/Radiometry/SARCalibration/test/CMakeLists.txt +++ b/Modules/Radiometry/SARCalibration/test/CMakeLists.txt @@ -138,7 +138,7 @@ otb_add_test(NAME raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWith #Radarsat2 otb_add_test(NAME raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2 COMMAND otbSARCalibrationTestDriver - --compare-image ${EPSILON_12} + --compare-image ${EPSILON_6} ${BASELINE}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2_HV.tif ${TEMP}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2_HV.tif otbSarRadiometricCalibrationToImageFilterWithComplexPixelTestWithoutNoise diff --git a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h index 1116fc7f88982b33200cbc3de4feb116be7b1aaf..09575398d2bca4dc447c1cdcc6864b8b0379961b 100644 --- a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h +++ b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAtmosphericEffects_h -#define __otbAtmosphericEffects_h +#ifndef otbAtmosphericEffects_h +#define otbAtmosphericEffects_h #include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" @@ -93,7 +93,7 @@ class AtmosphericEffects /** Constructor from a ASCII file */ //AtmosphericEffects( const std::string & filename ); /** Destructor */ - virtual ~AtmosphericEffects() {}; + ~AtmosphericEffects() ITK_OVERRIDE {}; /** PrintSelf method */ //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.txx b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.txx index e31a692ca505ce74c566cb405f227e36bb59d52b..6bd373b7916a2c5be7df8b19c36fd35faf6de3bc 100644 --- a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.txx +++ b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAtmosphericEffects_txx -#define __otbAtmosphericEffects_txx +#ifndef otbAtmosphericEffects_txx +#define otbAtmosphericEffects_txx #include "otbAtmosphericEffects.h" #include "otbSurfaceReflectanceToReflectanceFilter.h" diff --git a/Modules/Radiometry/Simulation/include/otbDataSpecP5B.h b/Modules/Radiometry/Simulation/include/otbDataSpecP5B.h index ae829af9ef85c9c9193b40f1a6c041f737782351..e5116ac13fd4f373d3e6b86b4ce7f66a35701358 100644 --- a/Modules/Radiometry/Simulation/include/otbDataSpecP5B.h +++ b/Modules/Radiometry/Simulation/include/otbDataSpecP5B.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbDataSpecP5B_h -#define __otbDataSpecP5B_h +#ifndef otbDataSpecP5B_h +#define otbDataSpecP5B_h namespace otb { @@ -62,4 +62,4 @@ extern const DataSpec DataSpecP5B[2101]; } -#endif /* __otbDataSpecP5B_h */ +#endif /* otbDataSpecP5B_h */ diff --git a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h index 5fe703e2c2a611d3c4300905215cd6291c7c33b3..77143adb68d5b66aae696c7f13bb08aceb5421c9 100644 --- a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h +++ b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbImageSimulationMethod_h -#define __otbImageSimulationMethod_h +#ifndef otbImageSimulationMethod_h +#define otbImageSimulationMethod_h #include "itkImageSource.h" @@ -163,13 +163,13 @@ public: protected: ImageSimulationMethod(); - virtual ~ImageSimulationMethod() + ~ImageSimulationMethod() ITK_OVERRIDE { } - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; // virtual void GenerateData(); - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: ImageSimulationMethod(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx index 880f18e9d4ecd8680f7d8d6567bc49fc3cb1f887..5af27083d0da2b62a3b5bea4e67dc1c2d164a28f 100644 --- a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx +++ b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageSimulationMethod_txx -#define __otbImageSimulationMethod_txx +#ifndef otbImageSimulationMethod_txx +#define otbImageSimulationMethod_txx #include "otbImageSimulationMethod.h" diff --git a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h index 91801a97be931924af28e1bd52acb8a01d06e82a..f3589aefe9dff9b423f51ecfdfdb5be92d519650 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h +++ b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelMapToSimulatedImageFilter_h -#define __otbLabelMapToSimulatedImageFilter_h +#ifndef otbLabelMapToSimulatedImageFilter_h +#define otbLabelMapToSimulatedImageFilter_h #include "itkLabelMapFilter.h" @@ -117,12 +117,12 @@ public: protected: LabelMapToSimulatedImageFilter(); - virtual ~LabelMapToSimulatedImageFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelMapToSimulatedImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void BeforeThreadedGenerateData(); - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); - virtual void GenerateOutputInformation(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void GenerateOutputInformation() ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.txx b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.txx index b892bfe307a52f408328e61f741614123c3383b6..24403404d0c7e5728e5f5d44bd080bc9bd169154 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.txx +++ b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToSimulatedImageFilter_txx -#define __otbLabelMapToSimulatedImageFilter_txx +#ifndef otbLabelMapToSimulatedImageFilter_txx +#define otbLabelMapToSimulatedImageFilter_txx #include "otbLabelMapToSimulatedImageFilter.h" diff --git a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h index 7c1ad1ac392e34500cb3e576d49afa2ce6e2c0a2..6fe0a5c811e9ae7386a600f8555f83314cca60c0 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h +++ b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelToProSailParameters_h -#define __otbLabelToProSailParameters_h +#ifndef otbLabelToProSailParameters_h +#define otbLabelToProSailParameters_h #include "otbLabelToSimulationParametersBase.h" @@ -83,11 +83,11 @@ public: // virtual const ParametersType & GetStep1Parameters(); //virtual const ParametersType & GetStep2Parameters(); - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: LabelToProSailParameters(); - virtual ~LabelToProSailParameters() {} + ~LabelToProSailParameters() ITK_OVERRIDE {} private: diff --git a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.txx b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.txx index 3def2c714b1fb025ac2baf028dfd78ca897c86a0..d198b6159644a174822249d9851f6d02be5826ca 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.txx +++ b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelToProSailParameters_txx -#define __otbLabelToProSailParameters_txx +#ifndef otbLabelToProSailParameters_txx +#define otbLabelToProSailParameters_txx #include "itkNumericTraits.h" diff --git a/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h b/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h index 1bc5444ab1b22c20e2f76a72c92fa30573ff2c8f..667913a6484c496ad15adb72f1c557440e65eec8 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h +++ b/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelToSimulationParametersBase_h -#define __otbLabelToSimulationParametersBase_h +#ifndef otbLabelToSimulationParametersBase_h +#define otbLabelToSimulationParametersBase_h #include "itkProcessObject.h" @@ -90,7 +90,7 @@ public: protected: LabelToSimulationParametersBase(){}; - virtual ~LabelToSimulationParametersBase() {} + ~LabelToSimulationParametersBase() ITK_OVERRIDE {} private: diff --git a/Modules/Radiometry/Simulation/include/otbLeafParameters.h b/Modules/Radiometry/Simulation/include/otbLeafParameters.h index 0e6eb212e11bb8e37b0b8a1718af5cd7e41c25e7..51fb59d85a6c435e29e59186d7ae9b5d6f20df32 100644 --- a/Modules/Radiometry/Simulation/include/otbLeafParameters.h +++ b/Modules/Radiometry/Simulation/include/otbLeafParameters.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLeafParameters_h -#define __otbLeafParameters_h +#ifndef otbLeafParameters_h +#define otbLeafParameters_h #include "itkDataObject.h" @@ -75,9 +75,9 @@ class ITK_EXPORT LeafParameters : public itk::DataObject /** Constructor */ LeafParameters(); /** Destructor */ - ~LeafParameters(); + ~LeafParameters() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LeafParameters(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbProSailParameters.h b/Modules/Radiometry/Simulation/include/otbProSailParameters.h index 52d1475b06c483c2c0895fac3ff2cfb9784b93ea..f4a306b2d27c200c1a678788c4a6ae4af1a9ee0a 100644 --- a/Modules/Radiometry/Simulation/include/otbProSailParameters.h +++ b/Modules/Radiometry/Simulation/include/otbProSailParameters.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProSailParameters_h -#define __otbProSailParameters_h +#ifndef otbProSailParameters_h +#define otbProSailParameters_h #include "itkDataObject.h" diff --git a/Modules/Radiometry/Simulation/include/otbProspectModel.h b/Modules/Radiometry/Simulation/include/otbProspectModel.h index f3589107b5c6af70a9f20fb9e52779cccdd6d9cd..68165778a7683d0b4f50fb16613525f3e5bff54a 100644 --- a/Modules/Radiometry/Simulation/include/otbProspectModel.h +++ b/Modules/Radiometry/Simulation/include/otbProspectModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProspectModel_h -#define __otbProspectModel_h +#ifndef otbProspectModel_h +#define otbProspectModel_h #include "otbLeafParameters.h" @@ -63,21 +63,21 @@ class ITK_EXPORT ProspectModel : public SimulationStep1Base LeafParametersType * GetInput(); /** GenerateData */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Get Output reflectance/transmittance*/ - virtual SpectralResponseType * GetReflectance(); - virtual SpectralResponseType * GetTransmittance(); + SpectralResponseType * GetReflectance() ITK_OVERRIDE; + SpectralResponseType * GetTransmittance() ITK_OVERRIDE; protected: /** Constructor */ ProspectModel(); /** Destructor */ - ~ProspectModel(); + ~ProspectModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; using Superclass::MakeOutput; /** Compute Transmission of isotropic radiation across an interface between two dielectrics*/ diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h index aad26a9cc1ca572a198c68218f3396b9f61411bb..b0370b74652634f28add75d2f1d3b0796582a6c8 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReduceSpectralResponse_h -#define __otbReduceSpectralResponse_h +#ifndef otbReduceSpectralResponse_h +#define otbReduceSpectralResponse_h #include "itkDataObject.h" @@ -110,7 +110,7 @@ public: virtual bool Clear(); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * \param PrecisionType @@ -132,7 +132,7 @@ protected: /** Constructor from a ASCII file */ //ReduceSpectralResponse( const std::string & filename ); /** Destructor */ - virtual ~ReduceSpectralResponse() + ~ReduceSpectralResponse() ITK_OVERRIDE { } ; diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx index 2ab4baa479004215d8f9665433a52bbf18066b59..3105b757c33235c59e7db09f7fe84ac9be6e0543 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReduceSpectralResponse_txx -#define __otbReduceSpectralResponse_txx +#ifndef otbReduceSpectralResponse_txx +#define otbReduceSpectralResponse_txx #include <algorithm> #include "itkNumericTraits.h" @@ -81,7 +81,7 @@ ReduceSpectralResponse<TSpectralResponse , TRSR> if(m_ReflectanceMode) { - if (solarIrradiance == 0) + if (solarIrradiance == ITK_NULLPTR) { itkExceptionMacro(<<"Error occurs getting solar irradiance. Solar irradiance is mandatory using the reflectance mode."); } diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h index ce663bdbd2f461c956d358b2fe00b5ca22de62dd..70f103268845e30b9bfffa6e069f23a844b9f41e 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReduceSpectralResponseClassifierRAndNIR_h -#define __otbReduceSpectralResponseClassifierRAndNIR_h +#ifndef otbReduceSpectralResponseClassifierRAndNIR_h +#define otbReduceSpectralResponseClassifierRAndNIR_h #include "otbReduceSpectralResponse.h" @@ -106,7 +106,7 @@ namespace otb /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** @@ -122,7 +122,7 @@ namespace otb /** Constructor from a ASCII file */ //ReduceSpectralResponseClassifierRAndNIR( const std::string & filename ); /** Destructor */ - virtual ~ReduceSpectralResponseClassifierRAndNIR() {}; + ~ReduceSpectralResponseClassifierRAndNIR() ITK_OVERRIDE {}; /** PrintSelf method */ //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.txx b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.txx index 2791d1fa55e3112a606664df6ad73084172ef668..7f488cdc729859f3bdbd68dacdce7a2273990a00 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.txx +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbReduceSpectralResponseClassifierRAndNIR_txx -#define __otbReduceSpectralResponseClassifierRAndNIR_txx +#ifndef otbReduceSpectralResponseClassifierRAndNIR_txx +#define otbReduceSpectralResponseClassifierRAndNIR_txx #include "otbReduceSpectralResponseClassifierRAndNIR.h" diff --git a/Modules/Radiometry/Simulation/include/otbSailModel.h b/Modules/Radiometry/Simulation/include/otbSailModel.h index 5a1cca0dc71db074264eaa797bc971c9a70738ad..5aec526b6dffc2bec319da461da56943afa6a47b 100644 --- a/Modules/Radiometry/Simulation/include/otbSailModel.h +++ b/Modules/Radiometry/Simulation/include/otbSailModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSailModel_h -#define __otbSailModel_h +#ifndef otbSailModel_h +#define otbSailModel_h #include "otbSpectralResponse.h" @@ -58,10 +58,10 @@ class ITK_EXPORT SailModel : public SimulationStep2Base /** Set Inputs */ - void SetReflectance(const SpectralResponseType *object); + void SetReflectance(const SpectralResponseType *object) ITK_OVERRIDE; SpectralResponseType * GetReflectance(); - void SetTransmittance(const SpectralResponseType *object); + void SetTransmittance(const SpectralResponseType *object) ITK_OVERRIDE; SpectralResponseType * GetTransmittance(); /** Set parameters */ @@ -101,7 +101,7 @@ class ITK_EXPORT SailModel : public SimulationStep2Base itkGetMacro(FCoverView, double); /** GenerateData */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Get Output */ virtual SpectralResponseType * GetViewingReflectance(); @@ -118,11 +118,11 @@ class ITK_EXPORT SailModel : public SimulationStep2Base /** Constructor */ SailModel(); /** Destructor */ - virtual ~SailModel(); + ~SailModel() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; using Superclass::MakeOutput; /** Compute Leaf Angle Distribution */ diff --git a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h index 27166a40f9d52c420b015a92f597690df4bd032d..e98f2b4a181990351f7726ee97d09c2646e7f13d 100644 --- a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h +++ b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSatelliteRSR_h -#define __otbSatelliteRSR_h +#ifndef otbSatelliteRSR_h +#define otbSatelliteRSR_h #include <vector> #include <utility> @@ -124,7 +124,7 @@ public: inline ValuePrecisionType operator()(const PrecisionType & lambda, const unsigned int numBand); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** get vector of RSR */ RSRVectorType & GetRSR() @@ -144,7 +144,7 @@ protected: /** Constructor from a ASCII file */ //SatelliteRSR( const std::string & filename ); /** Destructor */ - virtual ~SatelliteRSR() + ~SatelliteRSR() ITK_OVERRIDE { } ; diff --git a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.txx b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.txx index 12d3b8c04c762cd0dd0f2ba3f3220939dbb19df6..b12efd80f47088d56e8ed06139da39996cafae2e 100644 --- a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.txx +++ b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSatelliteRSR_txx -#define __otbSatelliteRSR_txx +#ifndef otbSatelliteRSR_txx +#define otbSatelliteRSR_txx #include "otbSatelliteRSR.h" diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h index bfaaff863bcaf4e267a2f07d75db2921b8e67602..6285ff432c9d3c3d6034880b445a6e1b92eea2bc 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSimulationStep1Base_h -#define __otbSimulationStep1Base_h +#ifndef otbSimulationStep1Base_h +#define otbSimulationStep1Base_h #include "itkProcessObject.h" @@ -66,7 +66,7 @@ public: protected: SimulationStep1Base(){}; - virtual ~SimulationStep1Base() {} + ~SimulationStep1Base() ITK_OVERRIDE {} private: diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h index 0758ae05b8966432ce06e7f2e652d55d45058ea4..b53beded13fc7654e6327afa8b303f6c43325fa6 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSimulationStep2Base_h -#define __otbSimulationStep2Base_h +#ifndef otbSimulationStep2Base_h +#define otbSimulationStep2Base_h #include "itkProcessObject.h" #include "otbSpectralResponse.h" @@ -67,7 +67,7 @@ protected: { } ; - virtual ~SimulationStep2Base() + ~SimulationStep2Base() ITK_OVERRIDE { } diff --git a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h index 3cf1ae115287bf6029cd39e086764acbd4fc2bf2..c480ccd7a3a25eb07f0d05427d4f555cefb93456 100644 --- a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h +++ b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbSpatialisationFilter_h -#define __otbSpatialisationFilter_h +#ifndef otbSpatialisationFilter_h +#define otbSpatialisationFilter_h #include "itkLabelObject.h" #include "otbLabelMapSource.h" @@ -109,12 +109,12 @@ public: protected: SpatialisationFilter(); - virtual ~SpatialisationFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~SpatialisationFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; virtual void ProcessObject(unsigned int obj); - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; private: SpatialisationFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.txx b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.txx index b6832c57a845c2a3248877d9a83e245a7c43e2d3..602dc7a1e8b928b79c8412fbcefe871b6061c89d 100644 --- a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.txx +++ b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpatialisationFilter_txx -#define __otbSpatialisationFilter_txx +#ifndef otbSpatialisationFilter_txx +#define otbSpatialisationFilter_txx #include "itkNumericTraits.h" diff --git a/Modules/Radiometry/Simulation/include/otbSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbSpectralResponse.h index cffd375942c3a2a20a31bb21a111685fa7656b0b..a2440838bcececdf6b359a86dc94106e795dda5e 100644 --- a/Modules/Radiometry/Simulation/include/otbSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbSpectralResponse.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralResponse_h -#define __otbSpectralResponse_h +#ifndef otbSpectralResponse_h +#define otbSpectralResponse_h #include "itkDataObject.h" #include <itkObjectFactory.h> @@ -101,7 +101,7 @@ public: void Load(const std::string & filename, ValuePrecisionType coefNormalization = 1.0); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** get vector of spectral responses */ VectorPairType & GetResponse() @@ -160,7 +160,7 @@ protected: /** Constructor from a ASCII file */ //SpectralResponse( const std::string & filename ); /** Destructor */ - virtual ~SpectralResponse() + ~SpectralResponse() ITK_OVERRIDE { } ; diff --git a/Modules/Radiometry/Simulation/include/otbSpectralResponse.txx b/Modules/Radiometry/Simulation/include/otbSpectralResponse.txx index 95fd78e0f68455cad7b20d1536b8b45bfd80d4e9..efad5980eb68faa7356b73ef0ceb27ac48f27aab 100644 --- a/Modules/Radiometry/Simulation/include/otbSpectralResponse.txx +++ b/Modules/Radiometry/Simulation/include/otbSpectralResponse.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSpectralResponse_txx -#define __otbSpectralResponse_txx +#ifndef otbSpectralResponse_txx +#define otbSpectralResponse_txx #include "itkNumericTraits.h" diff --git a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h index ae24c6b809607026d8ca4b3319cd6b50030ea691..cd469c5cdfa9169920c91590cb8550b48cb23828 100644 --- a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h +++ b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h @@ -19,8 +19,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSurfaceReflectanceToReflectanceFilter_h -#define __otbSurfaceReflectanceToReflectanceFilter_h +#ifndef otbSurfaceReflectanceToReflectanceFilter_h +#define otbSurfaceReflectanceToReflectanceFilter_h #include "otbUnaryImageFunctorWithVectorImageFilter.h" @@ -263,18 +263,18 @@ protected: /** Constructor */ SurfaceReflectanceToReflectanceFilter(); /** Destructor */ - virtual ~SurfaceReflectanceToReflectanceFilter() {}; + ~SurfaceReflectanceToReflectanceFilter() ITK_OVERRIDE {}; /** Initialize the functor vector */ - void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - virtual void Modified() const; + void Modified() const ITK_OVERRIDE; private: diff --git a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.txx b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.txx index de5447e914a5231ff21b04eb66cb3f4aad31478f..0f0aa8160aa4ffee115c44515a3a3b747f1ecdd7 100644 --- a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.txx +++ b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSurfaceReflectanceToReflectanceFilter_txx -#define __otbSurfaceReflectanceToReflectanceFilter_txx +#ifndef otbSurfaceReflectanceToReflectanceFilter_txx +#define otbSurfaceReflectanceToReflectanceFilter_txx #include "otbSurfaceReflectanceToReflectanceFilter.h" #include "otbOpticalImageMetadataInterfaceFactory.h" @@ -46,7 +46,7 @@ void SurfaceReflectanceToReflectanceFilter<TInputImage, TOutputImage> ::UpdateAtmosphericRadiativeTerms() { - if (this->GetInput() == NULL) + if (this->GetInput() == ITK_NULLPTR) { itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); } diff --git a/Modules/Radiometry/Simulation/src/otbProspectModel.cxx b/Modules/Radiometry/Simulation/src/otbProspectModel.cxx index 71edbf4d3a09db46bb177bdb46c2c74ae7f3b338..ea1525bf74a3dba4360dc7d21b8b444360efc1bf 100644 --- a/Modules/Radiometry/Simulation/src/otbProspectModel.cxx +++ b/Modules/Radiometry/Simulation/src/otbProspectModel.cxx @@ -64,7 +64,7 @@ ProspectModel if(this->GetNumberOfInputs() != 1) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<LeafParametersType *>(this->itk::ProcessObject::GetInput(0)); } @@ -85,7 +85,7 @@ ProspectModel if(this->GetNumberOfOutputs() < 2) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(0)); } @@ -98,7 +98,7 @@ ProspectModel if(this->GetNumberOfOutputs() < 2) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Radiometry/Simulation/src/otbSailModel.cxx b/Modules/Radiometry/Simulation/src/otbSailModel.cxx index 2d6b66fae20177039eeb8e5a56f847832fc331bb..94fb477e827156eb5719e7e0b0776183b22699f7 100644 --- a/Modules/Radiometry/Simulation/src/otbSailModel.cxx +++ b/Modules/Radiometry/Simulation/src/otbSailModel.cxx @@ -69,7 +69,7 @@ SailModel if(this->GetNumberOfInputs() != 2) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetInput(0)); } @@ -89,7 +89,7 @@ SailModel if(this->GetNumberOfInputs() != 2) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetInput(1)); } @@ -110,7 +110,7 @@ SailModel if(this->GetNumberOfOutputs() < 4) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(0)); } @@ -123,7 +123,7 @@ SailModel if(this->GetNumberOfOutputs() < 4) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(1)); } @@ -136,7 +136,7 @@ SailModel if(this->GetNumberOfOutputs() < 4) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(2)); } @@ -149,7 +149,7 @@ SailModel if(this->GetNumberOfOutputs() < 4) { //exit - return 0; + return ITK_NULLPTR; } return static_cast<SpectralResponseType *>(this->itk::ProcessObject::GetOutput(3)); } diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h index 99c547e07e73759eac80f9c0fd9e02509f2fc440..3bbe520a40c9beaea31a7b1125f8309e212f9ce3 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapEstimationMethod_h -#define __otbDisparityMapEstimationMethod_h +#ifndef otbDisparityMapEstimationMethod_h +#define otbDisparityMapEstimationMethod_h #include "itkImageToImageMetric.h" #include "itkSingleValuedNonLinearOptimizer.h" @@ -181,15 +181,15 @@ protected: /** * Destructor. */ - virtual ~DisparityMapEstimationMethod(); + ~DisparityMapEstimationMethod() ITK_OVERRIDE; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Main computation method. */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: DisparityMapEstimationMethod(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx index cf94785d23dfbcff507d3310cd7aa6710dd28bac..ffd6e10d2469691366ec40df27704c981a8056ad 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapEstimationMethod_txx -#define __otbDisparityMapEstimationMethod_txx +#ifndef otbDisparityMapEstimationMethod_txx +#define otbDisparityMapEstimationMethod_txx #include "otbDisparityMapEstimationMethod.h" #include "itkImageRegistrationMethod.h" @@ -39,10 +39,10 @@ DisparityMapEstimationMethod<TFixedImage, TMovingImage, TPointSet> //this->SetNumberOfRequiredOutputs(1); // this->SetReleaseDataFlag(false); this->SetReleaseDataBeforeUpdateFlag(false); - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. m_WinSize.Fill(15); m_ExploSize.Fill(10); m_InitialTransformParameters = ParametersType(1); diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h index e01c3f688008a4ab9cee6eb460cd2930a425b48a..4d45a7a5ff7654892d96def1142ffc79758c25e7 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapMedianFilter_h -#define __otbDisparityMapMedianFilter_h +#ifndef otbDisparityMapMedianFilter_h +#define otbDisparityMapMedianFilter_h #ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY #include "itkOptMedianImageFilter.h" @@ -148,8 +148,8 @@ public: protected: DisparityMapMedianFilter(); - virtual ~DisparityMapMedianFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~DisparityMapMedianFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** MedianImageFilter needs a larger input requested region than * the output requested region. As such, MedianImageFilter needs @@ -157,13 +157,13 @@ protected: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() throw(itk::InvalidRequestedRegionError); + void GenerateInputRequestedRegion() throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** apply median filter */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: DisparityMapMedianFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.txx index cf5255f9669dd8651cc1843cf2f38dfb6d5ff81e..d924888bbc9e623d28f7a1c3d27e170daf2bb127 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapMedianFilter_txx -#define __otbDisparityMapMedianFilter_txx +#ifndef otbDisparityMapMedianFilter_txx +#define otbDisparityMapMedianFilter_txx #ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY #else @@ -61,7 +61,7 @@ DisparityMapMedianFilter<TInputImage, TOutputImage, TMask> { if (this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMask *>(this->itk::ProcessObject::GetInput(1)); } @@ -73,7 +73,7 @@ DisparityMapMedianFilter<TInputImage, TOutputImage, TMask> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TMask *>(this->itk::ProcessObject::GetOutput(1)); } @@ -86,7 +86,7 @@ DisparityMapMedianFilter<TInputImage, TOutputImage, TMask> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputImage *>(this->itk::ProcessObject::GetOutput(2)); } @@ -98,7 +98,7 @@ DisparityMapMedianFilter<TInputImage, TOutputImage, TMask> { if (this->GetNumberOfOutputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<TMask *>(this->itk::ProcessObject::GetOutput(3)); } diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h index 5bc25dd6adc7a3beb5bc140c7eeee02ec89f2870..77adb6b9c4eb549c274198e01853ac2d52c7fee6 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapTo3DFilter_h -#define __otbDisparityMapTo3DFilter_h +#ifndef otbDisparityMapTo3DFilter_h +#define otbDisparityMapTo3DFilter_h #include "itkImageToImageFilter.h" #include "otbGenericRSTransform.h" @@ -141,26 +141,26 @@ protected: DisparityMapTo3DFilter(); /** Destructor */ - virtual ~DisparityMapTo3DFilter(); + ~DisparityMapTo3DFilter() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx index 284e63b2cc030005127dc73a8b4a7123e5e2e90e..1278d5c34cf8063e109b8b4d39630772ae665ee4 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapTo3DFilter_txx -#define __otbDisparityMapTo3DFilter_txx +#ifndef otbDisparityMapTo3DFilter_txx +#define otbDisparityMapTo3DFilter_txx #include "otbDisparityMapTo3DFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -103,7 +103,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag { if(this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -116,7 +116,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag { if(this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -129,7 +129,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag { if(this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TEpipolarGridImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -142,7 +142,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag { if(this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TEpipolarGridImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -155,7 +155,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag { if(this->GetNumberOfInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(4)); } diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h index fe28eaf9bec0e9732455ed4b47b194cdbb0db432..4a21701f41f572732a65e5ef3aaf39bc11af18b7 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapToDEMFilter_h -#define __otbDisparityMapToDEMFilter_h +#ifndef otbDisparityMapToDEMFilter_h +#define otbDisparityMapToDEMFilter_h #include "itkImageToImageFilter.h" #include "otbGenericRSTransform.h" @@ -146,29 +146,29 @@ protected: DisparityMapToDEMFilter(); /** Destructor */ - virtual ~DisparityMapToDEMFilter(); + ~DisparityMapToDEMFilter() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** After threaded generate data : sum up temporary DEMs */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx index ba5bb46cd7e7eb6933fd60634d1adcd262fe593e..900addc6432961f0362c45374ffa769d54cc6dd5 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityMapToDEMFilter_txx -#define __otbDisparityMapToDEMFilter_txx +#ifndef otbDisparityMapToDEMFilter_txx +#define otbDisparityMapToDEMFilter_txx #include "otbDisparityMapToDEMFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -131,7 +131,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -144,7 +144,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -157,7 +157,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -170,7 +170,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -183,7 +183,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TEpipolarGridImage *>(this->itk::ProcessObject::GetInput(4)); } @@ -196,7 +196,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<6) { - return 0; + return ITK_NULLPTR; } return static_cast<const TEpipolarGridImage *>(this->itk::ProcessObject::GetInput(5)); } @@ -209,7 +209,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfInputs()<7) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(6)); } @@ -235,7 +235,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri { if(this->GetNumberOfOutputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputDEMImage *>(this->itk::ProcessObject::GetOutput(0)); } @@ -688,7 +688,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri typename TEpipolarGridImage::RegionType gridRegion = leftGrid->GetLargestPossibleRegion(); - TOutputDEMImage * tmpDEM = NULL; + TOutputDEMImage * tmpDEM = ITK_NULLPTR; typename TOutputDEMImage::RegionType outputRequestedRegion = outputDEM->GetRequestedRegion(); typename TDisparityImage::RegionType disparityRegion; diff --git a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h index f0e4d379be02c83ef3d81adb5e3a889d0a8d9328..74585ba7c7b84509e846a8c7f50326f9d27da402 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityTranslateFilter_h -#define __otbDisparityTranslateFilter_h +#ifndef otbDisparityTranslateFilter_h +#define otbDisparityTranslateFilter_h #include "itkImageToImageFilter.h" #include "otbVectorImage.h" @@ -116,23 +116,23 @@ protected: DisparityTranslateFilter(); /** Destructor */ - virtual ~DisparityTranslateFilter(){}; + ~DisparityTranslateFilter() ITK_OVERRIDE{}; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx index afd59f1caf21033f43f0f4cc8f4449f69a63b389..caa46b902ffbcbbb947e90905b187d459c3a861a 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbDisparityTranslateFilter_txx -#define __otbDisparityTranslateFilter_txx +#ifndef otbDisparityTranslateFilter_txx +#define otbDisparityTranslateFilter_txx #include "otbDisparityTranslateFilter.h" @@ -102,7 +102,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -114,7 +114,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -126,7 +126,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TGridImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -138,7 +138,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TGridImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -150,7 +150,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(4)); } @@ -162,7 +162,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfInputs()<6) { - return 0; + return ITK_NULLPTR; } return static_cast<const TSensorImage *>(this->itk::ProcessObject::GetInput(5)); } @@ -174,7 +174,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfOutputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<TDisparityImage *>(this->itk::ProcessObject::GetOutput(0)); } @@ -186,7 +186,7 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TDisparityImage *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h index a9d5ca0aaf56914bc5b2e37a001e06a4b2824dda..e964838baeebaa7c92c7f4aecc8c50701b837969 100644 --- a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFineRegistrationImageFilter_h -#define __otbFineRegistrationImageFilter_h +#ifndef otbFineRegistrationImageFilter_h +#define otbFineRegistrationImageFilter_h #include "itkImageToImageFilter.h" #include "itkInterpolateImageFunction.h" @@ -178,16 +178,16 @@ protected: /** Constructor */ FineRegistrationImageFilter(); /** Destructor */ - virtual ~FineRegistrationImageFilter() {}; + ~FineRegistrationImageFilter() ITK_OVERRIDE {}; /** Threaded generate data */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Generate the input requested regions */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; private: FineRegistrationImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx index cc70ab6ba9172bc2b4b118918f7d9ff7285b3061..1eb1d442f6a49debc4d3a631e8ec9e3cb138945e 100644 --- a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbFineRegistrationImageFilter_txx -#define __otbFineRegistrationImageFilter_txx +#ifndef otbFineRegistrationImageFilter_txx +#define otbFineRegistrationImageFilter_txx #include "otbFineRegistrationImageFilter.h" @@ -66,7 +66,7 @@ FineRegistrationImageFilter<TInputImage, T0utputCorrelation, TOutputDisplacement // Default offset m_InitialOffset.Fill(0); - m_Transform = NULL; + m_Transform = ITK_NULLPTR; } template <class TInputImage, class T0utputCorrelation, class TOutputDisplacementField> @@ -94,7 +94,7 @@ FineRegistrationImageFilter<TInputImage, T0utputCorrelation, TOutputDisplacement { if (this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -106,7 +106,7 @@ FineRegistrationImageFilter<TInputImage, T0utputCorrelation, TOutputDisplacement { if (this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -118,7 +118,7 @@ FineRegistrationImageFilter<TInputImage, T0utputCorrelation, TOutputDisplacement { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputDisplacementField *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h index 7e50cc5845d54de54a1c44915464641f6a2b7cce..4dd2e19c3aa00f9e66b7251ffc6a49bb932b7756 100644 --- a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h +++ b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiDisparityMapTo3DFilter_h -#define __otbMultiDisparityMapTo3DFilter_h +#ifndef otbMultiDisparityMapTo3DFilter_h +#define otbMultiDisparityMapTo3DFilter_h #include "itkImageToImageFilter.h" #include "otbGenericRSTransform.h" @@ -154,19 +154,19 @@ protected: MultiDisparityMapTo3DFilter(); /** Destructor */ - virtual ~MultiDisparityMapTo3DFilter(); + ~MultiDisparityMapTo3DFilter() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: MultiDisparityMapTo3DFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx index 14229f5372339e23f7a4224b3aa1165c2d74d192..b41b60447c06f772df29cb8f47838356bf1ede34 100644 --- a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiDisparityMapTo3DFilter_txx -#define __otbMultiDisparityMapTo3DFilter_txx +#ifndef otbMultiDisparityMapTo3DFilter_txx +#define otbMultiDisparityMapTo3DFilter_txx #include "otbMultiDisparityMapTo3DFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -119,7 +119,7 @@ MultiDisparityMapTo3DFilter<TDisparityImage,TOutputImage,TMaskImage,TResidueImag { if ((3 * (index + 1)) > this->GetNumberOfRequiredInputs()) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(3 * index)); } @@ -132,7 +132,7 @@ MultiDisparityMapTo3DFilter<TDisparityImage,TOutputImage,TMaskImage,TResidueImag { if ((3 * (index + 1)) > this->GetNumberOfRequiredInputs()) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(3 * index + 1)); } @@ -145,7 +145,7 @@ MultiDisparityMapTo3DFilter<TDisparityImage,TOutputImage,TMaskImage,TResidueImag { if ((3 * (index + 1)) > this->GetNumberOfRequiredInputs()) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(3 * index + 2)); } diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h index 0ae6de3734b1d03c19b435e9d9b3be71ab297903..b802968ef7f3df212a8ae77af46d37a75f5a09ca 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCCRegistrationFilter_h -#define __otbNCCRegistrationFilter_h +#ifndef otbNCCRegistrationFilter_h +#define otbNCCRegistrationFilter_h #include "itkPDEDeformableRegistrationFilter.h" #include "otbNCCRegistrationFunction.h" @@ -134,18 +134,18 @@ public: protected: NCCRegistrationFilter(); - virtual ~NCCRegistrationFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~NCCRegistrationFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Initialize the state of filter and equation before each iteration. */ - virtual void InitializeIteration(); + void InitializeIteration() ITK_OVERRIDE; /** Apply update. */ using Superclass::ApplyUpdate; virtual void ApplyUpdate(TimeStepType dt); /** Update the Input requested region. */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; private: NCCRegistrationFilter(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.txx b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.txx index c4f3d5a7840110df6d92408c37757ae75191ec90..9e9edbcb4506ee3c6e4969f8e10b8d3ebd1d92bb 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCCRegistrationFilter_txx -#define __otbNCCRegistrationFilter_txx +#ifndef otbNCCRegistrationFilter_txx +#define otbNCCRegistrationFilter_txx #include "otbNCCRegistrationFilter.h" namespace otb diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h index b2a1fab6824371f936b89996a09beb2974e29119..bbb8f71bc3270aa0cded26df3333792cee4c2ad5 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCCRegistrationFunction_h -#define __otbNCCRegistrationFunction_h +#ifndef otbNCCRegistrationFunction_h +#define otbNCCRegistrationFunction_h #include "itkPDEDeformableRegistrationFunction.h" #include "itkPoint.h" @@ -119,38 +119,38 @@ public: } /** This class uses a constant timestep of 1. */ - virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const + TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const ITK_OVERRIDE { return m_TimeStep; } /** Return a pointer to a global data structure that is passed to * this object from the solver at each calculation. */ - virtual void *GetGlobalDataPointer() const + void *GetGlobalDataPointer() const ITK_OVERRIDE { GlobalDataStruct *global = new GlobalDataStruct(); return global; } /** Release memory for global data structure. */ - virtual void ReleaseGlobalDataPointer(void *GlobalData) const + void ReleaseGlobalDataPointer(void *GlobalData) const ITK_OVERRIDE { delete (GlobalDataStruct *) GlobalData; } /** Set the object's state before each iteration. */ - virtual void InitializeIteration(); + void InitializeIteration() ITK_OVERRIDE; /** This method is called by a finite difference solver image filter at * each pixel that does not lie on a data set boundary */ - virtual PixelType ComputeUpdate(const NeighborhoodType& neighborhood, + PixelType ComputeUpdate(const NeighborhoodType& neighborhood, void *globalData, - const FloatOffsetType& offset = FloatOffsetType(0.0)); + const FloatOffsetType& offset = FloatOffsetType(0.0)) ITK_OVERRIDE; protected: NCCRegistrationFunction(); - virtual ~NCCRegistrationFunction() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~NCCRegistrationFunction() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** FixedImage image neighborhood iterator type. */ typedef itk::ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType; diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx index ca682d349f262a67e103d47740f66384ceecf130..4648acbbad8d50e14839931db815a66cbc0ee2e3 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNCCRegistrationFunction_txx -#define __otbNCCRegistrationFunction_txx +#ifndef otbNCCRegistrationFunction_txx +#define otbNCCRegistrationFunction_txx #include "vnl/vnl_math.h" #include "itkNeighborhoodIterator.h" @@ -50,8 +50,8 @@ NCCRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField> m_TimeStep = 1.0; m_DenominatorThreshold = 1e-9; m_IntensityDifferenceThreshold = 0.001; - this->SetMovingImage(NULL); - this->SetFixedImage(NULL); + this->SetMovingImage(ITK_NULLPTR); + this->SetFixedImage(ITK_NULLPTR); m_FixedImageSpacing.Fill(1.0); m_FixedImageOrigin.Fill(0.0); m_FixedImageGradientCalculator = GradientCalculatorType::New(); diff --git a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h index ffdf02cd52cee98ac88728524580f8d9139863ee..db2ee9eac463dcd4ed1b7e9b5b85081d5138b1dc 100644 --- a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPixelWiseBlockMatchingImageFilter_h -#define __otbPixelWiseBlockMatchingImageFilter_h +#ifndef otbPixelWiseBlockMatchingImageFilter_h +#define otbPixelWiseBlockMatchingImageFilter_h #include "itkImageToImageFilter.h" @@ -415,10 +415,10 @@ public: return m_Functor; } - /** Set initial horizontal disparity field (optional, override m_InitHorizontalDisparity) */ + /** Set initial horizontal disparity field (optional, ITK_OVERRIDE m_InitHorizontalDisparity) */ void SetHorizontalDisparityInput( const TOutputDisparityImage * hfield); - /** Set initial vertical disparity field (optional, override m_InitVerticalDisparity) */ + /** Set initial vertical disparity field (optional, ITK_OVERRIDE m_InitVerticalDisparity) */ void SetVerticalDisparityInput( const TOutputDisparityImage * vfield); /** Get the initial disparity fields */ @@ -444,19 +444,19 @@ protected: PixelWiseBlockMatchingImageFilter(); /** Destructor */ - virtual ~PixelWiseBlockMatchingImageFilter(); + ~PixelWiseBlockMatchingImageFilter() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: PixelWiseBlockMatchingImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx index 4a1888427faf1d0fc616d0e49d8f6a02f84b12c7..5199a2c546884cc776913bb9938731046867af69 100644 --- a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPixelWiseBlockMatchingImageFilter_txx -#define __otbPixelWiseBlockMatchingImageFilter_txx +#ifndef otbPixelWiseBlockMatchingImageFilter_txx +#define otbPixelWiseBlockMatchingImageFilter_txx #include "otbPixelWiseBlockMatchingImageFilter.h" #include "itkProgressReporter.h" @@ -129,7 +129,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -143,7 +143,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -157,7 +157,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -171,7 +171,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -185,7 +185,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TOutputMetricImage *>(this->itk::ProcessObject::GetOutput(0)); } @@ -199,7 +199,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputMetricImage *>(this->itk::ProcessObject::GetOutput(0)); } @@ -214,7 +214,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TOutputDisparityImage *>(this->itk::ProcessObject::GetOutput(1)); } @@ -228,7 +228,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputDisparityImage *>(this->itk::ProcessObject::GetOutput(1)); } @@ -242,7 +242,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TOutputDisparityImage *>(this->itk::ProcessObject::GetOutput(2)); } @@ -256,7 +256,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputDisparityImage *>(this->itk::ProcessObject::GetOutput(2)); } @@ -292,7 +292,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TOutputDisparityImage *>(this->itk::ProcessObject::GetInput(4)); } @@ -306,7 +306,7 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfInputs()<6) { - return 0; + return ITK_NULLPTR; } return static_cast<const TOutputDisparityImage *>(this->itk::ProcessObject::GetInput(5)); } diff --git a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h index cbdc4282d41f2b609c815708e7a810163628b7c0..ca042aae9e6745af9bea471fdaf6cd4b088dc383 100644 --- a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSubPixelDisparityImageFilter_h -#define __otbSubPixelDisparityImageFilter_h +#ifndef otbSubPixelDisparityImageFilter_h +#define otbSubPixelDisparityImageFilter_h #include "otbPixelWiseBlockMatchingImageFilter.h" @@ -207,29 +207,29 @@ protected: SubPixelDisparityImageFilter(); /** Destructor */ - virtual ~SubPixelDisparityImageFilter(); + ~SubPixelDisparityImageFilter() ITK_OVERRIDE; /** \brief Verify that the input images are compatible * * This method needs to be re-implemented from ImageToImageFilter since * the initial images and disparity maps may not have the same size */ - virtual void VerifyInputInformation(); + void VerifyInputInformation() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** After threaded generate data */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; private: SubPixelDisparityImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx index 2c9e23b6af4706199c9ab7047b748d43c89d5ea7..20ecff5dbcfc62ab2ba512a2419d15b62ca869b1 100644 --- a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbSubPixelDisparityImageFilter_txx -#define __otbSubPixelDisparityImageFilter_txx +#ifndef otbSubPixelDisparityImageFilter_txx +#define otbSubPixelDisparityImageFilter_txx +#include "otbSubPixelDisparityImageFilter.h" namespace otb { @@ -152,7 +153,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfIndexedInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -166,7 +167,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfIndexedInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -180,7 +181,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfIndexedInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -194,7 +195,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfIndexedInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -208,7 +209,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfIndexedInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(4)); } @@ -222,7 +223,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if(this->GetNumberOfIndexedInputs()<6) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMaskImage *>(this->itk::ProcessObject::GetInput(5)); } @@ -250,7 +251,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<TDisparityImage *>(this->itk::ProcessObject::GetOutput(0)); } @@ -278,7 +279,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TDisparityImage *>(this->itk::ProcessObject::GetOutput(1)); } @@ -306,7 +307,7 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputMetricImage *>(this->itk::ProcessObject::GetOutput(2)); } diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h index 8f987463b0c1f371296af0823a6071278361be80..724dfbcc0ba66a7b424efe1bd423caf42922a267 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplinesInterpolateDisplacementFieldGenerator_h -#define __otbBSplinesInterpolateDisplacementFieldGenerator_h +#ifndef otbBSplinesInterpolateDisplacementFieldGenerator_h +#define otbBSplinesInterpolateDisplacementFieldGenerator_h #include "otbPointSetToDisplacementFieldGenerator.h" @@ -63,11 +63,11 @@ protected: /** Constructor */ BSplinesInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - virtual ~BSplinesInterpolateDisplacementFieldGenerator() {} + ~BSplinesInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: BSplinesInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.txx index 5c080f9c277ca804110fcb068664a9c0efa64efc..c37111188e5bd2ff386730c01a6c2ccf1d144fc5 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplinesInterpolateDisplacementFieldGenerator_txx -#define __otbBSplinesInterpolateDisplacementFieldGenerator_txx +#ifndef otbBSplinesInterpolateDisplacementFieldGenerator_txx +#define otbBSplinesInterpolateDisplacementFieldGenerator_txx #include "otbBSplinesInterpolateDisplacementFieldGenerator.h" // Disabling deprecation warning if on visual diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h index a60acfc31b367e76e10f814dc4b82a9f80d0032b..abf0562227bb67d458164d18e560f180bd057bce 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplinesInterpolateTransformDisplacementFieldGenerator_h -#define __otbBSplinesInterpolateTransformDisplacementFieldGenerator_h +#ifndef otbBSplinesInterpolateTransformDisplacementFieldGenerator_h +#define otbBSplinesInterpolateTransformDisplacementFieldGenerator_h #include "otbPointSetWithTransformToDisplacementFieldGenerator.h" #include "itkUnaryFunctorImageFilter.h" @@ -103,13 +103,13 @@ protected: /** Constructor */ BSplinesInterpolateTransformDisplacementFieldGenerator(); /** Destructor */ - virtual ~BSplinesInterpolateTransformDisplacementFieldGenerator() {} + ~BSplinesInterpolateTransformDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** * Test wether a parameter is angular or not. diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx index cfb6fccecb8da7f59465c1299cd19dc022429c6b..a015c12ed6ca89d73af0bc14e847ca5490007978 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBSplinesInterpolateTransformDisplacementFieldGenerator_txx -#define __otbBSplinesInterpolateTransformDisplacementFieldGenerator_txx +#ifndef otbBSplinesInterpolateTransformDisplacementFieldGenerator_txx +#define otbBSplinesInterpolateTransformDisplacementFieldGenerator_txx #include "otbBSplinesInterpolateTransformDisplacementFieldGenerator.h" #include "itkLandmarkDisplacementFieldSource.h" diff --git a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h index e7df1f96dfc5e67138538c8b8a36c98665765e12..daee0da6c74b7a2531c4f1c7036ba055f39ba5d8 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_h -#define __otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_h +#ifndef otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_h +#define otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_h #include "otbPointSetToDisplacementFieldGenerator.h" @@ -64,11 +64,11 @@ protected: /** Constructor */ NNearestPointsLinearInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - virtual ~NNearestPointsLinearInterpolateDisplacementFieldGenerator() {} + ~NNearestPointsLinearInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: NNearestPointsLinearInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.txx index 3c488e3c2693849929b0655136bcd29ffd806787..85dcc8a323110572377d800a00246baa53a0f0cf 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_txx -#define __otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_txx +#ifndef otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_txx +#define otbNNearestPointsLinearInterpolateDisplacementFieldGenerator_txx #define EPSILON 1e-15 diff --git a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h index 5ef63392f5bdf3c271fed4a59d6687d783240914..a7da0b9e68f1b9be5303a1847c390bed013bb3f8 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_h -#define __otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_h +#ifndef otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_h +#define otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_h #include "otbPointSetWithTransformToDisplacementFieldGenerator.h" @@ -71,11 +71,11 @@ protected: /** Constructor */ NNearestTransformsLinearInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - virtual ~NNearestTransformsLinearInterpolateDisplacementFieldGenerator() {} + ~NNearestTransformsLinearInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: NNearestTransformsLinearInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.txx index 6df8ffdefe3fb42d61bc963e2470489fb3665914..42f331b68b16c64662f6c366efcb425cad2aa869 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_txx -#define __otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_txx +#ifndef otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_txx +#define otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator_txx #define EPSILON 1e-15 diff --git a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h index 81cecc3ca7ce6c7d6517b97698a068decbcae21c..070bc6d72fec121023f0fb1bd15972166b7a1c27 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNearestPointDisplacementFieldGenerator_h -#define __otbNearestPointDisplacementFieldGenerator_h +#ifndef otbNearestPointDisplacementFieldGenerator_h +#define otbNearestPointDisplacementFieldGenerator_h #include "otbPointSetToDisplacementFieldGenerator.h" @@ -61,11 +61,11 @@ protected: /** Constructor */ NearestPointDisplacementFieldGenerator() {}; /** Destructor */ - virtual ~NearestPointDisplacementFieldGenerator() {} + ~NearestPointDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: NearestPointDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.txx index 002b80616204a49854022721171ad6ad561260fe..c7d149ba271ffdf0f5d4bd3858c77703cb8d2f4e 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNearestPointDisplacementFieldGenerator_txx -#define __otbNearestPointDisplacementFieldGenerator_txx +#ifndef otbNearestPointDisplacementFieldGenerator_txx +#define otbNearestPointDisplacementFieldGenerator_txx #include "otbNearestPointDisplacementFieldGenerator.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h index c5dd9798e320171e583782a7e1418595329982c9..027b3cb0b1031db1a07a17bae30c16186053d6ee 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNearestTransformDisplacementFieldGenerator_h -#define __otbNearestTransformDisplacementFieldGenerator_h +#ifndef otbNearestTransformDisplacementFieldGenerator_h +#define otbNearestTransformDisplacementFieldGenerator_h #include "otbPointSetWithTransformToDisplacementFieldGenerator.h" @@ -64,11 +64,11 @@ protected: /** Constructor */ NearestTransformDisplacementFieldGenerator() {}; /** Destructor */ - virtual ~NearestTransformDisplacementFieldGenerator() {} + ~NearestTransformDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: NearestTransformDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.txx index eaedebd5b804ae67a30e1fadf221f4141075adcc..36307f0213f23cc82c2509d43bcbe02713717810 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbNearestTransformDisplacementFieldGenerator_txx -#define __otbNearestTransformDisplacementFieldGenerator_txx +#ifndef otbNearestTransformDisplacementFieldGenerator_txx +#define otbNearestTransformDisplacementFieldGenerator_txx #include "otbNearestTransformDisplacementFieldGenerator.h" #include "itkImageRegionIteratorWithIndex.h" diff --git a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h index fad2a985c42b43362ab041e2b194c359d0e9a649..219de2132d11d1701861ef2ee96747d2decba338 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToDisplacementFieldGenerator_h -#define __otbPointSetToDisplacementFieldGenerator_h +#ifndef otbPointSetToDisplacementFieldGenerator_h +#define otbPointSetToDisplacementFieldGenerator_h #include "itkImageSource.h" @@ -122,11 +122,11 @@ protected: /** Constructor */ PointSetToDisplacementFieldGenerator(); /** Destructor */ - virtual ~PointSetToDisplacementFieldGenerator() {} + ~PointSetToDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** * Generate the n nearest valid point in point set, where a valid point has a sufficient metric value. * \param index The index of the pixel to compute. diff --git a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx index 22f088c18e828dd3360d60017f488543af2eb764..a21c18d1baa2f1190c17c098a0590fca97c483e4 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetToDisplacementFieldGenerator_txx -#define __otbPointSetToDisplacementFieldGenerator_txx +#ifndef otbPointSetToDisplacementFieldGenerator_txx +#define otbPointSetToDisplacementFieldGenerator_txx #include "otbPointSetToDisplacementFieldGenerator.h" #include "otbMacro.h" diff --git a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h index 2fe6858d8143e094c31d7d2dc9b06df71ce5f541..2d1ae6a6b9cb5b439e361ca4f0fee0671d5844fd 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetWithTransformToDisplacementFieldGenerator_h -#define __otbPointSetWithTransformToDisplacementFieldGenerator_h +#ifndef otbPointSetWithTransformToDisplacementFieldGenerator_h +#define otbPointSetWithTransformToDisplacementFieldGenerator_h #include "otbPointSetToDisplacementFieldGenerator.h" #include "itkTransform.h" @@ -81,9 +81,9 @@ protected: /** Constructor */ PointSetWithTransformToDisplacementFieldGenerator(); /** Destructor */ - virtual ~PointSetWithTransformToDisplacementFieldGenerator() {} + ~PointSetWithTransformToDisplacementFieldGenerator() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: PointSetWithTransformToDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.txx index da172dac0cb4fbd639b9ade35c6b2cdcdbeec646..5fb36334dfa2045ac766f9b832bd3a46e36a5476 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPointSetWithTransformToDisplacementFieldGenerator_txx -#define __otbPointSetWithTransformToDisplacementFieldGenerator_txx +#ifndef otbPointSetWithTransformToDisplacementFieldGenerator_txx +#define otbPointSetWithTransformToDisplacementFieldGenerator_txx #include "otbPointSetWithTransformToDisplacementFieldGenerator.h" @@ -31,7 +31,7 @@ template <class TPointSet, class TDisplacementField> PointSetWithTransformToDisplacementFieldGenerator<TPointSet, TDisplacementField> ::PointSetWithTransformToDisplacementFieldGenerator() { - m_Transform = 0; // has to be provided by the user + m_Transform = ITK_NULLPTR; // has to be provided by the user } /** * PrintSelf Method diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h index 59e1cf42a53ab1edbfdabff4c309603eb12e84cf..5b365d2646bf3c36d271419683ee36944c51b071 100644 --- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h +++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAdhesionCorrectionFilter_h -#define __otbAdhesionCorrectionFilter_h +#ifndef otbAdhesionCorrectionFilter_h +#define otbAdhesionCorrectionFilter_h #include "itkImageToImageFilter.h" #include "otbImage.h" @@ -148,16 +148,16 @@ protected: /** Constructor */ AdhesionCorrectionFilter(); /** Destructor */ - virtual ~AdhesionCorrectionFilter() {}; + ~AdhesionCorrectionFilter() ITK_OVERRIDE {}; /** Threaded generate data */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Generate the input requested regions */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; private: AdhesionCorrectionFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx index 7f9cd034e0278a3b221359e84e9d29acd5576cd3..9a06a335198822481b6dc312776baea87b0308e7 100644 --- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx +++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbAdhesionCorrectionFilter_txx -#define __otbAdhesionCorrectionFilter_txx +#ifndef otbAdhesionCorrectionFilter_txx +#define otbAdhesionCorrectionFilter_txx #include "otbAdhesionCorrectionFilter.h" @@ -97,7 +97,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -109,7 +109,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMask *>(this->itk::ProcessObject::GetInput(2)); } @@ -121,7 +121,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TImage *>(this->itk::ProcessObject::GetInput(3)); } @@ -133,7 +133,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfInputs()<5) { - return 0; + return ITK_NULLPTR; } return static_cast<const TMask *>(this->itk::ProcessObject::GetInput(4)); } @@ -145,7 +145,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TMask *>(this->itk::ProcessObject::GetOutput(1)); } @@ -157,7 +157,7 @@ AdhesionCorrectionFilter<TImage, TMask> { if (this->GetNumberOfOutputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<TImage *>(this->itk::ProcessObject::GetOutput(2)); } diff --git a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h index 25d849d136a872e613ccd66ced6c0dea0f4f1365..d24bf6f94b1d65bb07d0cda22983b5a34d07f536 100644 --- a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h +++ b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otBijectionCoherencyFilter_h -#define __otBijectionCoherencyFilter_h +#ifndef otbBijectionCoherencyFilter_h +#define otbBijectionCoherencyFilter_h #include "itkImageToImageFilter.h" #include "otbLineOfSightOptimizer.h" @@ -111,16 +111,16 @@ protected: BijectionCoherencyFilter(); /** Destructor */ - virtual ~BijectionCoherencyFilter(){}; + ~BijectionCoherencyFilter() ITK_OVERRIDE{}; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; private: BijectionCoherencyFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx index c4f6307af38e1d638fe14d9319c2751dc4ca2ff1..3175bbd02d0f07c1672e5f3c9ac3cb89defc1baf 100644 --- a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx +++ b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBijectionCoherencyFilter_txx -#define __otbBijectionCoherencyFilter_txx +#ifndef otbBijectionCoherencyFilter_txx +#define otbBijectionCoherencyFilter_txx #include "otbBijectionCoherencyFilter.h" @@ -87,7 +87,7 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage> { if (this->GetNumberOfInputs()<1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -99,7 +99,7 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage> { if (this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -111,7 +111,7 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage> { if (this->GetNumberOfInputs()<3) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(2)); } @@ -123,7 +123,7 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage> { if (this->GetNumberOfInputs()<4) { - return 0; + return ITK_NULLPTR; } return static_cast<const TDisparityImage *>(this->itk::ProcessObject::GetInput(3)); } diff --git a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h index 7bb90449cb30b34c537abf8abbd2dd3f0caf193c..e50771666cd874ac5a88011ee10263ac2f417f04 100644 --- a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h +++ b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineOfSightOptimizer_h -#define __otbLineOfSightOptimizer_h +#ifndef otbLineOfSightOptimizer_h +#define otbLineOfSightOptimizer_h #include "itkObject.h" @@ -66,7 +66,7 @@ public: /** Compute the best intersection between N lines of sight. * Starting points of every line of sight are stored in the point set 'pointA' - * ending points are stored in 'pointB' (however, the computation is symetrical)*/ + * ending points are stored in 'pointB' (however, the computation is symmetrical)*/ PointType Compute(PointSetPointerType pointA, PointSetPointerType pointB); /** Get the residues from last computation */ @@ -84,7 +84,7 @@ protected: LineOfSightOptimizer(); /** Destructor */ - virtual ~LineOfSightOptimizer(){}; + ~LineOfSightOptimizer() ITK_OVERRIDE{}; private: diff --git a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.txx b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.txx index 93681a28e62b79bb51cd204203d7cd43d8e91124..273662f3165c587613274a0ba3d9b1df88270644 100644 --- a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.txx +++ b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLineOfSightOptimizer_txx -#define __otbLineOfSightOptimizer_txx +#ifndef otbLineOfSightOptimizer_txx +#define otbLineOfSightOptimizer_txx #include "otbLineOfSightOptimizer.h" diff --git a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h index 3773eca435f68c7d8dadc35b02ab91b62ec1d90e..440b2348f406334b5c2abb2ecd47c965cf216534 100644 --- a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h +++ b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMulti3DMapToDEMFilter_h -#define __otbMulti3DMapToDEMFilter_h +#ifndef otbMulti3DMapToDEMFilter_h +#define otbMulti3DMapToDEMFilter_h #include "itkImageToImageFilter.h" #include "otbImageToGenericRSOutputParameters.h" @@ -229,29 +229,29 @@ protected: Multi3DMapToDEMFilter(); /** Destructor */ - virtual ~Multi3DMapToDEMFilter(); + ~Multi3DMapToDEMFilter() ITK_OVERRIDE; /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requrested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Before threaded generate data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; /** After threaded generate data */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx index 28c605bd22a2a7f35e083d82a9f651121b51c4d4..262c74d7ed1ef6f13e98b879c077b89ed25979d3 100644 --- a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx +++ b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMulti3DMapToDEMFilter_txx -#define __otbMulti3DMapToDEMFilter_txx +#ifndef otbMulti3DMapToDEMFilter_txx +#define otbMulti3DMapToDEMFilter_txx #include "otbMulti3DMapToDEMFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -104,7 +104,7 @@ Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::Get3DMapInput(unsi { if ((2 * (index + 1)) > this->GetNumberOfInputs()) { - return NULL; + return ITK_NULLPTR; } return static_cast<const T3DImage *> (this->itk::ProcessObject::GetInput(2 * index)); } @@ -115,7 +115,7 @@ Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GetMaskInput(unsig { if ((2 * (index + 1)) > this->GetNumberOfInputs()) { - return NULL; + return ITK_NULLPTR; } return static_cast<const TMaskImage *> (this->itk::ProcessObject::GetInput(2 * index + 1)); } @@ -137,7 +137,7 @@ Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GetDEMOutput() { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputDEMImage *> (this->itk::ProcessObject::GetOutput(0)); } @@ -567,8 +567,8 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::ThreadedGener InputInternalPixelType maxLat = std::max(regionLat1, regionLat2); */ - TOutputDEMImage * tmpDEM = NULL; - AccumulatorImageType *tmpAcc = NULL; + TOutputDEMImage * tmpDEM = ITK_NULLPTR; + AccumulatorImageType *tmpAcc = ITK_NULLPTR; typename TOutputDEMImage::RegionType outputRequestedRegion = outputPtr->GetRequestedRegion(); typename T3DImage::RegionType splitRegion; diff --git a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h index b2a7af763ff458d88eecf43f76a2b6a54fa1eaae..805ea3d86504aff7c5d53b9d86f69ded820cb11c 100644 --- a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h +++ b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStereoSensorModelToElevationMapFilter_h -#define __otbStereoSensorModelToElevationMapFilter_h +#ifndef otbStereoSensorModelToElevationMapFilter_h +#define otbStereoSensorModelToElevationMapFilter_h #include "itkImageToImageFilter.h" #include "itkInterpolateImageFunction.h" @@ -187,24 +187,24 @@ protected: StereoSensorModelToElevationFilter(); /** Destructor */ - virtual ~StereoSensorModelToElevationFilter(); + ~StereoSensorModelToElevationFilter() ITK_OVERRIDE; /** Threaded generate data */ - virtual void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, - itk::ThreadIdType threadId); + void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, + itk::ThreadIdType threadId) ITK_OVERRIDE; /** Generate the input requested regions */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Things to do before the threaded generate-data */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.txx b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.txx index 253a73496a2097d125086d044f10b91350df0f3a..581783af3661b5b6c2bea7ccc342c70ba664ca11 100644 --- a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.txx +++ b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStereoSensorModelToElevationMapFilter_txx -#define __otbStereoSensorModelToElevationMapFilter_txx +#ifndef otbStereoSensorModelToElevationMapFilter_txx +#define otbStereoSensorModelToElevationMapFilter_txx #include "otbStereoSensorModelToElevationMapFilter.h" @@ -84,7 +84,7 @@ StereoSensorModelToElevationFilter<TInputImage, TOutputHeight> { if(this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(0)); } @@ -96,7 +96,7 @@ StereoSensorModelToElevationFilter<TInputImage, TOutputHeight> { if(this->GetNumberOfInputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<const TInputImage *>(this->itk::ProcessObject::GetInput(1)); } @@ -108,7 +108,7 @@ StereoSensorModelToElevationFilter<TInputImage, TOutputHeight> { if(this->GetNumberOfOutputs()<2) { - return 0; + return ITK_NULLPTR; } return static_cast<TOutputHeight *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h index 9cebbf5d4d0f4d639891fc23074cfb5f9e63a783..0698b5aaac2146e38307ce0e20a4d496408d1bab 100644 --- a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h +++ b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStereorectificationDisplacementFieldSource_h -#define __otbStereorectificationDisplacementFieldSource_h +#ifndef otbStereorectificationDisplacementFieldSource_h +#define otbStereorectificationDisplacementFieldSource_h #include "itkImageSource.h" #include "otbGenericRSTransform.h" @@ -163,19 +163,19 @@ protected: StereorectificationDisplacementFieldSource( void ); /** Destructor */ - ~StereorectificationDisplacementFieldSource( void ) {}; + ~StereorectificationDisplacementFieldSource( void ) ITK_OVERRIDE {}; /** Generate output images information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Enlarge output requested region (no streaming) */ - virtual void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)); + void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) ITK_OVERRIDE; /** Compute the deformation field */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; + void PrintSelf( std::ostream& os, itk::Indent indent ) const ITK_OVERRIDE; private: StereorectificationDisplacementFieldSource( const Self& ); // purposely diff --git a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx index aa66e6ec4d4efebdfeedc4bb8041aeba2d2a0356..f5f210a1f14442038fca54c00866d8913f95926c 100644 --- a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx +++ b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStereoSensorModelToElevationMapFilter_txx -#define __otbStereoSensorModelToElevationMapFilter_txx +#ifndef otbStereoSensorModelToElevationMapFilter_txx +#define otbStereoSensorModelToElevationMapFilter_txx #include "otbStereorectificationDisplacementFieldSource.h" #include "itkProgressReporter.h" @@ -78,7 +78,7 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->itk::ProcessObject::GetOutput(0)); } @@ -104,7 +104,7 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx b/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx index a06c79db289808499d923459f3413ec45bbd1a4a..585ba0b90ca5949e74e3a86ca3297e7033b79170 100644 --- a/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx +++ b/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx @@ -124,8 +124,8 @@ int otbMulti3DMapToDEMFilterEPSG(int argc, char* argv[]) multiFilter->SetOutputSpacing(spacing); VectorImageType::PointType origin; - origin[0] = strtod(argv[argc-7], NULL); - origin[1] = strtod(argv[argc-6], NULL); + origin[0] = strtod(argv[argc-7], ITK_NULLPTR); + origin[1] = strtod(argv[argc-6], ITK_NULLPTR); multiFilter->SetOutputOrigin(origin); std::string projectionRef=otb::GeoInformationConversion::ToWKT( atoi(argv[argc-1])); @@ -380,8 +380,8 @@ spacing[1] = atof(argv[argc-1]); multiFilter->SetOutputSpacing(spacing); VectorImageType::PointType origin; -origin[0] = strtod(argv[argc-6], NULL); -origin[1] = strtod(argv[argc-5], NULL); +origin[0] = strtod(argv[argc-6], ITK_NULLPTR); +origin[1] = strtod(argv[argc-5], ITK_NULLPTR); multiFilter->SetOutputOrigin(origin); diff --git a/Modules/Remote/Mosaic.remote.cmake b/Modules/Remote/Mosaic.remote.cmake index fa38ba461d59ed501e7289e95a9236359cf731d9..fe66d5bbac58775fe950fc93e49278b5a5f03a04 100644 --- a/Modules/Remote/Mosaic.remote.cmake +++ b/Modules/Remote/Mosaic.remote.cmake @@ -5,5 +5,5 @@ A more detailed description can be found on the project website: https://github.com/remicres/otb-mosaic " GIT_REPOSITORY https://github.com/remicres/otb-mosaic.git - GIT_TAG 1406369c1ec9accffc0b3f40d0411e78bed2d893 + GIT_TAG 5b180a274b731bfd366f731cb829797e6d1ec756 ) diff --git a/Modules/Remote/SertitObject.remote.cmake b/Modules/Remote/SertitObject.remote.cmake index e933f05d97f21b875d3bbd4af60c6cce8429a28a..369c759dce8c47fe2a5ca1b0d2e64baf543d3b2f 100644 --- a/Modules/Remote/SertitObject.remote.cmake +++ b/Modules/Remote/SertitObject.remote.cmake @@ -26,5 +26,5 @@ median, variance, kurtosis, skewness. The result could be use to perform futher object-oriented image analysis. " GIT_REPOSITORY https://github.com/sertit/SertitObject.git - GIT_TAG 90c369e9a197b3f83cb18e1d7bc594313fef63d5 + GIT_TAG d228e0d65de58496e2410ae8944e715b3970760a ) diff --git a/Modules/Remote/otbGRM.remote.cmake b/Modules/Remote/otbGRM.remote.cmake index 5c17e58c0e3da30fafcc566b4cdd404c53a18dd1..c6ac506a316a2b019656563ce6bcaaf728b478b1 100644 --- a/Modules/Remote/otbGRM.remote.cmake +++ b/Modules/Remote/otbGRM.remote.cmake @@ -12,5 +12,5 @@ A more detailed description can be found on the project website: http://tully.ups-tlse.fr/lassallep/grm " GIT_REPOSITORY http://tully.ups-tlse.fr/lassallep/grm.git - GIT_TAG 7762ef1f84154fcbaecba476ab9e0aba1bcd736c + GIT_TAG a08d2309bc8d4f4ceaf1dba8bda33aa1e21fc4aa ) diff --git a/Modules/Segmentation/CCOBIA/include/otbConnectedComponentMuParserFunctor.h b/Modules/Segmentation/CCOBIA/include/otbConnectedComponentMuParserFunctor.h index 606403ddad22d778c70f17ff92f2a728c2b2d802..c473d8bdba052f08d75369a4d53561c7f0a9cd24 100644 --- a/Modules/Segmentation/CCOBIA/include/otbConnectedComponentMuParserFunctor.h +++ b/Modules/Segmentation/CCOBIA/include/otbConnectedComponentMuParserFunctor.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbConnectedComponentMuParserFunctor_h -#define __otbConnectedComponentMuParserFunctor_h +#ifndef otbConnectedComponentMuParserFunctor_h +#define otbConnectedComponentMuParserFunctor_h #include "otbParser.h" #include "otbMacro.h" diff --git a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h index 87a85bd0ec3c1e4b5ad3a6cf9e5b8a6fb203a00f..8153ac1a5c6e555bfc9d851957069c6c4551dace 100644 --- a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h +++ b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h @@ -19,8 +19,8 @@ =========================================================================*/ -#ifndef __otbLabelObjectOpeningMuParserFilter_h -#define __otbLabelObjectOpeningMuParserFilter_h +#ifndef otbLabelObjectOpeningMuParserFilter_h +#define otbLabelObjectOpeningMuParserFilter_h #include "itkProgressReporter.h" #include <iostream> @@ -110,18 +110,18 @@ public: /** return list of Mu Parser functions**/ Parser::FunctionMapType GetFunList() const; - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; - void EnlargeOutputRequestedRegion(itk::DataObject *) {} + void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE {} - void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: LabelObjectOpeningMuParserFilter(); - virtual ~LabelObjectOpeningMuParserFilter(); - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelObjectOpeningMuParserFilter() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: LabelObjectOpeningMuParserFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.txx b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.txx index cfa2060bb3b0eaa36e8aea5bbc3646deba327574..bff200e684fd24794255b57de0b9f8e276a1be40 100644 --- a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.txx +++ b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelObjectOpeningMuParserFilter_txx -#define __otbLabelObjectOpeningMuParserFilter_txx +#ifndef otbLabelObjectOpeningMuParserFilter_txx +#define otbLabelObjectOpeningMuParserFilter_txx #include "otbLabelObjectOpeningMuParserFilter.h" #include <iostream> diff --git a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h index 2ad1a455d2d908a8053aebf7eb89b5e4c4d612c2..f974b798798218dcab830d9685a8be7bc69583fc 100644 --- a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h +++ b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h -#define __otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h +#ifndef otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h +#define otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h #include "otbPersistentImageToVectorDataFilter.h" #include "otbPersistentFilterStreamingDecorator.h" @@ -178,9 +178,9 @@ public: protected: PersistentConnectedComponentSegmentationOBIAToVectorDataFilter(); - virtual ~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter(); + ~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; private: ObjectSizeType m_MinimumObjectSize; @@ -196,7 +196,7 @@ private: bool m_ComputeFeretDiameter; bool m_ComputePerimeter; - virtual VectorDataPointerType ProcessTile(); + VectorDataPointerType ProcessTile() ITK_OVERRIDE; }; /** \class StreamingConnectedComponentSegmentationOBIAToVectorDataFilter diff --git a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx index 4516c786c41b5fafc2ca34fc52f8f5dbc4e1dbe2..4090a9c43d8b8833d23b4f07003c638d90802764 100644 --- a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx +++ b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_txx -#define __otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_txx +#ifndef otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_txx +#define otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_txx #include "otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h" #include "otbVectorDataTransformFilter.h" diff --git a/Modules/Segmentation/CCOBIA/test/otbConnectedComponentMuParserFunctorTest.cxx b/Modules/Segmentation/CCOBIA/test/otbConnectedComponentMuParserFunctorTest.cxx index d8634f59a28614db36c0f8f258cf08ca13dceaf0..e49652a2c972f8786d903aa17bebe71e4a66abfb 100644 --- a/Modules/Segmentation/CCOBIA/test/otbConnectedComponentMuParserFunctorTest.cxx +++ b/Modules/Segmentation/CCOBIA/test/otbConnectedComponentMuParserFunctorTest.cxx @@ -45,7 +45,7 @@ int otbConnectedComponentMuParserFunctorTest(int argc, char *argv[]) } else { - maskFilename = NULL; + maskFilename = ITK_NULLPTR; } typedef float InputPixelType; @@ -74,7 +74,7 @@ int otbConnectedComponentMuParserFunctorTest(int argc, char *argv[]) filter->SetInput(reader->GetOutput()); - if(NULL != maskFilename) + if(ITK_NULLPTR != maskFilename) { maskReader = MaskReaderType::New(); maskReader->SetFileName(maskFilename); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h index 242439ddbcc2aeef78b5477ac1863a39bd6152d4..d01eb0dc07b4573046d93a5faf1b18c747a9299d 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageRegionMergingFilter_h -#define __otbLabelImageRegionMergingFilter_h +#ifndef otbLabelImageRegionMergingFilter_h +#define otbLabelImageRegionMergingFilter_h #include "otbImage.h" #include "otbVectorImage.h" @@ -112,20 +112,20 @@ public: InputSpectralImageType * GetInputSpectralImage(); protected: - virtual void EnlargeOutputRequestedRegion( itk::DataObject *output ); + void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Constructor */ LabelImageRegionMergingFilter(); /** Destructor */ - virtual ~LabelImageRegionMergingFilter(); + ~LabelImageRegionMergingFilter() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Method to build a map of adjacent regions */ RegionAdjacencyMapType LabelImageToRegionAdjacencyMap(typename OutputLabelImageType::Pointer inputLabelImage); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.txx index e4b0da77479d1081815090fa601c8d95af2597e3..808293e743c1e692aba296e54f52319724e62aeb 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelImageRegionMergingFilter_txx -#define __otbLabelImageRegionMergingFilter_txx +#ifndef otbLabelImageRegionMergingFilter_txx +#define otbLabelImageRegionMergingFilter_txx #include "otbLabelImageRegionMergingFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -90,7 +90,7 @@ LabelImageRegionMergingFilter<TInputLabelImage, TInputSpectralImage, TOutputLabe { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputLabelImageType *>(this->itk::ProcessObject::GetOutput(0)); } @@ -114,7 +114,7 @@ LabelImageRegionMergingFilter<TInputLabelImage, TInputSpectralImage, TOutputLabe { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputClusteredImageType *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h index 8643a00dfb84849db82a245a6c5192487ee361a4..ae01edf09854ef442fcdbbb2a4711fb6fb919b0a 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageRegionPruningFilter_h -#define __otbLabelImageRegionPruningFilter_h +#ifndef otbLabelImageRegionPruningFilter_h +#define otbLabelImageRegionPruningFilter_h #include "otbImage.h" #include "otbVectorImage.h" @@ -111,20 +111,20 @@ public: InputSpectralImageType * GetInputSpectralImage(); protected: - virtual void EnlargeOutputRequestedRegion( itk::DataObject *output ); + void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Constructor */ LabelImageRegionPruningFilter(); /** Destructor */ - virtual ~LabelImageRegionPruningFilter(); + ~LabelImageRegionPruningFilter() ITK_OVERRIDE; /** PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Method to build a map of adjacent regions */ RegionAdjacencyMapType LabelImageToRegionAdjacencyMap(typename OutputLabelImageType::Pointer inputLabelImage); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.txx index ed0adf9ddb7832002421b7545fbb0f1ff1d351f0..082e4eaebcde7f92a487ba944d2973bc12b81a7e 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.txx @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbLabelImageRegionPruningFilter_txx -#define __otbLabelImageRegionPruningFilter_txx +#ifndef otbLabelImageRegionPruningFilter_txx +#define otbLabelImageRegionPruningFilter_txx #include "otbLabelImageRegionPruningFilter.h" #include "itkImageRegionConstIteratorWithIndex.h" @@ -91,7 +91,7 @@ LabelImageRegionPruningFilter<TInputLabelImage, TInputSpectralImage, TOutputLabe { if (this->GetNumberOfOutputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputLabelImageType *>(this->itk::ProcessObject::GetOutput(0)); } @@ -115,7 +115,7 @@ LabelImageRegionPruningFilter<TInputLabelImage, TInputSpectralImage, TOutputLabe { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputClusteredImageType *>(this->itk::ProcessObject::GetOutput(1)); } diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h index b4d6817c76a37189bb0882f7329cc58a405fd587..8b59caa41d59396f8189250431250f733ee59249 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToOGRDataSourceFilter_h -#define __otbLabelImageToOGRDataSourceFilter_h +#ifndef otbLabelImageToOGRDataSourceFilter_h +#define otbLabelImageToOGRDataSourceFilter_h #include "itkProcessObject.h" #include "otbOGRDataSourceWrapper.h" @@ -111,17 +111,17 @@ public: protected: LabelImageToOGRDataSourceFilter(); - virtual ~LabelImageToOGRDataSourceFilter() {} + ~LabelImageToOGRDataSourceFilter() ITK_OVERRIDE {} - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Generate Data method*/ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** DataObject pointer */ typedef itk::DataObject::Pointer DataObjectPointer; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; using Superclass::MakeOutput; private: diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx index 395e5d87d31ae62549bcc4e60bcbf66837b86ba6..3a8c9bec74b559831fad1c07c26237f4e26d4f06 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToOGRDataSourceFilter_txx -#define __otbLabelImageToOGRDataSourceFilter_txx +#ifndef otbLabelImageToOGRDataSourceFilter_txx +#define otbLabelImageToOGRDataSourceFilter_txx #include "otbLabelImageToOGRDataSourceFilter.h" #include "otbGdalDataTypeBridge.h" @@ -78,7 +78,7 @@ LabelImageToOGRDataSourceFilter<TInputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(0)); @@ -100,7 +100,7 @@ LabelImageToOGRDataSourceFilter<TInputImage> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(1)); @@ -204,14 +204,14 @@ LabelImageToOGRDataSourceFilter<TInputImage> //Create the output layer for GDALPolygonize(). ogr::DataSource::Pointer ogrDS = ogr::DataSource::New(); - OGRLayerType outputLayer = ogrDS->CreateLayer("layer",NULL,wkbPolygon); + OGRLayerType outputLayer = ogrDS->CreateLayer("layer",ITK_NULLPTR,wkbPolygon); OGRFieldDefn field(m_FieldName.c_str(),OFTInteger); outputLayer.CreateField(field, true); //Call GDALPolygonize() char ** options; - options = NULL; + options = ITK_NULLPTR; char * option[1]; if (m_Use8Connected == true) { @@ -271,12 +271,12 @@ LabelImageToOGRDataSourceFilter<TInputImage> } maskDataset->SetGeoTransform(geoTransform); - GDALPolygonize(dataset->GetRasterBand(1), maskDataset->GetRasterBand(1), &outputLayer.ogr(), 0, options, NULL, NULL); + GDALPolygonize(dataset->GetRasterBand(1), maskDataset->GetRasterBand(1), &outputLayer.ogr(), 0, options, ITK_NULLPTR, ITK_NULLPTR); GDALClose(maskDataset); } else { - GDALPolygonize(dataset->GetRasterBand(1), NULL, &outputLayer.ogr(), 0, options, NULL, NULL); + GDALPolygonize(dataset->GetRasterBand(1), ITK_NULLPTR, &outputLayer.ogr(), 0, options, ITK_NULLPTR, ITK_NULLPTR); } this->SetNthOutput(0,ogrDS); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h index 23a3a20fea0271bc778518c31753d40d5ca6624c..771989924b9715718c432e8c3aea32ff2942b56e 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToVectorDataFilter_h -#define __otbLabelImageToVectorDataFilter_h +#ifndef otbLabelImageToVectorDataFilter_h +#define otbLabelImageToVectorDataFilter_h #include "otbVectorDataSource.h" #include "otbVectorData.h" @@ -101,12 +101,12 @@ public: protected: LabelImageToVectorDataFilter(); - virtual ~LabelImageToVectorDataFilter() {} + ~LabelImageToVectorDataFilter() ITK_OVERRIDE {} - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Generate Data method*/ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: LabelImageToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx index 4e40994ad7223528d89f4b797d96e43794c244ae..d27f06596a4b1ced5d6e07661207d86797d273bb 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelImageToVectorDataFilter_txx -#define __otbLabelImageToVectorDataFilter_txx +#ifndef otbLabelImageToVectorDataFilter_txx +#define otbLabelImageToVectorDataFilter_txx #include "otbLabelImageToVectorDataFilter.h" #include "otbOGRIOHelper.h" @@ -59,7 +59,7 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(0)); @@ -81,7 +81,7 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> { if (this->GetNumberOfInputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(1)); @@ -184,14 +184,14 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> //Create the output layer for GDALPolygonize(). ogr::DataSource::Pointer ogrDS = ogr::DataSource::New(); - OGRLayerType outputLayer = ogrDS->CreateLayer("layer",NULL,wkbPolygon); + OGRLayerType outputLayer = ogrDS->CreateLayer("layer",ITK_NULLPTR,wkbPolygon); OGRFieldDefn field(m_FieldName.c_str(),OFTInteger); outputLayer.CreateField(field, true); //Call GDALPolygonize() char ** options; - options = NULL; + options = ITK_NULLPTR; char * option[1]; if (m_Use8Connected == true) { @@ -251,12 +251,12 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> } maskDataset->SetGeoTransform(geoTransform); - GDALPolygonize(dataset->GetRasterBand(1), maskDataset->GetRasterBand(1), &outputLayer.ogr(), 0, options, NULL, NULL); + GDALPolygonize(dataset->GetRasterBand(1), maskDataset->GetRasterBand(1), &outputLayer.ogr(), 0, options, ITK_NULLPTR, ITK_NULLPTR); GDALClose(maskDataset); } else { - GDALPolygonize(dataset->GetRasterBand(1), NULL, &outputLayer.ogr(), 0, options, NULL, NULL); + GDALPolygonize(dataset->GetRasterBand(1), ITK_NULLPTR, &outputLayer.ogr(), 0, options, ITK_NULLPTR, ITK_NULLPTR); } diff --git a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h index 81eb0b9e5e42c5537564bd54c7a74303fa562c9f..f1e0913c8a2e83259cc1a73c04270a05e1351bc5 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToVectorDataFilter_h -#define __otbLabelMapToVectorDataFilter_h +#ifndef otbLabelMapToVectorDataFilter_h +#define otbLabelMapToVectorDataFilter_h #include "otbVectorDataSource.h" #include "itkLabelMap.h" @@ -112,9 +112,9 @@ public: protected: LabelMapToVectorDataFilter(); - virtual ~LabelMapToVectorDataFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - void GenerateData(); + ~LabelMapToVectorDataFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: LabelMapToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.txx index 54d1dca9b28ae01a7ec0c6f4e6b09d30e23db48e..358d3c58ab88a50295a76d25ddd382730b88f632 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelMapToVectorDataFilter_txx -#define __otbLabelMapToVectorDataFilter_txx +#ifndef otbLabelMapToVectorDataFilter_txx +#define otbLabelMapToVectorDataFilter_txx #include "otbLabelMapToVectorDataFilter.h" @@ -56,7 +56,7 @@ LabelMapToVectorDataFilter<TLabelMap, TVectorData, TFieldsFunctor> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TLabelMap *> diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h index 0d258cd891a072d327d062c40494513d518b897a..ac5cbcda4158d44c85233aea9a33f155b3b8ce4e 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRDataSourceToLabelImageFilter_h -#define __otbOGRDataSourceToLabelImageFilter_h +#ifndef otbOGRDataSourceToLabelImageFilter_h +#define otbOGRDataSourceToLabelImageFilter_h #include "itkImageToImageFilter.h" #include "otbMacro.h" @@ -137,14 +137,14 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); protected: - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; OGRDataSourceToLabelImageFilter(); - virtual ~OGRDataSourceToLabelImageFilter() {} + ~OGRDataSourceToLabelImageFilter() ITK_OVERRIDE {} - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: OGRDataSourceToLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx index 69b8e325f45c80d0dc20259fe885037e2f396c1c..a704709105277d56f305ccf6baae11bd77df121e 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx @@ -15,6 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbOGRDataSourceToLabelImageFilter_txx +#define otbOGRDataSourceToLabelImageFilter_txx #include "otbOGRDataSourceToLabelImageFilter.h" #include "otbOGRIOHelper.h" @@ -235,7 +237,7 @@ OGRDataSourceToLabelImageFilter<TOutputImage>::GenerateData() GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer())); // Burn the geometries into the dataset - if (dataset != NULL) + if (dataset != ITK_NULLPTR) { std::vector<std::string> options; @@ -250,9 +252,9 @@ OGRDataSourceToLabelImageFilter<TOutputImage>::GenerateData() &m_BandsToBurn[0], m_SrcDataSetLayers.size(), &(m_SrcDataSetLayers[0]), - NULL, NULL, &foreground[0], + ITK_NULLPTR, ITK_NULLPTR, &foreground[0], ogr::StringListConverter(options).to_ogr(), - NULL, NULL ); + ITK_NULLPTR, ITK_NULLPTR ); // release the dataset GDALClose( dataset ); } @@ -267,3 +269,5 @@ OGRDataSourceToLabelImageFilter<TOutputImage> } } // end namespace otb + +#endif diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.h b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.h index c591ae3e99be9dd6297ddfea746eca52143ca810..d20d0079350b5a7391756a3770dfafbdd253d1c7 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToOGRDataFilter_h -#define __otbPersistentImageToOGRDataFilter_h +#ifndef otbPersistentImageToOGRDataFilter_h +#define otbPersistentImageToOGRDataFilter_h #include "otbPersistentImageFilter.h" @@ -104,6 +104,12 @@ public: * for fusioning streaming tiles. */ itkGetMacro(StreamSize, SizeType); + + /** Set the geometry type */ + itkSetMacro(GeometryType,OGRwkbGeometryType); + + /** Get the geometry type */ + itkGetMacro(GeometryType,OGRwkbGeometryType); /** Set the \c ogr::DataSource in which the layer LayerName will be created. */ void SetOGRDataSource( OGRDataSourcePointerType ogrDS ); @@ -118,6 +124,15 @@ public: /** Set the OGR layer creation options */ void SetOGRLayerCreationOptions(const std::vector<std::string> & options); + + /** Get the OGR layer creation options */ + const std::vector<std::string> & GetOGRLayerCreationOptions(void); + + /** Set the field type for class label */ + itkSetMacro(FieldType,OGRFieldType); + + /** Get the field type for class label */ + itkGetMacro(FieldType,OGRFieldType); protected: PersistentImageToOGRDataFilter(); @@ -139,6 +154,7 @@ private: OGRwkbGeometryType m_GeometryType; SizeType m_StreamSize; std::vector<std::string> m_OGRLayerCreationOptions; + OGRFieldType m_FieldType; }; // end of class } // end namespace otb diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx index 8fd05386153df6cd39ab3e3389bf21422aea1bf9..fe6b61a3c4037b8d8a62eeed0aaa35d97e8ee6e2 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToOGRDataFilter_txx -#define __otbPersistentImageToOGRDataFilter_txx +#ifndef otbPersistentImageToOGRDataFilter_txx +#define otbPersistentImageToOGRDataFilter_txx #include "otbPersistentImageToOGRDataFilter.h" #include "itkTimeProbe.h" @@ -33,7 +33,11 @@ namespace otb template<class TImage> PersistentImageToOGRDataFilter<TImage> -::PersistentImageToOGRDataFilter() : m_FieldName("DN"), m_LayerName("Layer"), m_GeometryType(wkbMultiPolygon) +::PersistentImageToOGRDataFilter() + : m_FieldName("DN") + , m_LayerName("Layer") + , m_GeometryType(wkbMultiPolygon) + , m_FieldType(OFTInteger) { this->SetNumberOfRequiredInputs(2); this->SetNumberOfRequiredInputs(2); @@ -89,6 +93,13 @@ PersistentImageToOGRDataFilter<TImage> this->Modified(); } +template<class TImage> +const std::vector<std::string>& +PersistentImageToOGRDataFilter<TImage> +::GetOGRLayerCreationOptions(void) +{ + return m_OGRLayerCreationOptions; +} template<class TImage> void @@ -117,7 +128,6 @@ void PersistentImageToOGRDataFilter<TImage> ::Initialize() { - std::string projectionRefWkt = this->GetInput()->GetProjectionRef(); bool projectionInformationAvailable = !projectionRefWkt.empty(); OGRSpatialReference * oSRS = NULL; @@ -126,26 +136,10 @@ PersistentImageToOGRDataFilter<TImage> oSRS = static_cast<OGRSpatialReference *>(OSRNewSpatialReference(projectionRefWkt.c_str())); } - OGRDataSourcePointerType ogrDS = this->GetOGRDataSource(); - - ogrDS->CreateLayer(m_LayerName, oSRS ,m_GeometryType, m_OGRLayerCreationOptions); - OGRFieldDefn field(m_FieldName.c_str(),OFTInteger); - - //Handle the case of shapefile. A shapefile is a layer and not a datasource. - //The layer name in a shapefile is the shapefile's name. - //This is not the case for a database as sqlite or PG. - if (ogrDS->GetLayersCount() == 1) - { - ogrDS->GetLayer(0).CreateField(field, true); - } - else - { - ogrDS->GetLayer(m_LayerName).CreateField(field, true); - } - - //CSLDestroy( options ); - + OGRLayerType outLayer = ogrDS->CreateLayer(m_LayerName, oSRS ,m_GeometryType, m_OGRLayerCreationOptions); + OGRFieldDefn field(m_FieldName.c_str(),m_FieldType); + outLayer.CreateField(field, true); } diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h index 4e7727b94440f0e88a29195cfc0e3a24441938c8..8d54301fd291f373f6471aad58c2bcd12cb5b1e1 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToOGRLayerFilter_h -#define __otbPersistentImageToOGRLayerFilter_h +#ifndef otbPersistentImageToOGRLayerFilter_h +#define otbPersistentImageToOGRLayerFilter_h #include "otbPersistentImageFilter.h" @@ -73,9 +73,9 @@ public: typedef ogr::Layer OGRLayerType; typedef ogr::Feature OGRFeatureType; - void AllocateOutputs(); - virtual void Reset(void); - virtual void Synthetize(void); + void AllocateOutputs() ITK_OVERRIDE; + void Reset(void) ITK_OVERRIDE; + void Synthetize(void) ITK_OVERRIDE; /** This method creates the output layer in the OGRLayer set by the user. * \note This methode must be called before the call of Update . @@ -95,11 +95,11 @@ public: protected: PersistentImageToOGRLayerFilter(); - virtual ~PersistentImageToOGRLayerFilter(); + ~PersistentImageToOGRLayerFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.txx b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.txx index 290dd18f0ff1348181bdcf1a1754a7ef6a5e8889..39ce2c28148f4cb0503e232f5056ba0d9c333fd7 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToOGRLayerFilter_txx -#define __otbPersistentImageToOGRLayerFilter_txx +#ifndef otbPersistentImageToOGRLayerFilter_txx +#define otbPersistentImageToOGRLayerFilter_txx #include "otbPersistentImageToOGRLayerFilter.h" #include "itkTimeProbe.h" @@ -33,7 +33,7 @@ namespace otb template<class TImage> PersistentImageToOGRLayerFilter<TImage> -::PersistentImageToOGRLayerFilter() : m_OGRLayer(NULL, false) +::PersistentImageToOGRLayerFilter() : m_OGRLayer(ITK_NULLPTR, false) { m_StreamSize.Fill(0); } diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h index 0a262e79a03f6ba1099a36cdaf065d246133f524..d408b75c8f24174d0e168d2ee22ba53b8e93ebc3 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToVectorDataFilter_h -#define __otbPersistentImageToVectorDataFilter_h +#ifndef otbPersistentImageToVectorDataFilter_h +#define otbPersistentImageToVectorDataFilter_h #include "otbPersistentImageFilter.h" #include "itkExtractImageFilter.h" @@ -85,11 +85,11 @@ public: OutputVectorDataType* GetOutputVectorData() const; - void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; - virtual void Reset(void); + void Reset(void) ITK_OVERRIDE; - virtual void Synthetize(void); + void Synthetize(void) ITK_OVERRIDE; /** Specify the name of the output shapefile to write. */ itkSetStringMacro(FileName); @@ -97,11 +97,11 @@ public: protected: PersistentImageToVectorDataFilter(); - virtual ~PersistentImageToVectorDataFilter() {} + ~PersistentImageToVectorDataFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; ExtractImageFilterPointerType m_ExtractFilter; diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.txx index c5ed5a20e77afd96003efe75c0eb3046c3e4e375..0ad32752b32c46380aa5dff2b62c67f15a798a0c 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbPersistentImageToVectorDataFilter_txx -#define __otbPersistentImageToVectorDataFilter_txx +#ifndef otbPersistentImageToVectorDataFilter_txx +#define otbPersistentImageToVectorDataFilter_txx #include "otbPersistentImageToVectorDataFilter.h" diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h index 1cbbe1041e447074ccb278a4302804a23c09089f..bd0187cb43f9f59d59a0da360d7cec242fb037ce 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRasterizeVectorDataFilter_h -#define __otbRasterizeVectorDataFilter_h +#ifndef otbRasterizeVectorDataFilter_h +#define otbRasterizeVectorDataFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkImageToImageFilter.h" @@ -133,20 +133,20 @@ public: } protected: - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; RasterizeVectorDataFilter(); - virtual ~RasterizeVectorDataFilter() + ~RasterizeVectorDataFilter() ITK_OVERRIDE { - if (m_OGRDataSourcePointer != NULL) + if (m_OGRDataSourcePointer != ITK_NULLPTR) { ogr::version_proxy::Close(m_OGRDataSourcePointer); } } - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: RasterizeVectorDataFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx index 425710d5162e06a844ba228bb9847cc36aad5c57..09711a6f009a8905ed446e599b62f47e8a79a54b 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx @@ -15,6 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifndef otbRasterizeVectorDataFilter_txx +#define otbRasterizeVectorDataFilter_txx #include "otbRasterizeVectorDataFilter.h" #include "otbOGRIOHelper.h" @@ -25,7 +27,7 @@ namespace otb template<class TVectorData, class TInputImage, class TOutputImage> RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> ::RasterizeVectorDataFilter() - : m_OGRDataSourcePointer(0) + : m_OGRDataSourcePointer(ITK_NULLPTR) { this->SetNumberOfRequiredInputs(1); } @@ -64,7 +66,7 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> // Get the projection ref of the current VectorData std::string projectionRefWkt = vd->GetProjectionRef(); bool projectionInformationAvailable = !projectionRefWkt.empty(); - OGRSpatialReference * oSRS = NULL; + OGRSpatialReference * oSRS = ITK_NULLPTR; if (projectionInformationAvailable) { @@ -83,14 +85,14 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> // Iterative method to build the layers from a VectorData OGRRegisterAll(); - OGRLayer * ogrCurrentLayer = NULL; + OGRLayer * ogrCurrentLayer = ITK_NULLPTR; std::vector<OGRLayer *> ogrLayerVector; otb::OGRIOHelper::Pointer IOConversion = otb::OGRIOHelper::New(); // The method ConvertDataTreeNodeToOGRLayers create the // OGRDataSource but don t release it. Destruction is done in the // desctructor - m_OGRDataSourcePointer = NULL; + m_OGRDataSourcePointer = ITK_NULLPTR; ogrLayerVector = IOConversion->ConvertDataTreeNodeToOGRLayers(inputRoot, m_OGRDataSourcePointer, ogrCurrentLayer, @@ -103,7 +105,7 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> } // Destroy the oSRS - if (oSRS != NULL) + if (oSRS != ITK_NULLPTR) { OSRRelease(oSRS); } @@ -184,15 +186,15 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData( GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer())); // Burn the geometries into the dataset - if (dataset != NULL) + if (dataset != ITK_NULLPTR) { GDALRasterizeLayers( dataset, m_BandsToBurn.size(), &(m_BandsToBurn[0]), m_SrcDataSetLayers.size(), &(m_SrcDataSetLayers[0]), - NULL, NULL, &(m_FullBurnValues[0]), - NULL, - GDALDummyProgress, NULL ); + ITK_NULLPTR, ITK_NULLPTR, &(m_FullBurnValues[0]), + ITK_NULLPTR, + GDALDummyProgress, ITK_NULLPTR ); // release the dataset GDALClose( dataset ); @@ -209,3 +211,4 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> } // end namespace otb +#endif diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h index 85faf2380937782312f2bf4c5a989dddf13257a4..ac5f4d68951ebdfca59969a4bbd6eaa7fa662d0e 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToLabelImageFilter_h -#define __otbVectorDataToLabelImageFilter_h +#ifndef otbVectorDataToLabelImageFilter_h +#define otbVectorDataToLabelImageFilter_h #include "itkImageToImageFilter.h" #include "itkImageRegionIterator.h" @@ -121,10 +121,10 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); protected: - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; VectorDataToLabelImageFilter(); - virtual ~VectorDataToLabelImageFilter() + ~VectorDataToLabelImageFilter() ITK_OVERRIDE { // Destroy the geometries stored for (unsigned int idx = 0; idx < m_SrcDataSetGeometries.size(); ++idx) @@ -132,15 +132,15 @@ protected: OGR_G_DestroyGeometry(m_SrcDataSetGeometries[idx]); } - if (m_OGRDataSourcePointer != NULL) + if (m_OGRDataSourcePointer != ITK_NULLPTR) { ogr::version_proxy::Close(m_OGRDataSourcePointer); } } - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: VectorDataToLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx index 94b4157c544ab86337f74b83cf66849495745c1f..80de3b44e97fc338e96036500ac1610bfce1cc46 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToLabelImageFilter_txx -#define __otbVectorDataToLabelImageFilter_txx +#ifndef otbVectorDataToLabelImageFilter_txx +#define otbVectorDataToLabelImageFilter_txx #include "gdal_alg.h" #include "ogr_srs_api.h" @@ -32,7 +32,7 @@ namespace otb template<class TVectorData, class TOutputImage> VectorDataToLabelImageFilter<TVectorData, TOutputImage> ::VectorDataToLabelImageFilter() - : m_OGRDataSourcePointer(0), + : m_OGRDataSourcePointer(ITK_NULLPTR), m_BurnAttribute("FID") { this->SetNumberOfRequiredInputs(1); @@ -165,7 +165,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> // Get the projection ref of the current VectorData std::string projectionRefWkt = vd->GetProjectionRef(); bool projectionInformationAvailable = !projectionRefWkt.empty(); - OGRSpatialReference * oSRS = NULL; + OGRSpatialReference * oSRS = ITK_NULLPTR; if (projectionInformationAvailable) { @@ -183,14 +183,14 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> InternalTreeNodeType * inputRoot = const_cast<InternalTreeNodeType *>(tree->GetRoot()); // Iterative method to build the layers from a VectorData - OGRLayer * ogrCurrentLayer = NULL; + OGRLayer * ogrCurrentLayer = ITK_NULLPTR; std::vector<OGRLayer *> ogrLayerVector; otb::OGRIOHelper::Pointer IOConversion = otb::OGRIOHelper::New(); // The method ConvertDataTreeNodeToOGRLayers create the // OGRDataSource but don t release it. Destruction is done in the // desctructor - m_OGRDataSourcePointer = NULL; + m_OGRDataSourcePointer = ITK_NULLPTR; ogrLayerVector = IOConversion->ConvertDataTreeNodeToOGRLayers(inputRoot, m_OGRDataSourcePointer, ogrCurrentLayer, @@ -210,10 +210,10 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> // Get the geometries of the layer OGRFeatureH hFeat; OGR_L_ResetReading( (OGRLayerH)(ogrLayerVector[idx2]) ); - while( ( hFeat = OGR_L_GetNextFeature( (OGRLayerH)(ogrLayerVector[idx2]) )) != NULL ) + while( ( hFeat = OGR_L_GetNextFeature( (OGRLayerH)(ogrLayerVector[idx2]) )) != ITK_NULLPTR ) { OGRGeometryH hGeom; - if( OGR_F_GetGeometryRef( hFeat ) == NULL ) + if( OGR_F_GetGeometryRef( hFeat ) == ITK_NULLPTR ) { OGR_F_Destroy( hFeat ); continue; @@ -241,7 +241,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> } // Destroy the oSRS - if (oSRS != NULL) + if (oSRS != ITK_NULLPTR) { OSRRelease(oSRS); } @@ -309,15 +309,15 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData() GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer())); // Burn the geometries into the dataset - if (dataset != NULL) + if (dataset != ITK_NULLPTR) { GDALRasterizeGeometries( dataset, m_BandsToBurn.size(), &(m_BandsToBurn[0]), m_SrcDataSetGeometries.size(), &(m_SrcDataSetGeometries[0]), - NULL, NULL, &(m_FullBurnValues[0]), - NULL, - GDALDummyProgress, NULL ); + ITK_NULLPTR, ITK_NULLPTR, &(m_FullBurnValues[0]), + ITK_NULLPTR, + GDALDummyProgress, ITK_NULLPTR ); // release the dataset GDALClose( dataset ); diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h index 14dd953410e337ec26a3d0ef66c65f152db1c9d8..ca2eae4f8460875e7490654b96614a4ccfeccfd2 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToLabelMapFilter_h -#define __otbVectorDataToLabelMapFilter_h +#ifndef otbVectorDataToLabelMapFilter_h +#define otbVectorDataToLabelMapFilter_h #include "itkLabelObject.h" #include "itkProgressReporter.h" @@ -158,18 +158,18 @@ public: const InputVectorDataType * GetInput(void); const InputVectorDataType * GetInput(unsigned int idx); - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; protected: VectorDataToLabelMapFilter(); - virtual ~VectorDataToLabelMapFilter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~VectorDataToLabelMapFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Standard pipeline method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** VectorDataToLabelMapFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx index e4d85af4fea7c31d1ff16930bd843334dadbef2c..0cad27cbc0d03883b137d98060578ca44d54e86b 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToLabelMapFilter_txx -#define __otbVectorDataToLabelMapFilter_txx +#ifndef otbVectorDataToLabelMapFilter_txx +#define otbVectorDataToLabelMapFilter_txx +#include "otbVectorDataToLabelMapFilter.h" #include "itkBinaryImageToLabelMapFilter.h" #include "itkNumericTraits.h" diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h index bc4c9432586df99cfca7beac280e859da1adafd7..2286de75b63e647efe1a0f4f2f3d7fd336e4a16b 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbVectorDataToLabelMapWithAttributesFilter_h -#define __otbVectorDataToLabelMapWithAttributesFilter_h +#ifndef otbVectorDataToLabelMapWithAttributesFilter_h +#define otbVectorDataToLabelMapWithAttributesFilter_h #include "itkLabelObject.h" #include "itkProgressReporter.h" @@ -184,20 +184,20 @@ public: ; itkGetMacro(InitialLabel, LabelType) ; - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; protected: VectorDataToLabelMapWithAttributesFilter(); - virtual ~VectorDataToLabelMapWithAttributesFilter() + ~VectorDataToLabelMapWithAttributesFilter() ITK_OVERRIDE { } - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** * Standard pipeline method. */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** VectorDataToLabelMapWithAttributesFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx index 138ef6608f24c49c9b026a89eb63943247814f9c..33ccb048c2ce52a511713258fffc8bf9c35cba23 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx @@ -15,9 +15,10 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbVectorDataToLabelMapWithAttributesFilter_txx -#define __otbVectorDataToLabelMapWithAttributesFilter_txx +#ifndef otbVectorDataToLabelMapWithAttributesFilter_txx +#define otbVectorDataToLabelMapWithAttributesFilter_txx +#include "otbVectorDataToLabelMapWithAttributesFilter.h" #include "itkBinaryImageToLabelMapFilter.h" #include "itkNumericTraits.h" @@ -224,7 +225,7 @@ VectorDataToLabelMapWithAttributesFilter<TVectorData, TLabelMap> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const TVectorData *> diff --git a/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h index b3f4778f46095321e91374ccb085b3fcde152c91..959d05ffdd799db2d45facbf62380a5ef29e32e2 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelToBoundaryImageFilter_h -#define __otbLabelToBoundaryImageFilter_h +#ifndef otbLabelToBoundaryImageFilter_h +#define otbLabelToBoundaryImageFilter_h #include "otbUnaryFunctorNeighborhoodImageFilter.h" @@ -30,7 +30,7 @@ namespace Functor * \brief Functor to extract segmentation boundaries * * Functor intended to work with 3x3 neighborhood and scalar label image - * The generated boundary is 1-pixel wide, so it is not symetric. + * The generated boundary is 1-pixel wide, so it is not symmetric. * Output value is 1 on the boundaries and 0 in the background * * \ingroup OTBLabelling @@ -63,7 +63,7 @@ public: * \brief Filter to extract boundaries of a label image * * Filter intended to work with a scalar label image. - * The generated boundary is 1-pixel wide, so it is not symetric. + * The generated boundary is 1-pixel wide, so it is not symmetric. * Output value is 1 on the boundaries and 0 in the background * * \ingroup OTBLabelling @@ -93,7 +93,7 @@ protected: { this->SetRadius(1); } - virtual ~LabelToBoundaryImageFilter() { } + ~LabelToBoundaryImageFilter() ITK_OVERRIDE { } private: LabelToBoundaryImageFilter( const Self & ); // Not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabeledOutputAccessor.h b/Modules/Segmentation/Labelling/include/otbLabeledOutputAccessor.h index 7c2edab22319a4813dfa46c1ab8d1ed361e5fdd9..2fd70360862a6352fb9533a02157dfd118f6d517 100644 --- a/Modules/Segmentation/Labelling/include/otbLabeledOutputAccessor.h +++ b/Modules/Segmentation/Labelling/include/otbLabeledOutputAccessor.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabeledOutputAccessor_h -#define __otbLabeledOutputAccessor_h +#ifndef otbLabeledOutputAccessor_h +#define otbLabeledOutputAccessor_h #include "itkMacro.h" diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h index 9e3e9a2f2625df6e371fa5b4810a96b646d055ea..df0f0776b30815322080b8ea049e77135c66fe0c 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeConfidenceConnectedImageFilter_h -#define __otbLabelizeConfidenceConnectedImageFilter_h +#ifndef otbLabelizeConfidenceConnectedImageFilter_h +#define otbLabelizeConfidenceConnectedImageFilter_h #include "itkConfidenceConnectedImageFilter.h" #include "otbLabelizeImageFilterBase.h" @@ -106,11 +106,11 @@ public: protected: LabelizeConfidenceConnectedImageFilter(); - virtual ~LabelizeConfidenceConnectedImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelizeConfidenceConnectedImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Region growing */ - virtual void RegionGrowing(const IndexType indexSeed); + void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; private: LabelizeConfidenceConnectedImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.txx b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.txx index 4e63b8fac7f1423340455fccbb919830137d4472..cd51d29bf76b6cee342cc437fb7c8279c4df962e 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.txx +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeConfidenceConnectedImageFilter_txx -#define __otbLabelizeConfidenceConnectedImageFilter_txx +#ifndef otbLabelizeConfidenceConnectedImageFilter_txx +#define otbLabelizeConfidenceConnectedImageFilter_txx #include "itkNumericTraits.h" diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h index f26a729e16da7b31f5dfc017b18061e5a25f4208..ddab2da4b45da4cf4e535f120606a635f143cb80 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeConnectedThresholdImageFilter_h -#define __otbLabelizeConnectedThresholdImageFilter_h +#ifndef otbLabelizeConnectedThresholdImageFilter_h +#define otbLabelizeConnectedThresholdImageFilter_h #include "itkConnectedThresholdImageFilter.h" #include "otbLabelizeImageFilterBase.h" @@ -79,11 +79,11 @@ public: protected: LabelizeConnectedThresholdImageFilter(); - virtual ~LabelizeConnectedThresholdImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelizeConnectedThresholdImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Region growing */ - virtual void RegionGrowing(const IndexType indexSeed); + void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; private: LabelizeConnectedThresholdImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.txx b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.txx index 9052c271831486a8e81f14d14e58081779372b6e..9ffa89dc927a5cb92926f9b682e8189cc185e82f 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.txx +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeConnectedThresholdImageFilter_txx -#define __otbLabelizeConnectedThresholdImageFilter_txx +#ifndef otbLabelizeConnectedThresholdImageFilter_txx +#define otbLabelizeConnectedThresholdImageFilter_txx #include "itkNumericTraits.h" diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h index 755d8856d646d82df72d97b9bb63734d7c9aba3b..060889ae2e18e863420370dfbb8c9270996db6c9 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeImageFilterBase_h -#define __otbLabelizeImageFilterBase_h +#ifndef otbLabelizeImageFilterBase_h +#define otbLabelizeImageFilterBase_h #include "itkImageToImageFilter.h" #include "itkAddImageFilter.h" @@ -93,11 +93,11 @@ public: protected: LabelizeImageFilterBase(); - virtual ~LabelizeImageFilterBase() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelizeImageFilterBase() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Region growing */ virtual void RegionGrowing(const IndexType itkNotUsed(indexSeed)) {} diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.txx b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.txx index 0fb39b10729be650bc1a13ee80980785c3968ef7..209ceba458f23ea54ff108a7dc5027b0f5fa4f52 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.txx +++ b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeImageFilterBase_txx -#define __otbLabelizeImageFilterBase_txx +#ifndef otbLabelizeImageFilterBase_txx +#define otbLabelizeImageFilterBase_txx #include "otbLabelizeImageFilterBase.h" diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h index 5dcf88b29f4d498c757f7ac8a2124c044a1ef73c..2eb07b8d09d8f8427581dd8ccd13981300f540f4 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeNeighborhoodConnectedImageFilter_h -#define __otbLabelizeNeighborhoodConnectedImageFilter_h +#ifndef otbLabelizeNeighborhoodConnectedImageFilter_h +#define otbLabelizeNeighborhoodConnectedImageFilter_h #include "itkNeighborhoodConnectedImageFilter.h" #include "otbLabelizeImageFilterBase.h" @@ -101,11 +101,11 @@ public: protected: LabelizeNeighborhoodConnectedImageFilter(); - virtual ~LabelizeNeighborhoodConnectedImageFilter() {} - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~LabelizeNeighborhoodConnectedImageFilter() ITK_OVERRIDE {} + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** Region growing */ - virtual void RegionGrowing(const IndexType indexSeed); + void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; private: LabelizeNeighborhoodConnectedImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.txx b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.txx index a1c51148ad734f6de9129fa4848fbd8d68f9cef9..fb190b8a493ff6b3c3aa754f985b1c29c55f1015 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.txx +++ b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbLabelizeNeighborhoodConnectedImageFilter_txx -#define __otbLabelizeNeighborhoodConnectedImageFilter_txx +#ifndef otbLabelizeNeighborhoodConnectedImageFilter_txx +#define otbLabelizeNeighborhoodConnectedImageFilter_txx #include "otbLabelizeNeighborhoodConnectedImageFilter.h" diff --git a/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.h b/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.h index 5c289b8209c281d1a630f051f4221ae5e9c3fd55..1ebeccfe33e20ef5588adf3fdee2d7112983a3fd 100644 --- a/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.h @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRelabelComponentImageFilter_h -#define __otbRelabelComponentImageFilter_h +#ifndef otbRelabelComponentImageFilter_h +#define otbRelabelComponentImageFilter_h #include "itkRelabelComponentImageFilter.h" #include <vector> diff --git a/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.txx b/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.txx index 926517686f0224e78137a7af5ce5cb607280fc77..84898fea59bd8b8fb781f23256e067bc345822d9 100644 --- a/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.txx +++ b/Modules/Segmentation/Labelling/include/otbRelabelComponentImageFilter.txx @@ -14,8 +14,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbRelabelComponentImageFilter_txx -#define __otbRelabelComponentImageFilter_txx +#ifndef otbRelabelComponentImageFilter_txx +#define otbRelabelComponentImageFilter_txx #include "otbRelabelComponentImageFilter.h" #include "itkImageRegionIterator.h" diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h index 5b394fd9593de55adeda3f8b1bfc5b2a24e04918..1a99bc5306281dda64bdf6c991f9c78231cd8702 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanShiftConnectedComponentSegmentationFilter_h -#define __otbMeanShiftConnectedComponentSegmentationFilter_h +#ifndef otbMeanShiftConnectedComponentSegmentationFilter_h +#define otbMeanShiftConnectedComponentSegmentationFilter_h #include "itkMacro.h" @@ -127,10 +127,10 @@ public: protected: MeanShiftConnectedComponentSegmentationFilter(); - virtual ~MeanShiftConnectedComponentSegmentationFilter(); + ~MeanShiftConnectedComponentSegmentationFilter() ITK_OVERRIDE; - void GenerateInputRequestedRegion(); - virtual void GenerateData(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.txx b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.txx index 21f4a819c881990d1c6bd156f857e61fffea9457..d8f221871b2f4f836256e6eeb38b57ff0ec0ae64 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.txx +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanShiftConnectedComponentSegmentationFilter_txx -#define __otbMeanShiftConnectedComponentSegmentationFilter_txx +#ifndef otbMeanShiftConnectedComponentSegmentationFilter_txx +#define otbMeanShiftConnectedComponentSegmentationFilter_txx #include "otbMeanShiftConnectedComponentSegmentationFilter.h" #include "itkExtractImageFilter.h" diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h index 7057b2016990e8c3a37f7aeb2088b7c16604e69f..9a6904629a099ce266e2a4e8702c3e0c7191e6b6 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanShiftSegmentationFilter_h -#define __otbMeanShiftSegmentationFilter_h +#ifndef otbMeanShiftSegmentationFilter_h +#define otbMeanShiftSegmentationFilter_h #include "itkMacro.h" @@ -170,11 +170,11 @@ public: protected: MeanShiftSegmentationFilter(); - virtual ~MeanShiftSegmentationFilter(); + ~MeanShiftSegmentationFilter() ITK_OVERRIDE; // virtual void GenerateOutputInformation(void); - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.txx b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.txx index 52ecb44e8915c5a4197d2b086719b1e2d013e74d..4a5790611fef4b4281545acb152bba5df8737925 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.txx +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMeanShiftSegmentationFilter_txx -#define __otbMeanShiftSegmentationFilter_txx +#ifndef otbMeanShiftSegmentationFilter_txx +#define otbMeanShiftSegmentationFilter_txx #include "otbMeanShiftSegmentationFilter.h" diff --git a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h index 200ceedde9e6d4f14fc9af6aaae72b345025ff35..5d2a3aff080cc40a7f9968d4a6d37eb290c63b0f 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h +++ b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbHooverInstanceFilter_h -#define __otbHooverInstanceFilter_h +#ifndef otbHooverInstanceFilter_h +#define otbHooverInstanceFilter_h #include <set> #include "itkInPlaceLabelMapFilter.h" @@ -207,30 +207,30 @@ public: protected: HooverInstanceFilter(); - ~HooverInstanceFilter() {}; + ~HooverInstanceFilter() ITK_OVERRIDE {}; /** Re implement the allocate output method to handle the second output correctly */ - virtual void AllocateOutputs(); + void AllocateOutputs() ITK_OVERRIDE; /** Re implement the release input method to handle the second input correctly */ - virtual void ReleaseInputs(); + void ReleaseInputs() ITK_OVERRIDE; /** Actions : * - Fill cardinalities of GT regions */ - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; /** Actions: * - Check matrix size * - Init cardinalities lists * - Fill cardinalities list for MS (GT is done by ThreadedProcessLabelObject) */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Actions : * - Compute Hoover instances */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; private: diff --git a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.txx b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.txx index b64bad1248c0a96e5a7a197bac064fa537c2d17f..b67aba294817578388e979da4bd11639bbcd25b5 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.txx +++ b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHooverInstanceFilter_txx -#define __otbHooverInstanceFilter_txx +#ifndef otbHooverInstanceFilter_txx +#define otbHooverInstanceFilter_txx #include "otbHooverInstanceFilter.h" #include "otbMacro.h" diff --git a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h index fb2395bf90cb22fb5b16bdffa658365cca477e94..1dd0cd314d28d53c2fc0d541558a681d490f6d79 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h +++ b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbHooverMatrixFilter_h -#define __otbHooverMatrixFilter_h +#ifndef otbHooverMatrixFilter_h +#define otbHooverMatrixFilter_h #include "itkLabelMapFilter.h" #include "itkVariableSizeMatrix.h" @@ -86,16 +86,16 @@ protected: /** Constructor */ HooverMatrixFilter(); - ~HooverMatrixFilter() {}; + ~HooverMatrixFilter() ITK_OVERRIDE {}; /** Action : Resize the matrix */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** Action : fill the line of the confusion matrix corresponding to * the given label object */ - virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject ); + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; private: diff --git a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.txx b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.txx index 3377f2b23ec573722ae40eb0fee2a2496736f903..1dcf0bce2370ec710d3f14443f659e7d203ddfc1 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.txx +++ b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbHooverMatrixFilter_txx -#define __otbHooverMatrixFilter_txx +#ifndef otbHooverMatrixFilter_txx +#define otbHooverMatrixFilter_txx #include "otbHooverMatrixFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h index c7290c59744daa911c443de3659901049d3cfdc1..9d31c45d8f945418553aeb44a103cad48fc8240d 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbClosingOpeningMorphologicalFilter_h -#define __otbClosingOpeningMorphologicalFilter_h +#ifndef otbClosingOpeningMorphologicalFilter_h +#define otbClosingOpeningMorphologicalFilter_h #include "itkImageToImageFilter.h" @@ -76,15 +76,15 @@ protected: /** Constructor */ ClosingOpeningMorphologicalFilter(); /** Destructor */ - ~ClosingOpeningMorphologicalFilter() {} + ~ClosingOpeningMorphologicalFilter() ITK_OVERRIDE {} /* void GenerateInputRequestedRegion(); */ /* void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)); */ /** Main computation method */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ClosingOpeningMorphologicalFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.txx index a463e5235091c11e45ff2589085697b34cb39060..39140b8b3f98fa6ce24632fc27e289b035fda696 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbClosingOpeningMorphologicalFilter_txx -#define __otbClosingOpeningMorphologicalFilter_txx +#ifndef otbClosingOpeningMorphologicalFilter_txx +#define otbClosingOpeningMorphologicalFilter_txx #include "otbClosingOpeningMorphologicalFilter.h" #include "itkUnaryFunctorImageFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h index 0db26672c632fa7912377d2d55a30eb387fc2e58..5cca5ac4253c93b7e8eb0c3e04bd42970c3a790f 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbConvexOrConcaveClassificationFilter_h -#define __otbConvexOrConcaveClassificationFilter_h +#ifndef otbConvexOrConcaveClassificationFilter_h +#define otbConvexOrConcaveClassificationFilter_h #include "itkBinaryFunctorImageFilter.h" namespace otb @@ -212,7 +212,7 @@ public: * */ using Superclass::SetInput; - void SetInput(const TInputImage * image) + void SetInput(const TInputImage * image) ITK_OVERRIDE { this->SetInput1(image); } @@ -239,7 +239,7 @@ public: itkGetMacro(Sigma, double); /** Set the functor parameters before calling the ThreadedGenerateData() */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { this->GetFunctor().SetConvexLabel(m_ConvexLabel); this->GetFunctor().SetConcaveLabel(m_ConcaveLabel); @@ -257,9 +257,9 @@ protected: m_Sigma = 0.0; }; /** Destructor */ - virtual ~ConvexOrConcaveClassificationFilter() {} + ~ConvexOrConcaveClassificationFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "ConvexLabel: " << m_ConvexLabel << std::endl; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h index e7bdcf20e86b8e334623b839cfe351b907673c85..bc8a2915b3896d264507b262b07b51ae86bd6b48 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeodesicMorphologyDecompositionImageFilter_h -#define __otbGeodesicMorphologyDecompositionImageFilter_h +#ifndef otbGeodesicMorphologyDecompositionImageFilter_h +#define otbGeodesicMorphologyDecompositionImageFilter_h #include "otbGeodesicMorphologyLevelingFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -146,13 +146,13 @@ public: protected: /** GenerateData */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ GeodesicMorphologyDecompositionImageFilter(); /** Destructor */ - virtual ~GeodesicMorphologyDecompositionImageFilter() {} + ~GeodesicMorphologyDecompositionImageFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: GeodesicMorphologyDecompositionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.txx index c44308f34abacd4020efa56f56c3a3b0acd4aaba..bb910c8192f934669b3efd463e67d840b26c6acd 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeodesicMorphologyDecompositionImageFilter_txx -#define __otbGeodesicMorphologyDecompositionImageFilter_txx +#ifndef otbGeodesicMorphologyDecompositionImageFilter_txx +#define otbGeodesicMorphologyDecompositionImageFilter_txx #include "otbGeodesicMorphologyDecompositionImageFilter.h" @@ -100,7 +100,7 @@ GeodesicMorphologyDecompositionImageFilter<TInputImage, TOutputImage, TStructuri { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *> (this->itk::ProcessObject::GetOutput(1)); @@ -116,7 +116,7 @@ GeodesicMorphologyDecompositionImageFilter<TInputImage, TOutputImage, TStructuri { if (this->GetNumberOfOutputs() < 3) { - return 0; + return ITK_NULLPTR; } return static_cast<OutputImageType *> (this->itk::ProcessObject::GetOutput(2)); diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h index d29e0a923dff31c05915e1e7cf78002ad2aa866d..e37c89b1a7b8810e43d7485bc33895564aff7f1b 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeodesicMorphologyIterativeDecompositionImageFilter_h -#define __otbGeodesicMorphologyIterativeDecompositionImageFilter_h +#ifndef otbGeodesicMorphologyIterativeDecompositionImageFilter_h +#define otbGeodesicMorphologyIterativeDecompositionImageFilter_h #include "otbImageToImageListFilter.h" #include "otbGeodesicMorphologyDecompositionImageFilter.h" @@ -113,7 +113,7 @@ public: * Get The leveling images for each scale. * \return The leveling images for each scale. */ - OutputImageListType* GetOutput(void); + OutputImageListType* GetOutput(void) ITK_OVERRIDE; /** * Get convex membership function for each scale * \return The convex membership function for each scale. @@ -129,15 +129,15 @@ protected: /** Constructor */ GeodesicMorphologyIterativeDecompositionImageFilter(); /** Destructor */ - virtual ~GeodesicMorphologyIterativeDecompositionImageFilter() {} + ~GeodesicMorphologyIterativeDecompositionImageFilter() ITK_OVERRIDE {} /** Generate output information */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** Generate input requested region */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Main computation method */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** Printself method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: /** The step for the scale analysis */ diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.txx index 7896e12cabb8fcfbf7a5995e24ab9b68b60d511a..7300212e247abf6130a4f7a44724d307ea8988d3 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeodesicMorphologyIterativeDecompositionImageFilter_txx -#define __otbGeodesicMorphologyIterativeDecompositionImageFilter_txx +#ifndef otbGeodesicMorphologyIterativeDecompositionImageFilter_txx +#define otbGeodesicMorphologyIterativeDecompositionImageFilter_txx #include "otbGeodesicMorphologyIterativeDecompositionImageFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h index 2c2a999fb9c828881b64ba8be66159628d9fddae..d28301b0322b5f1424667694204b4584dc8600c0 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbGeodesicMorphologyLevelingFilter_h -#define __otbGeodesicMorphologyLevelingFilter_h +#ifndef otbGeodesicMorphologyLevelingFilter_h +#define otbGeodesicMorphologyLevelingFilter_h #include "itkTernaryFunctorImageFilter.h" @@ -114,7 +114,7 @@ public: * Set the original input image */ using Superclass::SetInput; - void SetInput(const TInputImage * input) + void SetInput(const TInputImage * input) ITK_OVERRIDE { this->SetInput1(input); } @@ -123,9 +123,9 @@ protected: /** Constructor */ GeodesicMorphologyLevelingFilter() {}; /** Destructor */ - virtual ~GeodesicMorphologyLevelingFilter() {} + ~GeodesicMorphologyLevelingFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h index eef5ff4957216ce221ef5410ee711379e9739d61..f8d61dff778e29e5e62679fa2da5ef60f4a5f39a 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToProfileFilter_h -#define __otbImageToProfileFilter_h +#ifndef otbImageToProfileFilter_h +#define otbImageToProfileFilter_h #include "otbImageToImageListFilter.h" @@ -88,17 +88,17 @@ protected: /** Get the pointer to the filter */ itkGetObjectMacro(Filter, FilterType); /** GenerateData method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** GenerateOutputInformation method */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Constructor */ ImageToProfileFilter(); /** Destructor */ - virtual ~ImageToProfileFilter() {} + ~ImageToProfileFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ImageToProfileFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.txx index 461c38d0befc93c3112a5f70eb1beb44ae37d936..2111e40c77fe14f10c721a4da197416b01c3762f 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImageToProfileFilter_txx -#define __otbImageToProfileFilter_txx +#ifndef otbImageToProfileFilter_txx +#define otbImageToProfileFilter_txx #include "otbImageToProfileFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h index c826c615a80504edb4e345f3077ec9c1b0be376c..b290c526fbcea51330ebb76362556bf2a3af936a 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalClosingProfileFilter_h -#define __otbMorphologicalClosingProfileFilter_h +#ifndef otbMorphologicalClosingProfileFilter_h +#define otbMorphologicalClosingProfileFilter_h #include "otbImageToProfileFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -74,7 +74,7 @@ public: protected: /** Set the profile parameter */ - virtual void SetProfileParameter(ParameterType param) + void SetProfileParameter(ParameterType param) ITK_OVERRIDE { StructuringElementType se; se.SetRadius(param); @@ -84,9 +84,9 @@ protected: /** Constructor */ MorphologicalClosingProfileFilter() {}; /** Destructor */ - virtual ~MorphologicalClosingProfileFilter() {} + ~MorphologicalClosingProfileFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h index 08330d8b9ca65ca249c880e37b9d284daedf73e7..6caac39a23e0fa8dde2ce5d3ba44c028680cb8ba 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalOpeningProfileFilter_h -#define __otbMorphologicalOpeningProfileFilter_h +#ifndef otbMorphologicalOpeningProfileFilter_h +#define otbMorphologicalOpeningProfileFilter_h #include "otbImageToProfileFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -74,7 +74,7 @@ public: protected: /** Set the profile parameter */ - virtual void SetProfileParameter(ParameterType param) + void SetProfileParameter(ParameterType param) ITK_OVERRIDE { StructuringElementType se; se.SetRadius(param); @@ -84,9 +84,9 @@ protected: /** Constructor */ MorphologicalOpeningProfileFilter() {}; /** Destructor */ - virtual ~MorphologicalOpeningProfileFilter() {} + ~MorphologicalOpeningProfileFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h index b6f6fc8ae34d2d8fba3a705ea5f35c05b7925067..38d68415e64a176e8d630503d45a445f09444159 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalProfilesSegmentationFilter_h -#define __otbMorphologicalProfilesSegmentationFilter_h +#ifndef otbMorphologicalProfilesSegmentationFilter_h +#define otbMorphologicalProfilesSegmentationFilter_h #include "otbMorphologicalOpeningProfileFilter.h" #include "otbMorphologicalClosingProfileFilter.h" @@ -103,9 +103,9 @@ itkGetConstReferenceMacro(Sigma,double); protected: MorphologicalProfilesSegmentationFilter(); -virtual ~MorphologicalProfilesSegmentationFilter(); +~MorphologicalProfilesSegmentationFilter() ITK_OVERRIDE; -virtual void GenerateData(); +void GenerateData() ITK_OVERRIDE; private: typename OpeningProfileFilterType::Pointer m_OpeningProfile; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.txx index 770ea7651204ef9225d1ec69cceb56d7d4ad99ed..6c3caf76cb879ea6b33e52ed71699db2a9fffdf1 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMorphologicalProfilesSegmentationFilter_txx -#define __otbMorphologicalProfilesSegmentationFilter_txx +#ifndef otbMorphologicalProfilesSegmentationFilter_txx +#define otbMorphologicalProfilesSegmentationFilter_txx #include "otbMorphologicalProfilesSegmentationFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h index fe8b16dd9ea4c49dbba35e5e8a618866f751a448..32d0899e01db4838ac45a78307e62e9be66bc628 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbMultiScaleConvexOrConcaveClassificationFilter_h -#define __otbMultiScaleConvexOrConcaveClassificationFilter_h +#ifndef otbMultiScaleConvexOrConcaveClassificationFilter_h +#define otbMultiScaleConvexOrConcaveClassificationFilter_h #include "otbQuaternaryFunctorImageFilter.h" namespace otb @@ -219,7 +219,7 @@ public: itkGetMacro(LabelSeparator, LabelType); /** Set the functor parameters before calling the ThreadedGenerateData() */ - virtual void BeforeThreadedGenerateData(void) + void BeforeThreadedGenerateData(void) ITK_OVERRIDE { this->GetFunctor().SetLabelSeparator(m_LabelSeparator); this->GetFunctor().SetSigma(m_Sigma); @@ -233,9 +233,9 @@ protected: m_Sigma = 0.0; }; /** Destructor */ - virtual ~MultiScaleConvexOrConcaveClassificationFilter() {} + ~MultiScaleConvexOrConcaveClassificationFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "LabelSeparator: " << m_LabelSeparator << std::endl; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h index 7bcf55ab9f92876ffac18e4db00ffeb431b7cfdd..6c9e6418992ebb54de9ea7e2a2147bfe3b27ae37 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpeningClosingMorphologicalFilter_h -#define __otbOpeningClosingMorphologicalFilter_h +#ifndef otbOpeningClosingMorphologicalFilter_h +#define otbOpeningClosingMorphologicalFilter_h #include "itkImageToImageFilter.h" @@ -76,15 +76,15 @@ protected: /** Constructor */ OpeningClosingMorphologicalFilter(); /** Destructor */ - ~OpeningClosingMorphologicalFilter() {} + ~OpeningClosingMorphologicalFilter() ITK_OVERRIDE {} /* void GenerateInputRequestedRegion(); */ /* void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)); */ /** Main computation method */ - void GenerateData(); + void GenerateData() ITK_OVERRIDE; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: OpeningClosingMorphologicalFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.txx index 66955a3e744a0382688625da4dcbbe82b3e7eb16..2ed171df0c211585d21b17737d98fe318c7a4dfa 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOpeningClosingMorphologicalFilter_txx -#define __otbOpeningClosingMorphologicalFilter_txx +#ifndef otbOpeningClosingMorphologicalFilter_txx +#define otbOpeningClosingMorphologicalFilter_txx #include "otbOpeningClosingMorphologicalFilter.h" #include "itkUnaryFunctorImageFilter.h" diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h index 4280c2a3448f9ed77286f05ce5397bd43c620164..b842d7420830e9dd3e241c282b66a2b5c9940377 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProfileDerivativeToMultiScaleCharacteristicsFilter_h -#define __otbProfileDerivativeToMultiScaleCharacteristicsFilter_h +#ifndef otbProfileDerivativeToMultiScaleCharacteristicsFilter_h +#define otbProfileDerivativeToMultiScaleCharacteristicsFilter_h #include "otbImageListToImageFilter.h" @@ -83,26 +83,26 @@ public: protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** * GenerateInputRequestedRegion * Set the requested region of each image in the list. */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; /** Constructor */ ProfileDerivativeToMultiScaleCharacteristicsFilter(); /** Destructor */ - virtual ~ProfileDerivativeToMultiScaleCharacteristicsFilter() {} + ~ProfileDerivativeToMultiScaleCharacteristicsFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ProfileDerivativeToMultiScaleCharacteristicsFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.txx index b6eff7705102320b82dbcdbec02938781af73505..841bc57c78ab336321f618073ab63a33c2ad6f1e 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProfileDerivativeToMultiScaleCharacteristicsFilter_txx -#define __otbProfileDerivativeToMultiScaleCharacteristicsFilter_txx +#ifndef otbProfileDerivativeToMultiScaleCharacteristicsFilter_txx +#define otbProfileDerivativeToMultiScaleCharacteristicsFilter_txx #include "otbProfileDerivativeToMultiScaleCharacteristicsFilter.h" #include "itkImageRegionIterator.h" @@ -43,7 +43,7 @@ ProfileDerivativeToMultiScaleCharacteristicsFilter<TInputImage, TOutputImage, TL { if (this->GetNumberOfOutputs() < 2) { - return 0; + return ITK_NULLPTR; } return static_cast<LabeledImageType *> (this->itk::ProcessObject::GetOutput(1)); diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h index 98048b8aa8e13cc8cb04e4d9135a386ebb17ecb4..8f0387087aabb3a0eb3ecf18408746cbf3255d12 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProfileToProfileDerivativeFilter_h -#define __otbProfileToProfileDerivativeFilter_h +#ifndef otbProfileToProfileDerivativeFilter_h +#define otbProfileToProfileDerivativeFilter_h #include "otbImageListToImageListFilter.h" #include "itkUnaryFunctorImageFilter.h" @@ -75,20 +75,20 @@ public: /** Generate output information for the ImageList and for each image in the list. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Generate input requested region for each image in the list. */ - virtual void GenerateInputRequestedRegion(void); + void GenerateInputRequestedRegion(void) ITK_OVERRIDE; protected: /** Main computation method */ - virtual void GenerateData(void); + void GenerateData(void) ITK_OVERRIDE; /** Constructor */ ProfileToProfileDerivativeFilter(); /** Destructor */ - virtual ~ProfileToProfileDerivativeFilter() {} + ~ProfileToProfileDerivativeFilter() ITK_OVERRIDE {} /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; private: ProfileToProfileDerivativeFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.txx b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.txx index b3e0f9577cfdd63d1248ad02038e3f5192ae89ff..6f7674de798abf01b378f83780e8f207dd0dc879 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.txx +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbProfileToProfileDerivativeFilter_txx -#define __otbProfileToProfileDerivativeFilter_txx +#ifndef otbProfileToProfileDerivativeFilter_txx +#define otbProfileToProfileDerivativeFilter_txx #include "otbProfileToProfileDerivativeFilter.h" diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h index 4f606468e75eefd8db2c22fea84221aa0d2e2497..b749bca797be5d550a79e9a83b859f96e841b701 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h +++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRLayerStreamStitchingFilter_h -#define __otbOGRLayerStreamStitchingFilter_h +#ifndef otbOGRLayerStreamStitchingFilter_h +#define otbOGRLayerStreamStitchingFilter_h #include "otbOGRDataSourceWrapper.h" #include "otbMacro.h" @@ -103,11 +103,11 @@ public: itkGetMacro(StreamSize, SizeType); /** Generate Data method. This method must be called explicitly (not through the \c Update method). */ - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; protected: OGRLayerStreamStitchingFilter(); - virtual ~OGRLayerStreamStitchingFilter() {} + ~OGRLayerStreamStitchingFilter() ITK_OVERRIDE {} struct FusionStruct { diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx index a077dca97ce85e5a9de5e72f46051667c2412814..4e8b88b0961b01098aeed170a42cb3fd032e0d69 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx +++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbOGRLayerStreamStitchingFilter_txx -#define __otbOGRLayerStreamStitchingFilter_txx +#ifndef otbOGRLayerStreamStitchingFilter_txx +#define otbOGRLayerStreamStitchingFilter_txx #include "otbOGRLayerStreamStitchingFilter.h" #include "itkContinuousIndex.h" @@ -31,7 +31,7 @@ namespace otb template<class TImage> OGRLayerStreamStitchingFilter<TImage> -::OGRLayerStreamStitchingFilter() : m_Radius(2), m_OGRLayer(NULL, false) +::OGRLayerStreamStitchingFilter() : m_Radius(2), m_OGRLayer(ITK_NULLPTR, false) { m_StreamSize.Fill(0); } @@ -52,7 +52,7 @@ OGRLayerStreamStitchingFilter<TInputImage> { if (this->GetNumberOfInputs() < 1) { - return 0; + return ITK_NULLPTR; } return static_cast<const InputImageType *>(this->Superclass::GetInput(0)); diff --git a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h index fea9821b8f3ba2d5cb3588d6b078c2b1eab09885..e62521a5a29ef07caa714245fb9cb060762c23ab 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h +++ b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingImageToOGRLayerSegmentationFilter_h -#define __otbStreamingImageToOGRLayerSegmentationFilter_h +#ifndef otbStreamingImageToOGRLayerSegmentationFilter_h +#define otbStreamingImageToOGRLayerSegmentationFilter_h #include "itkExtractImageFilter.h" @@ -143,14 +143,14 @@ public: protected: PersistentImageToOGRLayerSegmentationFilter(); - virtual ~PersistentImageToOGRLayerSegmentationFilter(); + ~PersistentImageToOGRLayerSegmentationFilter() ITK_OVERRIDE; private: PersistentImageToOGRLayerSegmentationFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - virtual OGRDataSourcePointerType ProcessTile(); + OGRDataSourcePointerType ProcessTile() ITK_OVERRIDE; int m_TileMaxLabel; @@ -348,7 +348,7 @@ protected: /** Constructor */ StreamingImageToOGRLayerSegmentationFilter() {} /** Destructor */ - virtual ~StreamingImageToOGRLayerSegmentationFilter() {} + ~StreamingImageToOGRLayerSegmentationFilter() ITK_OVERRIDE {} private: StreamingImageToOGRLayerSegmentationFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx index c9f94d006cd1e4356aca528dbcc6db1365fb6d61..bf952c9939eeac7bfce84446451f6b8e14a5c357 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx +++ b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbStreamingImageToOGRLayerSegmentationFilter_txx -#define __otbStreamingImageToOGRLayerSegmentationFilter_txx +#ifndef otbStreamingImageToOGRLayerSegmentationFilter_txx +#define otbStreamingImageToOGRLayerSegmentationFilter_txx #include "otbStreamingImageToOGRLayerSegmentationFilter.h" diff --git a/Modules/Segmentation/OGRProcessing/test/otbOGRLayerStreamStitchingFilter.cxx b/Modules/Segmentation/OGRProcessing/test/otbOGRLayerStreamStitchingFilter.cxx index ce622a15a80a5067b210008e930315d33f33c863..a18726e4d9bfca10b8779adc8325c6268a0e14b6 100644 --- a/Modules/Segmentation/OGRProcessing/test/otbOGRLayerStreamStitchingFilter.cxx +++ b/Modules/Segmentation/OGRProcessing/test/otbOGRLayerStreamStitchingFilter.cxx @@ -85,7 +85,7 @@ int otbOGRLayerStreamStitchingFilter(int argc, char * argv[]) //REPACK the layer to remove features marked as deleted in the Shapefile. std::string sql("REPACK "); sql = sql + layerName; - ogrDS->ExecuteSQL(sql , NULL, NULL); + ogrDS->ExecuteSQL(sql , ITK_NULLPTR, ITK_NULLPTR); return EXIT_SUCCESS; } diff --git a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h index 2f16a8587d2c2db5f5430d8a6c36f92c7b04acc6..9972ff9a2474c1e4dfe39723baaef3f81112ea2f 100644 --- a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h +++ b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWatershedSegmentationFilter_h -#define __otbWatershedSegmentationFilter_h +#ifndef otbWatershedSegmentationFilter_h +#define otbWatershedSegmentationFilter_h #include "otbMacro.h" #include "itkUnaryFunctorImageFilter.h" @@ -81,9 +81,9 @@ public: protected: WatershedSegmentationFilter(); - virtual ~WatershedSegmentationFilter(); + ~WatershedSegmentationFilter() ITK_OVERRIDE; - virtual void GenerateData(); + void GenerateData() ITK_OVERRIDE; private: typename CastImageFilterType::Pointer m_CastFilter; diff --git a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.txx b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.txx index 4e60d088d7dc01d02bd069b1efc856e4d6e981d2..6fb1c509d7da63d37e15797c4db13651f0716910 100644 --- a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.txx +++ b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWatershedSegmentationFilter_txx -#define __otbWatershedSegmentationFilter_txx +#ifndef otbWatershedSegmentationFilter_txx +#define otbWatershedSegmentationFilter_txx #include "otbWatershedSegmentationFilter.h" diff --git a/Modules/ThirdParty/Boost/CMakeLists.txt b/Modules/ThirdParty/Boost/CMakeLists.txt index 96a21c8faceecc2aee1f5cf51362e8831912547b..be133cffe4458fb17ac5dbb9d8924b606ae85039 100644 --- a/Modules/ThirdParty/Boost/CMakeLists.txt +++ b/Modules/ThirdParty/Boost/CMakeLists.txt @@ -7,6 +7,8 @@ if(Boost_LIBRARIES) set(OTBBoost_LIBRARIES "${Boost_LIBRARIES}") endif() +set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" CACHE INTERNAL "" FORCE) + otb_module_impl() install(DIRECTORY ${OTBBoost_SOURCE_DIR}/src/boost diff --git a/Modules/ThirdParty/Boost/otb-module-init.cmake b/Modules/ThirdParty/Boost/otb-module-init.cmake index ea68e120484c2bdc30ca6127b81b75855b00bf15..6efec0892440b10cc607d58ca2989cc451f272d1 100644 --- a/Modules/ThirdParty/Boost/otb-module-init.cmake +++ b/Modules/ThirdParty/Boost/otb-module-init.cmake @@ -1,19 +1,11 @@ -# Required -message(STATUS "Looking for required Boost headers") -find_package ( Boost - 1.35.0 - REQUIRED - ) +find_package (Boost 1.35.0 REQUIRED) -# Optional components -# Boost (OPTIONAL_COMPONENTS does not work with Boost find_package) -# unit_test_framework component is used only in GdalAdapters module if (BUILD_TESTING) - set(OTB_Boost_OPTIONAL_COMPONENTS unit_test_framework) - message(STATUS "Looking for optional Boost components : ${OTB_Boost_OPTIONAL_COMPONENTS}") - find_package ( Boost - QUIET - 1.35.0 - COMPONENTS ${OTB_Boost_OPTIONAL_COMPONENTS} - ) -endif() + find_package (Boost 1.35.0 QUIET + COMPONENTS unit_test_framework) + if (NOT Boost_UNIT_TEST_FRAMEWORK_FOUND) + message(STATUS "Boost unit_test_framework not found. Hence otbOGRTests will be skipped") + else() + message(STATUS "Found Boost components: unit_test_framework") + endif() +endif() #BUILD_TESTING diff --git a/Modules/ThirdParty/Boost/src/boost/type_traits/is_contiguous.h b/Modules/ThirdParty/Boost/src/boost/type_traits/is_contiguous.h index 1f93a4340d95b662b45bd3c4bb003c988cb610f3..6e492883f828dde9ce33e2369be566605633a7a1 100644 --- a/Modules/ThirdParty/Boost/src/boost/type_traits/is_contiguous.h +++ b/Modules/ThirdParty/Boost/src/boost/type_traits/is_contiguous.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __is_contiguous_h -#define __is_contiguous_h +#ifndef is_contiguous_h +#define is_contiguous_h /**\ingroup boost * \file is_contiguous.h diff --git a/Modules/ThirdParty/Boost/src/otbBoostDox.h b/Modules/ThirdParty/Boost/src/otbBoostDox.h index d019018f2b11dfa2b43cf1390c5e902833f1ab81..368507c105beefc7fab7716098f00272b6f0ee40 100644 --- a/Modules/ThirdParty/Boost/src/otbBoostDox.h +++ b/Modules/ThirdParty/Boost/src/otbBoostDox.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbBoostDox_h -#define __otbBoostDox_h +#ifndef otbBoostDox_h +#define otbBoostDox_h /**\defgroup boost Boost alike helpers * \ingroup Thematic @@ -27,4 +27,4 @@ namespace boost { } //@} -#endif // __otbBoostDox_h +#endif // otbBoostDox_h diff --git a/Modules/ThirdParty/Curl/src/otb_curl.h.in b/Modules/ThirdParty/Curl/src/otb_curl.h.in index 5a04d6b6493f6e42fc93d5a406205d834da83f93..0902efa5b21b2fb77deeada131a658ec3ea3a82a 100644 --- a/Modules/ThirdParty/Curl/src/otb_curl.h.in +++ b/Modules/ThirdParty/Curl/src/otb_curl.h.in @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otb_curl_h -#define __otb_curl_h +#ifndef otb_curl_h +#define otb_curl_h #cmakedefine OTB_CURL_MULTI_AVAILABLE #include <curl/curl.h> diff --git a/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx b/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx index d147d5e2f284984ddc65a8ac7f77286c6a3c13d7..4eadd75959a5bca0b18759d732b9175cb37f2dfa 100644 --- a/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx +++ b/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx @@ -1,44 +1,55 @@ -#include <iostream> -#include <stdexcept> #include <gdal.h> #include <gdal_priv.h> -#include "cpl_string.h" - +#include <cpl_string.h> +#include <stdlib.h> +#include <stdio.h> int main(int argc, char * argv[]) -{ - const char *pszFormat = argv[1]; - GDALDriver *poDriver,*poDriver2; - char **papszCreateOptions=NULL; - - if(argc==5) +{ + GDALAllRegister(); + + const char *pszFormat = argv[3]; + + GDALDriverH hDriver = GDALGetDriverByName( pszFormat ); + + if( hDriver == NULL ) { + printf ("gdalCreateCopyTest.cxx: hDriver == NULL "); + return EXIT_FAILURE; + } + + char **papszCreateOptions = NULL; + + if( argc == 5 ) { + papszCreateOptions = CSLAddString( papszCreateOptions, argv[4] ); + } + + char **papszMetadata; + papszMetadata = GDALGetMetadata( hDriver, NULL ); + if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) ) + printf( "Driver %s supports CreateCopy() method.\n", pszFormat ); + + GDALDatasetH hSrcDS = GDALOpen( argv[1], GA_ReadOnly ); + if( hSrcDS == NULL ) { + printf ("gdalCreateCopyTest.cxx: hSrcDS == NULL "); + return EXIT_FAILURE; + } + + GDALDatasetH hDstDS; + hDstDS = GDALCreateCopy( hDriver, argv[2], hSrcDS, FALSE, NULL, NULL, NULL ); + + if( hDstDS == NULL ) { - papszCreateOptions = CSLAddString( papszCreateOptions, argv[4] ); - std::cout << "argv[4] = " << argv[4] << std::endl; - } - - GDALAllRegister(); - - GDALDriverH drv = NULL; - - std::cout << GDALGetDriverShortName(GDALGetDriverByName("GTiff")) << std::endl; - std::cout << GDALVersionInfo("RELEASE_NAME") << std::endl; - - // ------------------- step 1 ------------------- - GDALDataset *poSrcDS = - (GDALDataset *) GDALOpen( argv[1], GA_ReadOnly ); - GDALDataset *poDstDS; - - //poDriver2 = (GDALDriver *) GDALGetDriver(19); - poDriver2 = (GDALDriver *) GDALGetDriverByName(argv[3]); - poDstDS = poDriver2->CreateCopy( argv[2], poSrcDS, FALSE, papszCreateOptions, NULL, NULL ); - - // ------------------- step 2 ------------------- - if( poDstDS != NULL ) - GDALClose( (GDALDatasetH) poDstDS ); - - return 1; // SUCCESS + printf ("gdalCreateCopyTest.cxx: hDstDS == NULL "); + return EXIT_FAILURE; + } + + +/* Once we're done, close properly the dataset */ + if( hDstDS != NULL ) + GDALClose( hDstDS ); + + GDALClose(hSrcDS); + + return EXIT_SUCCESS; } -//GDALDataset * CreateCopy (const char *, GDALDataset *, int, char **, GDALProgressFunc pfnProgress, void *pProgressData) CPL_WARN_UNUSED_RESULT -//GDALCreateCopy (GDALDriverH, const char *, GDALDatasetH, int, char **, GDALProgressFunc, void *) diff --git a/Modules/ThirdParty/GDAL/gdalCreateTest.cxx b/Modules/ThirdParty/GDAL/gdalCreateTest.cxx index 894579de438ddba9076d9b71eacef2e0b595d439..34b81e9e7aa82ff24be9c9f6d5150aa54cb90c4a 100644 --- a/Modules/ThirdParty/GDAL/gdalCreateTest.cxx +++ b/Modules/ThirdParty/GDAL/gdalCreateTest.cxx @@ -7,56 +7,58 @@ int main(int argc, char * argv[]) { - const char *pszFormat = argv[1]; - GDALDriver *poDriver; - char **papszMetadata; + const char *pszFormat = argv[1]; + char **papszMetadata; GDALAllRegister(); // ------------------- step 1 ------------------- - poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat); - - if( poDriver == NULL ) - { - std::cout << "poDriver NULL" << std::endl; - - return 0; //FAIL - } - - papszMetadata = poDriver->GetMetadata(); - if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) ) - printf( "Driver %s supports Create() method.\n", pszFormat ); - if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) ) - printf( "Driver %s supports CreateCopy() method.\n", pszFormat ); - - // ------------------- step 2 ------------------- - GDALDataset *poDstDS; - char **papszOptions = NULL; - - poDstDS = poDriver->Create( argv[2], 512, 512, 1, GDT_Byte, - papszOptions ); - - // ------------------- step 3 ------------------- - double adfGeoTransform[6] = { 444720, 30, 0, 3751320, 0, -30 }; - OGRSpatialReference oSRS; - char *pszSRS_WKT = NULL; - GDALRasterBand *poBand; - GByte abyRaster[512*512]; - - poDstDS->SetGeoTransform( adfGeoTransform ); - - oSRS.SetUTM( 11, TRUE ); - oSRS.SetWellKnownGeogCS( "NAD27" ); - oSRS.exportToWkt( &pszSRS_WKT ); - poDstDS->SetProjection( pszSRS_WKT ); - CPLFree( pszSRS_WKT ); - - poBand = poDstDS->GetRasterBand(1); - poBand->RasterIO( GF_Write, 0, 0, 512, 512, - abyRaster, 512, 512, GDT_Byte, 0, 0 ); + GDALDriverH hDriver = GDALGetDriverByName( pszFormat ); + + if( hDriver == NULL ) { + printf("poDriver == NULL\n" ); + return EXIT_FAILURE; + } + + papszMetadata = GDALGetMetadata( hDriver, NULL ); + + if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) ) + printf( "Driver %s supports Create() method.\n", pszFormat ); + else { + printf( "Driver %s does supports Create() method.\n", pszFormat ); + return EXIT_FAILURE; + } + + // ------------------- step 2 ------------------- + + GDALDatasetH hDstDS; + char **papszOptions = NULL; + hDstDS = GDALCreate( hDriver, argv[2], 512, 512, 1, GDT_Byte, + papszOptions ); + + // ------------------- step 3 ------------------- + + double adfGeoTransform[6] = { 444720, 30, 0, 3751320, 0, -30 }; + OGRSpatialReferenceH hSRS; + char *pszSRS_WKT = NULL; + GDALRasterBandH hBand; + GByte abyRaster[512*512]; + GDALSetGeoTransform( hDstDS, adfGeoTransform ); + hSRS = OSRNewSpatialReference( NULL ); + OSRSetUTM( hSRS, 11, TRUE ); + OSRSetWellKnownGeogCS( hSRS, "NAD27" ); + OSRExportToWkt( hSRS, &pszSRS_WKT ); + OSRDestroySpatialReference( hSRS ); + GDALSetProjection( hDstDS, pszSRS_WKT ); + CPLFree( pszSRS_WKT ); + hBand = GDALGetRasterBand( hDstDS, 1 ); + GDALRasterIO( hBand, GF_Write, 0, 0, 512, 512, + abyRaster, 512, 512, GDT_Byte, 0, 0 ); // ------------------- step 4 ------------------- - GDALClose( (GDALDatasetH) poDstDS ); - - return 1; // SUCCESS + +/* Once we're done, close properly the dataset */ + GDALClose( hDstDS ); + + return EXIT_SUCCESS;// SUCCESS } diff --git a/Modules/ThirdParty/GDAL/gdalFormatsListTest.c b/Modules/ThirdParty/GDAL/gdalFormatsListTest.c new file mode 100644 index 0000000000000000000000000000000000000000..302505ddfd56b3bcbc8a49187dffc04cfefcbf80 --- /dev/null +++ b/Modules/ThirdParty/GDAL/gdalFormatsListTest.c @@ -0,0 +1,47 @@ +#include <gdal.h> +#include <stdio.h> + +/* http://www.gdal.org/formats_list.html */ + +int main(int argc, char * argv[]) +{ + + int i; + int count = 0; + FILE *fp = NULL; + GDALDriverH driver = NULL; + + if (argc < 2) { + printf( "gdalFormatList.c: incorrect usage.\n"); + exit(1); + } + + GDALAllRegister(); + + count = GDALGetDriverCount(); + + if( count < 1 ) { + printf( "gdalFormatList.c: Driver count zero.\n"); + exit(1); + } + + fp = fopen(argv[1], "w"); + if (fp == NULL) { + printf("gdalFormatList.c: Error opening file!\n"); + exit(1); + } + + fprintf(fp, "%s\n", "###############################"); + fprintf(fp, "# Nb of drivers: %d\n", count); + fprintf(fp, "%s\n", "###############################"); + fprintf(fp, "%s\n", "ID,Short name,Long name"); + + for (i = 0; i < count; i++) { + driver = GDALGetDriver(i); + fprintf(fp, "%d,%s,%s\n", i, GDALGetDriverShortName(driver), GDALGetDriverLongName(driver)); + } + + fclose(fp); + + return EXIT_SUCCESS; +} diff --git a/Modules/ThirdParty/GDAL/gdalFormatsTest.c b/Modules/ThirdParty/GDAL/gdalFormatsTest.c new file mode 100644 index 0000000000000000000000000000000000000000..517130d0a3fa9f7b07eb349a072ade8dcbbf14ec --- /dev/null +++ b/Modules/ThirdParty/GDAL/gdalFormatsTest.c @@ -0,0 +1,23 @@ +#include <gdal.h> +#include <stdio.h> + +/* http://www.gdal.org/formats_list.html */ + +int main(int argc, char * argv[]) +{ + GDALDriverH hDriver = NULL; + if (argc < 2) { + printf( "Usage : gdalFormatsTest driverName.\n"); + return EXIT_FAILURE;; + } + + GDALAllRegister(); + + hDriver = GDALGetDriverByName( argv[1] ); + if( hDriver == NULL ) { + printf( "No driver for input name '%s' ", argv[1]); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx b/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx deleted file mode 100644 index 97d4509b471d00ca4537fe48904fff9ce3b429ab..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx +++ /dev/null @@ -1,59 +0,0 @@ -#include <iostream> -#include <fstream> -#include <stdexcept> -#include <gdal.h> -#include <gdal_priv.h> - -//http://www.gdal.org/formats_list.html - -using namespace std; - -int main(int argc, char * argv[]) -{ -cout << " argc = " << argc << endl; - string driverName(argv[1]); - - GDALAllRegister(); - - GDALDriverH drv = NULL; - unsigned int count = GDALGetDriverCount(); - - // Remember gdal formats - if (argc == 3) // ie. ./exe driverName fileName - { - const char * inputFilename = argv[2]; - ofstream file(inputFilename, ios::out | ios::trunc); - if(file) - { - file << "###############################" << std::endl; - file << "# ID / Short name / Long name #" << std::endl; - file << "###############################" << std::endl; - file << std::endl; - file << "# Nb of drivers : " << count << std::endl; - file << std::endl; - - for (unsigned int i = 0; i < count; i++) - { - drv = GDALGetDriver(i); - file << "i = " << i << " / " << GDALGetDriverShortName(drv) << " / " << GDALGetDriverLongName(drv) << std::endl; - } - - file.close(); - } - } - - //std::cout << GDALGetDriverShortName(GDALGetDriverByName("GTiff")) << std::endl; - - //Driver check - for (unsigned int i = 0; i < count; i++) - { - drv = GDALGetDriver(i); - if (string(GDALGetDriverShortName(drv)).compare(driverName) == 0 ) - return 1; // SUCCESS - } - - - - return 0; // FAIL - -} diff --git a/Modules/ThirdParty/GDAL/gdalOGRTest.cxx b/Modules/ThirdParty/GDAL/gdalOGRTest.cxx index 3787cec7047f9a70069dedfab3fddb03ba26e820..017b0274993d3079c74d4c119462b965f8f51b4b 100644 --- a/Modules/ThirdParty/GDAL/gdalOGRTest.cxx +++ b/Modules/ThirdParty/GDAL/gdalOGRTest.cxx @@ -1,23 +1,13 @@ -#ifdef WIN32 -#define CPL_DISABLE_DLL -#endif #include "ogr_api.h" int main(int argc,char * argv[]) { OGRDataSourceH hDS; - OGRSFDriverH *pahDriver; - - OGRRegisterAll(); - - hDS = OGROpen(argv[1], FALSE, pahDriver ); - - if( hDS == NULL ) - { - return -1; - } + OGRSFDriverH *pahDriver = NULL; + OGRRegisterAll(); + hDS = OGROpen("null.shp", FALSE, pahDriver ); OGRReleaseDataSource( hDS ); - - return 0; + + return EXIT_SUCCESS; } diff --git a/Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx b/Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx index d3406e7c468ab8fa94b8ce8f11fc7e4837a04408..bf87dad72a587e986fb6b6534b438874a6cce2f0 100644 --- a/Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx +++ b/Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx @@ -1,8 +1,9 @@ #include <fstream> #include <iostream> + #include <sstream> #include <cstdlib> - +#include <cstdio> using namespace std; @@ -11,32 +12,28 @@ int main(int argc, char * argv[]) { const char * inputFilename = argv[1]; - + string pattern1("TIFFClose"); string pattern2("gdal_"); - ifstream file(inputFilename, ios::in); - if(file) + ifstream file(inputFilename, ios::in); + if(file) { - string line; + string line; while(getline(file, line)) { if (line.find(pattern1) != string::npos) if (line.find(pattern2) == string::npos) { - cout << "WARNING : Internal versions of libtiff/libgeotiff detected without symbol renaming." << endl; - return 1; + cout << "Internal versions of libtiff/libgeotiff detected without symbol renaming!" << std::endl; + cout << "When configuring GDAL, if options --with-libtiff or --with-geotiff are set to 'internal', then options --with-rename-internal-libtiff-symbols and --with-rename-internal-libgeotiff-symbols should be set to 'yes')" << std::endl; + return EXIT_FAILURE; } - + } file.close(); } - /*else - { - cout << "WARNING : Can't open file " << inputFilename << endl; - return 2; - }*/ - + return EXIT_SUCCESS; } diff --git a/Modules/ThirdParty/GDAL/gdalVersionTest.cxx b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx index 076a144dd5f368c6cc673983dd09f85aafb2f979..247520cce8597e949cf3c3f97ec6dff7b65889db 100644 --- a/Modules/ThirdParty/GDAL/gdalVersionTest.cxx +++ b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx @@ -16,36 +16,36 @@ int main(int argc, char * argv[]) int MINOR = atoi(argv[3]); string version(GDALVersionInfo("RELEASE_NAME")); - + // Remember gdal version - const char * inputFilename = argv[1]; - ofstream file(inputFilename, ios::out | ios::trunc); - if(file) + const char * inputFilename = argv[1]; + ofstream file(inputFilename, ios::out | ios::trunc); + if(file) { - + file << version; file.close(); - + } /*else { cout << "WARNING : Can't open file " << inputFilename << endl; return 2; }*/ - - + + //Version check istringstream iss(version); unsigned int pos=0; string sub; unsigned int someUIntVal; vector<unsigned int> UIntVect; - while ( std::getline( iss, sub, '.' ) ) - { + while ( std::getline( iss, sub, '.' ) ) + { istringstream convert(sub); convert >> someUIntVal; - //cout << someUIntVal << '\n'; - + //cout << someUIntVal << '\n'; + if (pos==0) //Major UIntVect.push_back(someUIntVal); if (pos==1) //Minor @@ -54,14 +54,14 @@ int main(int argc, char * argv[]) pos++; } - + if ( (UIntVect[0]==MAJOR && UIntVect[1]<MINOR) || (UIntVect[0]<MAJOR) ) { cout << "WARNING : Version of GDAL must be >= " << MAJOR << "." << MINOR << " : " << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl; - return 1; + return EXIT_FAILURE; } - - return EXIT_SUCCESS; + + return EXIT_SUCCESS; } diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake index 62810c03c2a29555c447d2572f7bd5b7477ef1fe..4d8c8e371bec5b9b188ed3474fd73b13061d603e 100644 --- a/Modules/ThirdParty/GDAL/otb-module-init.cmake +++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake @@ -1,226 +1,154 @@ find_package ( GDAL REQUIRED ) - mark_as_advanced(GDAL_INCLUDE_DIR) mark_as_advanced(GDAL_LIBRARY) mark_as_advanced(GDAL_CONFIG) if(NOT GDAL_FOUND) - message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY") + message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY") endif() #Check if GDAL is compatible with OTB using a bunch of cmake try_run and try_compile. (Default value is ON.) set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE) mark_as_advanced(GDAL_CONFIG_CHECKING) -if(GDAL_CONFIG_CHECKING) - set(MIN_MAJOR_VERSION 1) - set(MIN_MINOR_VERSION 10) - - set(GDAL_QUALIFIES TRUE) - set(COMPILE_ERRORS FALSE) - - # Ensure that the temporary dir always exists before starting tests - if(NOT EXISTS ${TEMP}) - FILE(MAKE_DIRECTORY ${TEMP}) - endif() - - #------------------- TESTS --------------------- - # Version of GDAL - try_run(RUN_RESULT_VERSION COMPILE_RESULT_VERSION ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalVersionTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/gdalVersion.txt ${MIN_MAJOR_VERSION} ${MIN_MINOR_VERSION}) - - # Has OGR - try_compile(GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}") - - - # Has formats JPEG2000 & JPEG & GTIF - # Note : exact format names can be found here http://www.gdal.org/formats_list.html - try_run(GDAL_HAS_J2K_OPJG COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS JP2OpenJPEG ${TEMP}/gdalFormats.txt ) - try_run(GDAL_HAS_J2K_KAK COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS JP2KAK ) # No need to output ${TEMP}/gdalFormats.txt everytime - try_run(GDAL_HAS_J2K_ECW COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS JP2ECW ) - try_run(GDAL_HAS_J2K_JG2000 COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS JPEG2000 ) - try_run(GDAL_HAS_JPEG COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS JPEG ) - try_run(GDAL_HAS_GTIF COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS GTiff ) - try_run(GDAL_HAS_HDF5 COMPILE_RESULT_FORMATS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalFormatsTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS HDF5 ) - - # Can create geotiff file - if (GDAL_HAS_GTIF) - try_run(GDAL_CAN_CREATE_GEOTIFF COMPILE_RESULT_CREATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS GTiff ${TEMP}/testImage.gtif ) - endif() - - #Can create other format file - if(COMPILE_RESULT_CREATE AND GDAL_CAN_CREATE_GEOTIFF) #Use the result of the previous try_run - - # Can create bigtiff file - if (GDAL_HAS_GTIF) - try_run(GDAL_CAN_CREATE_BIGTIFF COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.bigtif GTiff "BIGTIFF=YES") - endif() - - # Can create jpeg file - if (GDAL_HAS_JPEG) - try_run(GDAL_CAN_CREATE_JPEG COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.jpeg JPEG) - endif() - - # Can create jpeg2000 file - if (GDAL_HAS_J2K_OPJG) - try_run(GDAL_CAN_CREATE_JPEG2000 COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2OpenJPEG) - endif() - - if (GDAL_HAS_J2K_KAK AND NOT GDAL_CAN_CREATE_JPEG2000) - try_run(GDAL_CAN_CREATE_JPEG2000 COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2KAK) - endif() - - if (GDAL_HAS_J2K_ECW AND NOT GDAL_CAN_CREATE_JPEG2000) - try_run(GDAL_CAN_CREATE_JPEG2000 COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2ECW) - endif() - - if (GDAL_HAS_J2K_JG2000 AND NOT GDAL_CAN_CREATE_JPEG2000) - try_run(GDAL_CAN_CREATE_JPEG2000 COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JPEG2000) - endif() - - endif() - #------------------- TESTS (END)--------------------- - - - # Warning messages - if (NOT COMPILE_RESULT_VERSION) - message(WARNING "Modules/ThirdParty/GDAL/gdalVersionTest.cxx did not compile.") - set(COMPILE_ERRORS TRUE) - elseif (${RUN_RESULT_VERSION} EQUAL 1) - file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION) - message(WARNING "Version of GDAL must be >= " ${MIN_MAJOR_VERSION} "." ${MIN_MINOR_VERSION} " : " ${DETECTED_VERSION} " detected.") - set(GDAL_QUALIFIES FALSE) - else((${RUN_RESULT_VERSION} EQUAL 1)) - file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION) - string(SUBSTRING ${DETECTED_VERSION} 0 2 VER2) - if(${VER2} EQUAL "2.") - message(STATUS "Gdal >= 2.0.0 detected") - set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) - else(${VER2} EQUAL "2.") - set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) - endif() - endif() - - if (NOT GDAL_HAS_OGR) - message(WARNING "GDAL doesn't expose OGR library symbols.") - set(GDAL_QUALIFIES FALSE) - endif() - - if (NOT COMPILE_RESULT_FORMATS) - message(WARNING "Modules/ThirdParty/GDAL/gdalFormatsTest.cxx did not compile.") - set(COMPILE_ERRORS TRUE) - else() - - if (NOT GDAL_HAS_J2K_JG2000 AND NOT GDAL_HAS_J2K_OPJG AND NOT GDAL_HAS_J2K_KAK AND NOT GDAL_HAS_J2K_ECW) - message(STATUS "No Jpeg2000 driver found (compatible drivers are : OpenJpeg, Kakadu, ECW).") - #set(GDAL_QUALIFIES FALSE) - endif() - - if (NOT GDAL_HAS_JPEG) - message(WARNING "No jpeg driver found.") - set(GDAL_QUALIFIES FALSE) - endif() - - if (NOT GDAL_HAS_GTIF) - message(WARNING "No geotiff driver found.") - set(GDAL_QUALIFIES FALSE) - endif() - - endif() - - if (NOT GDAL_HAS_HDF5) - message(STATUS "GDAL doesn't have HDF5 drivers. (HDF5 tests will be deactivated)") - endif() - - if (NOT COMPILE_RESULT_CREATE) - message(WARNING "Modules/ThirdParty/GDAL/gdalCreateTest.cxx did not compile.") - set(COMPILE_ERRORS TRUE) - elseif (NOT GDAL_CAN_CREATE_GEOTIFF) - message(WARNING "GDAL can't create geotiff files.") - set(GDAL_QUALIFIES FALSE) - endif() - - - if (NOT COMPILE_RESULT_CREATECOPY) - message(WARNING "Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx did not compile.") - set(COMPILE_ERRORS TRUE) - - if (NOT GDAL_CAN_CREATE_BIGTIFF) - message(WARNING "No BIGTIFF capatilities.") - set(GDAL_QUALIFIES FALSE) - endif() - - if (NOT GDAL_CAN_CREATE_JPEG) - message(WARNING "GDAL can't create jpeg files.") - set(GDAL_QUALIFIES FALSE) - endif() +if(NOT GDAL_CONFIG_CHECKING) + return() +endif() - if (NOT GDAL_CAN_CREATE_JPEG2000) - message(WARNING "GDAL can't create jpeg2000 files.") - set(GDAL_QUALIFIES FALSE) - endif() +set(MIN_MAJOR_VERSION 1) +set(MIN_MINOR_VERSION 10) - endif() +# Ensure that the temporary dir always exists before starting tests +if(NOT EXISTS ${TEMP}) + FILE(MAKE_DIRECTORY ${TEMP}) +endif() +#------------------- Helper Macro --------------------- +macro(gdal_try_run msg_type var source_file) +set(${var}) +try_run(RUN_${var} COMPILE_${var} ${CMAKE_CURRENT_BINARY_DIR} +${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/${source_file} +CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-w" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" +COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_${var} +RUN_OUTPUT_VARIABLE RUN_OUTPUT_${var} +ARGS ${ARGN} +) + +if(NOT COMPILE_${var}) + message(FATAL_ERROR "Compiling Test ${var} - Failed \n +COMPILE_OUTPUT_${var}: '${COMPILE_OUTPUT_${var}}'") +endif() +if(RUN_${var}) + set(${var} FALSE) + #if msg_type is STATUS (ie "okay" if test is failing), + #then we don't need to give an run-output and exit status. + if("${msg_type}" STREQUAL "STATUS") + message(${msg_type} "Performing Test ${var} - Failed") + else() + message(${msg_type} "Performing Test ${var} - Failed \n + Exit status: '${RUN_${var}}' \n + RUN_OUTPUT_${var}: '${RUN_OUTPUT_${var}}'") + endif() +else() + set(${var} TRUE) + message(STATUS "Performing Test ${var} - Success") +endif() +unset(RUN_OUTPUT_${var}) +unset(COMPILE_OUTPUT_${var}) +unset(COMPILE_${var}) +endmacro() + +#------------------- TESTS --------------------- +# Version of GDAL +gdal_try_run(FATAL_ERROR GDAL_VERSION gdalVersionTest.cxx ${TEMP}/gdalVersion.txt ${MIN_MAJOR_VERSION} ${MIN_MINOR_VERSION}) + +if(EXISTS "${TEMP}/gdalVersion.txt") + file(READ "${TEMP}/gdalVersion.txt" _GDAL_VERSION_STRING) + #can't we use GDAL_VERSION_NUM ? + string(SUBSTRING ${_GDAL_VERSION_STRING} 0 2 VER2) + if("${VER2}" STREQUAL "2.") + set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) + else() + set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) + endif() + set(GDAL_VERSION_STRING "${_GDAL_VERSION_STRING}" CACHE INTERNAL "" FORCE) +else() + message(FATAL_ERROR "${TEMP}/gdalVersion.txt does not exist. Cannot continue.") +endif() +#check OGR +#gdal_try_run(FATAL_ERROR GDAL_HAS_OGR gdalOGRTest.cxx) +try_compile(COMPILE_GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} +${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx +CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-w" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" +OUTPUT_VARIABLE COMPILE_OUTPUT_GDAL_HAS_OGR +) +if(NOT COMPILE_GDAL_HAS_OGR) + message(FATAL_ERROR "Performing Test COMPILE_GDAL_HAS_OGR - Failed\n COMPILE_OUTPUT:${COMPILE_OUTPUT_GDAL_HAS_OGR}\n") + else() + message(STATUS "Performing Test COMPILE_GDAL_HAS_OGR - Success") +endif() - #FOR UNIX SYSTEMS ONLY - if(UNIX) +# check formats TIFF, GeoTIFF, JPEG, JPEG2000, HDF5 +# Note : exact format names can be found here http://www.gdal.org/formats_list.html - if(GDAL_QUALIFIES) +gdal_try_run(STATUS GDAL_FORMATS_LIST gdalFormatsListTest.c ${TEMP}/gdalFormatsList.csv) - # Prepare bash script - configure_file(${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest.sh.in ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh @ONLY) - execute_process(COMMAND chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) - execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) +gdal_try_run(FATAL_ERROR GDAL_HAS_JPEG gdalFormatsTest.c JPEG) +gdal_try_run(FATAL_ERROR GDAL_HAS_GTiff gdalFormatsTest.c GTiff) - #------------------- TESTS --------------------- - # test libtiff/libgeotiff and test if symbols are renamed (only for internal libtiff/libgeotiff) - try_run(RUN_RESULT_SYMBOLS COMPILE_RESULT_SYMBOLS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx ARGS ${TEMP}/gdalSymbols.txt) - #------------------- TESTS (END)--------------------- +gdal_try_run(FATAL_ERROR GDAL_CAN_CREATE_GTiff gdalCreateTest.cxx GTiff ${TEMP}/testImage.gtif ) +gdal_try_run(FATAL_ERROR GDAL_CAN_CREATE_GTiff_BIGTIFF gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.bigtif GTiff "BIGTIFF=YES") - # Warning messages - if (NOT COMPILE_RESULT_SYMBOLS) - message(WARNING "Modules/ThirdParty/GDAL/gdalSymbolsTest.cxx did not compile.") - set(COMPILE_ERRORS TRUE) - elseif (${RUN_RESULT_SYMBOLS} EQUAL 1) - message(WARNING "Internal versions of libtiff/libgeotiff detected without symbol renaming (when configuring GDAL, if options --with-libtiff or --with-geotiff are set to 'internal', then options --with-rename-internal-libtiff-symbols and --with-rename-internal-libgeotiff-symbols should be set to 'yes').") - set(GDAL_QUALIFIES FALSE) - endif() +gdal_try_run(FATAL_ERROR GDAL_CAN_CREATE_JPEG gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.jpeg JPEG) +set(JPEG2000_DRIVER_USED) +gdal_try_run(STATUS GDAL_HAS_JP2OpenJPEG gdalFormatsTest.c JP2OpenJPEG) +if (GDAL_HAS_JP2OpenJPEG) + set(JPEG2000_DRIVER_USED "OpenJPEG") + gdal_try_run(STATUS GDAL_CAN_CREATE_JP2OpenJPEG gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2OpenJPEG) +endif() - endif() #GDAL_QUALIFIES +gdal_try_run(STATUS GDAL_HAS_JP2KAK gdalFormatsTest.c JP2KAK) +if (GDAL_HAS_JP2KAK) + set(JPEG2000_DRIVER_USED "Kakadu") + gdal_try_run(STATUS GDAL_CAN_CREATE_JP2KAK gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2KAK) +endif() +gdal_try_run(STATUS GDAL_HAS_JP2ECW gdalFormatsTest.c JP2ECW) +if (GDAL_HAS_JP2ECW) + set(JPEG2000_DRIVER_USED "ECW") + gdal_try_run(STATUS GDAL_CAN_CREATE_JP2ECW gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JP2ECW) +endif() - endif() #UNIX +gdal_try_run(STATUS GDAL_HAS_JPEG2000 gdalFormatsTest.c JPEG2000) +if (GDAL_HAS_JPEG2000) + set(JPEG2000_DRIVER_USED "JPEG2000") + gdal_try_run(STATUS GDAL_CAN_CREATE_JPEG2000 gdalCreateCopyTest.cxx ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JPEG2000) +endif() +gdal_try_run(STATUS GDAL_HAS_HDF5 gdalFormatsTest.c HDF5) +gdal_try_run(STATUS GDAL_HAS_HDF4 gdalFormatsTest.c HDF4) - if(GDAL_QUALIFIES AND NOT COMPILE_ERRORS) - message(STATUS "Check if Gdal qualifies for Orfeo ToolBox -- yes.") - else() - message(STATUS "Check if Gdal qualifies for Orfeo ToolBox -- no.") - endif() +#------------------- TESTS (END)--------------------- - if(NOT GDAL_VERSION) - if(EXISTS "${TEMP}/gdalVersion.txt") - file(READ "${TEMP}/gdalVersion.txt" GDAL_VERSION) - endif() - endif() - message(STATUS " Version : ${GDAL_VERSION}") - message(STATUS " Drivers for JPEG 2000 : ") - if(GDAL_HAS_J2K_JG2000) - message(STATUS " Jasper (will not be used)") - endif() - if(GDAL_HAS_J2K_OPJG) - message(STATUS " OpenJPEG") - endif() - if(GDAL_HAS_J2K_KAK) - message(STATUS " Kakadu") - endif() - if(GDAL_HAS_J2K_ECW) - message(STATUS " ECW") - endif() +#FOR UNIX SYSTEMS ONLY +if(UNIX) + # Prepare bash script + configure_file(${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest.sh.in ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh @ONLY) + execute_process(COMMAND chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) + execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) + gdal_try_run(FATAL_ERROR GDAL_SYMBOLS gdalSymbolsTest.cxx ARGS ${TEMP}/gdalSymbols.txt) +endif() -endif() #GDAL_CONFIG_CHECKING +if (NOT JPEG2000_DRIVER_USED) + message(STATUS "No Jpeg2000 gdal driver found. Supported drivers are : OpenJpeg, Kakadu, ECW.") +elseif("${JPEG2000_DRIVER_USED}" STREQUAL "JPEG2000") + message(STATUS "Jasper JPEG2000 gdal driver is available. This will be skipped by OTB. supported drivers are OpenJPEG, ECW, Kakadu") + unset(JPEG2000_DRIVER_USED) +else() + message(STATUS "GDAL driver used for JPEG2000 dataset is '${JPEG2000_DRIVER_USED}'") +endif() \ No newline at end of file diff --git a/Modules/ThirdParty/ITK/include/itkImageRegionMultidimensionalSplitter.hxx b/Modules/ThirdParty/ITK/include/itkImageRegionMultidimensionalSplitter.hxx index 8f5128ed86b3e1d77b9b0a7021c1aa6a7f435d7d..f101fa9b7d7fd0026713e1b1338dcaa1b234b9d4 100644 --- a/Modules/ThirdParty/ITK/include/itkImageRegionMultidimensionalSplitter.hxx +++ b/Modules/ThirdParty/ITK/include/itkImageRegionMultidimensionalSplitter.hxx @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __itkImageRegionMultidimensionalSplitter_hxx -#define __itkImageRegionMultidimensionalSplitter_hxx +#ifndef itkImageRegionMultidimensionalSplitter_hxx +#define itkImageRegionMultidimensionalSplitter_hxx #include "itkImageRegionMultidimensionalSplitter.h" #include <cmath> diff --git a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h index 8e0038df600510da12885b5132564a2f0c46ad24..0ab08e83d4dde1201b6520bc4409bdc856165f1c 100644 --- a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h +++ b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h @@ -121,12 +121,12 @@ public: protected: ImageRegionSplitter() {} - ~ImageRegionSplitter() {} + ~ImageRegionSplitter() ITK_OVERRIDE {} - virtual unsigned int GetNumberOfSplitsInternal(unsigned int, + unsigned int GetNumberOfSplitsInternal(unsigned int, const IndexValueType regionIndex[], const SizeValueType regionSize[], - unsigned int requestedNumber) const + unsigned int requestedNumber) const ITK_OVERRIDE { // this function adapts the legecy method, defined in this class // be used by the ImageRegionSplitterBase. @@ -141,11 +141,11 @@ protected: } - virtual unsigned int GetSplitInternal(unsigned int dim, + unsigned int GetSplitInternal(unsigned int dim, unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], - SizeValueType regionSize[]) const + SizeValueType regionSize[]) const ITK_OVERRIDE { // this function adapts the legecy method, defined in this class // be used by the ImageRegionSplitterBase. @@ -166,7 +166,7 @@ protected: return numberOfPieces; } - void PrintSelf(std::ostream & os, Indent indent) const; + void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageRegionSplitter(const ImageRegionSplitter &); //purposely not implemented diff --git a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.hxx b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.hxx index e3aa146b831ed6d3cad7eb83f75c0e16b3c19eb3..3748d952a4f832170be2e8ddc1537d94af409211 100644 --- a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.hxx +++ b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.hxx @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __itkImageRegionSplitter_hxx -#define __itkImageRegionSplitter_hxx +#ifndef itkImageRegionSplitter_hxx +#define itkImageRegionSplitter_hxx #include "itkImageRegionSplitter.h" #include <cmath> diff --git a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h index 8109c31e97dd94417e439960d5e8a84c8a6d01e1..ecdc5a421aaab662c7258731f11619c0c45d3665 100644 --- a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h +++ b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h @@ -37,9 +37,9 @@ namespace itk * spacing, origin and direction of the reference image will be used. * * Since this filter produces an image which is a different size than - * its input, it needs to override several of the methods defined + * its input, it needs to ITK_OVERRIDE several of the methods defined * in ProcessObject in order to properly manage the pipeline execution model. - * In particular, this filter overrides + * In particular, this filter ITK_OVERRIDEs * ProcessObject::GenerateInputRequestedRegion() and * ProcessObject::GenerateOutputInformation(). * @@ -154,13 +154,13 @@ public: void SetOutputParametersFromImage(const ImageBaseType *image); /** DisplacementFieldImageFilter produces a vector image. */ - virtual void GenerateOutputInformation(void); + void GenerateOutputInformation(void) ITK_OVERRIDE; /** Just checking if transform is set. */ - virtual void BeforeThreadedGenerateData(void); + void BeforeThreadedGenerateData(void) ITK_OVERRIDE; /** Compute the Modified Time based on changes to the components. */ - ModifiedTimeType GetMTime(void) const; + ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -173,16 +173,16 @@ public: protected: TransformToDisplacementFieldSource(void); - ~TransformToDisplacementFieldSource(void) {} + ~TransformToDisplacementFieldSource(void) ITK_OVERRIDE {} - void PrintSelf(std::ostream & os, Indent indent) const; + void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** TransformToDisplacementFieldSource can be implemented as a multithreaded * filter. */ void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId); + ThreadIdType threadId) ITK_OVERRIDE; /** Default implementation for resampling that works for any * transformation type. diff --git a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx index 0b0d72f03035f3d85778afdbdd25862cfe05f5b9..212a0f883915ac7b78ef829aaf3a75cb8918eaba 100644 --- a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx +++ b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __itkTransformToDisplacementFieldSource_hxx -#define __itkTransformToDisplacementFieldSource_hxx +#ifndef itkTransformToDisplacementFieldSource_hxx +#define itkTransformToDisplacementFieldSource_hxx #include "itkTransformToDisplacementFieldSource.h" diff --git a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h index 8d223d88eec06ea6cdcde85499120175c1b32da8..a47d8cf82a4c318d3d6a977fa6659f298c04845d 100644 --- a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h +++ b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h @@ -102,7 +102,7 @@ public: protected: UnaryFunctorImageFilter(); - virtual ~UnaryFunctorImageFilter() {} + ~UnaryFunctorImageFilter() ITK_OVERRIDE {} /** UnaryFunctorImageFilter can produce an image which is a different * resolution than its input image. As such, UnaryFunctorImageFilter @@ -112,7 +112,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** UnaryFunctorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -125,7 +125,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId); + ThreadIdType threadId) ITK_OVERRIDE; private: UnaryFunctorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx index 628ec45401b08e9045e3a0301e61843ac859c77d..c84c6d94aac1b29003f283b02161ada346a457eb 100644 --- a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx +++ b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __itkUnaryFunctorImageFilter_hxx -#define __itkUnaryFunctorImageFilter_hxx +#ifndef itkUnaryFunctorImageFilter_hxx +#define itkUnaryFunctorImageFilter_hxx #include "itkUnaryFunctorImageFilter.h" #include "itkImageScanlineIterator.h" diff --git a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h index 19f46d9a65ff4f4e1a6abc8aa8870e3a8de0f3d9..eabdfd98454d53df953c49d3cce70dbd9e7d0731 100644 --- a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h +++ b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWarpImageFilter_h -#define __otbWarpImageFilter_h +#ifndef otbWarpImageFilter_h +#define otbWarpImageFilter_h #include "itkImageBase.h" #include "itkImageToImageFilter.h" #include "itkLinearInterpolateImageFunction.h" @@ -200,7 +200,7 @@ public: * implemenation for GenerateOutputInformation() which set * the output information according the OutputSpacing, OutputOrigin * and the deformation field's LargestPossibleRegion. */ - virtual void GenerateOutputInformation(); + void GenerateOutputInformation() ITK_OVERRIDE; /** It is difficult to compute in advance the input image region * required to compute the requested output region. Thus the safest @@ -208,15 +208,15 @@ public: * * For the deformation field, the input requested region * set to be the same as that of the output requested region. */ - virtual void GenerateInputRequestedRegion(); + void GenerateInputRequestedRegion() ITK_OVERRIDE; /** This method is used to set the state of the filter before * multi-threading. */ - virtual void BeforeThreadedGenerateData(); + void BeforeThreadedGenerateData() ITK_OVERRIDE; /** This method is used to set the state of the filter after * multi-threading. */ - virtual void AfterThreadedGenerateData(); + void AfterThreadedGenerateData() ITK_OVERRIDE; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -233,21 +233,21 @@ public: protected: WarpImageFilter(); - virtual ~WarpImageFilter() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; + ~WarpImageFilter() ITK_OVERRIDE {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; /** WarpImageFilter is implemented as a multi-threaded filter. * As such, it needs to provide and implementation for * ThreadedGenerateData(). */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ); + itk::ThreadIdType threadId ) ITK_OVERRIDE; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - virtual void VerifyInputInformation() {} + void VerifyInputInformation() ITK_OVERRIDE {} private: diff --git a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx index 7f0719b187d0e3007bdf965eaa39c8b28fa18ce6..4cbfd2d363c2c6aa9443239d3ccea9c5f0fd1e2c 100644 --- a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx +++ b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWarpImageFilter_txx -#define __otbWarpImageFilter_txx +#ifndef otbWarpImageFilter_txx +#define otbWarpImageFilter_txx #include "otbWarpImageFilter.h" #include "itkImageRegionIterator.h" @@ -205,7 +205,7 @@ WarpImageFilter<TInputImage,TOutputImage,TDisplacementField> ::AfterThreadedGenerateData() { // Disconnect input image from interpolator - m_Interpolator->SetInputImage( NULL ); + m_Interpolator->SetInputImage( ITK_NULLPTR ); } diff --git a/Modules/ThirdParty/MPI/CMakeLists.txt b/Modules/ThirdParty/MPI/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6249fe0cd655649c207871e4c49cb7ef249dcf9f --- /dev/null +++ b/Modules/ThirdParty/MPI/CMakeLists.txt @@ -0,0 +1,6 @@ +project(OTBMPI) + +set(OTBMPI_SYSTEM_INCLUDE_DIRS ${MPI_CXX_INCLUDE_PATH}) +set(OTBMPI_LIBRARIES "${MPI_CXX_LIBRARIES}") + +otb_module_impl() diff --git a/Modules/ThirdParty/MPI/otb-module-init.cmake b/Modules/ThirdParty/MPI/otb-module-init.cmake new file mode 100644 index 0000000000000000000000000000000000000000..bfdd38bf7e34fbe06eedcca2f540ce8ecb068be4 --- /dev/null +++ b/Modules/ThirdParty/MPI/otb-module-init.cmake @@ -0,0 +1 @@ +find_package ( MPI REQUIRED ) diff --git a/Modules/ThirdParty/MPI/otb-module.cmake b/Modules/ThirdParty/MPI/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..49a23a202ac49bc9865e98d54ab96e0c8f939fbe --- /dev/null +++ b/Modules/ThirdParty/MPI/otb-module.cmake @@ -0,0 +1,12 @@ +set(DOCUMENTATION "This module imports MPI to the build system") + +otb_module(OTBMPI + DEPENDS + + TEST_DEPENDS + + DESCRIPTION + "${DOCUMENTATION}" + ) + +otb_module_activation_option("Enable MPI dependent modules" OFF) diff --git a/Modules/ThirdParty/MuParser/src/otb_muparser.h.in b/Modules/ThirdParty/MuParser/src/otb_muparser.h.in index 4a00e3403e8f5a3133af7f8f0d3c17b9d158e0ab..48f5aaa9ee374a0099867f43d24a93c95389950f 100644 --- a/Modules/ThirdParty/MuParser/src/otb_muparser.h.in +++ b/Modules/ThirdParty/MuParser/src/otb_muparser.h.in @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otb_muparser_h -#define __otb_muparser_h +#ifndef otb_muparser_h +#define otb_muparser_h /* MuParser has "&&" and "||" operators (version >= 2.0.0), instead of "and" and "or" (version <2.0.0 version) */ #cmakedefine OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS diff --git a/Modules/ThirdParty/OpenCV/otb-module-init.cmake b/Modules/ThirdParty/OpenCV/otb-module-init.cmake index ef0305c3c5a894b020e8c50b59982dc8bc30d54c..f3a9974910c2a8e0ed4e3d2b8a3fa4f6c429c889 100644 --- a/Modules/ThirdParty/OpenCV/otb-module-init.cmake +++ b/Modules/ThirdParty/OpenCV/otb-module-init.cmake @@ -1,2 +1,7 @@ find_package ( OpenCV REQUIRED ) mark_as_advanced( OpenCV_DIR ) + +if("${OpenCV_VERSION}" VERSION_LESS "2.4.0") + message(WARNING "The OpenCV version detected (${OpenCV_VERSION}) is older than 2.4.0, " + "it may not be fully compatible with OTB") +endif() diff --git a/Modules/ThirdParty/OpenJPEG/src/otb_openjpeg.h.in b/Modules/ThirdParty/OpenJPEG/src/otb_openjpeg.h.in index 7150bb7eaaf53f67dc6c5a2a9892b9a756ddb07e..c99cf9af14652e0392fa7d2cb71e5488fcfd014a 100644 --- a/Modules/ThirdParty/OpenJPEG/src/otb_openjpeg.h.in +++ b/Modules/ThirdParty/OpenJPEG/src/otb_openjpeg.h.in @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otb_openjpeg_h -#define __otb_openjpeg_h +#ifndef otb_openjpeg_h +#define otb_openjpeg_h /* different API between 2.0 and 2.1 */ #define OTBOpenJPEG_VERSION_NUMBER @OTBOpenJPEG_VERSION_NUMBER@ diff --git a/Modules/ThirdParty/OssimPlugins/otb-module.cmake b/Modules/ThirdParty/OssimPlugins/otb-module.cmake index 1886189fd7edcaefb004f563d672428c6d0b1c21..2fe31787d21430582aea8806176265092d7f22f8 100644 --- a/Modules/ThirdParty/OssimPlugins/otb-module.cmake +++ b/Modules/ThirdParty/OssimPlugins/otb-module.cmake @@ -2,6 +2,7 @@ set(DOCUMENTATION "This module provides Ossim Plugins") otb_module(OTBOssimPlugins DEPENDS + OTBBoost OTBGeoTIFF OTBGDAL OTBOssim diff --git a/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt b/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt index 9ae9700a49abd5bd8e50513e2354b5849189af53..48ff467aad9c2f78eedbe9ff0761476ffdacebc3 100644 --- a/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt +++ b/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt @@ -15,6 +15,20 @@ set(OSSIMPLUGINS_SVN_REVISION "18162") # patch number for OTB modifications applied on top of OSSIM_SVN_REVISION (used for .so versioning) set(OSSIMPLUGINS_OTB_PATCH "1") +# Check whether std::snprintf is defined +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(std::snprintf cstdio HAVE_STD_SNPRINTF) +if (NOT HAVE_STD_SNPRINTF) + # it would be _snprintf with VC++ + check_symbol_exists(_snprintf stdio.h HAVE_MSC_SNPRINTF) + if (NOT HAVE_MSC_SNPRINTF) + message(FATAL_ERROR "Either std::snprintf or VC++'s _snprintf are required") + endif() +endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ossim/ossimplugins-config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/ossim/ossimplugins-config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/ossim) + # include_directories(${CMAKE_CURRENT_SOURCE_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}/ossim # # ${OTB_SOURCE_DIR}/Utilities/otbossim/include @@ -26,7 +40,7 @@ set(OSSIMPLUGINS_OTB_PATCH "1") # When using External ossim, compile ossimplugin as a DLL # even if we compile OTB as a static lib set(ossimplugins_LIBTYPE SHARED) - if(WIN32) + if(WIN32) add_definitions(-DOSSIMPLUGINSMAKINGDLL) endif() @@ -50,7 +64,8 @@ set(ossimplugins_SOURCES ) add_library(otbossimplugins ${ossimplugins_LIBTYPE} ${ossimplugins_SOURCES}) -target_link_libraries(otbossimplugins +target_link_libraries(otbossimplugins + ${OTBBoost_LIBRARIES} ${OTBGDAL_LIBRARIES} ${OTBOssim_LIBRARIES} ${OTBGeoTIFF_LIBRARIES} diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.cpp index 2d2da1406b99914a13677ef42e6f240ececfd651..885b29aef91b93ff909f387ff5905a759dd03314 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.cpp @@ -225,8 +225,9 @@ namespace ossimplugins buf3[3] = '\0'; char buf2[3]; buf2[2] = '\0'; - char buf1[1]; + char buf1[2]; buf1[0] = '\0'; + buf1[1] = '\0'; is.read(buf8,8); data._product_name = buf8; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.h b/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.h index fd021e300c68863b0253ff6a6dc0f2dd30494be3..72a548c52772eed545ece4aa8c144d04a19fd08e 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/EnvisatAsar/mph.h @@ -21,6 +21,7 @@ namespace ossimplugins /** * @ingroup mphRecord * @brief This class is able to read the ASAR mph record of the leader file + * \todo Use the default generated copy- and move-constructors and assignment-operators */ class mph : public EnvisatAsarRecord { @@ -90,567 +91,567 @@ public: /** * @brief product_name */ - std::string get_product_name() + std::string const& get_product_name() const { return _product_name; }; /** * @brief product */ - std::string get_product() + std::string const& get_product() const { return _product; }; /** * @brief proc_stage_title */ - std::string get_proc_stage_title() + std::string const& get_proc_stage_title() const { return _proc_stage_title; }; /** * @brief proc_stage */ - std::string get_proc_stage() + std::string const& get_proc_stage() const { return _proc_stage; }; /** * @brief ref_doc_title */ - std::string get_ref_doc_title() + std::string const& get_ref_doc_title() const { return _ref_doc_title; }; /** * @brief ref_doc */ - std::string get_ref_doc() + std::string const& get_ref_doc() const { return _ref_doc; }; /** * @brief acq_stat_id_title */ - std::string get_acq_stat_id_title() + std::string const& get_acq_stat_id_title() const { return _acq_stat_id_title; }; /** * @brief acq_station */ - std::string get_acq_station() + std::string const& get_acq_station() const { return _acq_station; }; /** * @brief proc_center_title */ - std::string get_proc_center_title() + std::string const& get_proc_center_title() const { return _proc_center_title; }; /** * @brief proc_center */ - std::string get_proc_center() + std::string const& get_proc_center() const { return _proc_center; }; /** * @brief proc_time_title */ - std::string get_proc_time_title() + std::string const& get_proc_time_title() const { return _proc_time_title; }; /** * @brief proc_time */ - std::string get_proc_time() + std::string const& get_proc_time() const { return _proc_time; }; /** * @brief soft_version_title */ - std::string get_soft_version_title() + std::string const& get_soft_version_title() const { return _soft_version_title; }; /** * @brief soft_version */ - std::string get_soft_version() + std::string const& get_soft_version() const { return _soft_version; }; /** * @brief sensing_start_title */ - std::string get_sensing_start_title() + std::string const& get_sensing_start_title() const { return _sensing_start_title; }; /** * @brief sensing_start */ - std::string get_sensing_start() + std::string const& get_sensing_start() const { return _sensing_start; }; /** * @brief sensing_stop_title */ - std::string get_sensing_stop_title() + std::string const& get_sensing_stop_title() const { return _sensing_stop_title; }; /** * @brief sensing_stop */ - std::string get_sensing_stop() + std::string const& get_sensing_stop() const { return _sensing_stop; }; /** * @brief phase_title */ - std::string get_phase_title() + std::string const& get_phase_title() const { return _phase_title; }; /** * @brief phase */ - std::string get_phase() + std::string const& get_phase() const { return _phase; }; /** * @brief cycle_title */ - std::string get_cycle_title() + std::string const& get_cycle_title() const { return _cycle_title; }; /** * @brief cycle */ - std::string get_cycle() + std::string const& get_cycle() const { return _cycle; }; /** * @brief relative_orbit_title */ - std::string get_relative_orbit_title() + std::string const& get_relative_orbit_title() const { return _relative_orbit_title; }; /** * @brief rel_orbit */ - std::string get_rel_orbit() + std::string const& get_rel_orbit() const { return _rel_orbit; }; /** * @brief absolute_orbit_title */ - std::string get_absolute_orbit_title() + std::string const& get_absolute_orbit_title() const { return _absolute_orbit_title; }; /** * @brief abs_orbit */ - std::string get_abs_orbit() + std::string const& get_abs_orbit() const { return _abs_orbit; }; /** * @brief state_vector_time_title */ - std::string get_state_vector_time_title() + std::string const& get_state_vector_time_title() const { return _state_vector_time_title; }; /** * @brief state_vector_time */ - std::string get_state_vector_time() + std::string const& get_state_vector_time() const { return _state_vector_time; }; /** * @brief delta_ut1_title */ - std::string get_delta_ut1_title() + std::string const& get_delta_ut1_title() const { return _delta_ut1_title; }; /** * @brief delta_ut1 */ - std::string get_delta_ut1() + std::string const& get_delta_ut1() const { return _delta_ut1; }; /** * @brief delta_ut1_units */ - std::string get_delta_ut1_units() + std::string const& get_delta_ut1_units() const { return _delta_ut1_units; }; /** * @brief x_position_title */ - std::string get_x_position_title() + std::string const& get_x_position_title() const { return _x_position_title; }; /** * @brief x_position */ - std::string get_x_position() + std::string const& get_x_position() const { return _x_position; }; /** * @brief x_position_units */ - std::string get_x_position_units() + std::string const& get_x_position_units() const { return _x_position_units; }; /** * @brief y_position_title */ - std::string get_y_position_title() + std::string const& get_y_position_title() const { return _y_position_title; }; /** * @brief y_position */ - std::string get_y_position() + std::string const& get_y_position() const { return _y_position; }; /** * @brief y_position_units */ - std::string get_y_position_units() + std::string const& get_y_position_units() const { return _y_position_units; }; /** * @brief z_position_title */ - std::string get_z_position_title() + std::string const& get_z_position_title() const { return _z_position_title; }; /** * @brief z_position */ - std::string get_z_position() + std::string const& get_z_position() const { return _z_position; }; /** * @brief z_position_units */ - std::string get_z_position_units() + std::string const& get_z_position_units() const { return _z_position_units; }; /** * @brief x_velocity_title */ - std::string get_x_velocity_title() + std::string const& get_x_velocity_title() const { return _x_velocity_title; }; /** * @brief x_velocity */ - std::string get_x_velocity() + std::string const& get_x_velocity() const { return _x_velocity; }; /** * @brief x_velocity_units */ - std::string get_x_velocity_units() + std::string const& get_x_velocity_units() const { return _x_velocity_units; }; /** * @brief y_velocity_title */ - std::string get_y_velocity_title() + std::string const& get_y_velocity_title() const { return _y_velocity_title; }; /** * @brief y_velocity */ - std::string get_y_velocity() + std::string const& get_y_velocity() const { return _y_velocity; }; /** * @brief y_velocity_units */ - std::string get_y_velocity_units() + std::string const& get_y_velocity_units() const { return _y_velocity_units; }; /** * @brief z_velocity_title */ - std::string get_z_velocity_title() + std::string const& get_z_velocity_title() const { return _z_velocity_title; }; /** * @brief z_velocity */ - std::string get_z_velocity() + std::string const& get_z_velocity() const { return _z_velocity; }; /** * @brief z_velocity_units */ - std::string get_z_velocity_units() + std::string const& get_z_velocity_units() const { return _z_velocity_units; }; /** * @brief vector_source_title */ - std::string get_vector_source_title() + std::string const& get_vector_source_title() const { return _vector_source_title; }; /** * @brief vector_source */ - std::string get_vector_source() + std::string const& get_vector_source() const { return _vector_source; }; /** * @brief spare_4 */ - std::string get_spare_4() + std::string const& get_spare_4() const { return _spare_4; }; /** * @brief utc_sbt_time_title */ - std::string get_utc_sbt_time_title() + std::string const& get_utc_sbt_time_title() const { return _utc_sbt_time_title; }; /** * @brief utc_sbt_time */ - std::string get_utc_sbt_time() + std::string const& get_utc_sbt_time() const { return _utc_sbt_time; }; /** * @brief sat_binary_time_title */ - std::string get_sat_binary_time_title() + std::string const& get_sat_binary_time_title() const { return _sat_binary_time_title; }; /** * @brief sat_binary_time */ - std::string get_sat_binary_time() + std::string const& get_sat_binary_time() const { return _sat_binary_time; }; /** * @brief clock_step_title */ - std::string get_clock_step_title() + std::string const& get_clock_step_title() const { return _clock_step_title; }; /** * @brief clock_step */ - std::string get_clock_step() + std::string const& get_clock_step() const { return _clock_step; }; /** * @brief clock_step_units */ - std::string get_clock_step_units() + std::string const& get_clock_step_units() const { return _clock_step_units; }; /** * @brief leap_utc_title */ - std::string get_leap_utc_title() + std::string const& get_leap_utc_title() const { return _leap_utc_title; }; /** * @brief leap_utc */ - std::string get_leap_utc() + std::string const& get_leap_utc() const { return _leap_utc; }; /** * @brief leap_sign_title */ - std::string get_leap_sign_title() + std::string const& get_leap_sign_title() const { return _leap_sign_title; }; /** * @brief leap_sign */ - std::string get_leap_sign() + std::string const& get_leap_sign() const { return _leap_sign; }; /** * @brief leap_err_title */ - std::string get_leap_err_title() + std::string const& get_leap_err_title() const { return _leap_err_title; }; /** * @brief leap_err */ - std::string get_leap_err() + std::string const& get_leap_err() const { return _leap_err; }; /** * @brief product_err_title */ - std::string get_product_err_title() + std::string const& get_product_err_title() const { return _product_err_title; }; /** * @brief product_err */ - std::string get_product_err() + std::string const& get_product_err() const { return _product_err; }; /** * @brief total_size_title */ - std::string get_total_size_title() + std::string const& get_total_size_title() const { return _total_size_title; }; /** * @brief tot_size */ - std::string get_tot_size() + std::string const& get_tot_size() const { return _tot_size; }; /** * @brief total_size_units */ - std::string get_total_size_units() + std::string const& get_total_size_units() const { return _total_size_units; }; /** * @brief sph_size_title */ - std::string get_sph_size_title() + std::string const& get_sph_size_title() const { return _sph_size_title; }; /** * @brief sph_size */ - std::string get_sph_size() + std::string const& get_sph_size() const { return _sph_size; }; /** * @brief sph_size_units */ - std::string get_sph_size_units() + std::string const& get_sph_size_units() const { return _sph_size_units; }; /** * @brief number_of_dsd_title */ - std::string get_number_of_dsd_title() + std::string const& get_number_of_dsd_title() const { return _number_of_dsd_title; }; /** * @brief num_dsd */ - int get_num_dsd() + int get_num_dsd() const { return _num_dsd; }; /** * @brief size_of_dsd_title */ - std::string get_size_of_dsd_title() + std::string const& get_size_of_dsd_title() const { return _size_of_dsd_title; }; /** * @brief dsd_size */ - int get_dsd_size() + int get_dsd_size() const { return _dsd_size; }; /** * @brief size_of_dsd_units */ - std::string get_size_of_dsd_units() + std::string const& get_size_of_dsd_units() const { return _size_of_dsd_units; }; /** * @brief number_of_ds_att_title */ - std::string get_number_of_ds_att_title() + std::string const& get_number_of_ds_att_title() const { return _number_of_ds_att_title; }; /** * @brief num_data_sets */ - int get_num_data_sets() + int get_num_data_sets() const { return _num_data_sets; }; /** * @brief Check mph validity */ - bool is_valid() + bool is_valid() const { if ((_product_name.compare("PRODUCT=") == 0) && (_number_of_dsd_title.compare("NUM_DSD=") == 0)) { diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp index 0abfa4d9cbb5460975b94ec8adf72fb7cd252aab..cf72110dffa5956760b4286a0495c99a2b9690bd 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp @@ -120,10 +120,9 @@ namespace ossimplugins else { mph mph_rec; - dataFile >> mph_rec; // test if it is an ENVISAT Data file - if (mph_rec.is_valid()) + if (dataFile >> mph_rec && mph_rec.is_valid()) { if (traceDebug()) { diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimKeyWordListUtilities.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimKeyWordListUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..a86560a22e620d7f4aab24353fb18527ed732bac --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimKeyWordListUtilities.h @@ -0,0 +1,242 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- + +#ifndef ossimKeyWordListUtilities_h +#define ossimKeyWordListUtilities_h + +#include "ossimStringUtilities.h" +#include "ossimXmlTools.h" +#include <ossim/base/ossimKeywordlist.h> +#include <ossim/base/ossimRefPtr.h> +#include <ossim/base/ossimXmlNode.h> +#include <stdexcept> + +namespace ossimplugins { + class kw_runtime_error : public std::runtime_error { + public: + explicit kw_runtime_error(std::string const& msg) + : std::runtime_error(msg) + {} + }; + class empty_keyword_data : public kw_runtime_error { + public: + explicit empty_keyword_data(std::string const& keyword) + : kw_runtime_error("Data associated to '"+keyword+"' keyword is empty.") + {} + }; + + class missing_keyword : public kw_runtime_error { + public: + explicit missing_keyword(std::string const& keyword) + : kw_runtime_error("Cannot find '"+keyword+"' keyword in keyword list.") + {} + }; + + inline + void addOptional(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimRefPtr<ossimXmlNode> const& wh = parentNode.findFirstNode(xpath); + if (wh.valid()) { + ossimString const& value = wh->getText(); + kwl.addPair(prefix, key, value, true); + } + } + + inline + void addOptional(ossimKeywordlist & kwl, std::string const& key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimRefPtr<ossimXmlNode> const& wh = parentNode.findFirstNode(xpath); + if (wh.valid()) { + ossimString const& value = wh->getText(); + kwl.addPair(key, value, true); + } + } + + inline + ossimString const& addMandatory(ossimKeywordlist & kwl, std::string const& prefix, char const* key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimXmlNode const& childNode = getExpectedFirstNode(parentNode, xpath); + ossimString const& value = childNode.getText(); + kwl.addPair(prefix, key, value, true); + return value; + } + + inline + ossimString const& addMandatory(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimXmlNode const& childNode = getExpectedFirstNode(parentNode, xpath); + ossimString const& value = childNode.getText(); + kwl.addPair(prefix, key, value, true); + return value; + } + + inline + ossimString const& addMandatory(ossimKeywordlist & kwl, std::string const& prefix, ossimString const& key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimXmlNode const& childNode = getExpectedFirstNode(parentNode, xpath); + ossimString const& value = childNode.getText(); + kwl.addPair(prefix, key.string(), value, true); + return value; + } + + inline + ossimString const& addMandatory(ossimKeywordlist & kwl, std::string const& key, + ossimXmlNode const& parentNode, ossimString const& xpath) + { + ossimXmlNode const& childNode = getExpectedFirstNode(parentNode, xpath); + ossimString const& value = childNode.getText(); + kwl.addPair(key, value, true); + return value; + } + + struct ShallOverwrite { + enum type { no, yes}; + ShallOverwrite(type o) : m_o(o) {} + explicit ShallOverwrite(bool o) : m_o(o ? yes : no) {} + bool shall_we() const { return m_o == yes; } + private: + type m_o; + }; + + inline + std::size_t add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, std::size_t v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + const ossimString s = ossimString::toString(static_cast<ossim_uint64>(v)); + kwl.addPair(prefix, key, s.string(), overwrite.shall_we()); + return v; + } + inline + std::size_t add(ossimKeywordlist & kwl, std::string const& key, std::size_t v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + const ossimString s = ossimString::toString(static_cast<ossim_uint64>(v)); + kwl.addPair(key, s.string(), overwrite.shall_we()); + return v; + } + inline + std::string const& add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, std::string const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + kwl.addPair(prefix, key, v, overwrite.shall_we()); + return v; + } + inline + std::string const& add(ossimKeywordlist & kwl, std::string const& key, std::string const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + kwl.addPair(key, v, overwrite.shall_we()); + return v; + } + template <typename DataType> inline + DataType const& add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, DataType const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + const ossimString s = ossimString::toString(v); + kwl.addPair(prefix, key, s.string(), overwrite.shall_we()); + return v; + } + + template <typename DataType> inline + DataType const& add(ossimKeywordlist & kwl, std::string const& key, DataType const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + const ossimString s = ossimString::toString(v); + kwl.addPair(key, s.string(), overwrite.shall_we()); + return v; + } + + inline + ossimString const& add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, ossimString const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + kwl.addPair(prefix, key, v.string(), overwrite.shall_we()); + return v; + } + inline + ossimString const& add(ossimKeywordlist & kwl, std::string const& prefix, ossimString const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + kwl.addPair(prefix, v, overwrite.shall_we()); + return v; + } + inline + time::ModifiedJulianDate const& add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, time::ModifiedJulianDate const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + add(kwl, prefix, key, to_simple_string(v), overwrite); + return v; + } + inline + time::ModifiedJulianDate const& add(ossimKeywordlist & kwl, std::string const& key, time::ModifiedJulianDate const& v, ShallOverwrite overwrite = ShallOverwrite::yes) + { + add(kwl, key, to_simple_string(v), overwrite); + return v; + } +#if defined(USE_BOOST_TIME) + inline + boost::posix_time::ptime const& add(ossimKeywordlist & kwl, std::string const& key, boost::posix_time::ptime const& v) + { + add(kwl, key, to_iso_extended_string(v)); + return v; + } + inline + boost::posix_time::ptime const& add(ossimKeywordlist & kwl, std::string const& prefix, std::string const& key, boost::posix_time::ptime const& v) + { + return add(kwl, prefix+key, v); + } + + inline void get(ossimKeywordlist const& kwl, std::string const& key, boost::posix_time::ptime & v) + { + std::string str = kwl.findKey(key); + assert(&str != &ossimKeywordlist::NULL_KW); + assert(!str.empty()); + std::replace(str.begin(), str.end(), 'T', ' '); + v = boost::posix_time::time_from_string(str); + } + inline void get(ossimKeywordlist const& kwl, std::string const& prefix, std::string const& key, boost::posix_time::ptime & v) + { + get(kwl, prefix+key, v); + } +#endif + + template <typename T> + inline void get(ossimKeywordlist const& kwl, std::string const& key, T & v) + { + std::string const& str = kwl.findKey(key); + if (&str == &ossimKeywordlist::NULL_KW) { + throw missing_keyword(key); + } + if (str.empty()) { + throw empty_keyword_data(key); + } + assert(&str != &ossimKeywordlist::NULL_KW); + assert(!str.empty()); + v = to<T>(str, " extracting " + key + "from KWL"); + } + + template <typename T> + inline void get(ossimKeywordlist const& kwl, std::string const& prefix, std::string const& key, T & v) + { + return get(kwl, prefix+key, v); + } + + inline void get(ossimKeywordlist const& kwl, std::string const& key, time::ModifiedJulianDate & v) + { + std::string const& str = kwl.findKey(key); + assert(&str != &ossimKeywordlist::NULL_KW); + assert(!str.empty()); + v = time::toModifiedJulianDate(str); + } + + inline void get(ossimKeywordlist const& kwl, std::string const& prefix, std::string const& key, time::ModifiedJulianDate & v) + { + get(kwl, prefix + key, v); + } + +} // ossimplugins namespace + +#endif // ossimKeyWordListUtilities_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimOperatorUtilities.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimOperatorUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..a4a73b7f22d05e3c209dd82b2d36842edf0655f1 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimOperatorUtilities.h @@ -0,0 +1,94 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimOperatorUtilities_h +#define ossimOperatorUtilities_h + +namespace ossimplugins { + // Uses Barton-Nackman trick to help implement operator on classes + // Strongly inspired by boost.operators interface + + // See ossimTimeUtilities.h and ossimTimeUtilitiesTest.cpp for example of + // use + +#define DEFINE_OPERATORS(name, compound, op) \ + template <typename T> struct name ## 1 \ + { \ + friend T operator op(T lhs, T const& rhs) { \ + lhs compound rhs; \ + return lhs; \ + } \ + }; \ + template <typename T, typename U> struct name ## 2 \ + { \ + friend T operator op(T lhs, U const& rhs) { \ + lhs compound rhs; \ + return lhs; \ + } \ + friend T operator op(U const& lhs, T rhs) { \ + rhs compound lhs; \ + return rhs; \ + } \ + }; \ + template <typename T, typename U=void> struct name : name ## 2<T,U> {}; \ + template <typename T> struct name<T,void> : name ## 1<T> {}; + + template <typename U, typename V> struct substractable_asym + { + friend U operator-(V const& lhs, V const& rhs) { + return V::template diff<U,V>(lhs, rhs); + } + }; + + DEFINE_OPERATORS(addable, +=, +); + DEFINE_OPERATORS(substractable, -=, -); + DEFINE_OPERATORS(multipliable, *=, *); +#undef DEFINE_OPERATORS + + template <typename T, typename R> struct dividable { + typedef R scalar_type; + friend T operator/(T lhs, scalar_type const& rhs) { + lhs /= rhs; + return lhs; + } + friend scalar_type operator/(T const& lhs, T const& rhs) { + return ratio_(lhs, rhs); + } + }; + + template <typename T> struct streamable { + friend std::ostream & operator<<(std::ostream & os, const T & v) + { return v.display(os); } + friend std::istream & operator>>(std::istream & is, T & v) + { return v.read(is); } + }; + + template <typename T> struct less_than_comparable { + friend bool operator>(T const& lhs, T const& rhs) { + return rhs < lhs; + } + friend bool operator>=(T const& lhs, T const& rhs) { + return !(lhs < rhs); + } + friend bool operator<=(T const& lhs, T const& rhs) { + return !(rhs < lhs); + } + }; + + template <typename T> struct equality_comparable { + friend bool operator!=(T const& lhs, T const& rhs) { + return !(rhs == lhs); + } + }; + +}// namespace ossimplugins + +#endif // ossimOperatorUtilities_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp index dd59bd2d8d9d7db8cad0d02cded1f5a12bab636f..eed6955abf3bdb9daeed4664ad109549c6a57b03 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp @@ -16,24 +16,26 @@ // ADD_MODEL: Include all sensor model headers here: //*** #include "ossimPluginProjectionFactory.h" -#include <ossim/base/ossimKeywordNames.h> -#include <ossim/base/ossimRefPtr.h> -#include <ossim/projection/ossimProjection.h> #include "ossimRadarSatModel.h" #include "ossimEnvisatAsarModel.h" #include "ossimTerraSarModel.h" -//#include <ossim/projection/ossimCosmoSkymedModel.h> #include "ossimRadarSat2Model.h" #include "ossimErsSarModel.h" #include "ossimAlosPalsarModel.h" #include "ossimPleiadesModel.h" -#include <ossim/base/ossimNotifyContext.h> #include "ossimTileMapModel.h" #include "ossimSpot6Model.h" #include "ossimSentinel1Model.h" +#include "ossimStringUtilities.h" +#include "ossimTraceHelpers.h" +#include <ossim/base/ossimKeywordNames.h> +#include <ossim/base/ossimRefPtr.h> +#include <ossim/projection/ossimProjection.h> +//#include <ossim/projection/ossimCosmoSkymedModel.h> //*** // Define Trace flags for use within this file: //*** +#include <ossim/base/ossimNotifyContext.h> #include <ossim/base/ossimTrace.h> static ossimTrace traceExec = ossimTrace("ossimPluginProjectionFactory:exec"); static ossimTrace traceDebug = ossimTrace("ossimPluginProjectionFactory:debug"); @@ -44,17 +46,74 @@ static ossimTrace traceDebug = ossimTrace("ossimPluginProjectionFactory:debug"); namespace ossimplugins { - - bool ossimPluginProjectionFactory::initalized_; + bool ossimPluginProjectionFactory::initialized_; ossimPluginProjectionFactory ossimPluginProjectionFactory::factoryInstance; ossimPluginProjectionFactory* ossimPluginProjectionFactory::instance() { - return initalized_ ? &factoryInstance : 0; - + return initialized_ ? &factoryInstance : 0; } + template <typename ProjectionType> + inline + ossimRefPtr<ossimProjection> doUpcastModelToProjection(ossimRefPtr<ProjectionType> model) + { + return model.get(); + } + + template <typename ProjectionType> + inline + ossimRefPtr<ossimProjection> doUpcastModelToProjectionWhenOCG(ossimRefPtr<ProjectionType> model) + { + ossimRefPtr<ossimProjection> projection = model->getReplacementOcgModel().get(); +#if 0 + if (projection.valid()) + model = 0; // Have OCG, don't need this one anymore + else + projection = model.get(); +#else + if (!projection) { + projection = model.get(); + } +#endif + return projection; + } + + template <> inline + ossimRefPtr<ossimProjection> doUpcastModelToProjection<ossimRadarSat2Model>(ossimRefPtr<ossimRadarSat2Model> model) + { + return doUpcastModelToProjectionWhenOCG(model); + } + template <> inline + ossimRefPtr<ossimProjection> doUpcastModelToProjection<ossimTerraSarModel>(ossimRefPtr<ossimTerraSarModel> model) + { + return doUpcastModelToProjectionWhenOCG(model); + } + + + template <typename ProjectionType> + inline + ossimRefPtr<ossimProjection> doBuildProjection(ossimFilename const& filename) + { + static const char MODULE[] = "ossimPluginProjectionFactory::createProjection(ossimFilename& filename)"; + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " DEBUG: testing " << STATIC_TYPE_NAME(ProjectionType) << "\n"; + } + + ossimRefPtr<ProjectionType> model = new ProjectionType(); + if ( model->open(filename) ) + { + return model.get(); + } + else + { + return 0; + } + } + ossimProjection* ossimPluginProjectionFactory::createProjection( const ossimFilename& filename, ossim_uint32 /*entryIdx*/)const { @@ -62,29 +121,19 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( ossimRefPtr<ossimProjection> projection = 0; //traceDebug.setTraceFlag(true); + // TODO: use a type-list to simplify this chain factory. + // Sentinel1 if ( !projection ) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimSentinel1Model" << std::endl; - } - - ossimRefPtr<ossimSentinel1Model> model = new ossimSentinel1Model(); - if ( model->open(filename) ) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimSentinel1Model>(filename); } if ( !projection ) { - +#if 1 + projection = doBuildProjection<ossimRadarSat2Model>(filename); +#else if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) @@ -105,30 +154,18 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( { model = 0; } +#endif } // Pleiades if ( !projection ) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimPleiadesModel" << std::endl; - } - - ossimRefPtr<ossimPleiadesModel> model = new ossimPleiadesModel(); - if ( model->open(filename) ) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimPleiadesModel>(filename); } if ( !projection ) { +#if 0 if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) @@ -137,7 +174,7 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( ossimRefPtr<ossimTerraSarModel> model = new ossimTerraSarModel(); - if ( model->open(filename) ) + if ( model->open(filename) ) { // Check if a coarse grid was generated, and use it instead: projection = model->getReplacementOcgModel().get(); @@ -150,88 +187,34 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( { model = 0; } +#else + projection = doBuildProjection<ossimTerraSarModel>(filename); +#endif } - // ErsSar if ( !projection ) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimErsSarModel" << std::endl; - } - ossimRefPtr<ossimErsSarModel> model = new ossimErsSarModel(); - if ( model->open(filename) ) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimErsSarModel>(filename); } if (!projection) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimEnvisatSarModel" << std::endl; - } - - ossimRefPtr<ossimEnvisatAsarModel> model = new ossimEnvisatAsarModel(); - if (model->open(filename)) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimEnvisatAsarModel>(filename); } if (!projection) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimRadarSatModel" << std::endl; - } - - ossimRefPtr<ossimRadarSatModel> model = new ossimRadarSatModel(); - if (model->open(filename)) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimRadarSatModel>(filename); } if (!projection) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimAlosPalsarModel" << std::endl; - } - - ossimRefPtr<ossimAlosPalsarModel> model = new ossimAlosPalsarModel(); - if (model->open(filename)) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimAlosPalsarModel>(filename); } if (!projection) { - if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) @@ -266,50 +249,21 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( } } - if (!projection) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimTileMapModel" << std::endl; - } - - ossimRefPtr<ossimTileMapModel> model = new ossimTileMapModel(); - if (model->open(filename)) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimTileMapModel>(filename); } - // Spot6 if ( !projection ) { - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: testing ossimSpot6Model" << std::endl; - } - - ossimRefPtr<ossimSpot6Model> model = new ossimSpot6Model(); - if ( model->open(filename) ) - { - projection = model.get(); - } - else - { - model = 0; - } + projection = doBuildProjection<ossimSpot6Model>(filename); } //*** // ADD_MODEL: (Please leave this comment for the next programmer) + // Or, use doBuildProjection<MY_NEW_MODEL>(filename); //*** //if(traceDebug()) //{ @@ -341,14 +295,15 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( if(traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: Entering ...." << std::endl; + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " DEBUG: Entering ...." << std::endl; } // else if (name == STATIC_TYPE_NAME(ossimCosmoSkymedModel)) // { // return new ossimCosmoSkymedModel; // } + // TOTO: use type list/map if (name == STATIC_TYPE_NAME(ossimRadarSat2Model)) { return new ossimRadarSat2Model(); @@ -394,18 +349,16 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( return new ossimSentinel1Model; } - //*** // ADD_MODEL: (Please leave this comment for the next programmer) //*** // if(name == MY_NEW_MODEL) // return new myNewModel; - if(traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: Leaving ...." << std::endl; + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " DEBUG: Leaving ...." << std::endl; } return 0; @@ -417,105 +370,57 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( ossimRefPtr<ossimProjection> result = 0; static const char MODULE[] = "ossimPluginProjectionFactory::createProjection(ossimKeywordlist& kwl)"; - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: Start ...." << std::endl; - } + SCOPED_LOG(traceDebug, MODULE); const char* lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW); if (lookup) { - ossimString type = lookup; + const std::string type = lookup; if (type == "ossimRadarSat2Model") { result = new ossimRadarSat2Model(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimTerraSarModel") { result = new ossimTerraSarModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimErsSarModel") { result = new ossimErsSarModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimEnvisatAsarModel") { result = new ossimEnvisatAsarModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimRadarSatModel") { result = new ossimRadarSatModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimAlosPalsarModel") { result = new ossimAlosPalsarModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimFormosatModel") { result = new ossimFormosatModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimTileMapModel") { result = new ossimTileMapModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimPleiadesModel") { result = new ossimPleiadesModel(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimSpot6Model") { result = new ossimSpot6Model(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } else if (type == "ossimSentinel1Model") { result = new ossimSentinel1Model(); - if ( !result->loadState(kwl, prefix) ) - { - result = 0; - } } //*** @@ -524,18 +429,13 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( // else if (type == "ossimSpot6Model") // { // result = new ossimSpot6Model(); -// if ( !result->loadState(kwl, prefix) ) -// { -// result = 0; -// } // } - } - - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << MODULE << " DEBUG: End ...." << std::endl; + // Then, try to load the keyword list + if ( result.get() && !result->loadState(kwl, prefix) ) + { + result = 0; + } } return result.release(); @@ -575,23 +475,19 @@ void ossimPluginProjectionFactory::getTypeNameList(std::vector<ossimString>& typ //typeList.push_back(STATIC_TYPE_NAME(MY_NEW_MODEL)); } -bool ossimPluginProjectionFactory::isTileMap(const ossimFilename& filename)const +bool ossimPluginProjectionFactory::isTileMap(ossimFilename filename)const { - ossimFilename temp(filename); - temp.downcase(); - - ossimString os = temp.beforePos(4); - - if(temp.ext()=="otb") - { - return true; - } - else if(os == "http") - { - return true; - } - return false; -} + filename.downcase(); + // Incorrect inheritance, some string services have been lost + std::string const& sFilename = filename; + const bool res + = ends_with(sFilename, ".otb") + || starts_with(sFilename, "http") + ; + return res; } + + +} // ossimplugins namespace diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h index f245079a9735c077e6231e51d507fa550269172f..6ebb23b0e667dbb9fbbb076405351c769a3e461e 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h @@ -53,20 +53,21 @@ public: virtual void getTypeNameList(std::vector<ossimString>& typeList)const; protected: - bool isTileMap(const ossimFilename& filename) const; + // Taken by copy -> copy elision + bool isTileMap(ossimFilename filename) const; private: ossimPluginProjectionFactory() { - initalized_ = true; + initialized_ = true; } ~ossimPluginProjectionFactory() { - initalized_ = false; + initialized_ = false; } - static bool initalized_; + static bool initialized_; static ossimPluginProjectionFactory factoryInstance; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRangeUtilities.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRangeUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..8447a44aa3e4892b5dedfe76a8349cbbb6716680 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRangeUtilities.h @@ -0,0 +1,104 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimRangeUtilities_h +#define ossimRangeUtilities_h + +namespace ossimplugins { + template <typename T, std::size_t N> + inline + std::size_t size(T (&)[N]) + { return N; } + + template <typename T> + inline + typename T::size_type size(T const& cont) + { return cont.size(); } + + template <typename T, std::size_t N> + inline + T* begin(T (&array)[N]) + { return &array[0]; } + + template <typename T> + inline + typename T::iterator + begin(T & cont) + {return begin(cont);} + + template <typename T> + inline + typename T::const_iterator + begin(T const& cont) + {return begin(cont);} + + template <typename T, std::size_t N> + inline + std::reverse_iterator<T*> rbegin(T (&array)[N]) + { return std::reverse_iterator<T*>(&array[N]); } + + template <typename T> + inline + typename T::reverse_iterator + rbegin(T & cont) + {return rbegin(cont);} + + template <typename T> + inline + typename T::const_reverse_iterator + rbegin(T const& cont) + {return rbegin(cont);} + + + template <typename T, std::size_t N> + inline + T* end(T (&array)[N]) + { return &array[N]; } + + template <typename T> + inline + typename T::iterator + end(T & cont) + {return end(cont);} + + template <typename T> + inline + typename T::const_iterator + end(T const& cont) + {return end(cont);} + + template <typename T, std::size_t N> + inline + std::reverse_iterator<T*> rend(T (&array)[N]) + { return std::reverse_iterator<T*>(&array[0]); } + + template <typename T> + inline + typename T::reverse_iterator + rend(T & cont) + {return rend(cont);} + + template <typename T> + inline + typename T::const_reverse_iterator + rend(T const& cont) + {return rend(cont);} + + namespace details + { + template<typename T, std::size_t N> + char (&array_size_helper(T (&)[N]))[N]; +#define array_size(array) (sizeof ::ossimplugins::details::array_size_helper(array)) + } // details namespace + +} // ossimplugins namespace + +#endif // ossimRangeUtilities_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4314f43f1055073f2b37d40c61c305e78608f5bd --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp @@ -0,0 +1,1214 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include "ossimSarSensorModel.h" +#include "ossimKeyWordListUtilities.h" +#include "ossimTraceHelpers.h" +#include "ossimRangeUtilities.h" +#include "ossimSarSensorModelPathsAndKeys.h" +#include <ossim/base/ossimRegExp.h> +#include <ossim/base/ossimLsrSpace.h> +#include <boost/static_assert.hpp> +#include <iostream> +#include <vector> +#include <algorithm> + +#if defined(USE_BOOST_TIME) +using boost::posix_time::microseconds; +using boost::posix_time::seconds; +#else +using ossimplugins::time::microseconds; +using ossimplugins::time::seconds; +#endif + +namespace {// Anonymous namespace + const bool k_verbose = false; // global verbose constant; TODO: use an option + const unsigned int k_version = 2; + + // Sometimes, we don't need to compare the actual distance, its square value is + // more than enough. + inline double squareDistance(ossimDpt const& lhs, ossimDpt const& rhs) { + const double dx = lhs.x - rhs.x; + const double dy = lhs.y - rhs.y; + return dx*dx + dy*dy; + } + + inline double squareDistance(ossimGpt const& lhs, ossimGpt const& rhs) { + const ossimEcefPoint l(lhs); + const ossimEcefPoint r(rhs); + return (l-r).norm2(); + } + + template <typename Container> + inline void unzip(Container const& in, Container& out_even, Container& out_odd) + { + typedef typename Container::const_iterator const_iterator; + typedef typename Container::size_type size_type; + + const size_type size = in.size(); + const bool has_a_odd_number_of_elements = size % 2 == 1; + + out_even.reserve(size/2+1); + out_odd.reserve(size/2); + + const_iterator end = in.end(); + if (has_a_odd_number_of_elements) + { + std::advance(end, -1); + } + for (const_iterator it=in.begin(); it != end ; ) + { + out_even.push_back(*it++); + out_odd.push_back(*it++); + } + if (has_a_odd_number_of_elements) + { + assert(end != in.end()); + out_even.push_back(*end); + } + assert(out_even.size() >= out_odd.size()); + assert(out_odd.capacity() == size/2); // The correct number of element have been reserved + assert(out_even.capacity() == size/2+1); // The correct number of element have been reserved + assert(out_odd.size() + out_even.size() == size); + } + + ossimTrace traceExec ("ossimSarSensorModel:exec"); + ossimTrace traceDebug ("ossimSarSensorModel:debug"); + + typedef char const* const* strings_iterator; + static char const* const PRODUCTTYPE_STRINGS[] = { "SLC", "GRD", "MGD", "GEC", "EEC" }; +}// Anonymous namespace + +namespace ossimplugins +{ + const double ossimSarSensorModel::C = 299792458; + + ossimSarSensorModel::ProductType::ProductType(string_view const& s) + { + using ossimplugins::begin; + using ossimplugins::end; + strings_iterator const ProductType_it = std::find(begin(::PRODUCTTYPE_STRINGS),end(::PRODUCTTYPE_STRINGS), s); + if (ProductType_it == end(::PRODUCTTYPE_STRINGS)) { + throw std::runtime_error("Invalid Sar Sensor Product type: `"+s+"'"); + } + m_value = Type(std::distance(begin(::PRODUCTTYPE_STRINGS), ProductType_it)); + assert(m_value < MAX__); + } + + string_view ossimSarSensorModel::ProductType::ToString() const + { + BOOST_STATIC_ASSERT((MAX__ == array_size(::PRODUCTTYPE_STRINGS))); + assert(m_value != UNDEFINED__); // Yes, I know UNDEFINED__ > MAX__ + assert(m_value < MAX__); + return PRODUCTTYPE_STRINGS[m_value]; + } + + ossimSarSensorModel::ossimSarSensorModel() + : theRadarFrequency(0.), + theAzimuthTimeInterval(seconds(0)), + theNearRangeTime(0.), + theRangeSamplingRate(0.), + theRangeResolution(0.), + theBistaticCorrectionNeeded(false), + theAzimuthTimeOffset(seconds(0)), + theRangeTimeOffset(0.) + {} + + ossimSarSensorModel::GCPRecordType const& + ossimSarSensorModel::findClosestGCP(ossimDpt const& imPt) const + { + assert(!theGCPRecords.empty()&&"theGCPRecords is empty."); + + // Find the closest GCP + double distance2 = squareDistance(imPt, theGCPRecords.front().imPt); + + std::vector<GCPRecordType>::const_iterator refGcp = theGCPRecords.begin(); + std::vector<GCPRecordType>::const_iterator gcpIt = theGCPRecords.begin(); + std::vector<GCPRecordType>::const_iterator gcpEnd = theGCPRecords.end(); + for(++gcpIt ; gcpIt!=gcpEnd ; ++gcpIt) + { + const double currentDistance2 = squareDistance(imPt, gcpIt->imPt); + + if(currentDistance2 < distance2) + { + distance2 = currentDistance2; + refGcp = gcpIt; + } + } + + assert(refGcp != theGCPRecords.end() && "A GCP record shall have been found!"); + return *refGcp; + } + + void ossimSarSensorModel::lineSampleHeightToWorld(const ossimDpt& imPt, const double & heightAboveEllipsoid, ossimGpt& worldPt) const + { + // std::clog << "ossimSarSensorModel::lineSampleHeightToWorld()\n"; + assert(!theGCPRecords.empty()&&"theGCPRecords is empty."); + + GCPRecordType const& refGcp = findClosestGCP(imPt); + + // Set the height reference + ossim_float64 hgtSet; + if ( ossim::isnan(heightAboveEllipsoid) ) + { + hgtSet = refGcp.worldPt.height(); + } + else + { + hgtSet = heightAboveEllipsoid; + } + const ossimHgtRef hgtRef(AT_HGT, hgtSet); + + ossimEcefPoint ellPt; + + // Simple iterative inversion of inverse model starting at closest gcp + projToSurface(refGcp,imPt,hgtRef,ellPt); + + worldPt = ossimGpt(ellPt); + } + + void ossimSarSensorModel::lineSampleToWorld(ossimDpt const& imPt, ossimGpt& worldPt) const + { + // std::clog << "ossimSarSensorModel::lineSampleToWorld()\n"; + assert(!theGCPRecords.empty()&&"theGCPRecords is empty."); + + GCPRecordType const& refGcp = findClosestGCP(imPt); + ossimGpt const& refPt = refGcp.worldPt; + + const ossimHgtRef hgtRef(AT_DEM); + + ossimEcefPoint ellPt; + + // Simple iterative inversion of inverse model starting at closest gcp + projToSurface(refGcp,imPt,hgtRef,ellPt); + + worldPt = ossimGpt(ellPt); + } + + void ossimSarSensorModel::worldToLineSample(const ossimGpt& worldPt, ossimDpt & imPt) const + { + // std::clog << "ossimSarSensorModel::worldToLineSample()\n"; + assert(theRangeResolution>0&&"theRangeResolution is null."); + + // First compute azimuth and range time + TimeType azimuthTime; + double rangeTime; + + const bool success = worldToAzimuthRangeTime(worldPt, azimuthTime, rangeTime); + + if(!success) + { + imPt.makeNan(); + return; + } + // std::clog << "AzimuthTime: " << azimuthTime << "\n"; + // std::clog << "RangeTime: " << rangeTime << "\n"; + // std::clog << "GRD: " << isGRD() << "\n"; + + // Convert azimuth time to line + azimuthTimeToLine(azimuthTime,imPt.y); + + if(isGRD()) + { + // GRD case + double groundRange(0); + slantRangeToGroundRange(rangeTime*C/2,azimuthTime,groundRange); + // std::clog << "GroundRange: " << groundRange << "\n"; + // std::clog << "TheRangeResolution: " << theRangeResolution << "\n"; + + // Eq 32 p. 31 + // TODO: possible micro-optimization: precompute 1/theRangeResolution, and + // use * + imPt.x = groundRange/theRangeResolution; + } + else + { + // std::clog << "TheNearRangeTime: " << theNearRangeTime << "\n"; + // std::clog << "TheRangeSamplingRate: " << theRangeSamplingRate << "\n"; + // SLC case + // Eq 23 and 24 p. 28 + imPt.x = (rangeTime - theNearRangeTime)*theRangeSamplingRate; + } + } + + bool ossimSarSensorModel::worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime) const + { + // std::clog << "ossimSarSensorModel::worldToAzimuthRangeTime()\n"; + // First convert lat/lon to ECEF + ossimEcefPoint inputPt(worldPt); + + // Compute zero doppler time + TimeType interpTime; + ossimEcefPoint interpSensorPos; + ossimEcefVector interpSensorVel; + + const bool success = zeroDopplerLookup(inputPt,azimuthTime,interpSensorPos,interpSensorVel); + + if(!success) + { + // TODO: check whether we could throw instead + return false; + } + + if(theBistaticCorrectionNeeded) + { + // Compute bistatic correction if needed + DurationType bistaticCorrection; + computeBistaticCorrection(inputPt,interpSensorPos,bistaticCorrection); + + // Update interpolated azimuth time + azimuthTime += bistaticCorrection; + + // Update sensor position and velocity + interpolateSensorPosVel(interpTime,interpSensorPos,interpSensorVel); + } + + // rangeTime is the round-tripping time to target + const double rangeDistance = (interpSensorPos-inputPt).magnitude(); + rangeTime = theRangeTimeOffset + 2*rangeDistance/C; + + return true; + } + + void ossimSarSensorModel::lineSampleToAzimuthRangeTime(const ossimDpt & imPt, TimeType & azimuthTime, double & rangeTime) const + { + // std::clog << "ossimSarSensorModel::lineSampleToAzimuthRangeTime()\n"; + // First compute azimuth time here + lineToAzimuthTime(imPt.y,azimuthTime); + + // Then compute range time + if(isGRD()) + { + // Handle grd case here + double slantRange; + groundRangeToSlantRange(imPt.x*theRangeResolution,azimuthTime, slantRange); + rangeTime = theRangeTimeOffset + 2*slantRange/C; + } + else + { + rangeTime = theRangeTimeOffset + theNearRangeTime + imPt.x*(1/theRangeSamplingRate); + } + } + + void ossimSarSensorModel::computeRangeDoppler(const ossimEcefPoint & inputPt, const ossimEcefPoint & sensorPos, const ossimEcefVector sensorVel, double & range, double & doppler) const + { + // std::clog << "ossimSarSensorModel::computeRangeDoppler()\n"; + assert(theRadarFrequency>0&&"theRadarFrequency is null"); + + // eq. 19, p. 25 + const ossimEcefVector s2gVec = inputPt - sensorPos; + + range = s2gVec.magnitude(); + + const double coef = -2*C/(theRadarFrequency*range); + + doppler = coef * sensorVel.dot(s2gVec); + } + + void ossimSarSensorModel::interpolateSensorPosVel(const TimeType & azimuthTime, ossimEcefPoint& sensorPos, ossimEcefVector& sensorVel, unsigned int deg) const + { + assert(!theOrbitRecords.empty()&&"The orbit records vector is empty"); + + // Lagrangian interpolation of sensor position and velocity + + unsigned int nBegin(0), nEnd(0); + + sensorPos[0] = 0; + sensorPos[1] = 0; + sensorPos[2] = 0; + + sensorVel[0] = 0; + sensorVel[1] = 0; + sensorVel[2] = 0; + + // First, we search for the correct set of record to use during + // interpolation + + // If there are less records than degrees, use them all + if(theOrbitRecords.size()<deg) + { + nEnd = theOrbitRecords.size()-1; + } + else + { + // Search for the deg number of records around the azimuth time + unsigned int t_min_idx = 0; + DurationType t_min = abs(azimuthTime - theOrbitRecords.front().azimuthTime); + + unsigned int count = 0; + + for(std::vector<OrbitRecordType>::const_iterator it = theOrbitRecords.begin();it!=theOrbitRecords.end();++it,++count) + { + const DurationType current_time = abs(azimuthTime-it->azimuthTime); + + if(t_min > current_time) + { + t_min_idx = count; + t_min = current_time; + } + } + // TODO: see if these expressions can be simplified + nBegin = std::max((int)t_min_idx-(int)deg/2+1,(int)0); + nEnd = std::min(nBegin+deg-1,(unsigned int)theOrbitRecords.size()); + nBegin = nEnd<theOrbitRecords.size()-1 ? nBegin : nEnd-deg+1; + } + + // Compute lagrangian interpolation using records from nBegin to nEnd + for(unsigned int i = nBegin; i < nEnd; ++i) + { + double w = 1.; + + unsigned int j = nBegin; + for( ; j != i ; ++j) + { + const DurationType td1 = azimuthTime - theOrbitRecords[j].azimuthTime; + const DurationType td2 = theOrbitRecords[i].azimuthTime - theOrbitRecords[j].azimuthTime; + const double f = td1 / td2; + w *= f; + } + ++j; + for( ; j < nEnd; ++j) + { + const DurationType td1 = azimuthTime - theOrbitRecords[j].azimuthTime; + const DurationType td2 = theOrbitRecords[i].azimuthTime - theOrbitRecords[j].azimuthTime; + const double f = td1 / td2; + w *= f; + } + + sensorPos[0]+=w*theOrbitRecords[i].position[0]; + sensorPos[1]+=w*theOrbitRecords[i].position[1]; + sensorPos[2]+=w*theOrbitRecords[i].position[2]; + + sensorVel[0]+=w*theOrbitRecords[i].velocity[0]; + sensorVel[1]+=w*theOrbitRecords[i].velocity[1]; + sensorVel[2]+=w*theOrbitRecords[i].velocity[2]; + } + } + + void ossimSarSensorModel::slantRangeToGroundRange(const double & slantRange, const TimeType & azimuthTime, double & groundRange) const + { + applyCoordinateConversion(slantRange,azimuthTime,theSlantRangeToGroundRangeRecords,groundRange); + } + + void ossimSarSensorModel::groundRangeToSlantRange(const double & groundRange, const TimeType & azimuthTime, double & slantRange) const + { + applyCoordinateConversion(groundRange,azimuthTime,theGroundRangeToSlantRangeRecords,slantRange); + } + + void ossimSarSensorModel::applyCoordinateConversion(const double & in, const TimeType& azimuthTime, const std::vector<CoordinateConversionRecordType> & records, double & out) const + { + assert(!records.empty()&&"The records vector is empty."); + // std::clog << "conv coord(" << in << ", az="<<azimuthTime<<")\n"; + + // First, we need to find the correct pair of records for interpolation + std::vector<CoordinateConversionRecordType>::const_iterator it = records.begin(); + + CoordinateConversionRecordType srgrRecord; + + std::vector<CoordinateConversionRecordType>::const_iterator previousRecord = it; + ++it; + + std::vector<CoordinateConversionRecordType>::const_iterator nextRecord = it; + + // Look for the correct record + // std::clog << "Looking for " << azimuthTime << " within records:\n"; + while(it!=records.end()) + { + // std::clog << "- record: " << it->azimuthTime << "..."; + // nextRecord = it; + + if(azimuthTime >= previousRecord->azimuthTime + && azimuthTime < nextRecord->azimuthTime) + { + // std::clog << " found!\n"; + break; + } + else + { + previousRecord = nextRecord; + ++it; + nextRecord = it; + // std::clog << " NOT found => next!\n"; + } + } + assert(nextRecord == it); + if(it == records.end()) + { + if(azimuthTime < records.front().azimuthTime) + { + srgrRecord = records.front(); + // std::clog << "Not found, but before first => srgrRecord: " << srgrRecord.azimuthTime << "\n"; + } + else if(azimuthTime >= records.back().azimuthTime) + { + srgrRecord = records.back(); + // std::clog << "Not found, but after last => srgrRecord: " << srgrRecord.azimuthTime << "\n"; + } + } + else + { + assert(nextRecord != records.end()); + assert(!previousRecord->coefs.empty()&&"previousRecord coefficients vector is empty."); + assert(!nextRecord->coefs.empty()&&"nextRecord coefficients vector is empty."); + + // If azimuth time is between 2 records, interpolate + const double interp + = DurationType(azimuthTime - previousRecord->azimuthTime) + / (nextRecord->azimuthTime - previousRecord->azimuthTime) + ; + // std::clog << "interp: " << interp << " =" + // << " (" << azimuthTime << " - " << previousRecord->azimuthTime << " (="<< (azimuthTime - previousRecord->azimuthTime)<< ") )" + // << "/(" << nextRecord->azimuthTime << " - " << previousRecord->azimuthTime << " (="<< (nextRecord->azimuthTime - previousRecord->azimuthTime)<< ") )" + // << "\n"; + + srgrRecord.rg0 = (1-interp) * previousRecord->rg0 + interp*nextRecord->rg0; + + srgrRecord.coefs.clear(); + std::vector<double>::const_iterator pIt = previousRecord->coefs.begin(); + std::vector<double>::const_iterator nIt = nextRecord->coefs.begin(); + + for(;pIt != previousRecord->coefs.end() && nIt != nextRecord->coefs.end();++pIt,++nIt) + { + srgrRecord.coefs.push_back(interp*(*nIt)+(1-interp)*(*pIt)); + } + + assert(!srgrRecord.coefs.empty()&&"Slant range to ground range interpolated coefficients vector is empty."); + } + + // Now that we have the interpolated coefs, compute ground range + // from slant range + const double sr_minus_sr0 = in-srgrRecord.rg0; + + assert(!srgrRecord.coefs.empty()&&"Slant range to ground range coefficients vector is empty."); + + out = 0; + + for(std::vector<double>::const_reverse_iterator cIt = srgrRecord.coefs.rbegin();cIt!=srgrRecord.coefs.rend();++cIt) + { + out = *cIt + sr_minus_sr0*out; + } + } + + + bool ossimSarSensorModel::zeroDopplerLookup(const ossimEcefPoint & inputPt, TimeType & interpAzimuthTime, ossimEcefPoint & interpSensorPos, ossimEcefVector & interpSensorVel) const + { + assert((theOrbitRecords.size()>=2) && "Orbit records vector contains less than 2 elements"); + + std::vector<OrbitRecordType>::const_iterator it = theOrbitRecords.begin(); + + double doppler2(0.); + + // Compute range and doppler of first record + // NOTE: here we only use the scalar product with vel and discard + // the constant coef as it has no impact on doppler sign + + double doppler1 = (inputPt-it->position).dot(it->velocity); + + + bool dopplerSign1 = doppler1 < 0; + + ++it; // -> it != begin + + // Look for the consecutive records where doppler freq changes sign + // Note: implementing a bisection algorithm here might be faster + for ( ; it!=theOrbitRecords.end() ; ++it) + { + // compute range and doppler of current record + doppler2 = (inputPt-it->position).dot(it->velocity); + + const bool dopplerSign2 = doppler2 <0; + + // If a change of sign is detected + if(dopplerSign1 != dopplerSign2) + { + break; + } + else + { + doppler1 = doppler2; + } + } + + // In this case, we need to extrapolate + if(it == theOrbitRecords.end()) + { + std::vector<OrbitRecordType>::const_iterator record1 = theOrbitRecords.begin(); + std::vector<OrbitRecordType>::const_iterator record2 = record1 + theOrbitRecords.size()-1; + doppler1 = (inputPt-record1->position).dot(record1->velocity); + doppler2 = (inputPt-record2->position).dot(record2->velocity); + const DurationType delta_td = record2->azimuthTime - record1->azimuthTime; + interpAzimuthTime = record1->azimuthTime - doppler1 / (doppler2 - doppler1) * delta_td; + } + else + { + assert(it != theOrbitRecords.begin()); + assert(it != theOrbitRecords.end()); + std::vector<OrbitRecordType>::const_iterator record2 = it; + std::vector<OrbitRecordType>::const_iterator record1 = --it; + // now interpolate time and sensor position + const double abs_doppler1 = std::abs(doppler1); + const double interpDenom = abs_doppler1+std::abs(doppler2); + + assert(interpDenom>0&&"Both doppler frequency are null in interpolation weight computation"); + + const double interp = abs_doppler1/interpDenom; + // std::clog << "interp: " << interp << "\n"; + + const DurationType delta_td = record2->azimuthTime - record1->azimuthTime; + // std::clog << "delta_td: " << delta_td << " = " << record2->azimuthTime <<" - " <<record1->azimuthTime<< "\n"; + + // Compute interpolated time offset wrt record1 + // (No need for that many computations (day-frac -> ms -> day frac)) + const DurationType td = delta_td * interp; + // std::clog << "td: " << td << "(" << td.total_microseconds() << "us)\n"; + // Compute interpolated azimuth time + interpAzimuthTime = record1->azimuthTime + td + theAzimuthTimeOffset; + } + + // std::clog << "interpAzimuthTime: " << interpAzimuthTime << "\n"; + + // Interpolate sensor position and velocity + interpolateSensorPosVel(interpAzimuthTime,interpSensorPos, interpSensorVel); + + return true; + } + + void ossimSarSensorModel::computeBistaticCorrection(const ossimEcefPoint & inputPt, const ossimEcefPoint & sensorPos, DurationType & bistaticCorrection) const + { + // Bistatic correction (eq 25, p 28) + double halftrange = 1000000. * (sensorPos-inputPt).magnitude()/C; + bistaticCorrection= microseconds(static_cast<unsigned long>(floor(halftrange+0.5))); + } + + + void ossimSarSensorModel::azimuthTimeToLine(const TimeType & azimuthTime, double & line) const + { + assert(!theBurstRecords.empty()&&"Burst records are empty (at least one burst should be available)"); + + std::vector<BurstRecordType>::const_iterator currentBurst = theBurstRecords.begin(); + + // Look for the correct burst. In most cases the number of burst + // records will be 1 (except for TOPSAR Sentinel1 products) + std::vector<BurstRecordType>::const_iterator it = theBurstRecords.begin(); + std::vector<BurstRecordType>::const_iterator itend = theBurstRecords.end(); + for(; it!= itend ; ++it) + { + if(azimuthTime >= it->azimuthStartTime + && azimuthTime < it->azimuthStopTime) + { + currentBurst = it; + break; + } + } + + // If no burst is found, we will use the first (resp. last burst to + // extrapolate line + if(it == itend) + { + if(! theBurstRecords.empty()) + { + if(azimuthTime < theBurstRecords.front().azimuthStartTime) + { + currentBurst = theBurstRecords.begin(); + } + else if (azimuthTime > theBurstRecords.back().azimuthStopTime) + { + currentBurst = theBurstRecords.end()-1; + } + } + else + { + // Fall back to the only record + currentBurst = theBurstRecords.begin(); + } + } + + const DurationType timeSinceStart = azimuthTime - currentBurst->azimuthStartTime; + + // Eq 22 p 27 + line = (timeSinceStart/theAzimuthTimeInterval) + currentBurst->startLine; + // std::clog << "line = " << line << " <- " << timeSinceStart << "/" << theAzimuthTimeInterval << "+" << currentBurst->startLine << "\n"; + } + + void ossimSarSensorModel::lineToAzimuthTime(const double & line, TimeType & azimuthTime) const + { + assert(!theBurstRecords.empty()&&"Burst records are empty (at least one burst should be available)"); + + std::vector<BurstRecordType>::const_iterator currentBurst = theBurstRecords.begin(); + + if(theBurstRecords.size() != 1) + { + // Look for the correct burst. In most cases the number of burst + // records will be 1 (except for TOPSAR Sentinel1 products) + std::vector<BurstRecordType>::const_iterator it = theBurstRecords.begin(); + std::vector<BurstRecordType>::const_iterator itend = theBurstRecords.end(); + for( ; it!= itend; ++it) + { + if(line >= it->startLine && line < it->endLine) + { + currentBurst = it; + break; + } + } + + if(it == itend) + { + if(line < theBurstRecords.front().startLine) + { + currentBurst = theBurstRecords.begin(); + } + else if (line >= theBurstRecords.back().endLine) + { + currentBurst = theBurstRecords.end()-1; + } + } + + } + + const DurationType timeSinceStart = (line - currentBurst->startLine)*theAzimuthTimeInterval; + // std::clog << "timeSinceStart: " << timeSinceStart.total_microseconds() << "us\n"; + + // Eq 22 p 27 + azimuthTime = currentBurst->azimuthStartTime + timeSinceStart + theAzimuthTimeOffset; + // std::clog << "offset: " << theAzimuthTimeOffset << "\n"; + // std::clog << "->azimuthTime: " << azimuthTime << "\n"; + } + + + + bool ossimSarSensorModel::projToSurface(const GCPRecordType & initGcp, const ossimDpt & target, const ossimHgtRef & hgtRef, ossimEcefPoint & ellPt) const + { + // Initialize current estimation + ossimEcefPoint currentEstimation(initGcp.worldPt); + + // Compute corresponding image position + // std::clog << "initGCP: " << initGcp.imPt << "\n"; + ossimDpt currentImPoint(initGcp.imPt); + + ossim_float64 currentImSquareResidual = squareDistance(target,currentImPoint); + double currentHeightResidual = initGcp.worldPt.height() - hgtRef.getRefHeight(initGcp.worldPt); + + bool init = true; + + unsigned int iter = 0; + + // TODO: Every time the function is called, an allocation (+a free) is done. + // This is not efficient. => Find a static matrix of 3x3 elements + // Moreover, NEWMAT implies a lot of objet creations, hence allocations + NEWMAT::SymmetricMatrix BtB(3); + NEWMAT::ColumnVector BtF(3); + NEWMAT::ColumnVector F(3); + NEWMAT::ColumnVector dR(3); + + // Stop condition: img residual < 1e-2 pixels, height residual² < + // 0.01² m, nb iter < 50. init ensure that loop runs at least once. + while((init || (currentImSquareResidual > (0.01*0.01) || std::abs(currentHeightResidual) > 0.01)) && iter < 50) + { + if(init) + init =false; + + // std::clog<<"Iter: "<<iter<<", Res: im="<<currentImSquareResidual<<", hgt="<<currentHeightResidual<<'\n'; + + // compute residuals + F(1) = target.x - currentImPoint.x; + F(2) = target.y - currentImPoint.y; + F(3) = currentHeightResidual; + + // std::clog<<"F("<<iter<<")="<<F<<'\n'; + + // Delta use for partial derivatives estimation (in meters) + const double d = 10.; + + // Compute partial derivatives + ossimEcefVector p_fx, p_fy, p_fh,dx(d,0,0),dy(0,d,0),dz(0,0,d); + ossimDpt tmpImPt; + + ossim_float64 rdx,rdy,rdz, fdx,fdy,fdz; + + ossimGpt currentEstimationWorld(currentEstimation); + ossimGpt tmpGpt = ossimGpt(currentEstimation+dx); + worldToLineSample(tmpGpt,tmpImPt); + // std::clog << "currentEstimationWorld: " << currentEstimationWorld << "\n"; + // std::clog << "currentEstimation: " << currentEstimation << "\n"; + // std::clog << "tmpGpt: " << tmpGpt << "\n"; + // std::clog << "tmpImPt: " << tmpImPt << "\n"; + p_fx[0] = (currentImPoint.x-tmpImPt.x)/d; + p_fy[0] = (currentImPoint.y-tmpImPt.y)/d; + p_fh[0] = (currentEstimationWorld.height()-tmpGpt.height())/d; + + tmpGpt = ossimGpt(currentEstimation+dy); + worldToLineSample(tmpGpt,tmpImPt); + p_fx[1] = (currentImPoint.x-tmpImPt.x)/d; + p_fy[1] = (currentImPoint.y-tmpImPt.y)/d; + p_fh[1] = (currentEstimationWorld.height()-tmpGpt.height())/d; + + tmpGpt = ossimGpt(currentEstimation+dz); + worldToLineSample(tmpGpt,tmpImPt); + p_fx[2] = (currentImPoint.x-tmpImPt.x)/d; + p_fy[2] = (currentImPoint.y-tmpImPt.y)/d; + p_fh[2] = (currentEstimationWorld.height()-tmpGpt.height())/d; + + // Form B-matrix + NEWMAT::Matrix B = ossimMatrix3x3::create(p_fx[0], p_fx[1], p_fx[2], + p_fy[0], p_fy[1], p_fy[2], + p_fh[0], p_fh[1], p_fh[2]); + + // std::clog<<"B: "<<B<<'\n'; + + // Invert system + try { + dR = B.i() * F; +#if !(defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER) || defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)) + } catch (NEWMAT::SingularException const& e) { + // NEWMATH exception + throw std::runtime_error(e.what()); +#endif + } catch (...) { + throw std::runtime_error("Cannot invert 3x3 matrix in projToSurface"); + } + + // Update estimate + for (ossim_int32 k=0; k<3; k++) + { + currentEstimation[k] -= dR(k+1); + } + + // std::clog<<"dR: "<<dR<<'\n'; + + currentEstimationWorld=ossimGpt(currentEstimation); + + // Update residuals + const ossim_float64 atHgt = hgtRef.getRefHeight(currentEstimationWorld); + currentHeightResidual = atHgt - currentEstimationWorld.height(); + + worldToLineSample(currentEstimationWorld,currentImPoint); + + // std::clog<<currentImPoint<<'\n'; + + currentImSquareResidual = squareDistance(currentImPoint,target); + + ++iter; + } + + // std::clog<<"Iter: "<<iter<<", Res: im="<<currentImSquareResidual<<", hgt="<<currentHeightResidual<<'\n'; + + ellPt = currentEstimation; + return true; + } + + + + //************************************************************************************************* + // Infamous DUP + //************************************************************************************************* + ossimObject* ossimSarSensorModel::dup() const + { + return new ossimSarSensorModel(*this); + } + bool ossimSarSensorModel::useForward() const + { + return false; + } + + bool ossimSarSensorModel::autovalidateInverseModelFromGCPs(const double & xtol, const double & ytol, const double azTimeTol, const double & rangeTimeTol) const + { + // std::clog << "ossimSarSensorModel::autovalidateInverseModelFromGCPs()\n"; + if(theGCPRecords.empty()) + { + return false; + } + + bool success = true; + + unsigned int gcpId = 1; + + // std::clog << theGCPRecords.size() << " GCPS\n"; + for(std::vector<GCPRecordType>::const_iterator gcpIt = theGCPRecords.begin(); gcpIt!=theGCPRecords.end();++gcpIt,++gcpId) + { + ossimDpt estimatedImPt; + TimeType estimatedAzimuthTime; + double estimatedRangeTime; + + // Estimate times + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + this->worldToLineSample(gcpIt->worldPt,estimatedImPt); + + const bool thisSuccess + = s1 + && (std::abs(estimatedImPt.x - gcpIt->imPt.x) <= xtol) + && (std::abs(estimatedImPt.y - gcpIt->imPt.y) <= ytol) + && (std::abs((estimatedAzimuthTime-gcpIt->azimuthTime).total_microseconds()) <= azTimeTol) + && (std::abs(estimatedRangeTime - gcpIt->slantRangeTime) <= rangeTimeTol) + ; + + const bool verbose = k_verbose; + + success = success && thisSuccess; + + if(verbose) + { + std::clog<<"GCP #"<<gcpId<< (thisSuccess ? "succeeded" : "failed") << '\n'; + std::clog<<"Azimuth time: ref="<<gcpIt->azimuthTime<<", predicted: "<<estimatedAzimuthTime<<", res="<<to_simple_string(estimatedAzimuthTime-gcpIt->azimuthTime)<<'\n'; + std::clog<<"Slant range time: ref="<<gcpIt->slantRangeTime<<", predicted: "<<estimatedRangeTime<<", res="<<std::abs(estimatedRangeTime - gcpIt->slantRangeTime)<<'\n'; + std::clog<<"Image point: ref="<<gcpIt->imPt<<", predicted="<<estimatedImPt<<", res="<<estimatedImPt-gcpIt->imPt<<'\n'; + std::clog<<'\n'; + } + } + + if(success) + { + std::cout<<"All GCPs within "<<ytol <<" azimuth pixel, "<<xtol<<" range pixel, "<<azTimeTol<<" microseconds of azimuth time, "<<rangeTimeTol<<" of range time\n"; + } + + return success; + } + + bool ossimSarSensorModel::autovalidateForwardModelFromGCPs(double resTol) + { + // std::clog << "ossimSarSensorModel::autovalidateForwardModelFromGCPs()\n"; + resTol *= resTol; // as internally we won't be using sqrt on norms + + // First, split half of the gcps to serve as tests, and remove them + // temporarily from theGCPRecord. + std::vector<GCPRecordType> gcpRecordSave, testGcps; + + gcpRecordSave.swap(theGCPRecords); // steal the data; `gcpRecordSave = move(theGCPRecords);` in C++11 + + unsigned int count = 0; + + unzip(gcpRecordSave, theGCPRecords, testGcps); + assert(theGCPRecords.size() >= testGcps.size()); + + bool success = true; + const bool verbose = k_verbose; + + unsigned int gcpId = 1; + + // std::clog << testGcps.size() << " GCPS\n"; + for(std::vector<GCPRecordType>::const_iterator gcpIt = testGcps.begin(); gcpIt!=testGcps.end();++gcpIt,++gcpId) + { + ossimGpt estimatedWorldPt; + ossimGpt const& refPt = gcpIt->worldPt; + + double estimatedRangeTime; + TimeType estimatedAzimuthTime; + + lineSampleToAzimuthRangeTime(gcpIt->imPt,estimatedAzimuthTime,estimatedRangeTime); + + lineSampleHeightToWorld(gcpIt->imPt,refPt.height(),estimatedWorldPt); + + const double res = squareDistance(refPt, estimatedWorldPt); + + if(res>resTol || estimatedWorldPt.hasNans()) + { + success = false; + + if(verbose) + { + std::clog<<"GCP #"<<gcpId<<'\n'; + std::clog<<"Azimuth time: ref="<<gcpIt->azimuthTime<<", predicted: "<<estimatedAzimuthTime<<", res="<<to_simple_string(estimatedAzimuthTime-gcpIt->azimuthTime)<<'\n'; + std::clog<<"Slant range time: ref="<<gcpIt->slantRangeTime<<", predicted: "<<estimatedRangeTime<<", res="<<std::abs(estimatedRangeTime - gcpIt->slantRangeTime)<<'\n'; + std::clog<<"Im point: "<<gcpIt->imPt<<'\n'; + std::clog<<"World point: ref="<<refPt<<", predicted="<<estimatedWorldPt<<", res="<<sqrt(res)<<" m\n"; + std::clog<<'\n'; + } + } + } + + theGCPRecords.swap(gcpRecordSave); + + return success; + } + + void ossimSarSensorModel::optimizeTimeOffsetsFromGcps() + { + // std::clog << "ossimSarSensorModel::optimizeTimeOffsetsFromGcps()\n"; + DurationType cumulAzimuthTime(seconds(0)); + double cumulRangeTime(0); + unsigned int count=0; + + // First, fix the azimuth time + for(std::vector<GCPRecordType>::const_iterator gcpIt = theGCPRecords.begin(); gcpIt!=theGCPRecords.end();++gcpIt) + { + ossimDpt estimatedImPt; + TimeType estimatedAzimuthTime; + double estimatedRangeTime; + + // Estimate times + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + + if(s1) + { + cumulAzimuthTime -= (estimatedAzimuthTime-gcpIt->azimuthTime); + ++count; + } + } + + theAzimuthTimeOffset = count > 0 ? cumulAzimuthTime / count : DurationType(0); + + // Then, fix the range time + count=0; + + for(std::vector<GCPRecordType>::const_iterator gcpIt = theGCPRecords.begin(); gcpIt!=theGCPRecords.end();++gcpIt) + { + ossimDpt estimatedImPt; + TimeType estimatedAzimuthTime; + double estimatedRangeTime; + + // Estimate times + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + + if(s1) + { + cumulRangeTime+=-estimatedRangeTime+gcpIt->slantRangeTime; + ++count; + } + } + + theRangeTimeOffset = count > 0 ? cumulRangeTime/count : 0; + } + + void get( + ossimKeywordlist const& kwl, + std::vector<ossimSarSensorModel::OrbitRecordType> & orbitRecords) + { + char orbit_prefix_[256]; + std::size_t nbOrbits; + try { + get(kwl, "orbitList.nb_orbits", nbOrbits); + } catch (kw_runtime_error const& e) { + nbOrbits = 0; + ossimRegExp regExp; + regExp.compile("orbitList\\.orbit\\[.*\\]\\.time"); + ossimKeywordlist::KeywordMap::const_iterator i = + kwl.getMap().begin(); + for(; i != kwl.getMap().end(); ++i) + { + if(regExp.find( (*i).first.c_str())) + { + ++nbOrbits; + } + } + // Method getNumberOfKeysThatMatch not available in ossim 1.8.16 + //nbOrbits = kwl.getNumberOfKeysThatMatch("orbitList\\.orbit\\[.*\\]\\.time"); + ossimNotify(ossimNotifyLevel_WARN) + << "WARNING: " << e.what() + << "\n\tNumber of orbits manually counted to " << nbOrbits + << ".\n\tPlease update your geom file.\n"; + } + + for (std::size_t i=0; i!=nbOrbits ; ++i) { + const int pos = s_printf(orbit_prefix_, "orbitList.orbit[%d].", int(i)); + assert(pos > 0 && pos < 256); + const std::string orbit_prefix(orbit_prefix_, pos); + + ossimSarSensorModel::OrbitRecordType orbitRecord; + get(kwl, orbit_prefix + keyTime, orbitRecord.azimuthTime); + get(kwl, orbit_prefix + keyPosX, orbitRecord.position[0]); + get(kwl, orbit_prefix + keyPosY, orbitRecord.position[1]); + get(kwl, orbit_prefix + keyPosZ, orbitRecord.position[2]); + get(kwl, orbit_prefix + keyVelX, orbitRecord.velocity[0]); + get(kwl, orbit_prefix + keyVelY, orbitRecord.velocity[1]); + get(kwl, orbit_prefix + keyVelZ, orbitRecord.velocity[2]); + orbitRecords.push_back(orbitRecord); + } + } + + void get( + ossimKeywordlist const& kwl, + std::vector<ossimSarSensorModel::BurstRecordType> & burstRecords) + { + char burstPrefix_[1024]; + std::size_t nbBursts ; + get(kwl, BURST_NUMBER_KEY, nbBursts); + for (std::size_t burstId=0; burstId!=nbBursts ; ++burstId) { + const int pos = s_printf(burstPrefix_, "%s[%d].", BURST_PREFIX.c_str(), burstId); + assert(pos > 0 && pos < sizeof(burstPrefix_)); + const std::string burstPrefix(burstPrefix_, pos); + + ossimSarSensorModel::BurstRecordType burstRecord; + get(kwl, burstPrefix + keyStartLine, burstRecord.startLine); + get(kwl, burstPrefix + keyEndLine, burstRecord.endLine); + get(kwl, burstPrefix + keyAzimuthStartTime, burstRecord.azimuthStartTime); + get(kwl, burstPrefix + keyAzimuthStopTime, burstRecord.azimuthStopTime); + burstRecords.push_back(burstRecord); + } + } + + void get( + ossimKeywordlist const& kwl, + std::vector<ossimSarSensorModel::GCPRecordType> & gcpRecords) + { + char prefix_[1024]; + std::size_t nbGCPs ; + get(kwl, GCP_NUMBER_KEY, nbGCPs); + for (std::size_t gcpId=0; gcpId!=nbGCPs ; ++gcpId) { + const int pos = s_printf(prefix_, "%s[%d].", GCP_PREFIX.c_str(), gcpId); + assert(pos > 0 && pos < sizeof(prefix_)); + const std::string prefix(prefix_, pos); + + ossimSarSensorModel::GCPRecordType gcpRecord; + get(kwl, prefix, keyAzimuthTime, gcpRecord.azimuthTime); + get(kwl, prefix, keySlantRangeTime, gcpRecord.slantRangeTime); + get(kwl, prefix, keyImPtX, gcpRecord.imPt.x); + get(kwl, prefix, keyImPtY, gcpRecord.imPt.y); + get(kwl, prefix, keyWorldPtLat, gcpRecord.worldPt.lat); + get(kwl, prefix, keyWorldPtLon, gcpRecord.worldPt.lon); + get(kwl, prefix, keyWorldPtHgt, gcpRecord.worldPt.hgt); + gcpRecords.push_back(gcpRecord); + } + } + + void get( + ossimKeywordlist const& kwl, + std::string const& sr_gr_prefix, + std::string const& rg0, + std::vector<ossimSarSensorModel::CoordinateConversionRecordType> & outputRecords) + { + char prefix_[1024]; + std::size_t nbCoords ; + get(kwl, sr_gr_prefix +"."+ NUMBER_KEY, nbCoords); + + for (std::size_t idx=0 ; idx!=nbCoords ; ++idx) + { + const int pos = s_printf(prefix_, "%s[%d].", sr_gr_prefix.c_str(), idx); + assert(pos >= sizeof(SR_PREFIX)+4 && pos < sizeof(prefix_)); + std::string prefix(prefix_, pos); + + ossimSarSensorModel::CoordinateConversionRecordType coordRecord; + get(kwl, prefix + keyAzimuthTime, coordRecord.azimuthTime); + get(kwl, prefix + rg0, coordRecord.rg0); + + std::size_t nbCoeffs; + get(kwl, prefix + NUMBER_KEY, nbCoeffs); + for (std::size_t coeff_idx=0; coeff_idx!=nbCoeffs ; ++coeff_idx) { + const int pos2 = s_printf(prefix_+pos, sizeof(prefix_)-pos, "coeff[%d]", coeff_idx); + assert(pos2 > 0 && pos+pos2 < sizeof(prefix_)); + prefix.assign(prefix_, pos+pos2); + double coeff; + get(kwl, prefix, coeff); + coordRecord.coefs.push_back(coeff); + } + outputRecords.push_back(coordRecord); + } + } + + bool ossimSarSensorModel::saveState(ossimKeywordlist& kwl, const char* prefix) const + { + SCOPED_LOG(traceDebug, "ossimplugins::ossimSarSensorModel::loadState"); + + add(kwl, HEADER_PREFIX, "version", k_version); + return ossimSensorModel::saveState(kwl, prefix); + } + + bool ossimSarSensorModel::loadState(ossimKeywordlist const& kwl, const char* prefix) + { + // std::clog << "ossimSarSensorModel::loadState()\n"; + static const char MODULE[] = "ossimplugins::ossimSarSensorModel::loadState"; + SCOPED_LOG(traceDebug, MODULE); + + try + { + const bool success = ossimSensorModel::loadState(kwl, prefix); + if (!success) { + return false; + } + + // And finally, extract data into fields + std::string product_type_string; + get(kwl, SUPPORT_DATA_PREFIX + "product_type", product_type_string); + theProductType = ProductType(product_type_string); + + get(kwl, SUPPORT_DATA_PREFIX, "slant_range_to_first_pixel", theNearRangeTime ); + get(kwl, SUPPORT_DATA_PREFIX, "range_sampling_rate" , theRangeSamplingRate ); + get(kwl, SUPPORT_DATA_PREFIX, "range_spacing" , theRangeResolution ); + get(kwl, SUPPORT_DATA_PREFIX, "radar_frequency" , theRadarFrequency ); + double azimuthTimeInterval = 0.; // in seconds + get(kwl, SUPPORT_DATA_PREFIX, "line_time_interval" , azimuthTimeInterval); +#if defined(USE_BOOST_TIME) + theAzimuthTimeInterval = boost::posix_time::precise_duration(azimuthTimeInterval * 1000000.); +#else + theAzimuthTimeInterval = seconds(azimuthTimeInterval); +#endif + + get(kwl, theOrbitRecords); + // TODO: don't fetch burst records if already read thanks to xml loading + // that required them + theBurstRecords.clear(); + get(kwl, theBurstRecords); + if (isGRD()) + { + get(kwl, SR_PREFIX, keySr0, theSlantRangeToGroundRangeRecords); + get(kwl, GR_PREFIX, keyGr0, theGroundRangeToSlantRangeRecords); + } + get(kwl, theGCPRecords); + + try { + unsigned int version; + get(kwl, HEADER_PREFIX, "version", version); + if (version < k_version) { + throw std::runtime_error("Geom file generated with previous version of ossim plugins"); + } + } catch (...) { + throw std::runtime_error("Geom file generated with previous version of ossim plugins"); + } + + optimizeTimeOffsetsFromGcps(); + return true; + } catch (std::runtime_error const& e) { + ossimNotify(ossimNotifyLevel_WARN) + << "WARNING: " << e.what() + << "\n\tIt won't be possible to orthorectify the associated images!" + << "\n\tPlease upgrade your geom file.\n"; + } + return false; + } +} + +namespace ossimplugins { + template <typename T> inline + std::ostream & operator<<(std::ostream & os, const std::vector<T> & v) + { + for (typename std::vector<T>::const_iterator b = v.begin(), e = v.end() + ; b != e + ; ++b + ) + { + os << "- " << *b << "\n"; + } + + return os; + } +} // ossimplugins namespace + + +/*virtual*/ std::ostream& ossimplugins::ossimSarSensorModel::print(std::ostream& out) const +{ + return ossimSensorModel::print(out) + << "\n ossimSarSensorModel data-members:\n" + << "\n theRadarFrequency: " << theRadarFrequency << "Hz" + << "\n theAzimuthTimeInterval: " << theAzimuthTimeInterval.total_microseconds() << "us" + << "\n theNearRangeTime: " << theNearRangeTime << "s" + << "\n theRangeSamplingRate: " << theRangeSamplingRate << "Hz" + << "\n theRangeResolution: " << theRangeResolution << "m" + << "\n theBistaticCorrectionNeeded: " << theBistaticCorrectionNeeded + << "\n theProductType: " << theProductType + << "\n theAzimuthTimeOffset: " << theAzimuthTimeOffset.total_microseconds() << "us offset" + << "\n theRangeTimeOffset: " << theRangeTimeOffset << "s offset" + << "\n theGCPRecords: " << "\n" << theGCPRecords + << "\n theOrbitRecords: " << "\n" << theOrbitRecords + << "\n theBurstRecords: " << "\n" << theBurstRecords + << "\n theSlantRangeToGroundRangeRecords: " << "\n" << theSlantRangeToGroundRangeRecords + << "\n theGroundRangeToSlantRangeRecords: " << "\n" << theGroundRangeToSlantRangeRecords + << "\n" + ; +} + diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.h new file mode 100644 index 0000000000000000000000000000000000000000..9aa84b377e13525794c1290d10e1f1f20a2b5e62 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.h @@ -0,0 +1,389 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimSarSensorModel_HEADER +#define ossimSarSensorModel_HEADER + +#include <boost/config.hpp> +#include <string> +#include <stdint.h> +#include <cassert> + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Woverloaded-virtual" +# pragma GCC diagnostic ignored "-Wshadow" +# include <ossim/projection/ossimSensorModel.h> +# include <ossim/elevation/ossimHgtRef.h> +# include "ossimTimeUtilities.h" + +# pragma GCC diagnostic pop + +#else +# include <ossim/projection/ossimSensorModel.h> +# include <ossim/elevation/ossimHgtRef.h> +# include "ossimTimeUtilities.h" +#endif + +#if defined(USE_BOOST_TIME) +# include <boost/date_time/posix_time/posix_time.hpp> +#include <ostream> +#endif + +namespace ossimplugins +{ + +class OSSIM_PLUGINS_DLL ossimSarSensorModel : public ossimSensorModel +{ +public: + + struct ProductType + : private equality_comparable<ProductType> + , private less_than_comparable<ProductType> + { + enum Type { SLC, GRD, MGD, GEC, EEC, MAX__, UNDEFINED__, FIRST__=0 }; + + explicit ProductType(unsigned char value) + : m_value(Type(value)) + { + if (value >= MAX__) + throw std::runtime_error("Invalid Sar Sensor Product Type id"); + } + ProductType(Type value) + : m_value(Type(value)) + { assert(m_value < MAX__); } + ProductType() + : m_value(UNDEFINED__) + {} + ProductType(string_view const& s); + ProductType& operator++() { + assert(m_value < MAX__); + m_value = ProductType::Type(m_value+1); + return *this; + } + ProductType operator++(int) { + ProductType tmp = *this; + ++*this; + return tmp; + } + + string_view ToString() const; + Type ToInternal() const { return m_value; } + friend bool operator< (ProductType lhs, ProductType rhs) + { return lhs.m_value < rhs.m_value; } + friend bool operator==(ProductType lhs, ProductType rhs) + { return lhs.m_value == rhs.m_value; } + friend std::ostream & operator<<(std::ostream & os, const ossimSarSensorModel::ProductType & v) + { return os << v.ToString(); } + + + static ProductType Max () + { return ProductType(build_max()); } + static ProductType begin() + { return FIRST__; } + static ProductType end () + { return ProductType(build_max()); } + + private: + struct build_max {}; + ProductType(build_max) : m_value(MAX__) {} + + Type m_value; + }; + +#if defined(USE_BOOST_TIME) + typedef boost::posix_time::ptime TimeType; + typedef boost::posix_time::precise_duration DurationType; +#else + typedef time::ModifiedJulianDate TimeType; + typedef time::Duration DurationType; +#endif + + struct OrbitRecordType + { + TimeType azimuthTime; + ossimEcefPoint position; + ossimEcefVector velocity; + friend std::ostream & operator<<(std::ostream & os, const OrbitRecordType & v) + { + return os << "{ azimuthTime: " << v.azimuthTime + << ", position: " << v.position + << ", velocity: " << v.velocity + << "}"; + } + }; + + struct GCPRecordType + { + TimeType azimuthTime; + double slantRangeTime; + ossimDpt imPt; + ossimGpt worldPt; + friend std::ostream & operator<<(std::ostream & os, const GCPRecordType & v) + { + return os << "{ azimuthTime: " << v.azimuthTime + << ", imPt: " << v.imPt + << ", worldPt: " << v.worldPt + << "}"; + } + }; + + struct BurstRecordType + { + TimeType azimuthStartTime; + unsigned long startLine; + TimeType azimuthStopTime; + unsigned long endLine; + friend std::ostream & operator<<(std::ostream & os, const BurstRecordType & v) + { + return os << "{ azimuthStartTime: " << v.azimuthStartTime + << ", azimuthStopTime: " << v.azimuthStopTime + << ", startLine: " << v.startLine + << ", stopLine: " << v.endLine + << "}"; + } + }; + + struct IsWithin { + IsWithin(BurstRecordType const& br) + : m_start(br.azimuthStartTime) + , m_stop(br.azimuthStartTime) + {} + bool operator()(TimeType v) const + { return m_start <= v && v < m_stop; } + private: + TimeType m_start; + TimeType m_stop; + }; + + struct DoesContain { + DoesContain(TimeType value) + : m_value(value) + {} + bool operator()(BurstRecordType const& br) const + { return br.azimuthStartTime <= m_value && m_value < br.azimuthStopTime; } + private: + TimeType m_value; + }; + + struct CoordinateConversionRecordType + { + TimeType azimuthTime; + double rg0; + std::vector<double> coefs; + friend std::ostream & operator<<(std::ostream & os, const CoordinateConversionRecordType & v) + { + return os << "{ azimuthTime: " << v.azimuthTime + << ", rg0: " << v.rg0 + << ", coeffs: " << v.coefs.size() + << "}"; + } + }; + + /** Constructor */ + ossimSarSensorModel(); + +#if ! (defined(BOOST_NO_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX1_DEFAULTED_FUNCTIONS)) + /** Copy constructor */ + ossimSarSensorModel(ossimSarSensorModel const& m) = default; + /** Move constructor */ + ossimSarSensorModel(ossimSarSensorModel && m) = default; + + /** Destructor */ + virtual ~ossimSarSensorModel() = default; +#endif + + virtual void lineSampleHeightToWorld(const ossimDpt& imPt, const double & heightEllipsoid, ossimGpt& worldPt) const; + + virtual void lineSampleToWorld(const ossimDpt& imPt, ossimGpt& worldPt) const; + + + /** This method implement inverse sar geolocation using method found + * in ESA document "Guide to ASAR geocoding" (ref + * RSL-ASAR-GC-AD). Equation numbers can be found in source code + * comments. + * + * \param[in] worldPt World point to geocode + * \param[out] imPt Corresponding estimated image point + */ + virtual void worldToLineSample(const ossimGpt& worldPt, ossimDpt & imPt) const; + + /** + * Sub-routine of lineSampleToWorld that computes azimuthTime and + * slant range time from worldPoint + * + * \param[in] worldPoint World point to geocode + * \param[out] azimuthTime Estimated zero-doppler azimuth time + * \param[out] rangeTime Estimated range time + * \return True if sucess, false otherwise. In this case, + * azimuthTime and rangeTime will not be modified. + */ + /*virtual*/ bool worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime) const; + + // TODO: document me + /*virtual*/ void lineSampleToAzimuthRangeTime(const ossimDpt & imPt, TimeType & azimuthTime, double & rangeTime) const; + + // TODO: document me + bool autovalidateInverseModelFromGCPs(const double & xtol = 1, const double & ytol = 1, const double azTimeTol = 500, const double &rangeTimeTo=0.0000000001) const; + + // TODO: document me + bool autovalidateForwardModelFromGCPs(double resTol = 25); + + //Pure virtual in base class + bool useForward() const; + + void optimizeTimeOffsetsFromGcps(); + + /** + * Returns pointer to a new instance, copy of this. + */ + virtual ossimObject* dup() const; + + //TODO: Add virtual method readAnnotationFile? + + virtual bool saveState(ossimKeywordlist & kwl, const char* prefix=NULL) const; + virtual bool loadState(ossimKeywordlist const& kwl, const char* prefix=NULL); + + bool isGRD() const { + switch (theProductType.ToInternal()) { + case ProductType::GRD: + case ProductType::MGD: + case ProductType::GEC: + case ProductType::EEC: + return true; + default: + return false; + } + } + + virtual std::ostream& print(std::ostream& out) const; +protected: + + /** + * Compute range and doppler frequency from an input point, sensor + * position and velocity. + * + * \param[in] inputPt The target point + * \param[in] sensorPos The sensor position + * \param[in] sensorvel The sensor velocity + * \param[out] range Estimated range + * \param[out] doppler Estimated doppler frequency + */ + virtual void computeRangeDoppler(const ossimEcefPoint & inputPt, const ossimEcefPoint & sensorPos, const ossimEcefVector sensorVel, double & range, double & doppler) const; + + /** + * Interpolate sensor position and velocity at given azimuth time + * using lagragian interpolation of orbital records. + * + * \param[in] azimuthTime The time at which to interpolate + * \param[out] sensorPos Interpolated sensor position + * \param[out] sensorvel Interpolated sensor velocity + * \param[in] deg Degree of lagragian interpolation + */ + /*virtual*/ void interpolateSensorPosVel(const TimeType & azimuthTime, ossimEcefPoint& sensorPos, ossimEcefVector& sensorVel, unsigned int deg = 8) const; + + /** + * Convert slant range to ground range by interpolating slant range + * to ground range coefficients. + * + * \param[in] slantRangeTime The slantRange to convert (meters) + * \param[in] azimuthTime The corresponding azimuth time + * \param[out] groundRange The estimated ground range (meters) + */ + /*virtual*/ void slantRangeToGroundRange(const double & slantRange, const TimeType & azimuthTime, double & groundRange) const; + + // TODO: Document me + /*virtual*/ void groundRangeToSlantRange(const double & groundRange, const TimeType & azimuthTime, double & slantRange) const; + + // TODO: Document me + /*virtual*/ void applyCoordinateConversion(const double & in, const TimeType& azimuthTime, const std::vector<CoordinateConversionRecordType> & records, double & out) const; + /** + * Estimate the zero-doppler azimuth time and corresponding sensor + * position and velocity from the inputPt. + * + * \param[in] inputPt The point to estimated zero-doppler time on + * \param[out] interpAzimuthTime Interpolated azimuth time + * \param[out] interpSensorPos Interpolated sensor position + * \param[out] interpSensorVel Interpolated sensor velocity + * \return True if success, false otherwise. In this case, output + * parameters are left untouched. + */ + /*virtual*/ bool zeroDopplerLookup(const ossimEcefPoint & inputPt, TimeType & interpAzimuthTime, ossimEcefPoint & interpSensorPos, ossimEcefVector & interpSensorVel) const; + + /** + * Compute the bistatic correction to apply. + * + * \param[in] inputPt The point to compute bistatic correction on + * \param[in] sensorPos The corresponding sensor position + * \param[out] bistaticCorrection The estimated bistatic correction + */ + /*virtual*/ void computeBistaticCorrection(const ossimEcefPoint & inputPt, const ossimEcefPoint & sensorPos, DurationType & bistaticCorrection) const; + + /** + * Convert azimuth time to fractional line. + * + * \param[in] azimuthTime The azimuth time to convert + * \param[out] The estimated fractional line + */ + /*virtual*/ // TODO: check why virtual + void azimuthTimeToLine(const TimeType & azimuthTime, double & line) const; + + // TODO: document me + /*virtual*/ // TODO: check why virtual + void lineToAzimuthTime(const double & line, TimeType & azimuthTime) const; + + // TODO: document me + /*virtual*/ // TODO: check why virtual + bool projToSurface(const GCPRecordType & initGcp, const ossimDpt & target, const ossimHgtRef & hgtRef, ossimEcefPoint & ellpt) const; + + /** + * Finds closest GCP. + * + * \param[in] imPt «imPt-explanations» + * \return the closest GCP record to \c imPt. + * \throw None + * \pre `theGCPRecords` shall not be empty. + */ + GCPRecordType const& findClosestGCP(ossimDpt const& imPt) const; + + + std::vector<OrbitRecordType> theOrbitRecords; + std::vector<GCPRecordType> theGCPRecords; + std::vector<BurstRecordType> theBurstRecords; + std::vector<CoordinateConversionRecordType> theSlantRangeToGroundRangeRecords; + std::vector<CoordinateConversionRecordType> theGroundRangeToSlantRangeRecords; + + double theRadarFrequency; // in Hz + DurationType theAzimuthTimeInterval; + double theNearRangeTime; // in seconds + double theRangeSamplingRate; // in Hz + double theRangeResolution; // in meters + bool theBistaticCorrectionNeeded; // Do we need to compute + // bistatic correction ? + ProductType theProductType; // GRD/SLC + DurationType theAzimuthTimeOffset; // Offset computed + double theRangeTimeOffset; // Offset in seconds, computed + + static const double C; +private: + /** Disabled assignment operator. */ + ossimSarSensorModel& operator=(ossimSarSensorModel const& rhs); + // Disable a warning, and disable inherited buggy assignment (buggy because + // value semantics are incompatible with public inheritance thanks to + // slicing) + using ossimSensorModel::operator=; + using ossimOptimizableProjection::operator=; +}; + +} + +#endif diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.cpp new file mode 100644 index 0000000000000000000000000000000000000000..75a871ee4b96f317bbe23d174c3939809d7a616f --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.cpp @@ -0,0 +1,47 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- + +#include "ossimSarSensorModelPathsAndKeys.h" + +namespace ossimplugins { + const std::string HEADER_PREFIX = "header."; + const std::string SUPPORT_DATA_PREFIX = "support_data."; + const std::string GEOM_PREFIX = "support_data.geom"; + const std::string SRD_PREFIX = "support_data.geom.srd"; + const std::string SR_PREFIX = "support_data.geom.srd.coords.sr"; + const std::string GR_PREFIX = "support_data.geom.srd.coords.gr"; + const std::string BURST_PREFIX = "support_data.geom.bursts.burst"; + const std::string BURST_NUMBER_KEY = "support_data.geom.bursts.number"; + const std::string GCP_PREFIX = "support_data.geom.gcp"; + const std::string GCP_NUMBER_KEY = "support_data.geom.gcp.number"; + const std::string NUMBER_KEY = "number"; + + const std::string keySr0 = "sr0"; + const std::string keyGr0 = "gr0"; + const std::string keyAzimuthTime = "azimuthTime"; + const std::string keySlantRangeTime = "slant_range_time"; + const std::string keyImPtX = "im_pt.x"; + const std::string keyImPtY = "im_pt.y"; + const std::string keyWorldPtLat = "world_pt.lat"; + const std::string keyWorldPtLon = "world_pt.lon"; + const std::string keyWorldPtHgt = "world_pt.hgt"; + const std::string keyTime = "time"; + const std::string keyPosX = "x_pos"; + const std::string keyPosY = "y_pos"; + const std::string keyPosZ = "z_pos"; + const std::string keyVelX = "x_vel"; + const std::string keyVelY = "y_vel"; + const std::string keyVelZ = "z_vel"; + const std::string keyStartLine = "start_line"; + const std::string keyEndLine = "end_line"; + const std::string keyAzimuthStartTime = "azimuth_start_time"; + const std::string keyAzimuthStopTime = "azimuth_stop_time"; +} // ossimplugins namespace + diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.h new file mode 100644 index 0000000000000000000000000000000000000000..76dfde02e70cc35f855c2d1fcd7d53f5450b6271 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.h @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- + +#ifndef ossimSarSensorModelPathsAndKeys_h +#define ossimSarSensorModelPathsAndKeys_h + +#include <string> + +namespace ossimplugins { + extern const std::string HEADER_PREFIX ; + extern const std::string SUPPORT_DATA_PREFIX ; + extern const std::string GEOM_PREFIX ; + extern const std::string SRD_PREFIX ; + extern const std::string SR_PREFIX ; + extern const std::string GR_PREFIX ; + extern const std::string BURST_PREFIX ; + extern const std::string BURST_NUMBER_KEY ; + extern const std::string GCP_PREFIX ; + extern const std::string GCP_NUMBER_KEY ; + extern const std::string NUMBER_KEY ; + + extern const std::string keySr0 ; + extern const std::string keyGr0 ; + extern const std::string keyAzimuthTime ; + extern const std::string keySlantRangeTime ; + extern const std::string keyImPtX ; + extern const std::string keyImPtY ; + extern const std::string keyWorldPtLat ; + extern const std::string keyWorldPtLon ; + extern const std::string keyWorldPtHgt ; + extern const std::string keyTime ; + extern const std::string keyPosX ; + extern const std::string keyPosY ; + extern const std::string keyPosZ ; + extern const std::string keyVelX ; + extern const std::string keyVelY ; + extern const std::string keyVelZ ; + extern const std::string keyStartLine ; + extern const std::string keyEndLine ; + extern const std::string keyAzimuthStartTime ; + extern const std::string keyAzimuthStopTime ; +} // ossimplugins namespace + + +#endif // ossimSarSensorModelPathsAndKeys_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp index bd3bb6cff4d81c997ac55699d7cd8c50686f59ae..5cd3f0c246225e3ca40c015425ba14efc346a273 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp @@ -1,60 +1,84 @@ -#include "ossimSentinel1Model.h" +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#include "ossimSentinel1Model.h" +#include "ossimTraceHelpers.h" +#include "ossimXmlTools.h" +#include "ossimKeyWordListUtilities.h" +#include "ossimSarSensorModelPathsAndKeys.h" +#include <ossim/base/ossimDirectory.h> +#include <ossim/base/ossimString.h> +#include <ossim/base/ossimXmlNode.h> +#include <iostream> #include <cassert> +#if defined(USE_BOOST_TIME) + using boost::posix_time::microseconds; + using boost::posix_time::seconds; +#else + using ossimplugins::time::microseconds; + using ossimplugins::time::seconds; +#endif +namespace {// Anonymous namespace + ossimTrace traceExec ("ossimSentinel1Model:exec"); + ossimTrace traceDebug ("ossimSentinel1Model:debug"); + const ossimString attAdsHeader = "adsHeader"; + const ossimString attAzimuthTime = "azimuthTime"; + const ossimString attFirstValidSample = "firstValidSample"; + const ossimString attGr0 = "gr0"; + const ossimString attGrsrCoefficients = "grsrCoefficients"; + const ossimString attHeight = "height"; + const ossimString attLatitude = "latitude"; + const ossimString attLine = "line"; + const ossimString attLongitude = "longitude"; + const ossimString attPixel = "pixel"; + const ossimString attPosition = "position"; + const ossimString attSlantRangeTime = "slantRangeTime"; + const ossimString attSr0 = "sr0"; + const ossimString attSrgrCoefficients = "srgrCoefficients"; + const ossimString attTime = "time"; + const ossimString attVelocity = "velocity"; + const ossimString attX = "x"; + const ossimString attY = "y"; + const ossimString attZ = "z"; + + // const char LOAD_FROM_PRODUCT_FILE_KW[] = "load_from_product_file_flag"; + // const char PRODUCT_XML_FILE_KW[] = "product_xml_filename"; +}// Anonymous namespace + namespace ossimplugins { - -// Define Trace flags for use within this file: - static ossimTrace traceExec ("ossimSentinel1Model:exec"); - static ossimTrace traceDebug ("ossimSentinel1Model:debug"); - - RTTI_DEF1(ossimSentinel1Model, "ossimSentinel1Model", ossimSarModel); + RTTI_DEF1(ossimSentinel1Model, "ossimSentinel1Model", ossimSarSensorModel); //************************************************************************************************* // Constructor //************************************************************************************************* ossimSentinel1Model::ossimSentinel1Model() - : ossimSarModel() + : ossimSarSensorModel() , theOCN(false) , theSLC(false) + , theTOPSAR(false) { - theManifestDoc = new ossimXmlDocument(); - theProduct = new ossimSentinel1ProductDoc(); - this->clearFields(); - + // theManifestDoc = new ossimXmlDocument(); } - void ossimSentinel1Model::clearFields() - { - theOCN = false; - theSLC = false; - theManifestKwl.clear(); - theManifestFile = ossimFilename::NIL; - theProductXmlFile = ossimFilename::NIL; - theProduct->clearFields(); - - } - - -//************************************************************************************************* -// Constructor -//************************************************************************************************* - ossimSentinel1Model::ossimSentinel1Model(const ossimSentinel1Model& rhs) - :ossimSarModel(rhs) - , theOCN(rhs.theOCN) - , theSLC(rhs.theSLC) - { - - } - -//************************************************************************************************* -// Destructor -//************************************************************************************************* - ossimSentinel1Model::~ossimSentinel1Model() + void ossimSentinel1Model::clearFields() { - theProduct = 0; - if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG DESTRUCTOR: ~ossimSentinel1Model(): entering..." << std::endl; + theOCN = false; + theSLC = false; + theTOPSAR = false; + theManifestKwl.clear(); + theProductKwl.clear(); + // theManifestFile = ossimFilename::NIL; + theProductXmlFile = ossimFilename::NIL; } //************************************************************************************************* @@ -73,8 +97,8 @@ namespace ossimplugins // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimSentinel1Model at address " << (hex) << this - << (dec) + out << "\nDump of ossimSentinel1Model at address " << hex << this + << dec << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theImageSize = " << theImageSize @@ -84,8 +108,7 @@ namespace ossimplugins // Set the flags back. out.flags(f); - return ossimSarModel::print(out); - + return ossimSarSensorModel::print(out); } //************************************************************************************************* @@ -94,6 +117,8 @@ namespace ossimplugins bool ossimSentinel1Model::saveState(ossimKeywordlist& kwl, const char* prefix) const { + static const char MODULE[] = "ossimplugins::ossimSentinel1Model::saveState"; + SCOPED_LOG(traceDebug, MODULE); kwl.add(prefix, ossimKeywordNames::TYPE_KW, @@ -106,14 +131,9 @@ namespace ossimplugins true); kwl.addList(theManifestKwl, true); + kwl.addList(theProductKwl, true); - if(theProduct.get()) - { - kwl.addList(theProduct->getProductKwl(), true); - // theProduct->saveState(kwl, prefix); - } - ossimSarModel::saveState(kwl, prefix); - return true; + return ossimSarSensorModel::saveState(kwl, prefix); } @@ -124,48 +144,40 @@ namespace ossimplugins const char* prefix) { static const char MODULE[] = "ossimplugins::ossimSentinel1Model::loadState"; + SCOPED_LOG(traceDebug, MODULE); theManifestKwl.addList(kwl, true); if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "theManifestKwl.getSize()" << theManifestKwl.getSize() << std::endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "theManifestKwl.getSize()" << theManifestKwl.getSize() << "\n"; } - ossimSarModel::loadState(kwl, prefix); - - return true; + return ossimSarSensorModel::loadState(kwl, prefix); } - bool ossimSentinel1Model::findSafeManifest(const ossimFilename& file, ossimFilename& manifestFile) + ossimFilename ossimSentinel1Model::searchManifestFile(const ossimFilename& file) const { - manifestFile = ossimFilename(file.path().path() + "/manifest.safe"); + const ossimFilename manifestFile = ossimFilename(file.path().path() + "/manifest.safe"); if(!manifestFile.exists()) { - if (traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "manifest.safe " << manifestFile << " doesn't exist ...\n"; - } - return false; + ossimNotify(ossimNotifyLevel_WARN) << "manifest.safe " << manifestFile << " doesn't exist...\n"; + return ""; } - return true; + return manifestFile; } bool ossimSentinel1Model::open(const ossimFilename& file) { - static const char MODULE[] = "ossimplugins::ossimSentinel1Model::open"; //traceDebug.setTraceFlag(true); - - if (traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n"; - } + SCOPED_LOG(traceDebug, MODULE); bool result = false; - if ( !file.exists() || (file.ext().downcase() != "tiff") ) + const ossimString ext = file.ext().downcase(); + if ( !file.exists() || (ext != "tiff" && ext != "xml" )) { return false; } @@ -173,131 +185,112 @@ namespace ossimplugins { theGSD.makeNan(); - ossimFilename safeFile; - bool foundManifestFile = findSafeManifest(file, safeFile); - while (foundManifestFile) + // -----[ Read manifest file + const ossimFilename safeFile = searchManifestFile(file); + theManifestDirectory = safeFile.path(); + if (!safeFile.empty()) { - if(!theManifestDoc.get()) - { - ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " theManifestDoc.get()" << std::endl; - break; - } - - if( !theManifestDoc->openFile(safeFile)) - { - ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " theManifestDoc->openFile(safeFile)" << std::endl; - break; - } - if ( !this->isSentinel1(safeFile)) { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->isSentinel1(safeFile)" << std::endl; - break; + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << "Not a Sentinel 1 manifest file " << safeFile << "\n"; + return false; } - - ossimString productFile; - if ( !this->getAnnotationFileLocation(safeFile, "^product")) + ossimXmlDocument manifestDoc; + if (!manifestDoc.openFile(safeFile)) { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->getAnnotationFileLocation(safeFile, '^product')" << std::endl; - break; + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << "Invalid Manifest file " << safeFile << "\n"; + return false; } + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << "Manifest file " << safeFile << " opened\n"; - // Set the image ID to the scene ID. - if ( !this->getImageId( theImageID ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->getImageId( theImageID )" << std::endl; - break; + theImageID = getImageId(manifestDoc); + if (theImageID.empty()) { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << "Image ID not found in manifest file " << safeFile << "\n"; + return false; } - if ( !this->standAloneProductInformation( ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->standAloneProductInformation( )" << std::endl; - break; + if (! standAloneProductInformation(manifestDoc)) { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << "Cannot load product information from " << safeFile << "\n"; + return false; } - // Set the sensor ID to the mission ID. - if ( !this->initSensorID( theSensorID ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initSensorID( theSensorID )" << std::endl; - break; + theSensorID = initSensorID(manifestDoc); + if (theSensorID.empty()) { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << "Cannot load sensor ID from " << safeFile << "\n"; + return false; } + } - if ( !this->readProduct( safeFile ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->readProduct( safeFile )" << std::endl; - break; - } - - if ( !this->initImageSize( theImageSize ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initImageSize( theImageSize )" << std::endl; - break; - } - - theImageClipRect = ossimDrect( 0, 0, theImageSize.x-1, theImageSize.y-1 ); - theSubImageOffset.x = 0.0; - theSubImageOffset.y = 0.0; + // -----[ Read product file + ossimFilename xmlFileName = file; - if ( !this->initGsd( theGSD ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initGsd( theGSD )" << std::endl; - break; - } + // If this is tiff file, look for corresponding annotation file + if(ext != "xml") + { + const ossimFilename fileNameWihtoutExtension = file.fileNoExtension(); + const ossimFilename path = file.path().path(); + xmlFileName = ossimFilename(path+"/annotation/"+fileNameWihtoutExtension+".xml"); + } - theMeanGSD = (theGSD.x + theGSD.y)/2.0; + if ( !xmlFileName.exists() || !this->readProduct(xmlFileName) ) + { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->readProduct( safeFile )\n"; + return false; + } - if ( !this->initSRGR( ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initSRGR( )" << std::endl; - break; - } + if ( !this->initImageSize( theImageSize ) ) + { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initImageSize( theImageSize ) fails\n"; + return false; + } - // if ( !theSafeManifest->initPlatformPosition( ) ) - // { - // break; - // } - // else - // { - // std::cout << MODULE << "error at line:" << __LINE__ << std::endl; - // } + theImageClipRect = ossimDrect( 0, 0, theImageSize.x-1, theImageSize.y-1 ); + theSubImageOffset.x = 0.0; + theSubImageOffset.y = 0.0; + // automatically loaded/saved into ossimSensorModel + theMeanGSD = (theGSD.x + theGSD.y)/2.0; - return true; +#if 0 + if ( !this->initSRGR( ) ) + { + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " this->initSRGR( )\n"; + return false; } +#endif -// // If we broke out of the while, something happened... - return false; + // Commit the operation + theProductXmlFile = file; + return true; } - } - - bool ossimSentinel1Model::getImageId( ossimString& s) const + ossimString const& ossimSentinel1Model::getImageId(ossimXmlDocument const& manifestDoc) const { - ossimString xpath; - xpath = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation/s1sarl1:missionDataTakeID"; - return ossim::getPath(xpath, theManifestDoc.get(), s); + ossimString xpath = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation/s1sarl1:missionDataTakeID"; + return getOnlyText(manifestDoc, xpath); } - bool ossimSentinel1Model::initSensorID(ossimString& s) + ossimString ossimSentinel1Model::initSensorID(ossimXmlDocument const& manifestDoc) { - const ossimRefPtr<ossimXmlNode> safePlatform = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform"); + const ossimRefPtr<ossimXmlNode> safePlatform = manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform"); ossimString familyName, instrumentId; - bool ret1 = safePlatform->getChildTextValue(familyName, "safe:familyName"); - bool ret2 = safePlatform->getChildTextValue(instrumentId, "safe:number"); - - theManifestKwl.add("support_data.", - "instrument", - "S1" + instrumentId, - true); - - s = familyName + instrumentId; - return (ret1 && ret2); + const bool ret1 = safePlatform->getChildTextValue(familyName, "safe:familyName"); + const bool ret2 = safePlatform->getChildTextValue(instrumentId, "safe:number"); + + if (ret1 && ret2) { + theManifestKwl.add("support_data.", + "instrument", + "S1" + instrumentId, + true); + return familyName + instrumentId; + } + throw std::runtime_error("Cannot obtain Sensor ID"); } +#if 0 bool ossimSentinel1Model::getAnnotationFileLocation(const ossimFilename &manifestFile, const char* pattern) { - static const char MODULE[] = "ossimSentinel1SafeManifest::getAnnotationFileLocation"; //traceDebug.setTraceFlag(true); const ossimString prefix = "support_data."; @@ -316,13 +309,10 @@ namespace ossimplugins ossim::getPath(xpath + "/byteStream/fileLocation", theManifestDoc.get(), theProductXmlFile); xml_nodes.clear(); theManifestDoc->findNodes(xpath + "/byteStream/fileLocation", xml_nodes); - - assert( xml_nodes.size() > 0 ); - - if(xml_nodes.size() < 1 ) + if(xml_nodes.empty()) { - ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " getAnnotationFileLocation( )" << std::endl; - return false; + ossimNotify(ossimNotifyLevel_FATAL) << MODULE << " getAnnotationFileLocation( )\n"; + return false; } xml_nodes[0]->getAttributeValue(theProductXmlFile , "href"); theProductXmlFile.setPath(manifestFile.path() + "/annotation"); @@ -330,52 +320,52 @@ namespace ossimplugins } return true; } +#endif - - bool ossimSentinel1Model::standAloneProductInformation() + bool ossimSentinel1Model::standAloneProductInformation(ossimXmlDocument const& manifestDoc) { static const char MODULE[] = "ossimSentinel1ProductDoc::parseSafe"; const ossimString prefix = "support_data."; - const ossimRefPtr<ossimXmlNode> safeProcessing = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:processing"); - const ossimRefPtr<ossimXmlNode> facility = safeProcessing->findFirstNode("safe:facility"); - const ossimRefPtr<ossimXmlNode> software = facility->findFirstNode("safe:software"); - const ossimString org = facility->getAttributeValue("organisation"); - const ossimString name = software->getAttributeValue("name"); + const ossimRefPtr<ossimXmlNode> safeProcessing = manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:processing"); + const ossimRefPtr<ossimXmlNode> facility = safeProcessing->findFirstNode("safe:facility"); + const ossimRefPtr<ossimXmlNode> software = facility->findFirstNode("safe:software"); + const ossimString org = facility->getAttributeValue("organisation"); + const ossimString name = software->getAttributeValue("name"); const ossimString version = software->getAttributeValue("version"); theManifestKwl.add(prefix, - "Processing_system_identifier", - org + " " + name + " " + version, - true); + "Processing_system_identifier", + org + " " + name + " " + version, + true); theManifestKwl.add(prefix, - ossimKeywordNames::DATE_KW, - safeProcessing->getAttributeValue("start"), - true); + ossimKeywordNames::DATE_KW, + safeProcessing->getAttributeValue("start"), + true); - const ossimRefPtr<ossimXmlNode> acquisitionPeriod = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:acquisitionPeriod"); + const ossimRefPtr<ossimXmlNode> acquisitionPeriod = manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:acquisitionPeriod"); ossimString acqStartTime = acquisitionPeriod->getChildTextValue("safe:startTime"); theManifestKwl.add(prefix, - "first_line_time", - acqStartTime, - true); + "first_line_time", + acqStartTime, + true); theManifestKwl.add(prefix, - "last_line_time", - acquisitionPeriod->getChildTextValue("safe:stopTime"), - true); + "last_line_time", + acquisitionPeriod->getChildTextValue("safe:stopTime"), + true); //RK theManifestKwl.add(prefix, - ossimKeywordNames::IMAGE_DATE_KW, - acqStartTime, - true); + ossimKeywordNames::IMAGE_DATE_KW, + acqStartTime, + true); const ossimRefPtr<ossimXmlNode> instrumentNode = - theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform/safe:instrument"); - ossimString swath = instrumentNode->getChildTextValue("s1sarl1:swath"); + manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform/safe:instrument"); + ossimString swath = instrumentNode->getChildTextValue("s1sarl1:swath"); ossimString acquisition_mode = instrumentNode->getChildTextValue("s1sarl1:mode"); if( acquisition_mode.empty()) @@ -384,29 +374,29 @@ namespace ossimplugins if(instrumentModeNode.get()) { acquisition_mode = instrumentModeNode->getChildTextValue("s1sarl1:mode"); - swath = instrumentModeNode->getChildTextValue("s1sarl1:swath"); + swath = instrumentModeNode->getChildTextValue("s1sarl1:swath"); } } theManifestKwl.add(prefix, - "acquisition_mode", - acquisition_mode, - true); + "acquisition_mode", + acquisition_mode, + true); theManifestKwl.add(prefix, - "swath", - swath, - true); + "swath", + swath, + true); if (acquisition_mode == "IW" || acquisition_mode == "EW") - theProduct->setTOPSAR(true); + theTOPSAR = true; const ossimRefPtr<ossimXmlNode> orbitReference = - theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:orbitReference"); + manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:orbitReference"); std::vector<ossimRefPtr<ossimXmlNode> > orbitNumberNodes; const ossimString orbitReference_xpath = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/safe:orbitReference"; - theManifestDoc->findNodes(orbitReference_xpath + "/safe:orbitNumber", orbitNumberNodes); + manifestDoc.findNodes(orbitReference_xpath + "/safe:orbitNumber", orbitNumberNodes); std::vector<ossimRefPtr<ossimXmlNode> >::const_iterator it = orbitNumberNodes.begin(); while( it != orbitNumberNodes.end()) @@ -416,15 +406,15 @@ namespace ossimplugins { if( attribute->getValue() == "start" ) { - theManifestKwl.add(prefix, "abs_orbit", (*it)->getText(), true); - break; + theManifestKwl.add(prefix, "abs_orbit", (*it)->getText(), true); + break; } } ++it; } orbitNumberNodes.clear(); - theManifestDoc->findNodes(orbitReference_xpath + "/safe:relativeOrbitNumber", orbitNumberNodes); + manifestDoc.findNodes(orbitReference_xpath + "/safe:relativeOrbitNumber", orbitNumberNodes); std::vector<ossimRefPtr<ossimXmlNode> >::const_iterator it2 = orbitNumberNodes.begin(); while( it2 != orbitNumberNodes.end()) @@ -452,13 +442,13 @@ namespace ossimplugins } theManifestKwl.add(prefix, - "orbit_pass", - orbit_pass, - true); + "orbit_pass", + orbit_pass, + true); ossimString productType = "unknown"; const ossimRefPtr<ossimXmlNode> standAloneProductInformation = - theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation"); + manifestDoc.getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation"); if (theOCN) { @@ -471,16 +461,15 @@ namespace ossimplugins } theManifestKwl.add(prefix, - "product_type", - productType, - true); + "product_type", + productType, + true); if( productType.contains("SLC" ) ) { //ossimKeywordNames::PIXEL_TYPE_KW; RK theManifestKwl.add("sample_type", "COMPLEX", true); - theProduct->setSLC(true); - + theSLC = true; } else { @@ -494,42 +483,38 @@ namespace ossimplugins bool ossimSentinel1Model::isSentinel1(const ossimFilename &manifestFile ) { theOCN = isLevel2(manifestFile); - if( isLevel1(manifestFile) || theOCN || isLevel0(manifestFile)) - return true; - else - return false; + return isLevel1(manifestFile) || theOCN || isLevel0(manifestFile); } - bool ossimSentinel1Model::isLevel1(const ossimFilename& file) + bool ossimSentinel1Model::isLevel1(const ossimFilename& file) const { bool productXmlCheck = checkDirectory(file, "annotation", ".xml"); return productXmlCheck && checkDirectory(file, "measurement", ".tiff"); } - bool ossimSentinel1Model::isLevel2(const ossimFilename& file) + bool ossimSentinel1Model::isLevel2(const ossimFilename& file) const { - return checkDirectory(file, "measurement",".nc"); } - bool ossimSentinel1Model::isLevel0(const ossimFilename& file) + bool ossimSentinel1Model::isLevel0(const ossimFilename& file) const { return checkDirectory(file, "measurement",".dat"); } - bool ossimSentinel1Model::checkDirectory(const ossimFilename& file, const char* d, const char* ext) + bool ossimSentinel1Model::checkDirectory(const ossimFilename& file, const char* d, const char* ext) const { //check dir is valid first - ossimDirectory dir = ossimDirectory(file.path() + "/" + d + "/"); + ossimDirectory dir(file.path() + '/' + d + '/'); std::vector<ossimFilename> result; dir.findAllFilesThatMatch(result, ext); - if ( result.size() < 1 ) + if ( result.empty() ) { if (traceExec()) { ossimNotify(ossimNotifyLevel_FATAL) - << " DEBUG:" << " checkDirectory failed for: " << file.path() << "/" << d << " with ext ="<< ext << std::endl; + << " DEBUG:" << " checkDirectory failed for: " << file.path() << "/" << d << " with ext ="<< ext << "\n"; } return false; } @@ -537,41 +522,621 @@ namespace ossimplugins return true; } - bool ossimSentinel1Model::readProduct(const ossimFilename &manifestFile ) + bool ossimSentinel1Model::readProduct(const ossimFilename &productXmlFile) + { + try + { + const bool ret = read(productXmlFile); + if ( ret ) + { + readCalibrationMetadata(); + readNoiseMetadata(); + return true; + } + } catch (std::exception const& e) { + if (traceExec()) + ossimNotify(ossimNotifyLevel_INFO) + << "Error while reading " << productXmlFile << " as Sentinel1 model: " << e.what() << "\n"; + } + if (traceExec()) + ossimNotify(ossimNotifyLevel_FATAL) + << "Cannot read " << productXmlFile << " as Sentinel1 model.\n"; + return false; + } + + bool ossimSentinel1Model::read(ossimFilename const& annotationXml) + { + ossimXmlDocument productXmlDocument; + if (! openMetadataFile(productXmlDocument, annotationXml)) { + ossimNotify(ossimNotifyLevel_FATAL) << "Cannot open Sar Sentinel1 model from XML file: "<<annotationXml<< std::endl; + + return false; + } + + const ossimXmlNodePtr & productRoot = productXmlDocument.getRoot(); + assert(productRoot.get()); + + const ossimXmlNode & adsHeader = getExpectedFirstNode(*productRoot,attAdsHeader); + const ossimString & polarisation = getTextFromFirstNode(adsHeader, "polarisation"); + const ossimString & productType = getTextFromFirstNode(adsHeader, "productType"); + theProductType = ProductType(productType); + + add(theProductKwl, SUPPORT_DATA_PREFIX, "product_type", productType.string()); + + addMandatory(theProductKwl, HEADER_PREFIX, "swath", adsHeader, "swath"); + addMandatory(theProductKwl, HEADER_PREFIX, "polarisation", adsHeader, "polarisation"); + add(theProductKwl, HEADER_PREFIX, "polarisation", polarisation.string()); + add(theProductKwl, HEADER_PREFIX, "annotation", annotationXml.file().string()); + + addMandatory(theProductKwl, HEADER_PREFIX, "first_line_time", adsHeader, "startTime"); + addMandatory(theProductKwl, HEADER_PREFIX, "last_line_time", adsHeader, "stopTime"); + + //RK maybe use this->getManifestPrefix() + + add(theProductKwl, SUPPORT_DATA_PREFIX, "mds1_tx_rx_polar", polarisation); + + const ossimXmlNode & imageInformation = getExpectedFirstNode(*productRoot, "imageAnnotation/imageInformation"); + const ossimXmlNode & productInformation = getExpectedFirstNode(*productRoot, "generalAnnotation/productInformation"); + + addOptional (theProductKwl, SUPPORT_DATA_PREFIX, "data_take_id", adsHeader, "missionDataTakeId"); + addOptional (theProductKwl, SUPPORT_DATA_PREFIX, "slice_num", imageInformation, "sliceNumber"); + + ossimXmlNode const& xAzimutTimeInterval = getExpectedFirstNode(imageInformation, "azimuthTimeInterval"); + const double azimuthTimeInterval = to<double>(xAzimutTimeInterval.getText(), "decoding imageInformation/azimuthTimeInterval"); +#if defined(USE_BOOST_TIME) + theAzimuthTimeInterval = boost::posix_time::precise_duration(azimuthTimeInterval * 1000000.); +#else + theAzimuthTimeInterval = seconds(azimuthTimeInterval); +#endif + // std::clog << "theAzimuthTimeInterval " << theAzimuthTimeInterval.total_microseconds() << "\n"; + add(theProductKwl, SUPPORT_DATA_PREFIX, "line_time_interval", xAzimutTimeInterval.getText()); + // addMandatory(theProductKwl, SUPPORT_DATA_PREFIX, "line_time_interval", imageInformation, "azimuthTimeInterval"); + + const double rangeSpacing = getDoubleFromFirstNode(imageInformation, "rangePixelSpacing"); + add(theProductKwl, SUPPORT_DATA_PREFIX, "range_spacing", rangeSpacing); + theGSD.x = rangeSpacing; + + const double azimuthSpacing = getDoubleFromFirstNode(imageInformation, "azimuthPixelSpacing"); + add(theProductKwl, SUPPORT_DATA_PREFIX, "azimuth_spacing", azimuthSpacing); + theGSD.y = azimuthSpacing; + // theGSD and theMeanGSD will be saved and reloaded automatically in + // ossimSensorModel::load/saveState() + + // TODO: Why duplicting these two information elsewhere? they're already + // under root prefix + addOptional(theProductKwl, ossimKeywordNames::NUMBER_SAMPLES_KW, imageInformation, "numberOfSamples"); + addOptional(theProductKwl, ossimKeywordNames::NUMBER_LINES_KW, imageInformation, "numberOfLines"); + + add(theProductKwl, + "sample_type" /*ossimKeywordNames::PIXEL_TYPE_KW*/, + getOptionalTextFromFirstNode(imageInformation, "pixelValue").upcase()); + + // TODO: check if it makes sense when only one file is considered + const double heightSum = getBandTerrainHeight(productXmlDocument); + add(theProductKwl, SUPPORT_DATA_PREFIX, "avg_scene_height", heightSum); + + + // these should be the same for all swaths + //RK div by oneMillion taken from S1tlbx + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "range_sampling_rate", productInformation, "rangeSamplingRate"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "radar_frequency", productInformation, "radarFrequency"); + // TODO: store the line_time_interval * 1000000 + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "line_time_interval", imageInformation, "azimuthTimeInterval"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "slant_range_to_first_pixel", imageInformation, "slantRangeTime"); + + const ossimXmlNode & downlinkInformation = + getExpectedFirstNode(*productRoot, "generalAnnotation/downlinkInformationList/downlinkInformation"); + + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "pulse_repetition_frequency", downlinkInformation, "prf"); + + ossimXmlNode const& swathProcParams = + getExpectedFirstNode(*productRoot, "imageAnnotation/processingInformation/swathProcParamsList/swathProcParams"); + ossimXmlNode const& rangeProcessingNode = getExpectedFirstNode(swathProcParams, "rangeProcessing"); + ossimXmlNode const& azimuthProcessingNode = getExpectedFirstNode(swathProcParams, "azimuthProcessing"); + + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "azimuth_bandwidth", azimuthProcessingNode, "processingBandwidth"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "range_bandwidth", rangeProcessingNode, "processingBandwidth"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "range_looks", rangeProcessingNode, "numberOfLooks"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, "azimuth_looks", azimuthProcessingNode, "numberOfLooks"); + + if(!theTOPSAR || !theSLC) + { + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_SAMPLES_KW, imageInformation, "numberOfSamples"); + addOptional(theProductKwl, SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_LINES_KW, imageInformation, "numberOfLines"); + } + + ossimXmlNodePtr const& orbitList = productRoot->findFirstNode("generalAnnotation/orbitList"); + if (!orbitList) { + ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n"; + } else { + addOrbitStateVectors(*orbitList); + } + + if (isGRD()) { + ossimXmlNodePtr const& coordinateConversionList = productRoot->findFirstNode("coordinateConversion/coordinateConversionList"); + if (!coordinateConversionList) { + ossimNotify(ossimNotifyLevel_WARN) << "No coordinate conversion info available in metadata!!\n"; + } else { + addSRGRCoefficients(*coordinateConversionList); + } + } + + ossimXmlNodePtr const& dcEstimateList = productRoot->findFirstNode("dopplerCentroid/dcEstimateList"); + if (!dcEstimateList) { + ossimNotify(ossimNotifyLevel_DEBUG) << "No doppler centroid coefficients available in metadata!!\n"; + } else { + addDopplerCentroidCoefficients(*dcEstimateList); + } + + readBurstRecords(*productRoot, imageInformation); + + readGeoLocationGrid(*productRoot); + +#if 0 + add(theProductKwl, SUPPORT_DATA_PREFIX, + ossimKeywordNames::NUMBER_BANDS_KW, + numBands, + true); +#endif + return true; + } + + void ossimSentinel1Model::readCalibrationMetadata() { - theProduct->setMetadataDirectory( manifestFile.path() ); - bool ret = theProduct->readProductMetadata( ); - if ( ret ) + ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") ); + std::vector<ossimFilename> files; + if (calibrationDir.isOpened()) + { + calibrationDir.findAllFilesThatMatch(files, "calibration*"); + } + std::vector<ossimFilename>::const_iterator it = files.begin(); + + ossimNotify(ossimNotifyLevel_INFO) << files.size() << " calibration files found in " << theManifestDirectory << "\n"; + std::stringstream strm; + for (; it != files.end(); ++it) { - theProduct->readCalibrationMetadata(); - theProduct->readNoiseMetadata(); + ossimXmlDocument calibrationDoc; + openMetadataFile(calibrationDoc, *it ); + + const ossimXmlNodePtr & calibrationRoot = calibrationDoc.getRoot(); + assert(calibrationRoot.get()); + ossimXmlNode const& adsHeader = getExpectedFirstNode(*calibrationRoot, "adsHeader"); + ossimXmlNode const& calibrationInformation = getExpectedFirstNode(*calibrationRoot, "calibrationInformation"); + ossimXmlNode const& calibrationVectorList = getExpectedFirstNode(*calibrationRoot, "calibrationVectorList"); + + char const calibrationPrefix[] = "calibration."; + + addMandatory(theProductKwl, calibrationPrefix, "swath", adsHeader, "swath"); + addMandatory(theProductKwl, calibrationPrefix, "polarisation", adsHeader, "polarisation"); + + // store as a string + addMandatory(theProductKwl, calibrationPrefix, "startTime", adsHeader, "startTime"); + addMandatory(theProductKwl, calibrationPrefix, "stopTime", adsHeader, "stopTime"); + + addMandatory(theProductKwl, calibrationPrefix, "absoluteCalibrationConstant", calibrationInformation, "absoluteCalibrationConstant"); + + add(theProductKwl, calibrationPrefix, + "count", + calibrationVectorList.getAttributeValue("count").string()); + + std::vector< ossimXmlNodePtr > calibrationVectors; + calibrationRoot->findChildNodes("calibrationVectorList/calibrationVector", calibrationVectors); + int idx = 0; + for (std::vector< ossimXmlNodePtr >::const_iterator b_calibVector = calibrationVectors.begin(), e_calibVector = calibrationVectors.end() + ; b_calibVector != e_calibVector + ; ++b_calibVector, ++idx + ) + { + char calibrationVectorPrefix[256]; + s_printf(calibrationVectorPrefix, "%scalibrationVector[%d].", calibrationPrefix, idx); + assert(b_calibVector->get()); + + ossimXmlNode const& calibrationVector = **b_calibVector; + const ossimXmlNodePtr & node = calibrationVector.findFirstNode("pixel"); + + add(theProductKwl, calibrationVectorPrefix, + "pixel_count", + node->getAttributeValue("count").string()); + + // store as a string + addMandatory(theProductKwl, calibrationVectorPrefix, keyAzimuthTime, calibrationVector, "azimuthTime"); + + addMandatory(theProductKwl, calibrationVectorPrefix, "line", calibrationVector, "line"); + addMandatory(theProductKwl, calibrationVectorPrefix, "pixel", calibrationVector, "pixel"); + addMandatory(theProductKwl, calibrationVectorPrefix, "sigmaNought", calibrationVector, "sigmaNought"); + addMandatory(theProductKwl, calibrationVectorPrefix, "betaNought", calibrationVector, "betaNought"); + addMandatory(theProductKwl, calibrationVectorPrefix, "gamma", calibrationVector, "gamma"); + addMandatory(theProductKwl, calibrationVectorPrefix, "dn", calibrationVector, "dn"); + + // calibrationVectors[idx]->toKwl(theProductKwl, "calibrationVectorList_" + ossimString::toString(idx+1) + "."); + } + } + } + + void ossimSentinel1Model::readNoiseMetadata() + { + ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") ); + std::vector<ossimFilename> files; + if (calibrationDir.isOpened()) + { + calibrationDir.findAllFilesThatMatch(files, "noise*"); + } + std::vector<ossimFilename>::const_iterator it = files.begin(); + const char noisePrefix[] = "noise."; + + for (; it != files.end(); ++it) + { + ossimXmlDocument noiseDoc; + openMetadataFile(noiseDoc, *it ); + + const ossimXmlNodePtr noiseRoot = noiseDoc.getRoot(); + std::vector< ossimXmlNodePtr > noiseVectors; + noiseRoot->findChildNodes("noiseVectorList/noiseVector", noiseVectors); + int idx = 0; + for (std::vector< ossimXmlNodePtr >::const_iterator b_noiseVector = noiseVectors.begin(), e_noiseVector = noiseVectors.end() + ; b_noiseVector != e_noiseVector + ; ++b_noiseVector, ++idx + ) + { + char noiseVectorPrefix [256]; + s_printf(noiseVectorPrefix, "%snoiseVector[%d].", noisePrefix, idx); + assert(b_noiseVector->get()); + + ossimXmlNode const& noiseVector = **b_noiseVector; + + const ossimXmlNodePtr & node = noiseVector.findFirstNode("pixel"); + + add(theProductKwl, noiseVectorPrefix, + "pixel_count", + node->getAttributeValue("count"), + ShallOverwrite::no); + + // store as a string + addMandatory(theProductKwl, noiseVectorPrefix, keyAzimuthTime, noiseVector, "azimuthTime"); + + addMandatory(theProductKwl, noiseVectorPrefix, "line", noiseVector, "line"); + addMandatory(theProductKwl, noiseVectorPrefix, "pixel", noiseVector, "pixel"); + addMandatory(theProductKwl, noiseVectorPrefix, "noiseLut", noiseVector, "noiseLut"); + //noiseVectorList[idx]->toKwl(theProductKwl, "noiseVectorList_" + ossimString::toString(idx+1) + "."); + } + } + } + + void ossimSentinel1Model::readBurstRecords(ossimXmlNode const& productRoot, ossimXmlNode const& imageInformation) + { + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + productRoot.findChildNodes("swathTiming/burstList/burst",xnodes); + if (xnodes.empty()) + { + // Appart from TopSAR products, there won't be any burst + //records, so this warning is unnecessary + //ossimNotify(ossimNotifyLevel_DEBUG) << "No burst records available in metadata!!\n"; + add(theProductKwl, BURST_NUMBER_KEY, ossimString("1")); + BurstRecordType burstRecord; + burstRecord.startLine = add(theProductKwl, BURST_PREFIX, "[0].start_line", 0); + burstRecord.azimuthStartTime = add(theProductKwl, BURST_PREFIX, "[0].azimuth_start_time", getTimeFromFirstNode(imageInformation, "productFirstLineUtcTime")); + burstRecord.azimuthStopTime = add(theProductKwl, BURST_PREFIX, "[0].azimuth_stop_time", getTimeFromFirstNode(imageInformation, "productLastLineUtcTime")); + burstRecord.endLine = add(theProductKwl, BURST_PREFIX, "[0].end_line", getFromFirstNode<unsigned int>(imageInformation, "numberOfLines")-1); + theBurstRecords.push_back(burstRecord); } else { - ossimNotify(ossimNotifyLevel_FATAL) << " theProduct->readProductMetadata() failed" << std::endl; + char burstPrefix[1024]; + + const unsigned int linesPerBurst = getFromFirstNode<unsigned int>(productRoot, "swathTiming/linesPerBurst"); + unsigned int burstId(0); + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode,++burstId) + { + BurstRecordType burstRecord; + const TimeType azTime = getTimeFromFirstNode(**itNode, attAzimuthTime); + ossimString const& s = getTextFromFirstNode(**itNode, attFirstValidSample); + + ossim_int64 first_valid(0), last_valid(0); + bool begin_found(false), end_found(false); + + std::vector<ossimString> ssp = s.split(" "); + + for (std::vector<ossimString>::const_iterator sIt = ssp.begin(), e = ssp.end() + ; sIt != e && !end_found + ; ++sIt + ) + { + if(!begin_found) + { + if(*sIt!="-1") + { + begin_found = true; + } + else + { + ++first_valid; + } + ++last_valid; + } + else + { + if(!end_found && *sIt=="-1") + { + end_found = true; + } + else + { + ++last_valid; + } + } + } + + s_printf(burstPrefix, "%s[%d].", BURST_PREFIX.c_str(), burstId); + burstRecord.startLine = add(theProductKwl,burstPrefix + keyStartLine, burstId*linesPerBurst + first_valid); + burstRecord.endLine = add(theProductKwl,burstPrefix + keyEndLine, burstId*linesPerBurst + last_valid); + // TODO: check units. + burstRecord.azimuthStartTime = add(theProductKwl,burstPrefix + keyAzimuthStartTime, azTime + (first_valid*theAzimuthTimeInterval)); + burstRecord.azimuthStopTime = add(theProductKwl,burstPrefix + keyAzimuthStopTime, azTime + (last_valid*theAzimuthTimeInterval)); + + theBurstRecords.push_back(burstRecord); + } + add(theProductKwl, BURST_NUMBER_KEY, burstId); } + } + + void ossimSentinel1Model::addSRGRCoefficients(ossimXmlNode const& coordinateConversionList) + { + readCoordinates(coordinateConversionList, attSr0, attSrgrCoefficients, SR_PREFIX); + readCoordinates(coordinateConversionList, attGr0, attGrsrCoefficients, GR_PREFIX); + } + + void ossimSentinel1Model::readCoordinates( + ossimXmlNode const& node, + ossimString const& rg0_xpath, ossimString const& coeffs_xpath, + std::string const& sr_gr_prefix) + { + char prefix[1024]; + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + node.findChildNodes("coordinateConversion", xnodes); + + add(theProductKwl,sr_gr_prefix+"."+NUMBER_KEY, static_cast<ossim_uint32>(xnodes.size())); + + unsigned int idx = 0; + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode, ++idx) + { + int pos = s_printf(prefix, "%s[%d].", sr_gr_prefix.c_str(), idx); + assert(pos >= sizeof(SR_PREFIX)+4 && pos < sizeof(prefix)); + + addMandatory(theProductKwl, prefix + keyAzimuthTime,**itNode, attAzimuthTime); + addMandatory(theProductKwl, prefix + rg0_xpath, **itNode, rg0_xpath); + + ossimString const& s = getTextFromFirstNode(**itNode, coeffs_xpath); + std::vector<ossimString> ssplit = s.split(" "); + + if (ssplit.empty()) + { + throw std::runtime_error("The "+rg0_xpath.string()+" record has an empty coef vector"); + } + add(theProductKwl,prefix+ NUMBER_KEY, ssplit.size()); + + unsigned int coeff_idx = 0; + for (std::vector<ossimString>::const_iterator cIt = ssplit.begin(), e = ssplit.end() + ; cIt != e + ; ++cIt, ++coeff_idx + ) + { + // append to current prefix + s_printf(prefix+pos, sizeof(prefix)-pos, "coeff[%d]", coeff_idx); + add(theProductKwl, prefix, *cIt); // Don't check this is really a double. + } + assert(coeff_idx>0 &&"The rg0 record has empty coefs vector."); + } + } + + void ossimSentinel1Model::readGeoLocationGrid(ossimXmlNode const& productRoot) + { + SCOPED_LOG(traceDebug, "ossimSentinel1Model::readGeoLocationGrid"); + char prefix[1024]; + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + productRoot.findChildNodes("geolocationGrid/geolocationGridPointList/geolocationGridPoint", xnodes); + + unsigned int idx = 0; + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode,++idx) + { + int pos = s_printf(prefix, "%s[%d].", GCP_PREFIX.c_str(), idx); + assert(pos >= sizeof(SR_PREFIX)+4 && pos < 1024); +#if defined(USE_BOOST_TIME) + const TimeType azimuthTime = getTimeFromFirstNode(**itNode, attAzimuthTime); + add(theProductKwl, prefix, attAzimuthTime, azimuthTime); +#else + const TimeType azimuthTime = time::toModifiedJulianDate( + addMandatory(theProductKwl, prefix, attAzimuthTime, **itNode, attAzimuthTime)); // acquisition time +#endif + addMandatory(theProductKwl, prefix, keySlantRangeTime, **itNode, attSlantRangeTime); + addMandatory(theProductKwl, prefix, keyImPtX, **itNode, attPixel); + + // In TOPSAR products, GCPs are weird (they fall in black lines + // between burst. This code allows moving them to a valid area of + // the image. + if(theBurstRecords.size()>2) + { +#if defined(USE_BOOST_TIME) + TimeType acqStart; +#else + TimeType acqStart(0); +#endif + unsigned long acqStartLine(0); + + const std::vector<BurstRecordType>::const_reverse_iterator bIt + = std::find_if(theBurstRecords.rbegin(), theBurstRecords.rend(), DoesContain(azimuthTime)); + if (bIt != theBurstRecords.rend()) + { + acqStart = bIt->azimuthStartTime; + acqStartLine = bIt->startLine; + } + else if(azimuthTime < theBurstRecords.front().azimuthStartTime) + { + acqStart = theBurstRecords.front().azimuthStartTime; + acqStartLine = theBurstRecords.front().startLine; + } + else if (azimuthTime >= theBurstRecords.front().azimuthStopTime) + { + acqStart = theBurstRecords.back().azimuthStartTime; + acqStartLine = theBurstRecords.back().startLine; + } + else + { + assert(!"unexpected case"); + } + + const DurationType timeSinceStart = azimuthTime - acqStart; // in day frac + + const double imPt_y= timeSinceStart/theAzimuthTimeInterval + acqStartLine; + // std::clog << "timeSinceStart: " << timeSinceStart << "(" << timeSinceStart.total_microseconds() << "us) = " << azimuthTime << " - " << acqStart << " (azTime-acqStart)"<< "\n"; + // std::clog << "imPt_y: " << imPt_y << " = " << timeSinceStart.total_microseconds() << "/" << theAzimuthTimeInterval.total_microseconds() << "+" << acqStartLine << "\n"; + add(theProductKwl, prefix, keyImPtY, imPt_y); + } + else + { + addMandatory(theProductKwl, prefix, keyImPtY, **itNode, attLine); + } + addMandatory(theProductKwl, prefix, keyWorldPtLat, **itNode, attLatitude); + addMandatory(theProductKwl, prefix, keyWorldPtLon, **itNode, attLongitude); + addMandatory(theProductKwl, prefix, keyWorldPtHgt, **itNode, attHeight); + } + add(theProductKwl, GCP_NUMBER_KEY, static_cast<ossim_uint32>(idx)); + } + + void ossimSentinel1Model::addOrbitStateVectors(ossimXmlNode const& orbitList) + { + ossimXmlNode::ChildListType stateVectorList; + orbitList.findChildNodes("orbit", stateVectorList); + + if(stateVectorList.empty()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n"; + return; + } + + std::size_t stateVectorList_size = stateVectorList.size(); + char orbit_prefix_[256]; + for (std::size_t i = 0; i != stateVectorList_size ; ++i) + { + //orbit_state_vectors + const int pos = s_printf(orbit_prefix_, "orbitList.orbit[%d].", int(i)); + assert(pos > 0 && pos < 256); + const std::string orbit_prefix(orbit_prefix_, pos); + + addMandatory(theProductKwl, orbit_prefix + keyTime, *stateVectorList[i], "time"); + + addMandatory(theProductKwl, orbit_prefix + keyPosX, *stateVectorList[i], "position/x"); + addMandatory(theProductKwl, orbit_prefix + keyPosY, *stateVectorList[i], "position/y"); + addMandatory(theProductKwl, orbit_prefix + keyPosZ, *stateVectorList[i], "position/z"); + + addMandatory(theProductKwl, orbit_prefix + keyVelX, *stateVectorList[i], "velocity/x"); + addMandatory(theProductKwl, orbit_prefix + keyVelY, *stateVectorList[i], "velocity/y"); + addMandatory(theProductKwl, orbit_prefix + keyVelZ, *stateVectorList[i], "velocity/z"); + } + + add(theProductKwl,"orbitList.nb_orbits", static_cast<ossim_uint32>(stateVectorList_size)); + } + + bool ossimSentinel1Model::initImageSize(ossimIpt& imageSize) const + { + std::string const& samples_cstr = theProductKwl.findKey(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_SAMPLES_KW); + std::string const& lines_cstr = theProductKwl.findKey(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_LINES_KW); + + imageSize.samp = to<int>(samples_cstr, "decoding sample number from KWL"); + imageSize.line = to<int>(lines_cstr, "decoding line number from KWL"); return true; } - void - ossimSentinel1Model:: - lineSampleHeightToWorld(const ossimDpt& image_point, - const double& heightEllipsoid, - ossimGpt& worldPoint) const { + double ossimSentinel1Model::getBandTerrainHeight(ossimXmlDocument const& productXmlDocument) + { + double heightSum = 0.0; + vector< ossimXmlNodePtr > heightList; + productXmlDocument.findNodes("/product/generalAnnotation/terrainHeightList/terrainHeight", heightList); + vector<ossimXmlNodePtr >::const_iterator it = heightList.begin(); + for ( ; it != heightList.end() ; ++it) + { + heightSum += getOptionalTextFromFirstNode(**it, "value").toFloat64(); + } + return heightSum / heightList.size(); + } + + void ossimSentinel1Model::addDopplerCentroidCoefficients(ossimXmlNode const& dcEstimateList) + { + ossimString count_str; + dcEstimateList.getAttributeValue(count_str, "count"); + const int count = count_str.toInt(); + if( count < 1) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "No doppler centroid coefficients available in metadata!!\n"; + return; + } + else + { + ossimXmlNode::ChildListType dcEstimates; + dcEstimateList.findChildNodes("dcEstimate", dcEstimates); - // NOT YET IMPLEMENTED - setErrorStatus(); + ossimXmlNode::ChildListType::const_iterator it = dcEstimates.begin(); + + for (int index = 1 ; it != dcEstimates.end() ; ++it, ++index) + { + char prefix[256]; + //Doppler_Centroid_Coefficients.dop_coef_list; + s_printf(prefix, "dopplerCentroid.dop_coef_list%d.", index); + + const ossimXmlNodePtr & dcEstimate = *it; + assert(dcEstimate.get()); + addOptional(theProductKwl, prefix, "dop_coef_time", *dcEstimate, "azimuthTime"); + //RK + const double ref_time = getOptionalTextFromFirstNode(*dcEstimate, "t0").toFloat64() * 1e9; // s to ns + add(theProductKwl, prefix, keySlantRangeTime, ref_time); + + ossimString const& ns = getOptionalTextFromFirstNode(*dcEstimate, "ns"); + + if( !ns.empty() ) + add(theProductKwl, prefix, keySlantRangeTime, ns); + + ossimString const& coeffStr = getOptionalTextFromFirstNode(*dcEstimate, "geometryDcPolynomial"); + + if (!coeffStr.empty()) + { + const ossimString separatorList = " "; + std::vector<ossimString> result; + + coeffStr.split(result, separatorList, true); + + std::vector<ossimString>::const_iterator coeff = result.begin(); + + for (int count = 1 ; coeff != result.end() ; ++count, ++coeff) + { + char coeff_prefix[256]; + s_printf(coeff_prefix, "%s%d.dop_coef", prefix, count); + + add(theProductKwl, coeff_prefix, coeff->string()); + } + + } //if (!coeffStr.empty()) + + } // for each dcEstimate + + } // else count < 1 } - void - ossimSentinel1Model:: - lineSampleToWorld(const ossimDpt& image_point, - ossimGpt& gpt) const { + bool ossimSentinel1Model::openMetadataFile(ossimXmlDocument& doc, ossimString const& file) const + { + if ( !doc.openFile( file ) ) + { + ossimNotify(ossimNotifyLevel_FATAL) << "Cannot open metadata file `" << file << "`\n"; + return false; + } + + return true; + } + void ossimSentinel1Model::imagingRay(const ossimDpt& image_point, ossimEcefRay& image_ray) const + { // NOT YET IMPLEMENTED setErrorStatus(); } - } //end namespace diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h index 55de8be905f01d335f404d74a329c86a8ead6fe5..273509d8750d41a11ee37fa28d25cdde22b476f0 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h @@ -12,59 +12,60 @@ #ifndef ossimSentinel1Model_HEADER #define ossimSentinel1Model_HEADER +#include <iosfwd> +#include <boost/config.hpp> + #include <ossim/base/ossimCommon.h> #include <ossim/base/ossimFilename.h> -#include <ossim/base/ossimDirectory.h> #include <ossim/base/ossimKeywordNames.h> #include <ossim/base/ossimNotify.h> #include <ossim/base/ossimRefPtr.h> -#include <ossim/base/ossimString.h> -#include <ossim/base/ossimTrace.h> #include <ossim/base/ossimXmlDocument.h> -#include <ossim/base/ossimXmlNode.h> //#include <ossim/projection/ossimSensorModel.h> //#include <ossim/projection/ossimCoarseGridModel.h> -#include <ossim/projection/ossimSarModel.h> +#include "ossimSarSensorModel.h" +#include "ossimPluginConstants.h" // OSSIM_PLUGINS_DLL #include <ossim/support_data/ossimSupportFilesList.h> -#include "ossimPluginConstants.h" -#include "ossimPluginCommon.h" -#include <iostream> -#include <cmath> -#include <cstdio> - //#include "ossimGeometricSarSensorModel.h" -#include "ossimSentinel1ProductDoc.h" - -//ossimGeometricSarSensorModel +class OSSIMDLLEXPORT ossimXmlNode; +class OSSIMDLLEXPORT ossimString; namespace ossimplugins { - class OSSIM_PLUGINS_DLL ossimSentinel1Model : public ossimSarModel + class OSSIM_PLUGINS_DLL ossimSentinel1Model : public ossimSarSensorModel { public: - /*! - * CONSTRUCTORS: + typedef ossimRefPtr<ossimXmlNode> ossimXmlNodePtr; + typedef ossimRefPtr<ossimXmlDocument> ossimXmlDocumentPtr; + + /** + * CONSTRUCTORS. + * @{ */ - /** @brief default constructor */ + /** @brief Default constructor */ ossimSentinel1Model(); - /** @brief copy constructor */ - ossimSentinel1Model(const ossimSentinel1Model& rhs); +#if ! (defined(BOOST_NO_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX1_DEFAULTED_FUNCTIONS)) + /** @brief Copy constructor */ + ossimSentinel1Model(ossimSentinel1Model const& rhs) = default; - /** @brief Destructor */ - virtual ~ossimSentinel1Model(); + /** @brief Move constructor */ + ossimSentinel1Model(ossimSentinel1Model && rhs) = default; + /** @brief Destructor */ + virtual ~ossimSentinel1Model() = default; +#endif + //@} bool open(const ossimFilename& file); /*! * Returns pointer to a new instance, copy of this. - * Not implemented yet! Returns NULL... */ virtual ossimObject* dup() const; @@ -78,87 +79,80 @@ namespace ossimplugins * KWL files. Returns true if successful. */ virtual bool saveState(ossimKeywordlist& kwl, - const char* prefix=NULL) const; - - virtual bool loadState(const ossimKeywordlist& kwl, - const char* prefix=NULL); + const char* prefix=NULL) const; - bool checkDirectory(const ossimFilename& file, const char* d, const char *ext); + virtual bool loadState(ossimKeywordlist const& kwl, + const char* prefix=NULL); - bool isLevel0(const ossimFilename& file); + bool checkDirectory(const ossimFilename& file, const char* d, const char *ext) const; - bool isLevel2(const ossimFilename& file); + bool isLevel0(ossimFilename const& file) const; - bool isLevel1(const ossimFilename& file); + bool isLevel2(ossimFilename const& file) const; - bool isSentinel1(const ossimFilename &manifestFile); + bool isLevel1(ossimFilename const& file) const; - bool readProduct(const ossimFilename &manifestFile); + bool isSentinel1(ossimFilename const &manifestFile); - bool getImageId(ossimString& s) const; + bool readProduct(ossimFilename const &productXmlFile); - bool initSensorID(ossimString& s); + ossimString const& getImageId(ossimXmlDocument const& manifestDoc) const; - bool standAloneProductInformation(); + ossimString initSensorID(ossimXmlDocument const& manifestDoc); - bool getAnnotationFileLocation(const ossimFilename &manifestFile, const char* pattern); + bool standAloneProductInformation(ossimXmlDocument const& manifestDoc); - virtual void lineSampleHeightToWorld(const ossimDpt& image_point, - const double& heightEllipsoid, - ossimGpt& worldPoint) const; + // bool getAnnotationFileLocation(const ossimFilename &manifestFile, const char* pattern); - virtual void lineSampleToWorld(const ossimDpt& image_point, - ossimGpt& gpt) const; + bool initImageSize(ossimIpt& imageSize) const; - bool initImageSize(ossimIpt& imageSize) const - { - // theImageClipRect = ossimDrect(0, 0, theImageSize.x-1, theImageSize.y-1); - // theSubImageOffset.x = 0.0; - // theSubImageOffset.y = 0.0; + virtual void imagingRay(ossimDpt const& image_point, ossimEcefRay& image_ray) const; - return theProduct->initImageSize(imageSize ); - } + bool isSLC() const { return theSLC; } + bool isOCN() const { return theOCN; } - bool initGsd(ossimDpt& gsd) const - { - return theProduct->initGsd( gsd ); - } +#if 0 + bool initSRGR(); +#endif - const ossimKeywordlist getManifestKwl() const - { - return theManifestKwl; - } + ossimFilename searchManifestFile(const ossimFilename& file) const; - bool isSLC() { return theSLC; } - bool isOCN() { return theOCN; } - - bool initSRGR() - { - // theProduct->initSRGR( ); - return true; - } - - bool findSafeManifest(const ossimFilename& file, ossimFilename& safeFile); - - void clearFields(); + void clearFields(); + double getBandTerrainHeight(ossimXmlDocument const& theProductXmlDocument); + void setMetadataDirectory(ossimFilename const& d) + { + theManifestDirectory = d; + } protected: - TYPE_DATA - - private: - - ossimFilename theProductXmlFile; - ossimFilename theManifestFile; - ossimKeywordlist theManifestKwl; - ossimRefPtr<ossimXmlDocument> theManifestDoc; - ossimRefPtr<ossimSentinel1ProductDoc> theProduct; - bool theOCN; - bool theSLC; - - - }; //end class ossimSentinel1Model + TYPE_DATA; + + private: + bool read(ossimFilename const& annotationXml); + void readCalibrationMetadata(); + void readNoiseMetadata(); + void readBurstRecords(ossimXmlNode const& productRoot, ossimXmlNode const& imageInformation); + void addSRGRCoefficients(ossimXmlNode const& coordinateConversion); + void readCoordinates( + ossimXmlNode const& node, + ossimString const& rg0_xpath, ossimString const& coeffs_xpath, + std::string const& sr_gr_prefix); + void readGeoLocationGrid(ossimXmlNode const& productRoot); + void addOrbitStateVectors(ossimXmlNode const& orbitList); + void addDopplerCentroidCoefficients(ossimXmlNode const& dcEstimateList); + bool openMetadataFile(ossimXmlDocument& doc, ossimString const& file) const; + + ossimFilename theManifestDirectory; + ossimFilename theProductXmlFile; + // ossimFilename theManifestFile; + ossimKeywordlist theManifestKwl; + ossimKeywordlist theProductKwl; + bool theOCN; + bool theSLC; + bool theTOPSAR; + }; //end class ossimSentinel1Model } //end namespace ossimplugins diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp deleted file mode 100644 index 52c74ef916a8943a9a7918a75ec65c3b3c4e25b6..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp +++ /dev/null @@ -1,750 +0,0 @@ -#include "ossimSentinel1ProductDoc.h" -#include <ossim/base/ossimDirectory.h> -#include <ossim/base/ossimDate.h> - -// Define Trace flags for use within this file: -static ossimTrace traceExec ("ossimSentinel1SupportData:exec"); -static ossimTrace traceDebug ("ossimSentinel1SupportData:debug"); - -namespace ossimplugins -{ - - static const char LOAD_FROM_PRODUCT_FILE_KW[] = "load_from_product_file_flag"; - static const char PRODUCT_XML_FILE_KW[] = "product_xml_filename"; - static const char SUPPORT_DATA_PREFIX[] = "support_data."; - - ossimSentinel1ProductDoc::ossimSentinel1ProductDoc () - : ossimErrorStatusInterface () - , theRangeSpacingTotal (0.0) - , theAzimuthSpacingTotal (0.0) - , theSLC (false) - , theTOPSAR (false) - { - - } - - ossimSentinel1ProductDoc::~ossimSentinel1ProductDoc () - { - - } - - bool ossimSentinel1ProductDoc::openMetadataFile(ossimRefPtr<ossimXmlDocument>& doc, const ossimString file) const - { - if ( !doc->openFile( file ) ) - { - ossimNotify(ossimNotifyLevel_FATAL) << "ossimSentinel1ProductDoc::openMetadataFile" << std::endl; - return false; - } - - return true; - } - - - double - ossimSentinel1ProductDoc - ::getModifiedJulianDate(const ossimString utcTimeString) - { - - std::vector<ossimString> date_time; - std::vector<ossimString> output; - - utcTimeString.split(date_time, "T"); - - date_time[0].split(output, "-"); - - if (output.size () != 3) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid date\n"; - } - - char* stop; - int year = std::strtol( output[0].c_str(), &stop, 10); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid year\n"; - } - - stop = 0; - int month = std::strtol( output[1].c_str(), &stop, 10); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid month\n"; - } - stop = 0; - int day = std::strtol( output[2].c_str(), &stop, 10); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid day\n"; - } - /* Parse time */ - output.clear(); - date_time[1].split(output, ":"); - if (output.size () != 3) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid time\n"; - } - - stop = 0; - int hours = std::strtol( output[0].c_str(), &stop, 10); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid hours\n"; - } - - stop = 0; - int minutes = std::strtol( output[1].c_str(), &stop, 10); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid minutes\n"; - } - - stop = 0; - int seconds = std::strtod( output[2].c_str(), &stop); - if ( *stop != 0 ) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "invalid seconds in float\n"; - } - -/* Below method could replace all above split and convert. But there is a lot of - checks done in ossimLocalTm::setIso8601( ) which slows us down. And I dont - want that. */ -/* - ossimLocalTm otm; - if ( !otm.setIso8601(utcString) ) - { - } - ossimDate ossimdate(otm); -*/ - - ossimDate ossimdate(month, day, year); - ossimdate.setHour(hours); - ossimdate.setMin(minutes); - ossimdate.setFloatSec(seconds); - return ossimdate.getModifiedJulian(); - - } - - bool ossimSentinel1ProductDoc::readProductMetadata() - { - bool commonMetadataRetrieved = false; - double heightSum = 0.0; - int numBands = 0; - - ossimDirectory annotationDir( theManifestDirectory.dirCat( "annotation") ); - std::vector<ossimFilename> files; - annotationDir.findAllFilesThatMatch(files, ".xml"); - std::vector<ossimFilename>::const_iterator it = files.begin(); - - /* avoid zero value for numBands. This will result in division by zero below */ - if( files.size() < 1 ) numBands = 1; - - for (int count=0; it != files.end(); ++it, ++count) - { - ossimRefPtr<ossimXmlDocument> theProductXmlDocument = new ossimXmlDocument(); - openMetadataFile(theProductXmlDocument, (*it) ); - - const ossimXmlNodePtr productRoot = theProductXmlDocument->getRoot(); - - const ossimXmlNodePtr adsHeader = productRoot->findFirstNode("adsHeader"); - - const ossimString swath = adsHeader->getChildTextValue("swath"); - - const ossimString polarisation = - adsHeader->getChildTextValue("polarisation"); - - std::stringstream _tempstrm; - _tempstrm << "Band[" << count << "]."; - const ossimString bandPrefix = _tempstrm.str(); - - theProductKwl.add(bandPrefix, - "swath", - swath, - true); - - theProductKwl.add(bandPrefix, - "polarisation", - polarisation, - true); - - theProductKwl.add(bandPrefix, - "annotation", - (*it).file(), - true); - - theProductKwl.add(bandPrefix, - "first_line_time", - adsHeader->getChildTextValue("startTime"), - true); - - theProductKwl.add(bandPrefix, - "last_line_time", - adsHeader->getChildTextValue("stopTime"), - true); - //RK maybe use this->getManifestPrefix() - theProductKwl.add(SUPPORT_DATA_PREFIX, - "mds1_tx_rx_polar", - polarisation, - true); - - const ossimXmlNodePtr imageInformation = - productRoot->findFirstNode("imageAnnotation/imageInformation"); - - const ossimXmlNodePtr productInformation = - productRoot->findFirstNode("generalAnnotation/productInformation"); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "data_take_id", - adsHeader->getChildTextValue("missionDataTakeId"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "slice_num", - imageInformation->getChildTextValue("sliceNumber"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "line_time_interval", - imageInformation->getChildTextValue("azimuthTimeInterval"), - true); - - theRangeSpacingTotal += - imageInformation->getChildTextValue("rangePixelSpacing") - .toFloat64(); - - theAzimuthSpacingTotal += - imageInformation->getChildTextValue("azimuthPixelSpacing") - .toFloat64(); - - theProductKwl.add(bandPrefix, - ossimKeywordNames::NUMBER_SAMPLES_KW, - imageInformation->getChildTextValue("numberOfSamples"), - true); - - theProductKwl.add(bandPrefix, - ossimKeywordNames::NUMBER_LINES_KW, - imageInformation->getChildTextValue("numberOfLines"), - true); - - theProductKwl.add(bandPrefix, - "sample_type", //ossimKeywordNames::PIXEL_TYPE_KW, - imageInformation->getChildTextValue("pixelValue") - .upcase(), - true); - - heightSum += getBandTerrainHeight(theProductXmlDocument); - - - if (!commonMetadataRetrieved) - { - // these should be the same for all swaths - //RK div by oneMillion taken from S1tlbx - theProductKwl.add(SUPPORT_DATA_PREFIX, - "range_sampling_rate", - productInformation->getChildTextValue("rangeSamplingRate"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "radar_frequency", - productInformation->getChildTextValue("radarFrequency"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "line_time_interval", - imageInformation->getChildTextValue("azimuthTimeInterval"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "slant_range_to_first_pixel", - imageInformation->getChildTextValue("slantRangeTime"), - true); - - const ossimXmlNodePtr downlinkInformation = - productRoot->findFirstNode - ("generalAnnotation/downlinkInformationList/downlinkInformation"); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "pulse_repetition_frequency", - downlinkInformation->getChildTextValue("prf"), - true); - - const ossimXmlNodePtr swathProcParams = - productRoot->findFirstNode("imageAnnotation/processingInformation/swathProcParamsList/swathProcParams"); - const ossimXmlNodePtr rangeProcessingNode = - swathProcParams->findFirstNode("rangeProcessing"); - - const ossimXmlNodePtr azimuthProcessingNode = - swathProcParams->findFirstNode("azimuthProcessing"); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "azimuth_bandwidth", - azimuthProcessingNode->getChildTextValue( - "processingBandwidth"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "range_bandwidth", - rangeProcessingNode->getChildTextValue( - "processingBandwidth"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "range_looks", - rangeProcessingNode->getChildTextValue( - "numberOfLooks"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "azimuth_looks", - azimuthProcessingNode->getChildTextValue( - "numberOfLooks"), - true); - - if(!theTOPSAR || !theSLC) - { - theProductKwl.add(SUPPORT_DATA_PREFIX, - ossimKeywordNames::NUMBER_SAMPLES_KW, - imageInformation->getChildTextValue( - "numberOfSamples"), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - ossimKeywordNames::NUMBER_LINES_KW, - imageInformation->getChildTextValue( - "numberOfLines"), - true); - } - - const ossimXmlNodePtr orbitList = - productRoot->findFirstNode("generalAnnotation/orbitList"); - addOrbitStateVectors(orbitList); - - const ossimXmlNodePtr coordinateConversionList = - productRoot->findFirstNode( - "coordinateConversion/coordinateConversionList"); - - addSRGRCoefficients(SUPPORT_DATA_PREFIX, coordinateConversionList); - - const ossimXmlNodePtr dcEstimateList = productRoot->findFirstNode( - "dopplerCentroid/dcEstimateList"); - - addDopplerCentroidCoefficients(dcEstimateList); - - commonMetadataRetrieved = true; - } - - ++numBands; - } - - if(theSLC) - { - numBands = numBands * 2; // real and imaginary - } - - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "range_spacing", - theRangeSpacingTotal / (double)numBands, - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "azimuth_spacing", - theAzimuthSpacingTotal / (double)numBands, - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - "avg_scene_height", - heightSum / (double)files.size(), - true); - - theProductKwl.add(SUPPORT_DATA_PREFIX, - ossimKeywordNames::NUMBER_BANDS_KW, - numBands, - true); - return true; - } - - void ossimSentinel1ProductDoc::addDopplerCentroidCoefficients(const ossimRefPtr<ossimXmlNode>& dcEstimateList) - { - if (!dcEstimateList.get()) - return; - - ossimString count_str; - dcEstimateList->getAttributeValue(count_str, "count"); - const int count = count_str.toInt(); - if( count < 1) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "No doppler centroid coefficients available in metadata!!\n"; - return; - } - else - { - ossimXmlNode::ChildListType dcEstimates; - dcEstimateList->findChildNodes("dcEstimate", dcEstimates); - - ossimXmlNode::ChildListType::const_iterator it = dcEstimates.begin(); - - int index = 1; - - while( it != dcEstimates.end()) - { - //Doppler_Centroid_Coefficients.dop_coef_list; - const ossimString prefix = "dopplerCentroid.dop_coef_list" + ossimString::toString(index) + "."; - - ++index; - - const ossimRefPtr<ossimXmlNode> dcEstimate = (*it); - theProductKwl.add(prefix, - "dop_coef_time", - dcEstimate->getChildTextValue("azimuthTime"), - true); - //RK - const double ref_time = dcEstimate->getChildTextValue("t0").toFloat64() * 1e9; // s to ns - - theProductKwl.add(prefix, - "slant_range_time", - ref_time, - true); - - const ossimString ns = dcEstimate->getChildTextValue("ns"); - - if( !ns.empty() ) - theProductKwl.add(prefix, - "slant_range_time", - ns, - true); - - const ossimString coeffStr = dcEstimate->getChildTextValue("geometryDcPolynomial"); - - if (!coeffStr.empty()) - { - const ossimString separatorList = " "; - std::vector<ossimString> result; - - coeffStr.split(result, separatorList, true); - - std::vector<ossimString>::const_iterator coeff = result.begin(); - - int count = 1; - - while (coeff != result.end()) - { - const ossimString coeff_prefix = prefix + ossimString::toString(count) + "."; - - theProductKwl.add(coeff_prefix, - "dop_coef", - (*coeff), - true); - - ++coeff; - - ++count; - } - - } //if (!coeffStr.empty()) - - ++it; - - } // while( it != dcEstimates.end()) - - } // else count < 1 - } - - - double ossimSentinel1ProductDoc::getBandTerrainHeight( const ossimRefPtr<ossimXmlDocument>& theProductXmlDocument ) - { - double heightSum = 0.0; - vector< ossimRefPtr<ossimXmlNode> > heightList; - theProductXmlDocument->findNodes("/product/generalAnnotation/terrainHeightList/terrainHeight", heightList); - vector<ossimRefPtr<ossimXmlNode> >::const_iterator it = heightList.begin(); - while(it != heightList.end()) - { - heightSum += (*it)->getChildTextValue("value").toFloat64(); - ++it; - } - return heightSum / heightList.size(); - } - - bool ossimSentinel1ProductDoc::initImageSize(ossimIpt& imageSize) const - { - const ossimString samples_str = theProductKwl.find(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_SAMPLES_KW); - const ossimString lines_str = theProductKwl.find(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_LINES_KW); - - imageSize.samp = samples_str.toInt(); - imageSize.line = lines_str.toInt(); - - return true; - } - - bool ossimSentinel1ProductDoc::initGsd( ossimDpt& gsd) const - { - gsd.x = theRangeSpacingTotal; - gsd.y = theAzimuthSpacingTotal; - return true; - } - - void ossimSentinel1ProductDoc::addOrbitStateVectors(const ossimRefPtr<ossimXmlNode>& orbitList) - { - - if (!orbitList.get()) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n"; - return; - } - - ossimXmlNode::ChildListType stateVectorList; - orbitList->findChildNodes("orbit", stateVectorList); - - if(stateVectorList.size() < 1) - { - ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n"; - return; - } - - int stateVectorList_size = stateVectorList.size(); - for (int i = 0; i < stateVectorList_size ; ++i) - { - //orbit_state_vectors - const ossimString orbit_prefix = "orbitList.orbit[" + ossimString::toString(i) + "]."; - - theProductKwl.add(orbit_prefix, - "time", - stateVectorList[i]->getChildTextValue("time"), - true); - - theProductKwl.add(orbit_prefix, - "x_pos", - stateVectorList[i]->getChildTextValue("position/x").toFloat64(), - true); - - theProductKwl.add(orbit_prefix, - "y_pos", - stateVectorList[i]->getChildTextValue("position/y").toFloat64(), - true); - - theProductKwl.add(orbit_prefix, - "z_pos", - stateVectorList[i]->getChildTextValue("position/z").toFloat64(), - true); - - theProductKwl.add(orbit_prefix, - "x_vel", - stateVectorList[i]->getChildTextValue("velocity/x").toFloat64(), - true); - - theProductKwl.add(orbit_prefix, - "y_vel", - stateVectorList[i]->getChildTextValue("velocity/y").toFloat64(), - true); - - theProductKwl.add(orbit_prefix, - "z_vel", - stateVectorList[i]->getChildTextValue("velocity/z").toFloat64(), - true); - } - } - - void ossimSentinel1ProductDoc::addSRGRCoefficients(const char* prefix, const ossimRefPtr<ossimXmlNode>& coordinateConversionList) - { - if (!coordinateConversionList.get()) - return; - - ossimString count_str; - coordinateConversionList->getAttributeValue(count_str, "count"); - const int count = count_str.toInt(); - if( count < 1) - { - if(traceDebug()) - ossimNotify(ossimNotifyLevel_DEBUG) << "No coordinate conversion info available in metadata!" << std::endl; - return; - } - else - { - //NOT IMPLEMENTED YET - return; - } - - } - - void ossimSentinel1ProductDoc::readCalibrationMetadata() - { - ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") ); - std::vector<ossimFilename> files; - calibrationDir.findAllFilesThatMatch(files, "calibration*"); - std::vector<ossimFilename>::const_iterator it = files.begin(); - - std::stringstream strm; - for (; it != files.end(); ++it) - { - ossimRefPtr<ossimXmlDocument> calibrationDoc = new ossimXmlDocument(); - openMetadataFile(calibrationDoc, (*it) ); - - ossimRefPtr<ossimXmlNode> adsHeader = calibrationDoc->getRoot()->findFirstNode("adsHeader"); - ossimRefPtr<ossimXmlNode> calibrationInformation = calibrationDoc->getRoot()->findFirstNode("calibrationInformation"); - ossimRefPtr<ossimXmlNode> calibrationVectorList = calibrationDoc->getRoot()->findFirstNode("calibrationVectorList"); - - const ossimString calibrationPrefix = "calibration."; - - theProductKwl.add(calibrationPrefix, - "swath", - adsHeader->getChildTextValue("swath"), - true); - - theProductKwl.add(calibrationPrefix, - "polarisation", - adsHeader->getChildTextValue("polarisation"), - true); - - theProductKwl.add(calibrationPrefix, - "startTime", - getModifiedJulianDate(adsHeader->getChildTextValue("startTime")), - true); - - theProductKwl.add(calibrationPrefix, - "stopTime", - getModifiedJulianDate(adsHeader->getChildTextValue("stopTime")), - true); - - theProductKwl.add(calibrationPrefix, - "absoluteCalibrationConstant", - calibrationInformation->getChildTextValue("absoluteCalibrationConstant"), - true); - - theProductKwl.add(calibrationPrefix, - "count", - calibrationVectorList->getAttributeValue("count"), - true); - - const ossimRefPtr<ossimXmlNode> calibrationRoot = calibrationDoc->getRoot(); - std::vector< ossimRefPtr<ossimXmlNode> > calibrationVectors; - calibrationRoot->findChildNodes("calibrationVectorList/calibrationVector", calibrationVectors); - for( unsigned int idx = 0; idx < calibrationVectors.size(); ++idx) - { - - const ossimString calibrationVectorPrefix = calibrationPrefix + "calibrationVector[" + ossimString::toString(idx) + "]."; - - const ossimRefPtr<ossimXmlNode> node = calibrationVectors[idx]->findFirstNode("pixel"); - - theProductKwl.add(calibrationVectorPrefix, - "pixel_count", - node->getAttributeValue("count"), - false); - - theProductKwl.add(calibrationVectorPrefix, - "azimuthTime", - getModifiedJulianDate(calibrationVectors[idx]->getChildTextValue("azimuthTime")), - true); - - theProductKwl.add(calibrationVectorPrefix, - "line", - calibrationVectors[idx]->getChildTextValue("line"), - true); - - theProductKwl.add(calibrationVectorPrefix, - "pixel", - calibrationVectors[idx]->getChildTextValue("pixel"), - true); - - theProductKwl.add(calibrationVectorPrefix, - "sigmaNought", - calibrationVectors[idx]->getChildTextValue("sigmaNought"), - true); - - theProductKwl.add(calibrationVectorPrefix, - "betaNought", - calibrationVectors[idx]->getChildTextValue("betaNought"), - true); - - theProductKwl.add(calibrationVectorPrefix, - "gamma", - calibrationVectors[idx]->getChildTextValue("gamma"), - true); - - theProductKwl.add(calibrationVectorPrefix, - "dn", - calibrationVectors[idx]->getChildTextValue("dn"), - true); - - // calibrationVectors[idx]->toKwl(theProductKwl, "calibrationVectorList_" + ossimString::toString(idx+1) + "."); - } - } - } - - void ossimSentinel1ProductDoc::readNoiseMetadata() - { - ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") ); - std::vector<ossimFilename> files; - calibrationDir.findAllFilesThatMatch(files, "noise*"); - std::vector<ossimFilename>::const_iterator it = files.begin(); - const ossimString noisePrefix = "noise."; - - for (; it != files.end(); ++it) - { - ossimRefPtr<ossimXmlDocument> noiseDoc = new ossimXmlDocument(); - openMetadataFile(noiseDoc, (*it) ); - - const ossimRefPtr<ossimXmlNode> noiseRoot = noiseDoc->getRoot(); - std::vector< ossimRefPtr<ossimXmlNode> > noiseVectors; - noiseRoot->findChildNodes("noiseVectorList/noiseVector", noiseVectors); - for( unsigned int idx = 0; idx < noiseVectors.size(); ++idx) - { - const ossimString noiseVectorPrefix = noisePrefix + "noiseVector[" + ossimString::toString(idx) + "]."; - - const ossimRefPtr<ossimXmlNode> node = noiseVectors[idx]->findFirstNode("pixel"); - - theProductKwl.add(noiseVectorPrefix, - "pixel_count", - node->getAttributeValue("count"), - false); - - theProductKwl.add(noiseVectorPrefix, - "azimuthTime", - getModifiedJulianDate(noiseVectors[idx]->getChildTextValue("azimuthTime")), - true); - - theProductKwl.add(noiseVectorPrefix, - "line", - noiseVectors[idx]->getChildTextValue("line"), - true); - - theProductKwl.add(noiseVectorPrefix, - "pixel", - noiseVectors[idx]->getChildTextValue("pixel"), - true); - - theProductKwl.add(noiseVectorPrefix, - "noiseLut", - noiseVectors[idx]->getChildTextValue("noiseLut"), - true); - - //noiseVectorList[idx]->toKwl(theProductKwl, "noiseVectorList_" + ossimString::toString(idx+1) + "."); - } - } - } - - - void ossimSentinel1ProductDoc::clearFields( ) - { - theProductKwl.clear(); - } - //RK - // bool ossimSentinel1ProductDoc::saveState(ossimKeywordlist& kwl, - // const char* prefix)const - // { - // kwl.addList(theProductKwl); - - // kwl.add(prefix, - // "sample_type", - // theSampleType, - // true); - - // return true; - // } - - // bool ossimSentinel1ProductDoc::loadState(const ossimKeywordlist& kwl, - // const char* prefix) - // { - - // return true; - - // } -} diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h deleted file mode 100644 index 71bf0da69ba50b84a07cffd041af788c69aa5f74..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h +++ /dev/null @@ -1,115 +0,0 @@ -//---------------------------------------------------------------------------- -// -// "Copyright Centre National d'Etudes Spatiales" -// -// License: LGPL-2 -// -// See LICENSE.txt file in the top level directory for more details. -// -//---------------------------------------------------------------------------- -// $Id$ - -#ifndef ossimSentinel1ProductDoc_HEADER -#define ossimSentinel1ProductDoc_HEADER - -#include <ossim/base/ossimConstants.h> -#include <ossim/base/ossimIpt.h> -#include <ossim/base/ossimObject.h> -#include <ossim/base/ossimString.h> -#include <ossim/base/ossimErrorStatusInterface.h> -#include <ossim/base/ossimFilename.h> -#include <ossim/base/ossimDpt.h> -#include <ossim/base/ossimDrect.h> -#include <ossim/base/ossimGpt.h> -#include <ossim/base/ossimXmlDocument.h> -#include <ossim/base/ossimXmlNode.h> -#include <ossim/base/ossimKeywordlist.h> -#include <ossim/base/ossimNotify.h> -#include <ossim/base/ossimNotifyContext.h> -#include <ossim/base/ossimKeywordNames.h> -#include <ossim/base/ossimTrace.h> -#include <ossim/base/ossimCommon.h> -#include "ossimPluginCommon.h" -#include "ossimPluginConstants.h" - -#include <cstdio> -#include <vector> -#include <sstream> -#include <iostream> -#include <iterator> - -namespace ossimplugins -{ - - class OSSIM_PLUGINS_DLL ossimSentinel1ProductDoc : public ossimObject, - public ossimErrorStatusInterface - { - public: - - typedef ossimRefPtr<ossimXmlNode> ossimXmlNodePtr; - typedef ossimRefPtr<ossimXmlDocument> ossimXmlDocumentPtr; - - ossimSentinel1ProductDoc(); - - virtual ~ossimSentinel1ProductDoc(); - - void clearFields(); - - bool openMetadataFile(ossimRefPtr<ossimXmlDocument>& doc, const ossimString file) const; - - bool initImageSize(ossimIpt& imageSize) const; - - bool initGsd( ossimDpt& gsd) const; - - void addSRGRCoefficients(const char* prefix, const ossimRefPtr<ossimXmlNode>& coordinateConversion); - - void addDopplerCentroidCoefficients(const ossimRefPtr<ossimXmlNode>& dcEstimateList); - - void addOrbitStateVectors(const ossimRefPtr<ossimXmlNode>& dcEstimateList); - - void readCalibrationMetadata(); - - void readNoiseMetadata(); - - double getModifiedJulianDate(const ossimString utc_time); - - bool readProductMetadata( ); - - double getBandTerrainHeight( const ossimRefPtr<ossimXmlDocument>& theProductXmlDocument ); - - inline const ossimKeywordlist getProductKwl() const - { - return theProductKwl; - } - - inline void setMetadataDirectory(const ossimFilename d) - { - theManifestDirectory = d; - } - - - inline void setSLC(bool b) - { - theSLC = true; - } - - inline void setTOPSAR(bool b) - { - theTOPSAR = true; - } - - private: - ossimFilename theManifestDirectory; - double theRangeSpacingTotal; - double theAzimuthSpacingTotal; - bool theTOPSAR; - bool theSLC; - ossimFilename theProductXmlFile; - ossimString theSampleType; - ossimKeywordlist theProductKwl; - - }; - -} - -#endif /* #ifndef ossimSentinel1ProductDoc_HEADER */ diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c54d59f2e913f8696262d8baf1f3f46ec8a4e57c --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.cpp @@ -0,0 +1,304 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <ossimSentinel1SarSensorModel.h> +#include <ossim/base/ossimXmlDocument.h> +#include <ossimXmlTools.h> + +namespace {// Anonymous namespace + const ossimString attAzimuthTime = "azimuthTime"; + const ossimString attFirstValidSample = "firstValidSample"; + const ossimString attGr0 = "gr0"; + const ossimString attGrsrCoefficients = "grsrCoefficients"; + const ossimString attHeight = "height"; + const ossimString attLatitude = "latitude"; + const ossimString attLine = "line"; + const ossimString attLongitude = "longitude"; + const ossimString attPixel = "pixel"; + const ossimString attPosition = "position"; + const ossimString attSlantRangeTime = "slantRangeTime"; + const ossimString attSr0 = "sr0"; + const ossimString attSrgrCoefficients = "srgrCoefficients"; + const ossimString attTime = "time"; + const ossimString attVelocity = "velocity"; + const ossimString attX = "x"; + const ossimString attY = "y"; + const ossimString attZ = "z"; +}// Anonymous namespace + +#if defined(USE_BOOST_TIME) + using boost::posix_time::microseconds; + using boost::posix_time::seconds; +#else + using ossimplugins::time::microseconds; + using ossimplugins::time::seconds; +#endif +void ossimplugins::ossimSentinel1SarSensorModel::readCoordinates( + ossimXmlDocument const& xmlDoc, ossimString const& xpath, + ossimString const& rg0_xpath, ossimString const& coeffs_xpath, + std::vector<CoordinateConversionRecordType> & outputRecords) +{ + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + xmlDoc.findNodes(xpath, xnodes); + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode) + { + CoordinateConversionRecordType coordRecord; + + coordRecord.azimuthTime = getTimeFromFirstNode(**itNode, attAzimuthTime); + + coordRecord.rg0 = getDoubleFromFirstNode(**itNode, rg0_xpath);; + + ossimString const& s = getTextFromFirstNode(**itNode, coeffs_xpath); + std::vector<ossimString> ssplit = s.split(" "); + + if (ssplit.empty()) + { + throw std::runtime_error(("The "+rg0_xpath+" record has an empty coef vector").string()); + } + for (std::vector<ossimString>::const_iterator cIt = ssplit.begin(), e = ssplit.end() + ; cIt != e + ; ++cIt + ) + { + coordRecord.coefs.push_back(cIt->toDouble()); + } + assert(!coordRecord.coefs.empty()&&"The rg0 record has empty coefs vector."); + + outputRecords.push_back(coordRecord); + } +} + +namespace ossimplugins +{ +void ossimSentinel1SarSensorModel::readAnnotationFile(const std::string & annotationXml) +{ + ossimRefPtr<ossimXmlDocument> xmlDoc = new ossimXmlDocument(annotationXml); + const ossimXmlNode & xmlRoot = *xmlDoc->getRoot(); + + //Parse specific metadata for Sentinel1 + //TODO add as members to the Sentinel1SarSensorModel + const std::string & product_type = getTextFromFirstNode(xmlRoot, "adsHeader/productType"); + const std::string & mode = getTextFromFirstNode(xmlRoot, "adsHeader/mode"); + const std::string & swath = getTextFromFirstNode(xmlRoot, "adsHeader/swath"); + const std::string & polarisation = getTextFromFirstNode(xmlRoot, "adsHeader/polarisation"); + + theProductType = ProductType(product_type); + + // First, lookup position/velocity records + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + xmlDoc->findNodes("/product/generalAnnotation/orbitList/orbit",xnodes); + + //TODO uncomment and adapt following code from s1_inverse to fill + //SarSensorModel structure + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode) + { + OrbitRecordType orbitRecord; + + // Retrieve acquisition time + orbitRecord.azimuthTime = getTimeFromFirstNode(**itNode, attTime); + + // Retrieve ECEF position + ossimXmlNode const& positionNode = getExpectedFirstNode(**itNode, attPosition); + orbitRecord.position[0] = getDoubleFromFirstNode(positionNode, attX); + orbitRecord.position[1] = getDoubleFromFirstNode(positionNode, attY); + orbitRecord.position[2] = getDoubleFromFirstNode(positionNode, attZ); + + // Retrieve ECEF velocity + ossimXmlNode const& velocityNode = getExpectedFirstNode(**itNode, attVelocity); + orbitRecord.velocity[0] = getDoubleFromFirstNode(velocityNode, attX); + orbitRecord.velocity[1] = getDoubleFromFirstNode(velocityNode, attY); + orbitRecord.velocity[2] = getDoubleFromFirstNode(velocityNode, attZ); + + //Add one orbits record + theOrbitRecords.push_back(orbitRecord); + } + + //Parse the near range time (in seconds) + theNearRangeTime = getDoubleFromFirstNode(xmlRoot, "imageAnnotation/imageInformation/slantRangeTime"); + + //Parse the range sampling rate + theRangeSamplingRate = getDoubleFromFirstNode(xmlRoot, "generalAnnotation/productInformation/rangeSamplingRate"); + + //Parse the range resolution + theRangeResolution = getDoubleFromFirstNode(xmlRoot, "imageAnnotation/imageInformation/rangePixelSpacing"); + + //Parse the radar frequency + theRadarFrequency = getDoubleFromFirstNode(xmlRoot, "generalAnnotation/productInformation/radarFrequency"); + + //Parse azimuth time interval + const double azimuthTimeInterval = getDoubleFromFirstNode(xmlRoot, "imageAnnotation/imageInformation/azimuthTimeInterval"); +#if defined(USE_BOOST_TIME) + theAzimuthTimeInterval = boost::posix_time::precise_duration(azimuthTimeInterval * 1000000.); +#else + theAzimuthTimeInterval = seconds(azimuthTimeInterval); +#endif + ossimNotify(ossimNotifyLevel_DEBUG) << "theAzimuthTimeInterval " << theAzimuthTimeInterval.total_microseconds() << "us\n"; + + + // Now read burst records as well + xnodes.clear(); + xmlDoc->findNodes("/product/swathTiming/burstList/burst",xnodes); + + if(xnodes.empty()) + { + BurstRecordType burstRecord; + + burstRecord.startLine = 0; + burstRecord.azimuthStartTime = getTimeFromFirstNode(xmlRoot,"imageAnnotation/imageInformation/productFirstLineUtcTime"); + + ossimNotify(ossimNotifyLevel_DEBUG)<< burstRecord.azimuthStartTime<<'\n'; + + burstRecord.azimuthStopTime = getTimeFromFirstNode(xmlRoot,"imageAnnotation/imageInformation/productLastLineUtcTime"); + burstRecord.endLine = getTextFromFirstNode(xmlRoot, "imageAnnotation/imageInformation/numberOfLines").toUInt16()-1; + + theBurstRecords.push_back(burstRecord); + } + else + { + const unsigned int linesPerBurst = xmlRoot.findFirstNode("swathTiming/linesPerBurst")->getText().toUInt16(); + unsigned int burstId(0); + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode,++burstId) + { + BurstRecordType burstRecord; + + const ossimSarSensorModel::TimeType azTime = getTimeFromFirstNode(**itNode, attAzimuthTime); + + ossimString const& s = getTextFromFirstNode(**itNode, attFirstValidSample); + + long first_valid(0), last_valid(0); + bool begin_found(false), end_found(false); + + std::vector<ossimString> ssp = s.split(" "); + + for (std::vector<ossimString>::const_iterator sIt = ssp.begin(), e = ssp.end() + ; sIt != e && !end_found + ; ++sIt + ) + { + if(!begin_found) + { + if(*sIt!="-1") + { + begin_found = true; + } + else + { + ++first_valid; + } + ++last_valid; + } + else + { + if(!end_found && *sIt=="-1") + { + end_found = true; + } + else + { + ++last_valid; + } + } + } + + burstRecord.startLine = burstId*linesPerBurst + first_valid; + burstRecord.endLine = burstId*linesPerBurst + last_valid; + + burstRecord.azimuthStartTime = azTime + (first_valid*theAzimuthTimeInterval); + burstRecord.azimuthStopTime = azTime + (last_valid*theAzimuthTimeInterval); + + theBurstRecords.push_back(burstRecord); + } + } + + if(isGRD()) + { + readCoordinates(*xmlDoc, + "/product/coordinateConversion/coordinateConversionList/coordinateConversion", + attSr0, attSrgrCoefficients, + theSlantRangeToGroundRangeRecords); + + readCoordinates(*xmlDoc, + "/product/coordinateConversion/coordinateConversionList/coordinateConversion", + attGr0, attGrsrCoefficients, + theGroundRangeToSlantRangeRecords); + } + + xnodes.clear(); + xmlDoc->findNodes("/product/geolocationGrid/geolocationGridPointList/geolocationGridPoint",xnodes); + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode) + { + GCPRecordType gcpRecord; + + // Retrieve acquisition time + gcpRecord.azimuthTime = getTimeFromFirstNode(**itNode, attAzimuthTime); + + gcpRecord.slantRangeTime = getDoubleFromFirstNode(**itNode, attSlantRangeTime); + + gcpRecord.imPt.x = getDoubleFromFirstNode(**itNode, attPixel); + + // In TOPSAR products, GCPs are weird (they fall in black lines + // between burst. This code allows moving them to a valid area of + // the image. + if(theBurstRecords.size()>2) + { + ossimSarSensorModel::TimeType acqStart; + bool burstFound(false); + unsigned long acqStartLine(0); + + for(std::vector<BurstRecordType>::reverse_iterator bIt = theBurstRecords.rbegin();bIt!=theBurstRecords.rend() && !burstFound;++bIt) + { + if(gcpRecord.azimuthTime >= bIt->azimuthStartTime && gcpRecord.azimuthTime < bIt->azimuthStopTime) + { + burstFound = true; + acqStart = bIt->azimuthStartTime; + acqStartLine = bIt->startLine; + } + } + + if(!burstFound) + { + if(gcpRecord.azimuthTime < theBurstRecords.front().azimuthStartTime) + { + acqStart = theBurstRecords.front().azimuthStartTime; + acqStartLine = theBurstRecords.front().startLine; + } + else if (gcpRecord.azimuthTime >= theBurstRecords.front().azimuthStopTime) + { + acqStart = theBurstRecords.back().azimuthStartTime; + acqStartLine = theBurstRecords.back().startLine; + } + } + const DurationType timeSinceStart = gcpRecord.azimuthTime - acqStart; + + gcpRecord.imPt.y= timeSinceStart/theAzimuthTimeInterval + acqStartLine; + ossimNotify(ossimNotifyLevel_DEBUG) << "timeSinceStart: " << timeSinceStart << " = " << gcpRecord.azimuthTime << " - " << acqStart << " (azTime-acqStart)"<< "\n"; + ossimNotify(ossimNotifyLevel_DEBUG) << "imPt_y: " << gcpRecord.imPt.y << " = " << timeSinceStart.total_microseconds() << "/" << theAzimuthTimeInterval.total_microseconds() << "+" << acqStartLine << "\n"; + } + else + { + gcpRecord.imPt.y = getDoubleFromFirstNode(**itNode, attLine);; + } + ossimGpt geoPoint; + gcpRecord.worldPt.lat = getDoubleFromFirstNode(**itNode, attLatitude); + gcpRecord.worldPt.lon = getDoubleFromFirstNode(**itNode, attLongitude); + gcpRecord.worldPt.hgt = getDoubleFromFirstNode(**itNode, attHeight); + + theGCPRecords.push_back(gcpRecord); + } + + this->optimizeTimeOffsetsFromGcps(); +} + +} // namespace ossimplugins diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.h new file mode 100644 index 0000000000000000000000000000000000000000..642e55b49cea9144ba9c80493ed9152e7d2608a6 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.h @@ -0,0 +1,62 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimSentinel1SarSensorModel_HEADER +#define ossimSentinel1SarSensorModel_HEADER + +#include <boost/config.hpp> +#include "ossimSarSensorModel.h" + +class ossimXmlDocument; +class ossimString; + +namespace ossimplugins +{ + +class OSSIM_PLUGINS_DLL ossimSentinel1SarSensorModel : public ossimSarSensorModel +{ +public: + +#if ! (defined(BOOST_NO_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX1_DEFAULTED_FUNCTIONS)) + /** Constructor */ + ossimSentinel1SarSensorModel()=default; + + /** Copy constructor */ + ossimSentinel1SarSensorModel(ossimSentinel1SarSensorModel const& m)=default; + /** Move constructor */ + ossimSentinel1SarSensorModel(ossimSentinel1SarSensorModel && m)=default; + + /** Destructor */ + virtual ~ossimSentinel1SarSensorModel()=default; +#endif + + void readAnnotationFile(const std::string & annotationXml); + +private: + void readCoordinates( + ossimXmlDocument const& xmlDoc, ossimString const& xpath, + ossimString const& rg0_xpath, ossimString const& coeffs_xpath, + std::vector<CoordinateConversionRecordType> & outputRecords + ); + + +protected: + /* + std::string theProductType; + std::string theMode; + std::string theSwath; + std::string thePolarisation; + */ +}; + +} // end namespace + +#endif diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abd3ce28faf94002a6b06c8d3fea3e46b410d13e --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.cpp @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#include "ossimStringUtilities.h" +#include "ossimplugins-config.h" +#if defined(HAVE_STD_SNPRINTF) +# include <cstdio> +#elif defined(HAVE_MSC_SNPRINTF) +# include <stdio.h> +#else +# error "Don't know how to perform snprintf" +#endif + +int ossimplugins::vs_printf(char * str, std::size_t size, const char * format, std::va_list ap) +{ +#if defined(HAVE_STD_SNPRINTF) + const int res = std::vsnprintf(str, size, format, ap); + return res; +#elif defined(HAVE_MSC_SNPRINTF) + const int res = _vsnprintf(str, size, format, ap); + // force 0x0 on the last possible character at worst + str[size-1] = '\0'; + return res; +#else +# error "Don't know how to perform snprintf" +#endif +} + +int ossimplugins::s_printf(char *str, std::size_t size, const char *format, ...) +{ + std::va_list ap; + va_start(ap, format); + const int res = ossimplugins::vs_printf(str, size, format, ap); + va_end(ap); + return res; +} diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..b1d27c9b9c83177d115f88fd344e12532efc8a57 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.h @@ -0,0 +1,821 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#ifndef ossimStringUtilities_h +#define ossimStringUtilities_h + +#include "ossimPluginConstants.h" + +#include <algorithm> +#include <iterator> +#include <cassert> +#include <cstring> +#include <ostream> +// #include <iostream> +#include <sstream> +#include <typeinfo> +#include <stdexcept> +#include <cctype> +#include <cstdarg> +#include <string> +#include <ossim/base/ossimString.h> + +#ifdef nan +#undef nan +#endif + +#include <ossim/base/ossimCommon.h> // nan + +namespace ossimplugins { + +/**\name String view + functions */ +//@{ +/** String view class. + * Class inspired by C++17 `std::string_view` and `gsl::string_span`. + * + * This idea is to bring efficiency and correctness to C++ functions that take + * strings. A function that receives a `string_view` can receive any kind of + * string flavour and guarantee 0-copy. + * + * The only side effect to be aware of: no terminal-0 is to be expected. i.e. a + * `string_view` data cannot be passed freely to a function with a C API that + * expect a null-terminated string. + * + * @invariant there is no guarantee `data()[size()] == '\0'`. It may happen + * though depending on the constructor used. + */ +struct string_view +{ + typedef char const value_type; + typedef char const& reference; + typedef char const& const_reference; + typedef char const* const_pointer; + typedef char const* pointer; + typedef std::size_t size_type; + +private: + /** Strict view iterator.*/ + struct char_iterator + { + typedef char const value_type; + typedef char const& reference; + typedef char const* pointer; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef std::random_access_iterator_tag iterator_category; + + explicit char_iterator(const_pointer p) : m_ptr(p) {} + char_iterator & operator++() { ++m_ptr; return *this; } + char_iterator operator++(int) { char_iterator tmp(*this); ++m_ptr; return tmp; } + char_iterator & operator--() { --m_ptr; return *this; } + char_iterator operator--(int) { char_iterator tmp(*this); --m_ptr; return tmp; } + const_reference operator*() const { return *m_ptr; } + + char_iterator & operator+=(difference_type off) { m_ptr += off; return *this; } + char_iterator & operator-=(difference_type off) { m_ptr -= off; return *this; } + + friend char_iterator operator+(char_iterator lhs, difference_type off) { return lhs += off; } + friend char_iterator operator+(difference_type off, char_iterator rhs) { return rhs += off; } + friend char_iterator operator-(char_iterator lhs, difference_type off) { return lhs -= off; } + friend char_iterator operator-(difference_type off, char_iterator rhs) { return rhs -= off; } + + friend difference_type operator-(char_iterator lhs, char_iterator rhs) { return lhs.m_ptr - rhs.m_ptr; } + + friend bool operator==(char_iterator lhs, char_iterator rhs) { + return lhs.m_ptr == rhs.m_ptr; + } + friend bool operator!=(char_iterator lhs, char_iterator rhs) { + return lhs.m_ptr != rhs.m_ptr; + } + friend bool operator<(char_iterator lhs, char_iterator rhs) { + return lhs.m_ptr < rhs.m_ptr; + } + private: + friend bool operator<=(char_iterator lhs, char_iterator rhs) { + return lhs.m_ptr <= rhs.m_ptr; + } + private: + const_pointer m_ptr; + }; + +public: + // typedef char_iterator iterator; + typedef char_iterator const_iterator; + // typedef std::reverse_iterator<char_iterator> reverse_iterator; + typedef std::reverse_iterator<char_iterator> const_reverse_iterator; + + /** Construtor from a standard string. + *@post `data()[size()] == '\0'` + */ + string_view(std::string const& s) + : m_size(s.size()), m_first(s.c_str()) + {} + /** Construtor from an ossim string. + *@post `data()[size()] == '\0'` + */ + string_view(ossimString const& s) + : m_size(s.size()), m_first(s.c_str()) + {} + /** Construtor from an array of characters. + * @post `data()[size()] == '\0'` <= the array is built with this kind of + * syntax: `char const a[]="foobar";` + */ + template <std::size_t N> + string_view(char const (&array)[N]) + : m_size(N), m_first(&array[0]) + {} + /** Construtor from a pointer to a 0-terminated raw string. + * @post `data()[size()] == '\0'` + */ + string_view(char const* ptr) + : m_size(std::strlen(ptr)), m_first(ptr) + {} +#if 0 + string_view(char const* first, char const* last) + : m_size(last-first), m_first(first) + { + assert(first <= last); + } +#endif + /** Construtor from an input iterator and a size. + * @post there is no guarantee `data()[size()] == '\0'`. + */ + template <typename II> + string_view(II first, size_type size_) + : m_size(size_), m_first(first) + {} + + /** Construtor from a pair of input interators. + * @post there is no guarantee `data()[size()] == '\0'`. + */ + template <typename II> + string_view(II first, II last) + : m_size(last-first), m_first(first) + { + assert(first <= last); + } + + /** Builds a peculiar empty view to points to nullptr. */ + static string_view null() { return string_view(build_empty());} + + /** Tells whether a view is within another view. + * This functions doesn't test whether the characters from a view are found + * in the same relative positions in another view. + */ + bool belongs_to(char const* first, char const* last) const { + return first <= &*begin() && &*end() <= last; + } + template <std::size_t N> + bool belongs_to(char const (&array)[N]) const { + // N-1 because of terminal 0 + return belongs_to(&array[0], &array[N-1]); + } + bool belongs_to(char const* ptr) const { + return belongs_to(&ptr[0], &ptr[std::strlen(ptr)]); + } + template <typename String> + bool belongs_to(String const& s) const{ + return belongs_to(s.data(), s.data() + s.size()); + } + + size_type size () const { return m_size; } + bool empty () const { return m_size == 0; } + + // iterator begin () { return iterator(m_first); } + // iterator end () { return iterator(m_first+m_size); } + const_iterator begin () const { return m_first; } + const_iterator end () const { return m_first+m_size; } + const_iterator cbegin () const { return m_first; } + const_iterator cend () const { return m_first+m_size; } + + // reverse_iterator rbegin () { return reverse_iterator(m_first+m_size); } + // reverse_iterator rend () { return reverse_iterator(m_first); } + const_reverse_iterator rbegin () const { return const_reverse_iterator(m_first+m_size); } + const_reverse_iterator rend () const { return const_reverse_iterator(m_first); } + const_reverse_iterator crbegin() const { return const_reverse_iterator(m_first+m_size); } + const_reverse_iterator crend () const { return const_reverse_iterator(m_first); } + + /** Indexed access. + * @pre `p < size(),` checked with an assertion. + */ + const_reference operator[](size_type p) { + assert(p < size()); + return *(m_first+p); + } + + /** Returns first character of the view. + * @pre `!empty()`, checked with an assertion. + */ + const_reference front() const { assert(!empty()); return *begin(); } + /** Returns last character of the view. + * @pre `!empty()`, checked with an assertion. + */ + const_reference back () const { assert(!empty()); return *(end()-1); } + + /** Returns a pointer to the first character of the view. + * @warning there is no guarantee `data()[size()] == '\0'` + */ + const_pointer data () const { return &*m_first; } + + /** Removes the n first characters. + * @pre `n <= size()`, checked with an assertion + * @post size is n characters more little + * @post `begin()` iterator is n characters right. + */ + void remove_prefix(std::size_t n) { assert(n <= m_size); m_first += n; m_size -= n; } + /** Removes the n last characters. + * @pre `n <= size()`, checked with an assertion + * @post size is n characters more little + * @post `end()` iterator is n characters left. + */ + void remove_suffix(std::size_t n) { assert(n <= m_size); m_size -= n; } +private: + struct build_empty{}; + string_view(build_empty) : m_size(0), m_first(NULL) {} + + std::size_t m_size; + const_iterator m_first; +}; + +inline +bool operator==(string_view const& lhs, string_view const& rhs) +{ + return lhs.size() == rhs.size() + && std::equal(lhs.begin(), lhs.end(), rhs.begin()); +} +inline +bool operator!=(string_view const& lhs, string_view const& rhs) +{ + return ! (lhs == rhs); +} + +inline +std::ostream & operator<<(std::ostream & os, const string_view & v) +{ + std::copy(v.begin(), v.end(), std::ostream_iterator<char>(os)); + return os ; +} + +inline +std::string operator+(string_view const& lhs, string_view const& rhs) +{ + std::string res(lhs.begin(), lhs.end()); + res.append(rhs.begin(), rhs.end()); + return res; +} + +/** Tells whether two views are exactly identical. */ +inline +bool is_same_view(string_view const& lhs, string_view const& rhs) +{ + return lhs.begin() == rhs.begin() && lhs.size() == rhs.size(); +} + +/** Tells whether the haystack string starts with the needle string. */ +inline +bool starts_with(string_view const& haystack, string_view const& needle) +{ + return needle.size() <= haystack.size() + && std::equal(needle.begin(), needle.end(), haystack.begin()); +} + +/** Tells whether the haystack string starts with the needle string. */ +inline +bool ends_with(string_view const& haystack, string_view const& needle) +{ + return needle.size() <= haystack.size() + && std::equal(needle.rbegin(), needle.rend(), haystack.rbegin()); +} + +/** Searches needle string within the haystack string. */ +inline +string_view find(string_view const& haystack, string_view const& needle) +{ + assert(!haystack.empty()); + assert(!needle.empty()); + const string_view::size_type size = needle.size(); + if (haystack.size() < size) { + // std::cout << "haystack size < needle size!!!"; + return string_view::null(); + } + string_view::const_iterator const end = haystack.end() - size +1; + // std::cout << "comp up to:" + // << static_cast<void const*>(&*end) << "(" << (*end) << ")" + // ; + string_view::const_iterator it = haystack.begin(); + for ( ; it != end ; ++it) { + string_view v(it, size); + assert(v.size() == size); + assert(v.belongs_to(haystack)); + // std::cout << " check " + // << static_cast<void const*>(v.data())<<"["<<v.size()<<"] VS " + // << static_cast<void const*>(needle.data())<<"["<<needle.size()<<"]" + // ; + if (v == needle) { + return v; + } + } + assert(it+size-1 == haystack.end()); + return string_view::null(); +} + +/** Tells whether the haystack string contains the needle string. */ +inline +bool contains(string_view const& haystack, string_view const& needle) +{ + return ! is_same_view(find(haystack, needle), string_view::null()); +} +//@} + +/**\name Splitting functions */ +//@{ + +/** Split parts iterator. + * Not meant to be used directly. + * @tparam Splitter split algorithm used. + * @see `part_range` + * @see `split_on()` + */ +template <typename Splitter> +struct part_iterator +{ + typedef string_view & reference; + typedef string_view const& const_reference; + typedef string_view const* const_pointer; + typedef std::forward_iterator_tag iterator_category; + + // build last + part_iterator(string_view const& global_string, Splitter s) + : m_global(global_string) + , m_splitter(s) + , m_crt(m_splitter(global_string)) + {} + struct theend {}; + part_iterator(string_view const& global_string, Splitter s, theend) + : m_global(global_string) + , m_splitter(s) + , m_crt(string_view::null()) + {} + + part_iterator & operator++() { + assert(m_crt.belongs_to(m_global) && "Invariant check failure"); + assert(! is_same_view(m_crt, string_view::null()) && "Don't iterate past end"); + if (m_crt.end() == m_global.end()) { + m_crt = string_view::null(); + } else { + string_view within(m_crt.end()+m_splitter.next_start(), m_global.end()); + m_crt = m_splitter(within); + } + return *this; + } + part_iterator operator++(int) { + part_iterator tmp(*this); + ++(*this); + return *this; + } + const_reference operator*() const { + return m_crt; + } + const_pointer operator->() const { + return &m_crt; + } + + friend bool operator==(part_iterator const& lhs, part_iterator const& rhs) { + // std::cout << "<<"<<lhs<<">> ==?== <<"<<rhs<<">>" << std::endl; + assert(is_same_view(lhs.m_global, rhs.m_global)); + return is_same_view(lhs.m_crt, rhs.m_crt); // TODO: too many tests + } + friend bool operator!=(part_iterator const& lhs, part_iterator const& rhs) { + return ! (lhs == rhs); + } +#if defined(BOOST_TEST_MODULE) + friend std::ostream & operator<<(std::ostream & os, const part_iterator & v) + { + return os << "split iterator on `" << v.m_crt + << "'("<<static_cast<void const*>(&*v.m_crt.begin()) <<"-"<<v.m_crt.size()<<")"<<", within `" + << v.m_global << "'"; + } +#endif +private: + string_view m_global; + Splitter m_splitter; + string_view m_crt; +}; + +namespace details { + inline std::size_t len(char) { return 1; } + template <std::size_t N> inline std::size_t len(char const (&)[N]) + { assert(N>0); return N-1; } + inline std::size_t len(char const* ptr) { return std::strlen(ptr); } + template <typename String> inline std::size_t len(String const& s) { return s.length(); } +} // details namespace + +/** Split parts range. + * Not meant to be used directly. + * @tparam Splitter split algorithm used. + * @see `part_iterator` + * @see `split_on()` + */ +template <typename Splitter> +struct part_range +{ + part_range(string_view const& global_string, Splitter s) + : m_first(global_string, s) + , m_last(global_string, s, typename const_iterator::theend()) + {} + typedef part_iterator<Splitter> const_iterator; + const_iterator const& begin() const { return m_first; } + const_iterator const& end () const { return m_last; } +private: + const_iterator const m_first; + const_iterator const m_last; +}; + +/** Split algorithm that splits on single characters. + * Not meant to be used directly + * @see `split_on()` + */ +struct splitter_on_delim +{ + splitter_on_delim(char delim) : m_delimiter(delim) {} + string_view operator()(string_view const& within) const { + string_view res(within.begin(), + std::find(within.begin(), within.end(), m_delimiter) + ); + return res ; + } + std::size_t next_start() const { return details::len(m_delimiter); } +private: + char m_delimiter; +}; + +/** Split entry point. + * @tparam String Type of the string split (`ossimString`, `std::string`, + * `string_view`, ...) + * @param[in] str string to be split + * @param[in] delim character delimiter used to split. + * @return a range of the parts found in `str`. + * + * Example of use: + * \code + typedef part_range<splitter_on_delim> range_type; + typedef typename range_type::const_iterator const_iterator; + const range_type parts = split_on(",abc,z,,,def,xy,,", ',') + const_iterator it = parts.begin(); + const_iterator end = parts.end(); + for ( ; it != end ; ++it) { + doStuff(*it); + } + * \endcode + */ +template <typename String> +part_range<splitter_on_delim> split_on(String const& str, char delim) { + return part_range<splitter_on_delim>(str, splitter_on_delim(delim)); +} +//@} + +/**\name string to number conversion */ +//@{ +/** + * \brief Generic string to whatever conversion -- failure means exception. + * Tries to decode a value from a string. + * \tparam T Type of the value decoded from the input string + * \param[in] v input string to convert + * \param[in] context context message for the exception thrown + * + * \return The value decoded + * \throw std::runtime_error if a value of type `T` cannot be decoded from the + * string. + * \note For efficiency reasons, the function has been specialized for integral + * floating point, and string types. + * \note That alternative to `ossimString::toXxxx()` function has been defined + * to support generic programing in `get()` and `add()` helper functions for + * keyword list. + * \see `to_with_default()` for the version that never fails, but returns a + * default value otherwise (being `T()` by default). + * + */ +template <typename T> +inline +T to(string_view const& v, string_view const& context) +{ + T res ; + std::stringstream ss; + if (ss << v && (ss >> res >> std::ws).eof()) { + return res; + } + throw std::runtime_error("Cannot decode "+v+" as "+ + typeid(T).name() + " while " + context); +} + +/** + * \brief Generic string to whatever conversion -- failure is hidden. + * Tries to decode a value from a string. + * \tparam T Type of the value decoded from the input string + * \param[in] v input string to convert + * \param[in] def default value returned in the conversion isn't possible + * + * \return The value decoded + * \return `def` if no value of type `T` can be decoded from `v`. + * \throw None + * \note For efficiency reasons, the function has been specialized for integral + * floating point, and string types. + * \note That alternative to `ossimString::toXxxx()` function has been defined + * to support generic programing in `get()` and `add()` helper functions for + * keyword list. + * \see `to()` for the version that fails by throwing exceptions. + */ +template <typename T> +inline +T to_with_default(string_view const& v, T const& def = T()) +{ + T res = def; + std::stringstream ss; + if (ss << v && (ss >> res >> std::ws).eof()) { + return res; + } + return def; +} + +namespace details { + /** + * \brief Internal generic string to integer conversion (w/ exception). + * Tries to convert the input string into a integer type. If the + * string doesn't represent an integer value, an exception is thrown. + * \tparam Int Integral type (In a perfect world, we'd used `enable_if` & + * co to restrict the code to integral types) + * \param[in] v input string + * \param[in] context context message for the exception thrown + * + * \return The string as an integer. + * \throw std::runtime_error is the number cannot be converted. + * \todo Use a failure_policy in order to factorize code flavour (returns + * default value or throw an exception) + */ + template <typename Int> inline Int to_integer(string_view const& v, string_view const& context) + { + // string_view::data() isn't compatible with strtol => we emulate it + + // TODO: handle HEX, OCT, BIN, locales? + string_view::const_iterator it = v.begin(); + string_view::const_iterator end = v.end(); + + bool is_negative = false; + Int res = 0; + if (it != end) { + switch (*it) { + case '-': is_negative = true; /*[[fallthrough]]*/ + case '+': ++it; + } + for ( ; it != end ; ++it) { + // only support arabic digits + if (!std::isdigit(*it)) { + throw std::runtime_error("Cannot decode "+v+" as integer while " + context); + } + res = 10 * res + *it - '0'; + } + } + return is_negative ? -res : res; + } + + /** + * \brief Internal generic string to integer conversion (w/o exception). + * Tries to convert the input string into a integer type. If the + * string doesn't represent an integer value, the default value will be + * returned. + * \tparam Int Integral type (In a perfect world, we'd used `enable_if` & + * co to restrict the code to integral types) + * \param[in] v input string + * \param[in] def default value returned in the conversion isn't possible + * + * \return The string as an integer. + * \return `def` if the string cannot be converted to an integer value. + * \throw None + */ + template <typename Int> inline Int to_integer(string_view const& v, Int const def) + { + // string_view::data() isn't compatible with strtol => we emulate it + + // TODO: handle HEX, OCT, BIN, locales? + string_view::const_iterator it = v.begin(); + string_view::const_iterator end = v.end(); + + bool is_negative = false; + Int res = 0; + if (it != end) { + switch (*it) { + case '-': is_negative = true; /*[[fallthrough]]*/ + case '+': ++it; + } + for ( ; it != end ; ++it) { + // only support arabic digits + if (!std::isdigit(*it)) { + return def; + } + res = 10 * res + *it - '0'; + } + } + return is_negative ? -res : res; + } + + /** + * \brief Internal generic string to unsigned integer conversion (w/ exception). + * Tries to convert the input string into a integer type. If the + * string doesn't represent an integer value, an exception is thrown. + * \tparam Int Integral type (In a perfect world, we'd used `enable_if` & + * co to restrict the code to integral types) + * \param[in] v input string + * \param[in] context context message for the exception thrown + * + * \return The string as an integer. + * \throw std::runtime_error is the number cannot be converted. + */ + template <typename Int> inline Int to_uinteger(string_view const& v, string_view const& context) + { + // string_view::data() isn't compatible with strtol => we emulate it + + // TODO: handle HEX, OCT, BIN, locales? + string_view::const_iterator it = v.begin(); + string_view::const_iterator end = v.end(); + + Int res = 0; + if (it != end) { + for ( ; it != end ; ++it) { + // only support arabic digits + if (!std::isdigit(*it)) { + throw std::runtime_error("Cannot decode "+v+" as integer while " + context); + } + res = 10 * res + *it - '0'; + } + } + return res; + } + + /** + * \brief Internal generic string to unsigned integer conversion (w/o exception). + * Tries to convert the input string into a integer type. If the + * string doesn't represent an integer value, the default value will be + * returned. + * \tparam Int Integral type (In a perfect world, we'd used `enable_if` & + * co to restrict the code to integral types) + * \param[in] v input string + * \param[in] def default value returned in the conversion isn't possible + * + * \return The string as an integer. + * \return `def` if the string cannot be converted to an integer value. + * \throw None + */ + template <typename Int> inline Int to_uinteger(string_view const& v, Int const def) + { + // string_view::data() isn't compatible with strtol => we emulate it + + // TODO: handle HEX, OCT, BIN, locales? + string_view::const_iterator it = v.begin(); + string_view::const_iterator end = v.end(); + + Int res = 0; + if (it != end) { + for ( ; it != end ; ++it) { + // only support arabic digits + if (!std::isdigit(*it)) { + return def; + } + res = 10 * res + *it - '0'; + } + } + return res; + } + + /** + * \brief Internal generic string to float conversion (w/ exception). + * Tries to convert the input string into a floating point type. If the + * string doesn't represent a floating point value, an exception is thrown. + * \tparam FloatType floating point type (`float`, `double`, `long double`) + * \param[in] v input string + * \param[in] context context message for the exception thrown + * + * \return The string as a float. The special `"nan"` string is converted to + * `ossim::nan()`. + * \throw std::runtime_error is the number cannot be converted. + */ + template <typename FloatType> inline FloatType to_float(string_view const& v, string_view const& context) + { + if (contains(v, "nan")) { + return ::ossim::nan(); + } + FloatType res = FloatType(); // 0-construction + if (!v.empty()) { + std::stringstream ss; + if (! (ss << v && (ss >> res >> std::ws).eof())) { + throw std::runtime_error("Cannot decode "+v+" as float value while " + context); + } + } + return res; + } + + /** + * \brief Internal generic string to float conversion (w/o exception). + * Tries to convert the input string into a floating point type. If the + * string doesn't represent a floating point value, the default value will + * be returned. + * \tparam FloatType floating point type (`float`, `double`, `long double`) + * \param[in] v input string + * \param[in] def default value returned in the conversion isn't possible + * + * \return The string as a float. The special `"nan"` string is converted + * to `ossim::nan()`. + * \return `def` if the string cannot be converted to a floating point + * value. + * \throw None + */ + template <typename FloatType> inline FloatType to_float(string_view const& v, FloatType const def) + { + if (contains(v, "nan")) { + return ::ossim::nan(); + } + FloatType res = FloatType(); // 0-construction + if (!v.empty()) { + std::stringstream ss; + if (! (ss << v && (ss >> res >> std::ws).eof())) { + return def; + } + } + return res; + } + + inline unsigned int decode_uint(string_view & v) + { + unsigned int res = 0; + for ( ; !v.empty() ; v.remove_prefix(1)) + { + // only support arabic digits + if (!std::isdigit(v.front())) + break; + res = 10 * res + v.front() - '0'; + } + return res; + } +} // ossimplugins::details namespace + +#define OSSIM_GENERATE_CONV(internal_to, type) \ + template <> inline type to<type>(string_view const& v, string_view const& context) \ + { return details::internal_to<type>(v, context); } \ + template <> inline type to_with_default<type>(string_view const& v, type const& def) \ + { return details::internal_to<type>(v, def); } +// Note: specialization doesn't support default arguments, but default argument +// T() will still work. + +OSSIM_GENERATE_CONV(to_integer, char); +OSSIM_GENERATE_CONV(to_uinteger, unsigned char); +OSSIM_GENERATE_CONV(to_integer, signed char); +OSSIM_GENERATE_CONV(to_uinteger, unsigned short); +OSSIM_GENERATE_CONV(to_integer, short); +OSSIM_GENERATE_CONV(to_integer, int); +OSSIM_GENERATE_CONV(to_uinteger, unsigned int); +OSSIM_GENERATE_CONV(to_integer, long); +OSSIM_GENERATE_CONV(to_uinteger, unsigned long); +#if defined(HAS_LONG_LONG) // TODO: add this configure option +OSSIM_GENERATE_CONV(to_integer, long long); +OSSIM_GENERATE_CONV(to_uinteger, unsigned long long); +#endif +OSSIM_GENERATE_CONV(to_float, float); +OSSIM_GENERATE_CONV(to_float, double); +OSSIM_GENERATE_CONV(to_float, long double); +#undef OSSIM_GENERATE_CONV + +template <> inline std::string to<std::string>(string_view const& v, string_view const& /*context*/) +{ return std::string(v.begin(), v.end()); } + +template <typename T> inline T const& to(T const& v, string_view const& /*context*/) { return v; } + +template <typename T> inline T const& to_with_default(T const& v, T const& /* default*/) { return v; } + +// template <> inline double to<double>(ossimplugins::string_view const& v) +// { return details::to_float<double>(v); } +//@} + +OSSIM_PLUGINS_DLL int s_printf(char *str, std::size_t size, const char *format, ...); +OSSIM_PLUGINS_DLL int vs_printf(char *str, std::size_t size, const char *format, std::va_list ap); + +template <std::size_t size> +inline +int s_printf(char (&str)[size], const char *format, ...) { + std::va_list ap; + va_start(ap, format); + const int res = vs_printf(str, size, format, ap); + va_end(ap); + return res; +} + + +} // ossimplugins namespace + + +#endif // ossimStringUtilities_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6bc5d8259d656cbf678eb862ac00e7f624e724f --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.cpp @@ -0,0 +1,208 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <ossimTerraSarXSarSensorModel.h> +#include <ossim/base/ossimXmlDocument.h> +#include <ossimXmlTools.h> + + +namespace {// Anonymous namespace + const ossimString attTimeUTC = "timeUTC"; + const ossimString attPosX = "posX"; + const ossimString attPosY = "posY"; + const ossimString attPosZ = "posZ"; + const ossimString attVelX = "velX"; + const ossimString attVelY = "velY"; + const ossimString attVelZ = "velZ"; + const ossimString attT = "t"; + const ossimString attTau = "tau"; + const ossimString attCol = "col"; + const ossimString attRow = "row"; + const ossimString attLat = "lat"; + const ossimString attLon = "lon"; + const ossimString attHeight = "height"; +}// Anonymous namespace + +void ossimplugins::ossimTerraSarXSarSensorModel::readAnnotationFile(const std::string & annotationXml, const std::string & geoXml) +{ + ossimRefPtr<ossimXmlDocument> xmlDoc = new ossimXmlDocument(annotationXml); + const ossimXmlNode & xmlRoot = *xmlDoc->getRoot(); + + //isGRD parse variant? + std::string const& product_type = getTextFromFirstNode(xmlRoot, "productInfo/productVariantInfo/productVariant"); + + std::cout << "type " << product_type << '\n'; + + theProductType = ProductType(product_type); + + // First, lookup position/velocity records + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + xmlDoc->findNodes("/level1Product/platform/orbit/stateVec",xnodes); + + std::cout << "Number of states " << xnodes.size() << '\n'; + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode) + { + OrbitRecordType orbitRecord; + + // Retrieve acquisition time + orbitRecord.azimuthTime = getTimeFromFirstNode(**itNode, attTimeUTC); + + // Retrieve ECEF position + orbitRecord.position[0] = getDoubleFromFirstNode(**itNode, attPosX); + orbitRecord.position[1] = getDoubleFromFirstNode(**itNode, attPosY); + orbitRecord.position[2] = getDoubleFromFirstNode(**itNode, attPosZ); + + // Retrieve ECEF velocity + orbitRecord.velocity[0] = getDoubleFromFirstNode(**itNode, attVelX); + orbitRecord.velocity[1] = getDoubleFromFirstNode(**itNode, attVelY); + orbitRecord.velocity[2] = getDoubleFromFirstNode(**itNode, attVelZ); + + //Add one orbits record + std::cout << "Add theOrbitRecords\n"; + theOrbitRecords.push_back(orbitRecord); + } + + //Parse the near range time (in seconds) + theNearRangeTime = getDoubleFromFirstNode(xmlRoot, "productInfo/sceneInfo/rangeTime/firstPixel"); + + std::cout << "theNearRangeTime " << theNearRangeTime << '\n'; + + //Parse the range sampling rate + theRangeSamplingRate = getDoubleFromFirstNode(xmlRoot, "instrument/settings/RSF"); + + std::cout << "theRangeSamplingRate " << theRangeSamplingRate << '\n'; + + //Parse the range resolution + theRangeResolution = getDoubleFromFirstNode(xmlRoot, "productSpecific/complexImageInfo/slantRangeResolution"); + + std::cout << "theRangeResolution " << theRangeResolution << '\n'; + + //Parse the radar frequency + theRadarFrequency = getDoubleFromFirstNode(xmlRoot, "instrument/settings/settingRecord/PRF"); + + std::cout << "theRadarFrequency " << theRadarFrequency << '\n'; + + //Manage only strip map product for now (one burst) + + //Parse azimuth time start/stop + const TimeType azimuthTimeStart = getTimeFromFirstNode(xmlRoot, "productInfo/sceneInfo/start/timeUTC"); + + std::cout << "azimuthTimeStart " << azimuthTimeStart << '\n'; + + const TimeType azimuthTimeStop = getTimeFromFirstNode(xmlRoot, "productInfo/sceneInfo/stop/timeUTC"); + + std::cout << "azimuthTimeStop " << azimuthTimeStop << '\n'; + + const DurationType td = azimuthTimeStop - azimuthTimeStart; + + // numberOfRows + unsigned int numberOfRows = xmlRoot.findFirstNode("productInfo/imageDataInfo/imageRaster/numberOfRows")->getText().toUInt16(); + + std::cout << "numberOfRows " << numberOfRows << '\n'; + + //Compute azimuth time interval + theAzimuthTimeInterval = td / static_cast<double> (numberOfRows); + + std::cout << "theAzimuthTimeInterval " << theAzimuthTimeInterval.total_microseconds() << " and 1/prf: " << (1 / theRadarFrequency) * 1000000 << '\n'; + + //For Terrasar-X only 1 burst is supported for now + BurstRecordType burstRecord; + + burstRecord.startLine = 0; + burstRecord.azimuthStartTime = azimuthTimeStart; + burstRecord.azimuthStopTime = azimuthTimeStop; + + burstRecord.endLine = numberOfRows - 1; + + theBurstRecords.push_back(burstRecord); + + //GRD (detected product) + if(isGRD()) + { + //Retrieve Slant Range to Ground range coeddifcients + CoordinateConversionRecordType coordRecord; + + //Get azimuth time start (again) + coordRecord.azimuthTime = azimuthTimeStart; + + //Set ground range origin to 0 (FIXME?) + coordRecord.rg0 = 0.; + + //Read coefficients + xnodes.clear(); + + const unsigned int polynomialDegree = xmlRoot.findFirstNode("productSpecific/projectedImageInfo/slantToGroundRangeProjection/polynomialDegree")->getText().toUInt16(); + + std::cout << "Number of coefficients " << polynomialDegree << '\n'; + + ossimString path = "/level1Product/productSpecific/projectedImageInfo/slantToGroundRangeProjection/coefficient"; + const ossimString EXP = "exponent"; + ossimString s; + + xmlDoc->findNodes(path, xnodes); + + if ( xnodes.size() ) + { + for (unsigned int i = 0; i < xnodes.size(); ++i) + { + if (xnodes[i].valid()) + { + xnodes[i]->getAttributeValue(s, EXP); + const double coeff = xnodes[i]->getText().toDouble(); + coordRecord.coefs.push_back(coeff); + std::cout << "Coef number " << i << " value: " << coeff << '\n'; + } + } + } + assert(!coordRecord.coefs.empty()&&"The srgr record has empty coefs vector."); + + theSlantRangeToGroundRangeRecords.push_back(coordRecord); + } + + //Parse GCPs + ossimRefPtr<ossimXmlDocument> xmlGeo = new ossimXmlDocument(geoXml); + + xnodes.clear(); + xmlGeo->findNodes("/geoReference/geolocationGrid/gridPoint",xnodes); + + std::cout<<"Found "<<xnodes.size()<<" GCPs\n"; + + for(std::vector<ossimRefPtr<ossimXmlNode> >::iterator itNode = xnodes.begin(); itNode!=xnodes.end();++itNode) + { + GCPRecordType gcpRecord; + + // Get delta acquisition time + const double deltaAzimuth = getDoubleFromFirstNode(**itNode, attT); +#if defined(USE_BOOST_TIME) + using boost::posix_time::microseconds; +#else + using ossimplugins::time::microseconds; +#endif + gcpRecord.azimuthTime = azimuthTimeStart + microseconds(deltaAzimuth * 1000000); + + //Get delta range time + gcpRecord.slantRangeTime = theNearRangeTime + getDoubleFromFirstNode(**itNode, attTau); + + gcpRecord.imPt.x = getDoubleFromFirstNode(**itNode, attCol) - 1.; + + gcpRecord.imPt.y = getDoubleFromFirstNode(**itNode, attRow) - 1.; + + ossimGpt geoPoint; + gcpRecord.worldPt.lat = getDoubleFromFirstNode(**itNode, attLat); + gcpRecord.worldPt.lon = getDoubleFromFirstNode(**itNode, attLon); + gcpRecord.worldPt.hgt = getDoubleFromFirstNode(**itNode, attHeight); + + theGCPRecords.push_back(gcpRecord); + } + + this->optimizeTimeOffsetsFromGcps(); +} diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.h new file mode 100644 index 0000000000000000000000000000000000000000..73b71ab3015716b2d29a6899704ef486ce8e3cbf --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.h @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimTerraSarXSarSensorModel_HEADER +#define ossimTerraSarXSarSensorModel_HEADER + +#include "ossimSarSensorModel.h" + +namespace ossimplugins +{ + +class OSSIM_PLUGINS_DLL ossimTerraSarXSarSensorModel : public ossimSarSensorModel +{ +public: + +#if ! (defined(BOOST_NO_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX1_DEFAULTED_FUNCTIONS)) + /** Constructor */ + ossimTerraSarXSarSensorModel() = default; + + /** Copy constructor */ + ossimTerraSarXSarSensorModel(ossimTerraSarXSarSensorModel const& m) = default; + /** Move constructor */ + ossimTerraSarXSarSensorModel(ossimTerraSarXSarSensorModel && m) = default; + + /** Destructor */ + virtual ~ossimTerraSarXSarSensorModel() = default; +#endif + + //Not implemented yet + /** References + * TerraSAR-X Image Product Guide + * SNAP source code (s1tbx-io/src/main/java/org/esa/s1tbx/io/terrasarx/TerraSarXProductDirectory.java) + */ + void readAnnotationFile(const std::string & annotationXml, const std::string & geoXml); + +protected: + /* + std::string theProductType; + std::string theMode; + std::string theSwath; + std::string thePolarisation; + */ +}; + +} // end namespace + +#endif diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3d28ae5cd4cb4110711f09f2e0c735fb078813b1 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.cpp @@ -0,0 +1,140 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#include "ossimTimeUtilities.h" +#include <stdexcept> +// #include <sstream> +#include <typeinfo> +#include <cmath> +#include <cstdio> +#include <stdexcept> +#include "ossimStringUtilities.h" +#include <ossim/base/ossimDate.h> +// #include <iostream> + +ossimDate ossimplugins::time::details::strptime(string_view const& format, string_view const& date) +{ + using namespace ossimplugins::details; + + //[[pre: format doesn't end with a odd number of '%']] + string_view fmt = format; + string_view d = date; + unsigned int year = 0; + unsigned int month = 0; + unsigned int day = 0; + unsigned int hours = 0; + unsigned int minutes = 0; + unsigned int seconds = 0; + double ssecs = 0.0; + + for ( ; !fmt.empty() ; fmt.remove_prefix(1)) + { + switch (fmt.front()) + { + case '%': + // std::cout << "found ("<<fmt.size()<<")%: " << fmt.front(); + assert(!fmt.empty()); // invalid format => error + fmt.remove_prefix(1); + switch (fmt.front()) { + case '%': + // std::cout << "% -> just a %" << std::endl; + assert(!d.empty()); // invalid format => error + if (fmt.front() != d.front()) { + throw std::runtime_error("Date "+date+" doesn't match format (" + format + ")"); + } + d.remove_prefix(1); + break; + case 'Y': year = decode_uint(d); break; + case 'm': month = decode_uint(d); break; + case 'd': day = decode_uint(d); break; + case 'H': hours = decode_uint(d); break; + case 'M': minutes = decode_uint(d); break; + case 'S': seconds = decode_uint(d); break; + case '.': // subseconds + if (!d.empty() && d.front() == '.') { + d.remove_prefix(1); + std::size_t nsecs_nb_digits = d.size(); + ssecs = decode_uint(d); + nsecs_nb_digits -= d.size(); + ssecs /= std::pow((double)10.0, (int)nsecs_nb_digits); + } else { + // std::cout << "No subfraction in source date" << std::endl; + } + break; + default: + throw std::logic_error("Unsupported date format speficier (in "+format+": "+fmt.front()+")"); + } + break; + default: + // std::cout << "found char: `" << fmt.front() << "`. Does it match `" << d.front() << "`?" << std::endl; + if (fmt.front() != d.front()) { + throw std::runtime_error("Date "+date+" doesn't match format (" + format + ")"); + } + d.remove_prefix(1); + } + } // while fmt + // std::cout << std::endl; + + ossimDate res(month, day, year); + res.setHour(hours); + res.setMin(minutes); + res.setSec(seconds); + res.setFractionalSecond(ssecs); + // fmt = format; + return res; +} + +ossimplugins::time::ModifiedJulianDate ossimplugins::time::toModifiedJulianDate(string_view const& utcTimeString) +{ + const ossimDate date = details::strptime("%Y-%m-%dT%H:%M:%S%.", utcTimeString); + return ModifiedJulianDate(date.getModifiedJulian()); +} + + +std::string ossimplugins::time::to_simple_string(ModifiedJulianDate const& d) +{ + ossimDate date ; + date.setDateFromModifiedJulian(d.as_day_frac()); + char buffer[1024] = {0}; + size_t s = std::strftime(buffer, sizeof(buffer), "%Y-%m-%dT%H:%M:%S", &date); + if (s == 0) { + // TODO d.as_day_frac() -> string + throw std::runtime_error("Cannot encode date into a string"); + } + assert(s < 1000); // should be more than enough + typedef unsigned long ulong; + const double frac_sec = date.getFractionalSecond(); + // const double fs2 = fmod(d.as_day_frac() * 24ULL*60*60, 1); + // assert(fs2==frac_sec); + // std::cout << "From: " << d.as_day_frac() << " -> frac_sec: " << fs2 + // << " --> *10^6: " << fs2*1000ULL*1000 + // << " --> %10^6: " << ulong(fs2*1000ULL*1000)%(1000ULL*1000) + // << "\n"; + s += s_printf(&buffer[s], sizeof(buffer)-s, ".%06ld", + ulong(frac_sec * 1000ULL * 1000) % (1000ULL*1000)); + return std::string(buffer, s); +} + +std::string ossimplugins::time::to_simple_string(Duration const& d) +{ + typedef unsigned long ulong; + const double fs = d.as_day_frac() * 24 * 60 * 60; // in seconds + const ulong ls = std::abs(fs); + const ulong us = ulong(std::abs(fs * 1000ULL*1000)) % (1000ULL*1000); + const ulong s = ls % 60; + const ulong m = (ls/60) % 60; + const ulong h = (ls/60/60); + char buffer[1024]; + const std::size_t N = s_printf(buffer, "%s%02d:%02d:%02d.%06ld", fs < 0 ? "-" : "", h, m, s, us); + assert(N); + + return std::string(buffer, N); +} + diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..715ed3aadc888f81d0d0732e6790712968ee7c16 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.h @@ -0,0 +1,312 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#ifndef ossimTimeUtilities_h +#define ossimTimeUtilities_h + +#include "ossimStringUtilities.h" +#include "ossimOperatorUtilities.h" +#include "ossimPluginConstants.h" +#include <cassert> +#include <ostream> +class ossimDate; + +namespace ossimplugins { namespace time { + // class ModifiedJulianDate; + // class Duration; + namespace details + { + class DayFrac + { + public: + typedef double scalar_type; + // DayFrac(DayFrac const&) = default; + // DayFrac(DayFrac &&) = default; + // DayFrac& operator=(DayFrac const&) = default; + // DayFrac& operator=(DayFrac &&) = default; + double as_day_frac() const { return m_day_frac; } + + std::ostream & display(std::ostream & os) const { return os << m_day_frac; } + std::istream & read (std::istream & is) { return is >> m_day_frac; } + + protected: + /**@name Construction/destruction + */ + //@{ + /** Initialisation constructor. + */ + explicit DayFrac() {} // = default; + explicit DayFrac(double day_frac) : m_day_frac(day_frac) {} + /** Protected destructor. + */ + ~DayFrac() {}// = default; + //@} + + /**@name Operations + */ + //@{ + void add(DayFrac const& rhs) { m_day_frac += rhs.m_day_frac; } + void sub(DayFrac const& rhs) { m_day_frac -= rhs.m_day_frac; } + void mult(scalar_type coeff) { m_day_frac *= coeff; } + void div(scalar_type coeff) { assert(coeff && "Cannot divide by 0"); m_day_frac /= coeff; } + template <typename V> friend scalar_type ratio_(V const& lhs, V const& rhs) + { return lhs.as_day_frac() / rhs.as_day_frac(); } + + template <typename U, typename V> friend U& operator+=(U & u, V const& v) { + u.add(v); + return u; + } + template <typename U, typename V> friend U& operator-=(U & u, V const& v) { + u.sub(v); + return u; + } + + template <typename U, typename V> static U diff(V const& lhs, V const& rhs) { + U const res(lhs.as_day_frac() - rhs.as_day_frac()); + return res; + } + + template <typename U> friend U& operator*=(U & u, scalar_type const& v) { + u.mult(v); + return u; + } + template <typename U> friend U& operator/=(U & u, scalar_type const& v) { + u.div(v); + return u; + } + + template <typename T> friend bool operator<(T const& lhs, T const& rhs) { + return lhs.as_day_frac() < rhs.as_day_frac(); + } + template <typename T> friend bool operator==(T const& lhs, T const& rhs) { + return lhs.as_day_frac() == rhs.as_day_frac(); + } + //@} + private: + double m_day_frac; + }; + } + + /** + * Duration abstraction. + * + * Values of this class represent time interval. + * + * <p><b>Semantics</b><br> + * <li> Value, mathematical: it's relative position + * <li> Time interval + * + * @see \c std::duration<> + */ + class Duration + : public details::DayFrac + , private addable<Duration> + , private substractable<Duration> + , private streamable<Duration> + , private multipliable2<Duration, double> + , private dividable<Duration, details::DayFrac::scalar_type> + , private equality_comparable<Duration> + , private less_than_comparable<Duration> + { + public: + typedef details::DayFrac::scalar_type scalar_type; + + /**@name Construction/destruction + */ + //@{ + /** Initialisation constructor. + */ + Duration() {} // = default; + explicit Duration(double day_frac) + : details::DayFrac(day_frac) {} + //@} + + double total_seconds() const { + return as_day_frac() * 24 * 60 * 60; + } + double total_microseconds() const { + return total_seconds() * 1000 * 1000; + } + bool is_negative() const { return as_day_frac() < 0.0; } + Duration invert_sign() { return Duration(- as_day_frac()); } + friend Duration abs(Duration const& d) { return Duration(std::abs(d.as_day_frac())); } + }; + + /** + * Modified JulianDate abstraction. + * + * Objects of this class represent points in time. + * + * <p><b>Semantics</b><br> + * <li> Value, mathematical: it's an absolute position + * <li> Point in time + * @see \c std::time_point<> + */ + class ModifiedJulianDate + : public details::DayFrac + , private addable<ModifiedJulianDate, Duration> + , private substractable<ModifiedJulianDate, Duration> + , private substractable_asym<Duration, ModifiedJulianDate> + , private streamable<ModifiedJulianDate> + , private equality_comparable<ModifiedJulianDate> + , private less_than_comparable<ModifiedJulianDate> + { + public: + typedef details::DayFrac::scalar_type scalar_type; + + /**@name Construction/destruction + */ + //@{ + /** Initialisation constructor. + */ + ModifiedJulianDate() {} // = default; + explicit ModifiedJulianDate(double day_frac) + : details::DayFrac(day_frac) {} + //@} + using details::DayFrac::diff; + }; + + OSSIM_PLUGINS_DLL ModifiedJulianDate toModifiedJulianDate(string_view const& utcTimeString); + inline Duration microseconds(double us) { + return Duration(us / (24ULL * 60 * 60 * 1000 * 1000)); + } + inline Duration seconds(double us) { + return Duration(us / (24ULL * 60 * 60)); + } + OSSIM_PLUGINS_DLL std::string to_simple_string(ModifiedJulianDate const& d); + OSSIM_PLUGINS_DLL std::string to_simple_string(Duration const& d); + + namespace details { + // strptime is not portable, hence this simplified emulation + OSSIM_PLUGINS_DLL ossimDate strptime(string_view const& format, string_view const& date); + } // details namespace + +} } // ossimplugins namespace::time + +#if defined(USE_BOOST_TIME) +# include <boost/config.hpp> +# include <boost/date_time/posix_time/posix_time.hpp> +// boost::posix_time::time_duration doesn't have a sufficient precision to +// store things such an azimuth time interval, and yet, this IS a duration. +// Hence this new class injected into boost namespace to emulate a duration +// with precision behind the microsecond. +// TODO: +// - check whether we could have used another boost date +// - move this elsewhere +// - move this into another namespace +namespace boost { namespace posix_time { + class precise_duration; + double ratio_(precise_duration const& lhs, precise_duration const& rhs); + + class precise_duration + : private ossimplugins::addable<precise_duration> + , private ossimplugins::substractable<precise_duration> + , private ossimplugins::streamable<precise_duration> + , private ossimplugins::multipliable2<precise_duration, double> + , private ossimplugins::dividable<precise_duration, double> + , private ossimplugins::equality_comparable<precise_duration> + , private ossimplugins::less_than_comparable<precise_duration> + , private ossimplugins::addable<ptime, precise_duration> + , private ossimplugins::substractable<ptime, precise_duration> + { + public: + typedef double scalar_type; + + /**@name Construction/destruction + */ + //@{ + /** Initialisation constructor. + */ + precise_duration() {} // = default; + explicit precise_duration(double usec_frac) + : m_usec_frac(usec_frac) {} + precise_duration(time_duration const& d) + : m_usec_frac(d.total_microseconds()) {} + //@} + + double total_seconds() const { + return total_microseconds() / 1000000.; + } + double total_microseconds() const { + return m_usec_frac; + } + bool is_negative() const { return total_microseconds() < 0.0; } + precise_duration invert_sign() { return precise_duration(- total_seconds()); } + std::ostream & display(std::ostream & os) const { return os << m_usec_frac; } + std::istream & read (std::istream & is) { return is >> m_usec_frac; } + + protected: + + /**@name Operations + */ + //@{ + void add(precise_duration const& rhs) { m_usec_frac += rhs.total_microseconds(); } + void sub(precise_duration const& rhs) { m_usec_frac -= rhs.total_microseconds(); } + void mult(scalar_type coeff) { m_usec_frac *= coeff; } + void div(scalar_type coeff) { assert(coeff && "Cannot divide by 0"); m_usec_frac /= coeff; } + friend precise_duration& operator+=(precise_duration & u, precise_duration const& v) { + u.add(v); + return u; + } + friend ptime& operator+=(ptime & u, precise_duration const& v) { + const time_duration d = microseconds(floor(v.total_microseconds()+0.5)); + u += d; + return u; + } + friend precise_duration& operator-=(precise_duration & u, precise_duration const& v) { + u.sub(v); + return u; + } + friend ptime& operator-=(ptime & u, precise_duration const& v) { + const time_duration d = microseconds(floor(v.total_microseconds()+0.5)); + u -= d; + return u; + } + + template <typename U, typename V> static U diff(V const& lhs, V const& rhs) { + U const res(lhs.total_microseconds() - rhs.total_microseconds()); + return res; + } + + friend precise_duration& operator*=(precise_duration & u, scalar_type const& v) { + u.mult(v); + return u; + } + friend precise_duration& operator/=(precise_duration & u, scalar_type const& v) { + u.div(v); + return u; + } + + friend bool operator<(precise_duration const& lhs, precise_duration const& rhs) { + return lhs.total_microseconds() < rhs.total_microseconds(); + } + friend bool operator==(precise_duration const& lhs, precise_duration const& rhs) { + return lhs.total_microseconds() == rhs.total_microseconds(); + } + + public: + friend scalar_type ratio_(precise_duration const& lhs, precise_duration const& rhs) + { return lhs.total_microseconds() / rhs.total_microseconds(); } + + //@} + private: + double m_usec_frac; + }; + + time_duration abs(time_duration d) { + if(d.is_negative()) + d = d.invert_sign(); + return d; + } + +} } // boost::time namespaces +#endif + +#endif // ossimTimeUtilities_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c6605d997c822401083d2e9d7e15d65d7a9a8e8a --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + + +#ifndef ossimTraceHelpers_h +#define ossimTraceHelpers_h + +#include <ossim/base/ossimTrace.h> +#include <ossim/base/ossimNotify.h> + +namespace ossimplugins { + /** Helper class to log automatically entering and leaving scopes. + * @warning Not meant to be used directly. Use \c SCOPED_LOG instead. + */ + struct ScopedLogger + { + ScopedLogger(ossimTrace & channel, char const* module, ossimNotifyLevel level = ossimNotifyLevel_DEBUG) + : m_channel(channel) + , MODULE(module) + { + if (m_channel()) { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n"; + } + } + + ~ScopedLogger() { + if (m_channel()) { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " left...\n"; + } + } + private: + ScopedLogger(ScopedLogger const&); + ScopedLogger& operator=(ScopedLogger const&); + + ossimTrace & m_channel; + char const* MODULE; + }; + + +#define SCOPED_LOG(channel, msg) \ + SCOPED_LOG_NAME(__LINE__)(channel, msg) + +#define SCOPED_LOG_NAME(x) \ + SCOPED_LOG_NAME0(x) + +#define SCOPED_LOG_NAME0(x) \ + ossimplugins::ScopedLogger slog ## x +} // ossimplugins namespace + + +#endif // ossimTraceHelpers_h diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2fb25b5027b8dcf5250f7124b6c41a82fe973ea4 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.cpp @@ -0,0 +1,86 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- + +#include "ossimXmlTools.h" +#include "ossimTimeUtilities.h" +#include <ossim/base/ossimString.h> +#include <ossim/base/ossimXmlDocument.h> +#include <ossim/base/ossimNotify.h> +// #include <ossim/base/ossimXmlNode.h> + +ossimXmlNode const& ossimplugins::getExpectedFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ + ossimRefPtr<ossimXmlNode> const& wh = node.findFirstNode(xpath); + if (!wh) { + throw std::runtime_error("No '" + xpath.string() + "' subnode found"); + } + return *wh; +} + +ossimString const& ossimplugins::getTextFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ + ossimString const& s = getExpectedFirstNode(node, xpath).getText(); + return s; +} + + +ossimplugins::TimeType ossimplugins::getTimeFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ +#if defined(USE_BOOST_TIME) + ossimString s = getTextFromFirstNode(node, xpath); + std::replace(s.begin(), s.end(), 'T', ' '); + return boost::posix_time::time_from_string(s); +#else + return getModifiedJulianDateFromFirstNode(node, xpath); +#endif +} + +ossimplugins::time::ModifiedJulianDate +ossimplugins::getModifiedJulianDateFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ + ossimString const& s = getTextFromFirstNode(node, xpath); + return time::toModifiedJulianDate(s); +} + +double ossimplugins::getDoubleFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ + const ossimString & s = getTextFromFirstNode(node, xpath); + return s.toDouble(); +} + +ossimString const& ossimplugins::getOptionalTextFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) +{ + static const ossimString empty; + ossimRefPtr<ossimXmlNode> const& wh = node.findFirstNode(xpath); + return wh.valid() ? wh->getText() : empty; +} + +ossimString const& ossimplugins::getOnlyText(ossimXmlDocument const& doc, ossimString const& xpath) +{ + static const ossimString empty; + std::vector<ossimRefPtr<ossimXmlNode> > xnodes; + doc.findNodes(xpath, xnodes); + switch (xnodes.size()) { + case 1: // perfect + if (xnodes[0].valid()) { + return xnodes[0]->getText(); + } + + case 0: + ossimNotify(ossimNotifyLevel_WARN) << "No node found with the name: " << xpath << "\n"; + break; + default: + ossimNotify(ossimNotifyLevel_WARN) << xnodes.size() + << " (too many) nodes found with the name: " << xpath << "\n"; + break; + } + return empty; +} + diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.h new file mode 100644 index 0000000000000000000000000000000000000000..c36670c4cac8b609c595e7eed7943abffd39b35c --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.h @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +#ifndef OSSIM_XMLTOOLS_H__ +#define OSSIM_XMLTOOLS_H__ + +class ossimString; +class ossimXmlDocument; +// class ossimXmlNode; + +#if defined(USE_BOOST_TIME) +# include <boost/date_time/posix_time/posix_time.hpp> +#endif +#include "ossimStringUtilities.h" +#include "ossimTimeUtilities.h" +#include <ossim/base/ossimXmlNode.h> + +namespace ossimplugins { + namespace time { + class ModifiedJulianDate; + }// time namespace +#if defined(USE_BOOST_TIME) + typedef boost::posix_time::ptime TimeType; +#else + typedef time::ModifiedJulianDate TimeType; +#endif + + ossimXmlNode const& getExpectedFirstNode(ossimXmlNode const& node, ossimString const& xpath); + ossimString const& getTextFromFirstNode(ossimXmlNode const& node, ossimString const& xpath); + ossimString const& getOptionalTextFromFirstNode(ossimXmlNode const& node, ossimString const& xpath); + TimeType getTimeFromFirstNode(ossimXmlNode const& node, ossimString const& xpath); + time::ModifiedJulianDate getModifiedJulianDateFromFirstNode(ossimXmlNode const& node, ossimString const& xpath); + double getDoubleFromFirstNode(ossimXmlNode const& node, ossimString const& xpath); + + template <typename DataType> inline + DataType getFromFirstNode(ossimXmlNode const& node, ossimString const& xpath) { + ossimXmlNode const& childNode = getExpectedFirstNode(node, xpath); + ossimString const& sValue = childNode.getText(); + DataType const& value = to<DataType>(sValue, "decoding " + xpath + " node"); + return value; + } + + ossimString const& getOnlyText(ossimXmlDocument const& doc, ossimString const& xpath); + +} // ossimplugins namespace + + +#endif // OSSIM_XMLTOOLS_H__ diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimplugins-config.h.in b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimplugins-config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..d99f97c759b85d7555c112ccf027aaeb1eb70a8e --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimplugins-config.h.in @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#cmakedefine HAVE_STD_SNPRINTF +#cmakedefine HAVE_MSC_SNPRINTF diff --git a/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt b/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b9e2d44bd137956e696f02727dfa47d3d14974a --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt @@ -0,0 +1,81 @@ +otb_module_test() + + +# Common dirs +#include_directories(${PROJECT_SOURCE_DIR}/Modules/ThirdParty/OssimPlugins/src/ossim ${OSSIM_INCLUDE_DIR}) +#==== UT for utilities +if (Boost_UNIT_TEST_FRAMEWORK_FOUND) + add_executable(ossimStringUtilitiesTest ossimStringUtilitiesTest.cpp) + target_link_libraries(ossimStringUtilitiesTest + otbossimplugins + ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + otb_module_target_label(ossimStringUtilitiesTest) + otb_add_test(NAME ossimStringUtilitiesTest COMMAND ossimStringUtilitiesTest ) + + add_executable(ossimTimeUtilitiesTest ossimTimeUtilitiesTest.cpp) + target_link_libraries(ossimTimeUtilitiesTest + # ${OTBOssim_LIBRARIES} + otbossimplugins + ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + otb_module_target_label(ossimTimeUtilitiesTest) + otb_add_test(NAME ossimTimeUtilitiesTest COMMAND ossimTimeUtilitiesTest ) +else() + message(STATUS "Boost unit test framework not found, ossimStringUtilitiesTest and ossimTimeUtilitiesTest will be skipped.") +endif() + +#==== Benchmarking Time conversion +# (requires google.benchmark) +find_package(GBenchmark) +if (GBENCHMARK_FOUND) + add_executable(ossimTimeUtilitiesBench ossimTimeUtilitiesBench.cpp) + include_directories(${GBENCHMARK_INCLUDE_DIRS}) + target_link_libraries(ossimTimeUtilitiesBench + otbossimplugins + ${GBENCHMARK_LIBRARIES}) + otb_module_target_label(ossimTimeUtilitiesBench) +else() + message(STATUS "Google.benchmark not found, ossimTimeUtilitiesBench will be skipped.") +endif() + + +#===== Domain tests +#Test executables +add_executable(ossimSarSensorModelTest ossimSarSensorModelTest.cpp) +target_link_libraries(ossimSarSensorModelTest otbossimplugins) +otb_module_target_label(ossimSarSensorModelTest) + +# S1 +add_executable(ossimSentinel1ModelTest ossimSentinel1ModelTest.cpp) +target_link_libraries(ossimSentinel1ModelTest otbossimplugins) +otb_module_target_label(ossimSentinel1ModelTest) + +# TSX (old) +add_executable(ossimTerraSarXSarSensorModelTest ossimTerraSarXSarSensorModelTest.cpp) +target_link_libraries(ossimTerraSarXSarSensorModelTest otbossimplugins) +otb_module_target_label(ossimTerraSarXSarSensorModelTest) + +otb_add_test(NAME ossimSarSensorModelTest COMMAND ossimSarSensorModelTest ) + +#S1 tests +file(GLOB s1_files ${INPUTDATA}/ossimPlugins/s1/*.xml) +#Loop over all S1 annotation files +foreach(entry ${s1_files}) + get_filename_component(name ${entry} NAME_WE) + otb_add_test( NAME s1_inverse_${name} COMMAND ossimSentinel1ModelTest 1 ${entry}) + otb_add_test( NAME s1_forward_${name} COMMAND ossimSentinel1ModelTest 0 ${entry}) +endforeach() + +# #TSX tests +# file(GLOB tsx_files ${CMAKE_SOURCE_DIR}/data/tsx/*) +# #Loop over all S1 annotation files +# foreach(entry ${tsx_files}) +# file(GLOB tsx_files ${CMAKE_SOURCE_DIR}/data/tsx/*) +# get_filename_component(name ${entry} NAME_WE) +# add_test( tsx_inverse_${name} ossimTerraSarXSarSensorModelTest ${entry} ) +# add_test( tsx_forward_${name} ossimSentinel1SarSensorModelTest 0 ${entry}) +# endforeach() + +# otb_add_test( NAME tsx_inverse_PANGKALANBUUN COMMAND ossimTerraSarXSarSensorModelTest 1 ${CMAKE_SOURCE_DIR}/data/tsx/PANGKALANBUUN/TSX1_SAR__SSC______SM_D_SRA_20080313T221955_20080313T222003.xml ${CMAKE_SOURCE_DIR}/data/tsx/PANGKALANBUUN/GEOREF.xml) +# otb_add_test( NAME tsx_forward_PANGKALANBUUN COMMAND ossimTerraSarXSarSensorModelTest 0 ${CMAKE_SOURCE_DIR}/data/tsx/PANGKALANBUUN/TSX1_SAR__SSC______SM_D_SRA_20080313T221955_20080313T222003.xml ${CMAKE_SOURCE_DIR}/data/tsx/PANGKALANBUUN/GEOREF.xml) +# otb_add_test( NAME tsx_inverse_UPSALA COMMAND ossimTerraSarXSarSensorModelTest 1 ${CMAKE_SOURCE_DIR}/data/tsx/UPSALA_GLACIER/TSX1_SAR__MGD.xml ${CMAKE_SOURCE_DIR}/data/tsx/UPSALA_GLACIER/GEOREF.xml) +# otb_add_test( NAME tsx_forward_UPSALA COMMAND ossimTerraSarXSarSensorModelTest 0 ${CMAKE_SOURCE_DIR}/data/tsx/UPSALA_GLACIER/TSX1_SAR__MGD.xml ${CMAKE_SOURCE_DIR}/data/tsx/UPSALA_GLACIER/GEOREF.xml) diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimSarSensorModelTest.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimSarSensorModelTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88e0b655234ebd0224bb37bfafba8ccb24ef9624 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimSarSensorModelTest.cpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include "ossimSarSensorModel.h" + + +int main(int, char *[]) +{ + ossimplugins::ossimSarSensorModel sensor; + + return EXIT_SUCCESS; +} diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimSentinel1ModelTest.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimSentinel1ModelTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d7730aa7d9adaa2ad39bfc4d96aa44fefe2efdc5 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimSentinel1ModelTest.cpp @@ -0,0 +1,102 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Woverloaded-virtual" +# pragma GCC diagnostic ignored "-Wshadow" +#include "ossimSentinel1Model.h" +#include "ossimPluginProjectionFactory.h" +# pragma GCC diagnostic pop +#else +#include "ossimSentinel1Model.h" +#include "ossimPluginProjectionFactory.h" +#endif + +#include <iostream> +#include <memory> +#include <map> +#include <string> + +using namespace ossimplugins; +enum Inverse { fwd, inv, undef}; + +int main(int argc, char * argv[]) +{ + std::clog.precision(20); + + string annotationXml; + Inverse inverse = undef; + bool verbose = false; + + for (int i=1; i!=argc ; ++i) { + std::string const a(argv[i]); + if (a == "-v" || a == "-verbose") { + verbose = true; + } else if (inverse == undef) { + inverse = atoi(argv[i]) == 1 ? inv : fwd; + } else if (annotationXml.empty()) { + annotationXml = a; + } else { + std::cerr << "Too many arguments\n" + << argv[0] << "[-v|--verbose] <inverse> <annotationXml>\n"; + return EXIT_FAILURE; + } + } + + if(annotationXml.empty()) + { + std::cerr << "Not enough arguments\n" + << argv[0] << "[-v|--verbose] <inverse> <annotationXml>\n"; + return EXIT_FAILURE; + } + if (!verbose) { + std::clog.setstate(std::ios_base::badbit); + } + + try { + std::auto_ptr<ossimProjection> projection + (ossimPluginProjectionFactory::instance()->createProjection(annotationXml, 42)); + if (!projection.get()) { + throw std::runtime_error("Cannot read annotation file ("+annotationXml+"). Cannot create a projection from it."); + } + + ossimSentinel1Model * sensor = dynamic_cast<ossimSentinel1Model*>(projection.get()); + if (!sensor) { + throw std::runtime_error( + "Unlike Expectations, the annotation file ("+annotationXml+") is not a Sentinel Annotation File"); + } + + if (verbose) + { + sensor->print(std::clog); + } + + ossimKeywordlist kwl; + sensor->saveState(kwl, "S1."); + sensor->loadState(kwl, "S1."); + if (verbose) { + sensor->print(std::clog); + } + + const bool validate = inverse == inv + ? sensor->autovalidateInverseModelFromGCPs() + : sensor->autovalidateForwardModelFromGCPs() + ; + + std::cout << "Validate: " << validate << "\n"; + return validate ? EXIT_SUCCESS : EXIT_FAILURE; + } catch (std::exception const& e) { + std::cerr << "Error: " << e.what() << "\n"; + } + return EXIT_FAILURE; +} diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimStringUtilitiesTest.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimStringUtilitiesTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bfd02e47011455183c27b77a033f859f4b8cf7b6 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimStringUtilitiesTest.cpp @@ -0,0 +1,238 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +// #pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wshadow" +#endif + +#define BOOST_TEST_MODULE "ossim String Utilities unit testing" +#define BOOST_TEST_DYN_LINK +#include "ossimStringUtilities.h" +#include <boost/test/unit_test.hpp> +#include <cstdio> +#include <iostream> + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +using namespace ossimplugins; + +#if 0 +BOOST_AUTO_TEST_CASE(begin_end) +{ + char const t[] = "123456789"; + std::string const s = "123456789"; + + BOOST_REQUIRE_EQUAL(*rbegin(t), 0); + BOOST_REQUIRE_EQUAL(size(s), 9u); + BOOST_REQUIRE_EQUAL(size(t), 10u); +} +#endif + +BOOST_AUTO_TEST_CASE(string_view_array) +{ + char const t[] = "123456789"; + + string_view v(t); + BOOST_CHECK_EQUAL(v.size() , 9u); + BOOST_CHECK(! v.empty()); + BOOST_CHECK_EQUAL(*v.begin() , '1'); + BOOST_CHECK_EQUAL(*(v.end()-1), '9'); + BOOST_CHECK_EQUAL(v.front() , '1'); + BOOST_CHECK_EQUAL(v.back() , '9'); + + BOOST_CHECK(v.belongs_to(t)); + for (std::size_t i = 0; i!= sizeof(t) ; ++i) { + for (std::size_t j=i+1; j!=sizeof(t) ; ++j) { + string_view tmp(&t[i], &t[j]); + // std::cout << t << "[" << i << ":" << j << "[ -> " << tmp ; + BOOST_CHECK(tmp.belongs_to(t)); + string_view wh = find(t, tmp); + // std::cout << " -> found: " << static_cast<void const*>(wh.data()) << ", " << wh.size() << " chars\n"; + BOOST_CHECK_EQUAL(wh.data(), &t[i]); + BOOST_CHECK(contains(t,tmp)); + } + } + + BOOST_CHECK(contains(t, "345")); + BOOST_CHECK(!contains(t, "35")); +} + +BOOST_AUTO_TEST_CASE(string_view_string) +{ + std::string const s = "123456789"; + + string_view v(s); + BOOST_CHECK_EQUAL(v.size() , 9u); + BOOST_CHECK(! v.empty()); + BOOST_CHECK_EQUAL(*v.begin() , '1'); + BOOST_CHECK_EQUAL(*(v.end()-1), '9'); + BOOST_CHECK_EQUAL(v.front() , '1'); + BOOST_CHECK_EQUAL(v.back() , '9'); + + const std::size_t len = s.length(); + BOOST_CHECK(v.belongs_to(s)); + for (std::size_t i = 0; i!= len ; ++i) { + for (std::size_t j=i; j!=len ; ++j) { + BOOST_CHECK(string_view(&s[i], &s[j]).belongs_to(s)); + } + } + + BOOST_CHECK(string_view(&s[0], &s[len]).belongs_to(s)); + BOOST_CHECK(!string_view(&s[0], &s[len+1]).belongs_to(s)); + BOOST_CHECK(!string_view(&s[-1], &s[len]).belongs_to(s)); +} + +BOOST_AUTO_TEST_CASE(string_view_ptr) +{ + char const *ptr = "123456789"; + + string_view v(ptr); + BOOST_CHECK_EQUAL(v.size() , 9u); + BOOST_CHECK(! v.empty()); + BOOST_CHECK_EQUAL(*v.begin() , '1'); + BOOST_CHECK_EQUAL(*(v.end()-1), '9'); + BOOST_CHECK_EQUAL(v.front() , '1'); + BOOST_CHECK_EQUAL(v.back() , '9'); + + const std::size_t len = std::strlen(ptr); + BOOST_CHECK(v.belongs_to(ptr)); + for (std::size_t i = 0; i!= len ; ++i) { + for (std::size_t j=i; j!=len ; ++j) { + BOOST_CHECK(string_view(&ptr[i], &ptr[j]).belongs_to(ptr)); + } + } +} + +BOOST_AUTO_TEST_CASE(tests) +{ + char const t[] = "123456789"; + std::string const s = "123456789"; + + string_view v(t); + BOOST_CHECK_EQUAL(v, t); + BOOST_CHECK_EQUAL(v, s); + + BOOST_CHECK(starts_with(v, t)); + BOOST_CHECK(starts_with(v, s)); + BOOST_CHECK(starts_with(s, t)); + BOOST_CHECK(starts_with(t, s)); + BOOST_CHECK(starts_with(t, v)); + BOOST_CHECK(starts_with(s, v)); + + BOOST_CHECK(ends_with(v, t)); + BOOST_CHECK(ends_with(v, s)); + BOOST_CHECK(ends_with(s, t)); + BOOST_CHECK(ends_with(t, s)); + BOOST_CHECK(ends_with(t, v)); + BOOST_CHECK(ends_with(s, v)); + + BOOST_CHECK(starts_with(s, "1")); + BOOST_CHECK(starts_with(s, "12")); + BOOST_CHECK(starts_with(s, "123")); + BOOST_CHECK(!starts_with(s, "23")); + + BOOST_CHECK(ends_with(s, "9")); + BOOST_CHECK(ends_with(s, "89")); + BOOST_CHECK(ends_with(s, "789")); + BOOST_CHECK(!ends_with(s, "23")); +} + + + +template <typename RangeType, std::size_t NbParts> +void check_split(RangeType const& parts, char const* (&expected)[NbParts]) +{ + typedef RangeType range_type; + typedef typename range_type::const_iterator const_iterator; + + const_iterator it = parts.begin(); + const_iterator end = parts.end(); + + std::size_t n=0; + for (; it != end && n!=NbParts ; ++it, ++n) { + // std::cout << "iteration #" << n << " -> " << it << std::endl; + BOOST_CHECK(it->begin() <= it->end()); + BOOST_CHECK_EQUAL(*it, expected[n]); + } + // std::cout << "End reached: " << it << std::endl; + BOOST_CHECK_EQUAL(n, NbParts); + BOOST_CHECK_EQUAL(it, end); +} + +BOOST_AUTO_TEST_CASE(split1) { + { + char const* expected[] = { "abc", "def", "xy" }; + check_split(split_on( "abc,def,xy", ','), expected); + } + { + char const* expected[] = { "", "abc", "z", "", "", "def", "xy", "", "" }; + check_split(split_on( ",abc,z,,,def,xy,,", ','), expected); + } +} + + +BOOST_AUTO_TEST_CASE(to_int) { + BOOST_CHECK_EQUAL(to<int>("12", "UT"), 12); + BOOST_CHECK_EQUAL(to<int>("0", "UT"), 0); + BOOST_CHECK_EQUAL(to<int>("13576", "UT"), 13576); + BOOST_CHECK_EQUAL(to<int>("+12", "UT"), 12); + BOOST_CHECK_EQUAL(to<int>("+0", "UT"), 0); + BOOST_CHECK_EQUAL(to<int>("+13576", "UT"), 13576); + BOOST_CHECK_EQUAL(to<int>("-12", "UT"), -12); + BOOST_CHECK_EQUAL(to<int>("-0", "UT"), 0); + BOOST_CHECK_EQUAL(to<int>("-13576", "UT"), -13576); + + BOOST_CHECK_EQUAL(to_with_default<int>("abc", 42), 42); + BOOST_CHECK_EQUAL(to_with_default<int>("12h", 42), 42); + BOOST_CHECK_EQUAL(to_with_default<int>("0x12", 42), 42); + BOOST_CHECK_THROW(to<int>("abc", "UT"), std::runtime_error); + BOOST_CHECK_THROW(to<int>("12h", "UT"), std::runtime_error); + BOOST_CHECK_THROW(to<int>("0x12", "UT"), std::runtime_error); + + BOOST_CHECK_EQUAL(to<unsigned int>("12", "UT"), 12u); + BOOST_CHECK_EQUAL(to<int>("-1", "UT"), -1); + BOOST_CHECK_THROW(to<unsigned int>("-1", "UT"), std::runtime_error); +} +BOOST_AUTO_TEST_CASE(to_double) { + BOOST_CHECK_CLOSE(to<double>("12", "UT"), 12, 0.00001); + BOOST_CHECK_CLOSE(to<double>("0", "UT"), 0, 0.00001); + BOOST_CHECK_CLOSE(to<double>("13576", "UT"), 13576, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+12", "UT"), 12, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+0", "UT"), 0, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+13576", "UT"), 13576, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-12", "UT"), -12, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-0", "UT"), 0, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-13576", "UT"), -13576, 0.00001); + + BOOST_CHECK_CLOSE(to<double>("12.1", "UT"), 12.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("0.1", "UT"), 0.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("13576.1", "UT"), 13576.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+12.1", "UT"), 12.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+0.1", "UT"), 0.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("+13576.1", "UT"), 13576.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-12.1", "UT"), -12.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-0.1", "UT"), -0.1, 0.00001); + BOOST_CHECK_CLOSE(to<double>("-13576.1", "UT"), -13576.1, 0.00001); + + // invalid double conversions return 0 as per ossim way of doind things + BOOST_CHECK_THROW(to<double>("abc", "UT"), std::runtime_error); + BOOST_CHECK_THROW(to<double>("12h", "UT"), std::runtime_error); + BOOST_CHECK_THROW(to<double>("0x12", "UT"), std::runtime_error); + BOOST_CHECK_CLOSE(to_with_default<double>("abc", 42), 42, 0.00001); + BOOST_CHECK_CLOSE(to_with_default<double>("12h", 42), 42, 0.00001); + BOOST_CHECK_CLOSE(to_with_default<double>("0x12", 42), 42, 0.00001); + + BOOST_CHECK(ossim::isnan(to<double>("nan", "UT"))); +} diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimTerraSarXSarSensorModelTest.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimTerraSarXSarSensorModelTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea51b1be9a2aeb8dd01e2d7b7929f156b14b080b --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimTerraSarXSarSensorModelTest.cpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Woverloaded-virtual" +#include "ossimTerraSarXSarSensorModel.h" +# pragma GCC diagnostic pop +#else +#include "ossimTerraSarXSarSensorModel.h" +#endif + +int main(int argc, char * argv[]) +{ + std::cout.precision(9); + + if(argc != 4) + return EXIT_FAILURE; + + std::string annotationXml = argv[2]; + std::string geoXml = argv[3]; + bool inverse = atoi(argv[1]); + + ossimplugins::ossimTerraSarXSarSensorModel * sensor = new ossimplugins::ossimTerraSarXSarSensorModel(); + + sensor->readAnnotationFile(annotationXml, geoXml); + + bool validate(false); + + if(inverse) + { + validate = sensor->autovalidateInverseModelFromGCPs(); + } + else + { + validate = sensor->autovalidateForwardModelFromGCPs(); + } + + delete sensor; + + if(validate) + return EXIT_SUCCESS; + + return EXIT_FAILURE; +} diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesBench.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesBench.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b78218c31e623bdf8c6e9b49f13c1c732832eef --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesBench.cpp @@ -0,0 +1,217 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +// +// Typical results are: +// Run on (8 X 1998 MHz CPU s) +// 2016-05-19 18:55:03 +// ***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead. +// Benchmark Time CPU Iterations +// -------------------------------------------------------------------------------- +// BM_decode_string_view/697.936M 1927 ns 1923 ns 372340 +// BM_decode_string_view/1.36316G 1906 ns 1904 ns 357143 +// BM_decode_split/697.936M 4421 ns 4415 ns 157658 +// BM_decode_split/1.36316G 4404 ns 4400 ns 159091 +// BM_decode_iso/697.936M 11417 ns 11456 ns 62500 +// BM_decode_iso/1.36316G 11418 ns 11456 ns 62500 +// BM_decode_strptime_manual_julian/697.936M 1977 ns 1982 ns 357143 +// BM_decode_strptime_manual_julian/1.36316G 1938 ns 1942 ns 364583 +// BM_decode_strptime_ossim_julian/697.936M 2018 ns 2011 ns 350000 +// BM_decode_strptime_ossim_julian/1.36316G 1982 ns 1977 ns 350000 +//---------------------------------------------------------------------------- +// +#include "ossimTimeUtilities.h" +#include <benchmark/benchmark.h> +#include <vector> +#include <cstdio> +#include <ctime> +#include "ossimStringUtilities.h" +#include <ossim/base/ossimDate.h> +#include <ossim/base/ossimString.h> + +using namespace ossimplugins; + +static void clobber() { + asm volatile("" : : : "memory"); +} + +double +getModifiedJulianDate(ossimString const& utcTimeString) +{ + std::vector<ossimString> date_time; + std::vector<ossimString> output; + + utcTimeString.split(date_time, "T"); + + date_time[0].split(output, "-"); + + if (output.size () != 3) + { + throw std::runtime_error("Invalid date" + utcTimeString); + } + + char* stop; + int year = std::strtol( output[0].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid year" + utcTimeString); + } + + stop = 0; + int month = std::strtol( output[1].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid month" + utcTimeString); + } + stop = 0; + int day = std::strtol( output[2].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid day" + utcTimeString); + } + /* Parse time */ + output.clear(); + date_time[1].split(output, ":"); + if (output.size () != 3) + { + throw std::runtime_error("Invalid time" + utcTimeString); + } + + stop = 0; + int hours = std::strtol( output[0].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid hour" + utcTimeString); + } + + stop = 0; + int minutes = std::strtol( output[1].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid minutes" + utcTimeString); + } + + stop = 0; + double seconds = std::strtod( output[2].c_str(), &stop); + if ( *stop != 0 ) + { + throw std::runtime_error("Invalid seconds" + utcTimeString); + } + + /* Below method could replace all above split and convert. But there is a lot of + checks done in ossimLocalTm::setIso8601( ) which slows us down. And I dont + want that. */ + /* + ossimLocalTm otm; + if ( !otm.setIso8601(utcString) ) + { + } + ossimDate ossimdate(otm); + */ + + ossimDate ossimdate(month, day, year); + ossimdate.setHour(hours); + ossimdate.setMin(minutes); + ossimdate.setFloatSec(seconds); + return ossimdate.getModifiedJulian(); +} + + +static const char format[] = "%Y-%m-%dT%H:%M:%S"; +static const std::time_t now = std::time(NULL); + +template <std::size_t N> +void build_date_string(char (&date)[N], std::time_t t) +{ + std::tm tm; + localtime_r(&t, &tm); + std::strftime(date, N, format, &tm); +} + +static void BM_decode_string_view(benchmark::State & state) +{ + char date[1024]; // more than enough + build_date_string(date, state.range_x()); + + while (state.KeepRunning()) { + const time::ModifiedJulianDate d = time::toModifiedJulianDate(date); + benchmark::DoNotOptimize(d); + clobber(); + } +} +BENCHMARK(BM_decode_string_view)->Range(now/2, now); + +static void BM_decode_split(benchmark::State & state) +{ + char date[1024]; // more than enough + build_date_string(date, state.range_x()); + + while (state.KeepRunning()) { + const double d = getModifiedJulianDate(date); + benchmark::DoNotOptimize(d); + clobber(); + } +} +BENCHMARK(BM_decode_split)->Range(now/2, now); + +static void BM_decode_iso(benchmark::State & state) +{ + char date[1024]; // more than enough + build_date_string(date, state.range_x()); + + while (state.KeepRunning()) { + ossimLocalTm iso; + iso.setIso8601(date); + const double d = iso.getModifiedJulian(); + benchmark::DoNotOptimize(d); + clobber(); + } +} +BENCHMARK(BM_decode_iso)->Range(now/2, now); + +static void BM_decode_strptime_manual_julian(benchmark::State & state) +{ + char date[1024]; // more than enough + build_date_string(date, state.range_x()); + + while (state.KeepRunning()) { + // std::tm tm; + ossimDate tm; + strptime(date, format, &tm); + int J = tm.tm_mon + 1; + int K = tm.tm_mday; + int I = tm.tm_year + 1900; + double d = (K-32075+1461*(I+4800+(J-14)/12)/4+367*(J-2-(J-14)/12*12) + /12-3*((I+4900+(J-14)/12)/100)/4+ + (tm.tm_hour/24.0)+ + (tm.tm_min/1440.0)+ + ((tm.tm_sec+0.0)/86400.0)) - 2400000.5; + benchmark::DoNotOptimize(d); + clobber(); + } +} +BENCHMARK(BM_decode_strptime_manual_julian)->Range(now/2, now); + +static void BM_decode_strptime_ossim_julian(benchmark::State & state) +{ + char date[1024]; // more than enough + build_date_string(date, state.range_x()); + + while (state.KeepRunning()) { + ossimDate tm; + strptime(date, format, &tm); + const double d = tm.getModifiedJulian(); + benchmark::DoNotOptimize(d); + clobber(); + } +} +BENCHMARK(BM_decode_strptime_ossim_julian)->Range(now/2, now); + +BENCHMARK_MAIN(); diff --git a/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesTest.cpp b/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e965125339aab10a7a4dcf26093aa3239ddd0c2 --- /dev/null +++ b/Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesTest.cpp @@ -0,0 +1,198 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL-2 +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +// #pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wshadow" +#endif + +#define BOOST_TEST_MODULE "ossim Time Utilities unit testing" +#define BOOST_TEST_DYN_LINK +#include "ossimTimeUtilities.h" +#include "ossimStringUtilities.h" +#include <boost/test/unit_test.hpp> +#include <iostream> +#include <iomanip> +#include <vector> +#include <cstdio> +#include <ossim/base/ossimDate.h> +#include <ossim/base/ossimString.h> +#include <sstream> + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +using namespace ossimplugins; + +double +getModifiedJulianDate(ossimString const& utcTimeString) +{ + std::vector<ossimString> date_time; + std::vector<ossimString> output; + + utcTimeString.split(date_time, "T"); + + date_time[0].split(output, "-"); + + if (output.size () != 3) + { + throw std::runtime_error(("Invalid date" + utcTimeString).string()); + } + + char* stop; + int year = std::strtol( output[0].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid year" + utcTimeString).string()); + } + + stop = 0; + int month = std::strtol( output[1].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid month" + utcTimeString).string()); + } + stop = 0; + int day = std::strtol( output[2].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid day" + utcTimeString).string()); + } + /* Parse time */ + output.clear(); + date_time[1].split(output, ":"); + if (output.size () != 3) + { + throw std::runtime_error(("Invalid time" + utcTimeString).string()); + } + + stop = 0; + int hours = std::strtol( output[0].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid hour" + utcTimeString).string()); + } + + stop = 0; + int minutes = std::strtol( output[1].c_str(), &stop, 10); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid minutes" + utcTimeString).string()); + } + + stop = 0; + double seconds = std::strtod( output[2].c_str(), &stop); + if ( *stop != 0 ) + { + throw std::runtime_error(("Invalid seconds" + utcTimeString).string()); + } + + /* Below method could replace all above split and convert. But there is a lot of + checks done in ossimLocalTm::setIso8601( ) which slows us down. And I dont + want that. */ + /* + ossimLocalTm otm; + if ( !otm.setIso8601(utcString) ) + { + } + ossimDate ossimdate(otm); + */ + + ossimDate ossimdate(month, day, year); + ossimdate.setHour(hours); + ossimdate.setMin(minutes); + ossimdate.setFloatSec(seconds); + return ossimdate.getModifiedJulian(); +} + +typedef unsigned int uint; +void check_time(char const* format, char const* sDate, + int year, int month, int day, + int hour, int min, int sec, double fsec) +{ + // std::cout << "Test " << sDate << " against " << format << std::endl; + const ossimDate d = time::details::strptime(format, sDate); + BOOST_CHECK_EQUAL(d.getYear(), year); + BOOST_CHECK_EQUAL(d.getMonth(), month); + BOOST_CHECK_EQUAL(d.getDay(), day); + BOOST_CHECK_EQUAL(d.getHour(), hour); + BOOST_CHECK_EQUAL(d.getMin(), min); + BOOST_CHECK_EQUAL(d.getSec(), sec); + BOOST_CHECK_EQUAL(d.getFractionalSecond(), fsec); + + // Reference + ossimLocalTm iso; + iso.setIso8601(sDate); + BOOST_CHECK_EQUAL(d.getModifiedJulian(), iso.getModifiedJulian()); + + // Is ossimDate |--> MJD bijective ? + const double dMJD = d.getModifiedJulian(); + ossimDate d2; d2.setDateFromModifiedJulian(dMJD); + BOOST_CHECK_EQUAL(d2.getYear(), year); + BOOST_CHECK_EQUAL(d2.getMonth(), month); + BOOST_CHECK_EQUAL(d2.getDay(), day); + BOOST_CHECK_EQUAL(d2.getHour(), hour); + BOOST_CHECK_EQUAL(d2.getMin(), min); + BOOST_CHECK_CLOSE_FRACTION(d2.getSec()+d2.getFractionalSecond(), sec+fsec, 1e-6); + + // Alternative implementation + BOOST_CHECK_CLOSE_FRACTION(d.getModifiedJulian(), getModifiedJulianDate(sDate), 1e-12); + + // Check string conversion + // Yes, this is likelly to fail du to double imprecisions + // - official ossimDate string conversion + time::ModifiedJulianDate mjd = time::toModifiedJulianDate(sDate); + // std::cout << "MJD("<<sDate<<"): " << mjd.as_day_frac() << std::endl; + BOOST_CHECK_CLOSE_FRACTION(d.getModifiedJulian(), mjd.as_day_frac(), 1e-12); + std::ostringstream oss; + oss << d.getYear() << '-' << std::setw(2) << std::setfill('0') << d.getMonth() << '-' << d.getDay() << 'T'; + d.printTime(oss); + if (d.getFractionalSecond() > 0) { + oss << '.' << std::setw(6) << (d.getFractionalSecond() * 1000*1000); + } + BOOST_CHECK_EQUAL(oss.str(), sDate); + // - our string conversion + // std::cout << std::setprecision(20) ; + // std::cout << mjd.as_day_frac() << " -> " << to_simple_string(mjd) << " / " << d.getModifiedJulian() << "\n"; + // std::cout << oss.str() << "\n"; + + // We know this test will fail because of float rounding => just display + std::cout.precision(16); + std::cout << mjd << " as a simple string (" << time::to_simple_string(mjd) + << ") is expected to differ from " << sDate << "\n"; + // BOOST_CHECK_EQUAL(to_simple_string(mjd), sDate); +} + + +BOOST_AUTO_TEST_CASE(check_strptime) +{ + check_time( + "%Y-%m-%dT%H:%M:%S", "2016-01-12T13:42:52", + 2016, 1, 12, 13, 42, 52, 0.0); + + check_time( + "%Y-%m-%dT%H:%M:%S", "1970-12-31T00:42:52", + 1970, 12, 31, 0, 42, 52, 0.0); + + check_time( + "%Y-%m-%dT%H:%M:%S%.", "1970-12-31T00:42:52", + 1970, 12, 31, 0, 42, 52, 0.0); + + check_time( + "%Y-%m-%dT%H:%M:%S%.", "1970-12-31T00:42:52.156000", + 1970, 12, 31, 0, 42, 52, 0.156); + + check_time( + "%Y-%m-%dT%H:%M:%S%.", "2015-06-19T19:50:44.223221", + 2015, 6, 19, 19, 50, 44, 0.223221); +} diff --git a/Modules/ThirdParty/Qt4/CMakeLists.txt b/Modules/ThirdParty/Qt4/CMakeLists.txt index bd198da1202c51c2fd4d7f2201b02501880f0123..20dc99bb1156bbb83759f3842b2e1e467748d05f 100644 --- a/Modules/ThirdParty/Qt4/CMakeLists.txt +++ b/Modules/ThirdParty/Qt4/CMakeLists.txt @@ -2,5 +2,5 @@ project(OTBQt4) set(OTBQt4_SYSTEM_INCLUDE_DIRS ${QT_INCLUDE_DIRS}) set(OTBQt4_LIBRARIES "${QT_LIBRARIES}") - +set(QT_VERSION "${QTVERSION}" CACHE INTERNAL "" FORCE) otb_module_impl() diff --git a/Modules/ThirdParty/SPTW/CMakeLists.txt b/Modules/ThirdParty/SPTW/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d3788b802d0789ba964ca15b18c1474389cee9e --- /dev/null +++ b/Modules/ThirdParty/SPTW/CMakeLists.txt @@ -0,0 +1,8 @@ +project(OTBSPTW) +set(OTBSPTW_THIRD_PARTY 1) + +set(OTBSPTW_INCLUDE_DIRS ${OTBSPTW_SOURCE_DIR}/src) +set(OTBSPTW_LIBRARIES otbSPTW) + + +otb_module_impl() diff --git a/Modules/ThirdParty/SPTW/otb-module.cmake b/Modules/ThirdParty/SPTW/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ad14352ce42e6ec17490fbc4f50970db4de56e9b --- /dev/null +++ b/Modules/ThirdParty/SPTW/otb-module.cmake @@ -0,0 +1,14 @@ +set(DOCUMENTATION "This module imports SPTW to the build system") + +otb_module(OTBSPTW + DEPENDS + OTBMPI + OTBGDAL + + TEST_DEPENDS + + DESCRIPTION + "${DOCUMENTATION}" + ) + +otb_module_activation_option("Enable SPTW dependent modules" OFF) diff --git a/Modules/ThirdParty/SPTW/src/CMakeLists.txt b/Modules/ThirdParty/SPTW/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f75ce226dbc2dc560e8341c0b07bca51756e14 --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/CMakeLists.txt @@ -0,0 +1,32 @@ +set(OTB3P_INSTALL_EXPORT_NAME "${OTBSPTW-targets}") +set(OTB3P_INSTALL_INCLUDE_DIR "${OTBSPTW_INSTALL_INCLUDE_DIR}") +set(OTB3P_INSTALL_RUNTIME_DIR "${OTBSPTW_INSTALL_RUNTIME_DIR}") +set(OTB3P_INSTALL_LIBRARY_DIR "${OTBSPTW_INSTALL_LIBRARY_DIR}") +set(OTB3P_INSTALL_ARCHIVE_DIR "${OTBSPTW_INSTALL_ARCHIVE_DIR}") + +set(OTBSPTW_MAIN_SRCS sptw.cc) + + +add_library(otbSPTW ${OTBSPTW_MAIN_SRCS}) +target_link_libraries(otbSPTW) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +#Install TARGET & FILES for otb-lib +if(OTB_LIBRARY_PROPERTIES) + set_target_properties(otbSPTW PROPERTIES ${OTB_LIBRARY_PROPERTIES}) +endif() + +install(FILES sptw.h utils.h + DESTINATION ${OTB3P_INSTALL_INCLUDE_DIR}/SPTW + COMPONENT Development + ) + +install(TARGETS otbSPTW + EXPORT ${OTB3P_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${OTB3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${OTB3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${OTB3P_INSTALL_ARCHIVE_DIR} COMPONENT Development + ) + +otb_module_target( otbSPTW NO_INSTALL ) + diff --git a/Modules/ThirdParty/SPTW/src/LICENSE b/Modules/ThirdParty/SPTW/src/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..104ed07cbaa000020edbb49943f1517ceab09f62 --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/LICENSE @@ -0,0 +1,4 @@ +This software is in the public domain, furnished "as is", without +technical support, and with no warranty, express or implied, as to its +usefulness for any purpose. + diff --git a/Modules/ThirdParty/SPTW/src/README.md b/Modules/ThirdParty/SPTW/src/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fde10d081f23522f90f372a39b333aa58798ea68 --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/README.md @@ -0,0 +1,46 @@ +SPTW - Simple Parallel TIFF Writer +================================== + +The Simple Parallel TIFF Writer (SPTW) provides a useful interface for writing +GeoTIFF files using MPI-IO. + +In traditional parallel processing applications, individual output rasters are +created per processor because GDAL does not support parallel operation. This +adds unnecessary complexity since these rasters must be recombined at the end. + +SPTW provides sequential consistency only when all write +operations are nonconflicting, that is, each write operation accesses a distinct +section of the raster file. + +In the +[prasterblater-pio](https://github.com/dmm/prasterblaster/blob/master/src/demos/prasterblaster-pio.cc) +demo program, each pixel of +the output raster is contained in only one partition and each partition is only +assigned to one process. This ensures all write accesses are nonconflicting and +that sequential consistency is maintained. + +### API + +* open_raster +* populate_tile_offsets +* write_area +* close_raster + +Example usage can be found in examples/test.cpp + +### Possible improvements + +SPTW achieves sequential consistency but it is almost certainly not optimal. +Possble improvements include: + +#### Collective Operations + +Currently all file writes are done with non-collective operations. MPI I/O +supports collective calls in which use a shared file pointer and file accesses +are coordinated among processes. + +#### Using MPI I/O for read operations + +SPTW is only used to write the output file in the prasterblasterpio demo +program. The file reads are done with the standard I/O functions. The use +of collective reads may be more efficient. diff --git a/Modules/ThirdParty/SPTW/src/examples/test.cpp b/Modules/ThirdParty/SPTW/src/examples/test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3ca716ff561e1b88fd49ce8beae05470ab58f2a8 --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/examples/test.cpp @@ -0,0 +1,106 @@ +#include <iostream> +#include <cstring> +#include <cmath> + +#include <ogr_spatialref.h> + +#include "../sptw.h" + +int main(int argc, char *argv[]) +{ + const int TILE_SIZE = 16; + const int RASTER_WIDTH = 1234; + const int RASTER_HEIGHT = 5566; + + MPI_Init(&argc, &argv); + + if (argc < 2) { + std::cout << "usage: " << argv[0] << " raster.tiff" << std::endl; + return -1; + } + + int rank = 0, process_count = 1; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &process_count); + + string raster_fn = argv[1]; + + if (rank == 0) { + std::cout << "Creating raster " << raster_fn << std::endl; + + OGRSpatialReference srs; + char *wkt; + srs.SetFromUserInput("EPSG:4326"); + srs.exportToPrettyWkt(&wkt); + + double geotransform[6] = {1.0, 0.1, 0, 40, 0, 0.1}; + + sptw::SPTW_ERROR err = sptw::create_tiled_raster(raster_fn, RASTER_WIDTH, RASTER_HEIGHT, 1, + GDT_Byte, geotransform, wkt, TILE_SIZE); + + if (err != sptw::SP_None) { + std::cout << "Error creating raster" << std::endl; + } + } + + MPI_Barrier(MPI_COMM_WORLD); + + // We must open the raster in all the ranks + // since it is a collective operation + + std::cout << "Opening raster" << std::endl; + sptw::PTIFF* tmp = sptw::open_raster(raster_fn); + + if (rank == 0) { + std::cout << "Populating tile offsets" << std::endl; + + sptw::SPTW_ERROR err = sptw::populate_tile_offsets(tmp, TILE_SIZE); + + if (err != sptw::SP_None) { + std::cout << "Error populating tile offsets" << std::endl; + } + } + + sptw::close_raster(tmp); + + MPI_Barrier(MPI_COMM_WORLD); + + sptw::PTIFF* raster = sptw::open_raster(raster_fn); + + uint8_t tile_data[TILE_SIZE*TILE_SIZE]; + memset(tile_data, rank * 255 / process_count, TILE_SIZE*TILE_SIZE); + + int horizontal_tiles = std::ceil((double) RASTER_WIDTH / TILE_SIZE); + int vertical_tiles = std::ceil((double) RASTER_HEIGHT / TILE_SIZE); + int num_tiles = horizontal_tiles * vertical_tiles; + + int tiles_per_rank = std::ceil((double)num_tiles / process_count); + + std::cout << "Rank " << rank << " writing raster (" << tiles_per_rank << " tiles)" << std::endl; + + for(int i = 0; i < tiles_per_rank; i++) + { + int tile = i*process_count + rank; + + int x = tile % horizontal_tiles; + int y = tile / horizontal_tiles; + + x *= TILE_SIZE; + y *= TILE_SIZE; + + int w = std::min(TILE_SIZE, RASTER_WIDTH - x) - 1; + int h = std::min(TILE_SIZE, RASTER_HEIGHT - y) - 1; + + //printf("Writing (%d,%d) -> (%d, %d)\n", x, y, x+w, y+h); + sptw::write_area(raster, tile_data, x, y, x+w, y+h); + } + + MPI_Barrier(MPI_COMM_WORLD); + + sptw::close_raster(raster); + + MPI_Finalize(); + + return 0; +} diff --git a/Modules/ThirdParty/SPTW/src/sptw.cc b/Modules/ThirdParty/SPTW/src/sptw.cc new file mode 100644 index 0000000000000000000000000000000000000000..09c17238b99102278b6b43215d6b93a707a43fcb --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/sptw.cc @@ -0,0 +1,776 @@ +/*! + * Copyright 0000 <Nobody> + * @file + * @author David Matthew Mattli <dmattli@usgs.gov> + * + * @section LICENSE + * + * This software is in the public domain, furnished "as is", without + * technical support, and with no warranty, express or implied, as to + * its usefulness for any purpose. + * + * @section DESCRIPTION + * + * Implementation of the Simple Parallel Tiff Writer + * + */ + +#include <fcntl.h> +#include <gdal_priv.h> +#include <cpl_string.h> +#include <ogr_api.h> +#include <ogr_spatialref.h> +#include <mpi.h> +#include <tiff.h> +#include <tiffio.h> + +#include <algorithm> +#include <sstream> +#include <iostream> +#include <vector> + +#include "sptw.h" + +#include "utils.h" + +using std::string; +using sptw::Area; + +namespace sptw { +/* + * Return size of TIFFDataType in bytes + */ + +int get_type_size(TIFFDataType type) { + switch (type) { + case 0: + case TIFF_BYTE: + case TIFF_ASCII: + case TIFF_SBYTE: + case TIFF_UNDEFINED: + return 1; + case TIFF_SHORT: + case TIFF_SSHORT: + return 2; + case TIFF_LONG: + case TIFF_SLONG: + case TIFF_FLOAT: + case TIFF_IFD: + return 4; + case TIFF_RATIONAL: + case TIFF_SRATIONAL: + case TIFF_DOUBLE: + case TIFF_LONG8: + case TIFF_SLONG8: + case TIFF_IFD8: + return 8; + default: + return 0; /* unknown type */ + } +} + +int64_t parse_int64(uint8_t *buffer, bool big_endian) { + int64_t result = 0; + int64_t temp = 0; + + if (big_endian) { + temp = buffer[0]; + result |= temp<<56; + temp = buffer[1]; + result |= temp<<48; + temp = buffer[2]; + result |= temp<<40; + temp = buffer[3]; + result |= temp<<32; + temp = buffer[4]; + result |= temp<<24; + temp = buffer[5]; + result |= temp<<16; + temp = buffer[6]; + result |= temp<<8; + temp = buffer[7]; + result |= temp<<0; + } else { + temp = buffer[7]; + result |= temp<<56; + temp = buffer[6]; + result |= temp<<48; + temp = buffer[5]; + result |= temp<<40; + temp = buffer[4]; + result |= temp<<32; + temp = buffer[3]; + result |= temp<<24; + temp = buffer[2]; + result |= temp<<16; + temp = buffer[1]; + result |= temp<<8; + temp = buffer[0]; + result |= temp<<0; + } + + return result; +} + +int export_int64(int64_t num, uint8_t *buffer, bool big_endian) { + if (big_endian) { + buffer[0] = (num>>56); + buffer[1] = (num>>48); + buffer[2] = (num>>40); + buffer[3] = (num>>32); + buffer[4] = (num>>24); + buffer[5] = (num>>16); + buffer[6] = (num>>8); + buffer[7] = (num>>0); + } else { + buffer[7] = (num>>56); + buffer[6] = (num>>48); + buffer[5] = (num>>40); + buffer[4] = (num>>32); + buffer[3] = (num>>24); + buffer[2] = (num>>16); + buffer[1] = (num>>8); + buffer[0] = (num>>0); + } + return 0; +} + + +int16_t parse_int16(uint8_t *buffer, bool big_endian) { + if (big_endian) + return (buffer[1]<<0 | buffer[0]<<8); + else + return (buffer[0]<<0 | buffer[1]<<8); +} + +int64_t read_int64(PTIFF *tiff_file, int64_t offset, bool big_endian) { + uint8_t read_buffer[8]; + MPI_File_read_at(tiff_file->fh, + offset, + read_buffer, + sizeof(int64_t), + MPI_BYTE, + MPI_STATUS_IGNORE); + return parse_int64(read_buffer, big_endian); +} + +int write_int64(PTIFF *tiff_file, + int64_t offset, + int64_t value, + bool big_endian) { + uint8_t buffer[8]; + export_int64(value, buffer, big_endian); + MPI_File_write_at(tiff_file->fh, + offset, buffer, + sizeof(int64_t), + MPI_BYTE, + MPI_STATUS_IGNORE); + return 0; +} + +SPTW_ERROR populate_tile_offsets(PTIFF *tiff_file, + int64_t tile_size, + bool tiled = true) { + MPI_Status status; + bool big_endian = false; // Is tiff file big endian? + + // Read endianess of file + uint8_t endian_flag[2] = { 0x49, 0x49 }; + MPI_File_read_at(tiff_file->fh, 0, endian_flag, 2, MPI_BYTE, &status); + if (endian_flag[0] == 0x4d) { + big_endian = true; + } + + // Check tiff version, should be 0x002b for BigTiff + uint8_t version_data[2]; + int16_t version = 0; + MPI_File_read_at(tiff_file->fh, 2, version_data, 2, MPI_BYTE, &status); + + version = parse_int16(version_data, big_endian); + + if (version != 0x002b) { + // Wrong Tiff version ! + return SP_BadArg; + } + + // Read offset to first directory + int64_t doffset = 0; + doffset = read_int64(tiff_file, 8, big_endian); + + // Read number of directory entries + int64_t entry_count = read_int64(tiff_file, doffset, big_endian); + // directory offset + sizeof directory count + int64_t entry_offset = doffset + sizeof(int64_t); + + int64_t tile_count = 0; + + int64_t tile_size_bytes = tile_size * tiff_file->band_count + * tiff_file->band_type_size; + if (tiled) + { + tile_size_bytes *= tile_size; + } + + int64_t first_tile_offset = 0; + + for (int64_t i = 0; i < entry_count; ++i) { + // Read identifying tag of directory entry + uint8_t tag_buffer[2]; + MPI_File_read_at(tiff_file->fh, + entry_offset, + tag_buffer, + 2, + MPI_BYTE, + &status); + int16_t entry_tag = parse_int16(tag_buffer, big_endian); + + // Read count of elements in entry + int64_t element_count = read_int64(tiff_file, entry_offset+4, big_endian); + + // Read entry data + int64_t entry_data = read_int64(tiff_file, entry_offset+12, big_endian); + + // Check if directory type is TIFFTAG_TILEOFFSETS + if (entry_tag == TIFFTAG_TILEOFFSETS || entry_tag == TIFFTAG_STRIPOFFSETS) { + // Read location of first_offset + int64_t first_offset = read_int64(tiff_file, entry_data, big_endian); + first_tile_offset = first_offset; + tile_count = element_count; + + for (int64_t j = 1; j < element_count; ++j) { + write_int64(tiff_file, + entry_data+(sizeof(int64_t)*j), + first_offset+(tile_size_bytes*j), + big_endian); + } + } else if (entry_tag == TIFFTAG_TILEBYTECOUNTS || entry_tag == TIFFTAG_STRIPBYTECOUNTS) { + for (int64_t j = 1; j < element_count; ++j) { + write_int64(tiff_file, + entry_data+(sizeof(int64_t)*j), + tile_size_bytes, + big_endian); + } + } + entry_offset += 20; + } + + // Calculate end of file and write to it + uint8_t buffer[10]; + buffer[0] = 0; + int64_t file_size = (tile_count * tile_size_bytes) + first_tile_offset; + MPI_File_write_at(tiff_file->fh, file_size-1, buffer, 1, MPI_BYTE, &status); + return SP_None; +} + +SPTW_ERROR create_generic_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs, + int block_size_x, + bool tiled_mode) { + + GDALAllRegister(); + + // Get GeoTiff driver + GDALDriver *driver = GetGDALDriverManager()->GetDriverByName("GTiff"); + + if (driver == NULL) { + return SP_CreateError; + } + + // Set driver options + char **options = NULL; + options = CSLSetNameValue(options, "INTERLEAVE", "PIXEL"); + options = CSLSetNameValue(options, "BIGTIFF", "YES"); + options = CSLSetNameValue(options, "COMPRESS", "NONE"); + options = CSLSetNameValue(options, "SPARSE_OK", "YES"); + if (tiled_mode) + { + std::stringstream ts; + ts << block_size_x; + options = CSLSetNameValue(options, "TILED", "YES"); + options = CSLSetNameValue(options, "BLOCKXSIZE", ts.str().c_str()); + options = CSLSetNameValue(options, "BLOCKYSIZE", ts.str().c_str()); + } + + // Create output raster + GDALDataset *output = + driver->Create(filename.c_str(), + x_size, + y_size, + band_count, + band_type, + options); + if (output == NULL) { + fprintf(stderr, "driver->Create call failed.\n"); + return SP_CreateError; + } + + // Set GeoTransform + output->SetGeoTransform(geotransform); + + // Set projection + OGRSpatialReference out_sr; + char *wkt = NULL; + out_sr.SetFromUserInput(projection_srs.c_str()); + out_sr.exportToWkt(&wkt); + output->SetProjection(wkt); + + // Write first and last pixel in the raster + double *data = new double(sizeof(*data) * 4 * output->GetRasterCount()); + CPLErr rcode = output->RasterIO(GF_Write, + 0, + 0, + 1, + 1, + data, + 1, + 1, + output->GetRasterBand(1)->GetRasterDataType(), + output->GetRasterCount(), + NULL, + 0, + 0, + 0); + + if(rcode != CE_None) + { + delete data; + + // Clean stuff + OGRFree(wkt); + CSLDestroy(options); + GDALClose(output); + + fprintf(stderr, "Error while writing first pixel in the raster with GDAL\n"); + return SP_CreateError; + } + + + rcode = output->RasterIO(GF_Write, + x_size-1, + y_size-1, + 1, + 1, + data, + 1, + 1, + output->GetRasterBand(1)->GetRasterDataType(), + output->GetRasterCount(), + NULL, + 0, + 0, + 0); + + if(rcode != CE_None) + { + delete data; + + // Clean stuff + OGRFree(wkt); + CSLDestroy(options); + GDALClose(output); + + fprintf(stderr, "Error while writing last pixel in the raster with GDAL\n"); + return SP_CreateError; + + } + + delete data; + + // Clean stuff + OGRFree(wkt); + CSLDestroy(options); + GDALClose(output); + + return SP_None; +} + +SPTW_ERROR create_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs) { + GDALDriver *gtiff_driver = NULL; + GDALDataset *ds = NULL; + char **options = NULL; + OGRSpatialReference srs; + const char *format = "GTiff"; + + GDALAllRegister(); + + gtiff_driver = GetGDALDriverManager()->GetDriverByName(format); + + if (gtiff_driver == NULL) { + return SP_CreateError; + } + + options = CSLSetNameValue(options, "BIGTIFF", "YES"); + options = CSLSetNameValue(options, "INTERLEAVE", "PIXEL"); + options = CSLSetNameValue(options, "COMPRESS", "NONE"); + + ds = gtiff_driver->Create(filename.c_str(), + x_size, + y_size, + band_count, + band_type, + options); + // Clean up options + CSLDestroy(options); + + CPLErr err = ds->SetProjection(projection_srs.c_str()); + + if (err != CE_None) { + return SP_BadArg; + } + + ds->SetGeoTransform(geotransform); + + // Close dataset + GDALClose((GDALDatasetH) ds); + + return SP_None; +} + +SPTW_ERROR create_tiled_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs, + int64_t tile_size) { + GDALDriver *gtiff_driver = NULL; + GDALDataset *ds = NULL; + char **options = NULL; + + GDALAllRegister(); + + gtiff_driver = GetGDALDriverManager()->GetDriverByName("GTiff"); + + if (gtiff_driver == NULL) { + return SP_CreateError; + } + + std::stringstream ts; + ts << tile_size; + + options = CSLSetNameValue(options, "BIGTIFF", "YES"); + options = CSLSetNameValue(options, "INTERLEAVE", "PIXEL"); + options = CSLSetNameValue(options, "COMPRESS", "NONE"); + options = CSLSetNameValue(options, "TILED", "YES"); + options = CSLSetNameValue(options, "BLOCKXSIZE", ts.str().c_str()); + options = CSLSetNameValue(options, "BLOCKYSIZE", ts.str().c_str()); + + ds = gtiff_driver->Create(filename.c_str(), + x_size, + y_size, + band_count, + band_type, + options); + // Clean up options + CSLDestroy(options); + + CPLErr err = ds->SetProjection(projection_srs.c_str()); + + if (err != CE_None) { + return SP_BadArg; + } + + ds->SetGeoTransform(geotransform); + + // Close dataset + GDALClose((GDALDatasetH) ds); + + return SP_None; +} + +PTIFF* open_raster(string filename) { + PTIFF *ptiff = new PTIFF(); + char *c_filename = strdup(filename.c_str()); + + GDALAllRegister(); + + GDALDataset *ds = static_cast<GDALDataset*>(GDALOpen(filename.c_str(), + GA_Update)); + + if (ds == NULL) { + free(c_filename); + return NULL; + } + + ptiff->x_size = ds->GetRasterXSize(); + ptiff->y_size = ds->GetRasterYSize(); + ptiff->band_count = ds->GetRasterCount(); + ptiff->band_type = ds->GetRasterBand(1)->GetRasterDataType(); + ptiff->band_type_size = GDALGetDataTypeSize(ptiff->band_type)/8; + ptiff->first_strip_offset = -1; + ptiff->block_x_size = ptiff->x_size; + ptiff->block_y_size = ptiff->y_size; + + GDALClose(ds); + + TIFF *tiffds = TIFFOpen(c_filename, "r"); + free(c_filename); + + if (tiffds == NULL) { + fprintf(stderr, "Couldn't open tiff file\n"); + return NULL; + } + + // Attempt to read TileWidth tag. If not found we assume file to have strips + // instead. + int64_t *offset = NULL; + int64_t tiles_per_image = -1; + int64_t *tiff_offsets = NULL; + + int ret = 1; + ret &= TIFFGetField(tiffds, TIFFTAG_TILEWIDTH, &(ptiff->block_x_size)); + ret &= TIFFGetField(tiffds, TIFFTAG_TILELENGTH, &(ptiff->block_y_size)); + ret &= TIFFGetField(tiffds, TIFFTAG_TILEOFFSETS, &offset); + + if (ret == 1) { /* for tiled tiff */ + ptiff->tiles_across = (ptiff->x_size + + ptiff->block_x_size - 1) / ptiff->block_x_size; + ptiff->tiles_down = (ptiff->y_size + + ptiff->block_y_size - 1) / ptiff->block_y_size; + tiles_per_image = ptiff->tiles_across * ptiff->tiles_down; + ptiff->tile_offsets = new int64_t[tiles_per_image]; + if (ptiff->tile_offsets == NULL) { + // Allocation Fail! + return NULL; + } + ret = TIFFGetField(tiffds, TIFFTAG_TILEOFFSETS, &tiff_offsets); + memcpy(ptiff->tile_offsets, + tiff_offsets, + sizeof(int64_t) * tiles_per_image); + } else if (ret != 1) { /* for striped tiff */ + ret = TIFFGetField(tiffds, TIFFTAG_STRIPOFFSETS, &offset); + if (ret != 1) { + fprintf(stderr, "Error reading strip offsets!\n"); + return NULL; + } + ptiff->first_strip_offset = *offset; + ptiff->tiles_across = 1; + ptiff->tiles_down = ptiff->y_size; + ptiff->block_y_size = 1; + + // add by Remi for striped images + tiles_per_image = ptiff->tiles_across * ptiff->tiles_down; + ptiff->tile_offsets = new int64_t[tiles_per_image]; + for (int i = 0 ; i < ptiff->y_size ; i++) + { + ptiff->tile_offsets[i] = offset[0] + i*(ptiff->band_count)*(ptiff->band_type_size)*ptiff->block_x_size; + } + + } + + ptiff->first_strip_offset = *offset; + + TIFFClose(tiffds); + + c_filename = strdup(filename.c_str()); + int rc = MPI_File_open(MPI_COMM_WORLD, + c_filename, + MPI_MODE_RDWR, + MPI_INFO_NULL, + &(ptiff->fh)); + + if (rc != MPI_SUCCESS) { + char *errstr = static_cast<char*>(malloc(5000)); + int errlen = 0; + MPI_Error_string(rc, errstr, &errlen); + fprintf(stderr, + "MPI_File: Error opening file: %s: %s\n", + c_filename, + errstr); + + free(c_filename); + free(errstr); + return NULL; + } + + MPI_File_set_atomicity(ptiff->fh, 0); + + if (c_filename != NULL) { + free(c_filename); + } + + return ptiff; +} + +SPTW_ERROR close_raster(PTIFF *ptiff) { + MPI_File_close(&(ptiff->fh)); + delete ptiff; + return SP_None; +} + +SPTW_ERROR fill_stack(std::vector<Area> *write_stack, + Area old_area, + Area written_subset) { + const double size_below = old_area.lr.y - written_subset.lr.y; + const double size_right = old_area.lr.x - written_subset.lr.x; + + if (size_right > 0.0) { + write_stack->push_back(Area(written_subset.lr.x + 1, + old_area.ul.y, + old_area.lr.x, + old_area.lr.y)); + } + + if (size_below > 0.0) { + write_stack->push_back(Area(old_area.ul.x, + written_subset.lr.y + 1, + written_subset.lr.x, + old_area.lr.y)); + } + return SP_None; +} + +Area calculate_tile_intersection(PTIFF *tiff_file, + Area subset) { + const double tile_x_beginning = (static_cast<int64_t>(subset.ul.x) + / tiff_file->block_x_size) + * tiff_file->block_x_size; + const double tile_y_beginning = (static_cast<int64_t>(subset.ul.y) + / tiff_file->block_y_size) + * tiff_file->block_y_size; + const double tile_x_end = tile_x_beginning + tiff_file->block_x_size - 1; + const double tile_y_end = tile_y_beginning + tiff_file->block_y_size - 1; + const double subset_lr_x = std::min(tile_x_end, subset.lr.x); + const double subset_lr_y = std::min(tile_y_end, subset.lr.y); + + return Area(subset.ul.x, + subset.ul.y, + subset_lr_x, + subset_lr_y); +} + +int64_t calculate_file_offset(PTIFF *tiff, + const int64_t raster_x, + const int64_t raster_y) { + const int64_t tile_x = raster_x % tiff->block_x_size; + const int64_t tile_y = raster_y % tiff->block_y_size; + const int64_t offset_into_tile = (tile_x + (tile_y * tiff->block_x_size)) + * tiff->band_type_size + * tiff->band_count; + const int64_t tile_index = (raster_x / tiff->block_x_size) + + (raster_y / tiff->block_y_size) * tiff->tiles_across; + + const int64_t tiles_per_image = tiff->tiles_across * tiff->tiles_down; + + if (tile_index > tiles_per_image) { + std::cerr << "SPTW: Writing outside of file bounds! Corruption will occur." << std::endl; + } + + return tiff->tile_offsets[tile_index] + offset_into_tile; +} + +SPTW_ERROR write_subset(PTIFF *tiff_file, + void *data, + int64_t buffer_ul_x, + int64_t buffer_ul_y, + int64_t buffer_lr_x, + int64_t buffer_lr_y, + int64_t write_ul_x, + int64_t write_ul_y, + int64_t write_lr_x, + int64_t write_lr_y) { + const double tile_x_beginning = (write_ul_x / tiff_file->block_x_size) + * tiff_file->block_x_size; + const double tile_x_end = tile_x_beginning + tiff_file->block_x_size - 1; + int count = 0; + MPI_Status status; + + if (write_ul_x == tile_x_beginning + && write_lr_x == tile_x_end) { + // Area to be written is same width as tile, write area with single + // operation + count = ((write_lr_x - write_ul_x + 1) * (write_lr_y - write_ul_y + 1) + * tiff_file->band_type_size * tiff_file->band_count); + // Size in bytes of a row of the section of buffer being output + const int sub_row_size = (write_lr_x - write_ul_x + 1) + * tiff_file->band_type_size * tiff_file->band_count; + + char *buffer = new(std::nothrow) char[count]; + for (int y = write_ul_y; y <= write_lr_y; ++y) { + int pixel_offset = ((y - buffer_ul_y) * (buffer_lr_x - buffer_ul_x + 1) + + (write_ul_x - buffer_ul_x)) + * tiff_file->band_type_size * tiff_file->band_count; + + memcpy(buffer+((y-write_ul_y)*sub_row_size), + static_cast<char*>(data)+pixel_offset, + sub_row_size); + } + MPI_File_write_at(tiff_file->fh, + calculate_file_offset(tiff_file, write_ul_x, write_ul_y), + buffer, + count, + MPI_BYTE, + &status); + delete[] buffer; + } else { + // Subset of the buffer must be written row by row + count = (write_lr_x - write_ul_x + 1) + * tiff_file->band_type_size + * tiff_file->band_count; + + for (int y = write_ul_y; y <= write_lr_y; ++y) { + int pixel_offset = ((y - buffer_ul_y) * (buffer_lr_x - buffer_ul_x + 1) + + (write_ul_x - buffer_ul_x)) + * tiff_file->band_type_size * tiff_file->band_count; + MPI_File_write_at(tiff_file->fh, + calculate_file_offset(tiff_file, write_ul_x, y), + (static_cast<char*>(data)) + pixel_offset, + count, + MPI_BYTE, + &status); + } + } + return SP_None; +} + +SPTW_ERROR write_area(PTIFF *ptiff, + void *data, + int64_t ul_x, + int64_t ul_y, + int64_t lr_x, + int64_t lr_y) { + std::vector<Area> write_stack; + Area write_area; + write_area.ul = sptw::Coordinate(ul_x, ul_y, sptw::UNDEF); + write_area.lr = sptw::Coordinate(lr_x, lr_y, sptw::UNDEF); + + write_stack.push_back(write_area); + + while (!write_stack.empty()) { + // Pop area needing write from top of stack + Area top = write_stack.back(); + write_stack.pop_back(); + + // Calculate subset of write area that is within the UL tile + Area subset = calculate_tile_intersection(ptiff, top); + + // Fill the stack with any leftover areas + fill_stack(&write_stack, top, subset); + + // Finally write the tile-bound subset + write_subset(ptiff, + data, + ul_x, + ul_y, + lr_x, + lr_y, + subset.ul.x, + subset.ul.y, + subset.lr.x, + subset.lr.y); + } + return SP_None; +} +} diff --git a/Modules/ThirdParty/SPTW/src/sptw.h b/Modules/ThirdParty/SPTW/src/sptw.h new file mode 100644 index 0000000000000000000000000000000000000000..a018b26f403a5e156bebf8c1543f35fddd241bf7 --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/sptw.h @@ -0,0 +1,157 @@ +/*! + * Copyright 0000 <Nobody> + * @file + * @author David Matthew Mattli <dmattli@usgs.gov> + * + * @section LICENSE + * + * This software is in the public domain, furnished "as is", without + * technical support, and with no warranty, express or implied, as to + * its usefulness for any purpose. + * + * @section DESCRIPTION + * + * Header for the Simple Parallel Tiff Writer + * + */ + + +#ifndef SRC_DEMOS_SPTW_H_ +#define SRC_DEMOS_SPTW_H_ + +#include <gdal_priv.h> +#include <mpi.h> + +#include <string> +#if HAVE_STDINT_H == 0 +#include <cstdint> +#else +#include <stdint.h> +#endif + +using std::string; + +/*! Simple parallel tiff writer namespace + * + * The functions declared here allow certain tiff files to be written to in + * parallel by multiple processors by MPI-IO. + * + * Sequential consistency is guaranteed if the tiff file being written to is + * stored row-wise, uses pixel interleaving and has its strips store + * sequentially in the file, and no process writes to the same pixel + * values. Files created with the create_raster function or with the + * librasterblaster::ProjectedRaster::CreateRaster function should have the + * required attributes. + * + * Two functions are provided to write to tiff files: write_rows and + * ::write_subrow . write_rows allows multiple rows to be written at + * once. ::write_subrows writes a portion of a row. + * + */ +namespace sptw { + /*! + * This enum lists the possible errors used by sptw. + */ + enum SPTW_ERROR { + SP_None, /*!< No Error occurred */ + SP_CreateError, /*!< Error creating the file */ + SP_WriteError, /*!< Error Writing to the file */ + SP_BadArg, /*!< A bad argument was provided */ + }; + + /** + * @struct PTIFF sptw.h + * @brief PTIFF struct represents an open parallel tiff file + * + * + * + */ + struct PTIFF { + /*! MPI-IO file handle. This should be changed with open_raster or + * close_raster */ + MPI_File fh; + /*! Size of the opened raster in the x dimension */ + int64_t x_size; + /*! Size of the opened raster in the y dimension */ + int64_t y_size; + /*! Number of bands in the raster */ + int band_count; + /*! Datatype of the band values */ + GDALDataType band_type; + /*! Size in bytes of the band_type */ + int band_type_size; + /*! Byte offset to the first strip of the tiff file */ + int64_t first_strip_offset; + int64_t *tile_offsets; + /*! Width of each tile */ + int64_t block_x_size; + /* Height of each tile or strip */ + int64_t block_y_size; + /* Number of tiles across raster */ + int64_t tiles_across; + /* Number of tiles down raster */ + int64_t tiles_down; + }; + + SPTW_ERROR populate_tile_offsets(PTIFF *tiff_file, + int64_t tile_size, + bool tiled); + + SPTW_ERROR create_generic_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs, + int block_size_x, + bool tiled_mode); + + SPTW_ERROR create_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs); + + SPTW_ERROR create_tiled_raster(string filename, + int64_t x_size, + int64_t y_size, + int band_count, + GDALDataType band_type, + double *geotransform, + string projection_srs, + int64_t tile_size); + PTIFF* open_raster(string filename); + SPTW_ERROR close_raster(PTIFF *ptiff); + + /** + * @brief + * This function writes the given buffer to the open PTIFF. The + * area to be written is specified by the bounding box, in y-down, + * raster coordinates. The bounding box coordinates are inclusive, + * the point (lr_x, lr_y) will be written. + * + * @param ptiff The open PTIFF file to be written to + * @param data buffer containing, row-wise, pixel interleaved data to be + * written to the file + * @param ul_x Upper-left, inclusive, y-down, x coordinate of the area to be + * written + * @param ul_y Upper-left, inclusive, y-down, y coordinate of the area to be + * written + * @param lr_x Lower-right, inclusive, y-down, x coordinate of the area to be + * written + * @param _y Lower-right, inclusive, y-down, y coordinate of the area to be + * written + * + */ + SPTW_ERROR write_area(PTIFF *ptiff, + void *data, + int64_t ul_x, + int64_t ul_y, + int64_t lr_x, + int64_t lr_y); +} + +#endif // SRC_DEMOS_SPTW_H_ diff --git a/Modules/ThirdParty/SPTW/src/utils.h b/Modules/ThirdParty/SPTW/src/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0e780e8fa5838896a5e0bfc8ecb4152e0867324e --- /dev/null +++ b/Modules/ThirdParty/SPTW/src/utils.h @@ -0,0 +1,98 @@ +/** + * Copyright 0000 <Nobody> + * @file + * @author David Matthew Mattli <dmattli@usgs.gov> + * + * @section LICENSE + * + * This software is in the public domain, furnished "as is", without + * technical support, and with no warranty, express or implied, as to + * its usefulness for any purpose. + * + * @section DESCRIPTION + * + * Helper utilities and definitions + * + */ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +#include <cmath> + +namespace sptw { + /** An enum of possible return values */ + enum PRB_ERROR { + PRB_NOERROR, /*!< No error occurred */ + PRB_IOERROR, /*!< Error communicating or performing file I/O */ + PRB_BADARG, /*!< Bad argument provided */ + PRB_PROJERROR, /*!< Error with projection specification */ + }; + + enum ProjUnit { + UNDEF = -1, + RADIAN = 0, // Radians + FEET, // Feet + METER, // Meters + SECOND, // Seconds + DEGREE, // Decimal Degrees + INT_FEET // International Feet + }; + + /*! Coordinate struct + This class provides a more readable way of storing and passing coordinate + parameters for the Transformer class. It stores x and y as doubles and units + corresponds to the GCTP enumeration as defined in constants.h + */ + struct Coordinate { + /*! Default Constructor + 0's all attributes. + */ + Coordinate():x(0.0), y(0.0), units(UNDEF) {} + /*! Full Constructor + Sets all attributes in the Coordinate according to the parameters. + */ + Coordinate(double xx, double yy, ProjUnit uunits) + : x(xx), y(yy), units(uunits) {} + + /*! Copy Constructor + Sets all attributes to equal those in Coordinate c. + */ + Coordinate(const Coordinate &c): x(c.x), y(c.y), units(c.units) {} + + double x; + double y; + ProjUnit units; + }; + + /** + * @class + */ + struct Area { + /// A constructor + /** + * @brief This constructor initializes points to zero. + */ + Area():ul(), lr(), units(UNDEF) {} + /// A constructor + /** + * @brief This constructor allows both coordinates to be given initial values. + * @param ulx Value for the upper-left x + * @param uly Value for the upper-left y + * @param ulx Value for the lower-right x + * @param ulx Value for the lower-right y + */ + Area(double ulx, + double uly, + double lrx, + double lry) : ul(ulx, uly, UNDEF), lr(lrx, lry, UNDEF), units(UNDEF) {} + /// Upper-left coordinate of area + Coordinate ul; + /// Lower-right coordinate of area + Coordinate lr; + /// Units used in ul and lr coordinates + ProjUnit units; + }; +} + +#endif// _UTILS_H_ diff --git a/Modules/ThirdParty/SiftFast/src/otb_siftfast.h b/Modules/ThirdParty/SiftFast/src/otb_siftfast.h index 6341da75cea128133d58bfa951a4ecf65da24583..945b6f7c3530073790781bf859c7b911f32b6510 100644 --- a/Modules/ThirdParty/SiftFast/src/otb_siftfast.h +++ b/Modules/ThirdParty/SiftFast/src/otb_siftfast.h @@ -15,7 +15,7 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otb_siftfast_h +#ifndef otb_siftfast_h #include "otbsiftfast/siftfast.h" diff --git a/Modules/ThirdParty/TinyXML/src/otb_tinyxml.h.in b/Modules/ThirdParty/TinyXML/src/otb_tinyxml.h.in index 697561a2e466844d8b01de95e64904fe689c19f2..25792783b5d057b4e6ecb11092ef3d3bae2a171f 100644 --- a/Modules/ThirdParty/TinyXML/src/otb_tinyxml.h.in +++ b/Modules/ThirdParty/TinyXML/src/otb_tinyxml.h.in @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otb_tinyxml_h -#define __otb_tinyxml_h +#ifndef otb_tinyxml_h +#define otb_tinyxml_h #ifndef TIXML_USE_STL #cmakedefine TIXML_USE_STL diff --git a/Modules/Visualization/Ice/include/otbFragmentShader.h b/Modules/Visualization/Ice/include/otbFragmentShader.h index 6a33fa95fe453f91929a47fe2f3af363253c0d84..2be27f07fcf60d837d523ed12e176c335efab87a 100644 --- a/Modules/Visualization/Ice/include/otbFragmentShader.h +++ b/Modules/Visualization/Ice/include/otbFragmentShader.h @@ -53,7 +53,7 @@ public: protected: FragmentShader(); - virtual ~FragmentShader(); + ~FragmentShader() ITK_OVERRIDE; void BuildShader(); diff --git a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h b/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h index 8f1e4b2fe25928405af5eb1f7a728908f7b08e33..d8f9d5d39817105935cc7cadf70bbbcb96ba8b83 100644 --- a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h +++ b/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h @@ -52,7 +52,7 @@ public: protected: FragmentShaderRegistry(); - virtual ~FragmentShaderRegistry(); + ~FragmentShaderRegistry() ITK_OVERRIDE; private: typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ShaderMapType; diff --git a/Modules/Visualization/Ice/include/otbGlActor.h b/Modules/Visualization/Ice/include/otbGlActor.h index 3b73e2135be33375bf2bdca35d770a1c553fe09c..797ed995c15fb36646e70e98767dcc0c9fbcfb96 100644 --- a/Modules/Visualization/Ice/include/otbGlActor.h +++ b/Modules/Visualization/Ice/include/otbGlActor.h @@ -70,7 +70,7 @@ public: protected: GlActor(); - virtual ~GlActor(); + ~GlActor() ITK_OVERRIDE; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbGlImageActor.h b/Modules/Visualization/Ice/include/otbGlImageActor.h index 5e6e7a744415e5afe3878fedbd07d759a09128cc..618185de68c12aa0bcb2cb7a853814cce898cc28 100644 --- a/Modules/Visualization/Ice/include/otbGlImageActor.h +++ b/Modules/Visualization/Ice/include/otbGlImageActor.h @@ -77,16 +77,16 @@ public: void Initialize(const std::string & filename); // Retrieve the full extent of the actor - virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; // Update internal actor state with respect to ViewSettings - virtual void ProcessViewSettings(); + void ProcessViewSettings() ITK_OVERRIDE; // Heavy load/unload operations of data - virtual void UpdateData(); + void UpdateData() ITK_OVERRIDE; // Gl rendering of current state - virtual void Render(); + void Render() ITK_OVERRIDE; // Automatic color adjustment void AutoColorAdjustment( double & minRed, double & maxRed, @@ -98,15 +98,15 @@ public: const PointType & GetOrigin() const; - virtual const GeoInterface::Spacing2 & GetSpacing() const; + const GeoInterface::Spacing2 & GetSpacing() const ITK_OVERRIDE; - virtual std::string GetWkt() const; + std::string GetWkt() const ITK_OVERRIDE; ImageKeywordlistType GetKwl() const; - virtual bool HasKwl() const; + bool HasKwl() const ITK_OVERRIDE; - bool GetKwl( ImageKeywordlist & ) const; + bool GetKwl( ImageKeywordlist & ) const ITK_OVERRIDE; MetaDataDictionaryType & GetMetaDataDictionary() const; @@ -186,13 +186,13 @@ public: // otb::GlActor overloads. // - virtual bool TransformFromViewport( Point2d & out, + bool TransformFromViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const; + bool isPhysical = true ) const ITK_OVERRIDE; - virtual bool TransformToViewport( Point2d & out, + bool TransformToViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const; + bool isPhysical = true ) const ITK_OVERRIDE; void UpdateTransforms(); @@ -200,7 +200,7 @@ public: protected: GlImageActor(); - virtual ~GlImageActor(); + ~GlImageActor() ITK_OVERRIDE; typedef ImageFileReader<VectorImageType> ReaderType; typedef MultiChannelExtractROI<float,float> ExtractROIFilterType; @@ -226,7 +226,7 @@ protected: m_RedIdx(1), m_GreenIdx(2), m_BlueIdx(3), - m_RescaleFilter(NULL) + m_RescaleFilter(ITK_NULLPTR) { m_UL.Fill(0); m_UR.Fill(0); diff --git a/Modules/Visualization/Ice/include/otbGlROIActor.h b/Modules/Visualization/Ice/include/otbGlROIActor.h index 910777a24748967acf2f965142ff411857fe6ef7..469a0923bc55cbee69e57bffe3e49e5f93c20d72 100644 --- a/Modules/Visualization/Ice/include/otbGlROIActor.h +++ b/Modules/Visualization/Ice/include/otbGlROIActor.h @@ -46,16 +46,16 @@ public: itkNewMacro(Self); // Retrieve the full extent of the actor - virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; // Update internal actor state with respect to ViewSettings - virtual void ProcessViewSettings(); + void ProcessViewSettings() ITK_OVERRIDE; // Heavy load/unload operations of data - virtual void UpdateData(); + void UpdateData() ITK_OVERRIDE; // Gl rendering of current state - virtual void Render(); + void Render() ITK_OVERRIDE; void SetUL( const PointType & ); @@ -84,7 +84,7 @@ public: protected: GlROIActor(); - virtual ~GlROIActor(); + ~GlROIActor() ITK_OVERRIDE; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbGlVectorActor.h b/Modules/Visualization/Ice/include/otbGlVectorActor.h index e833ae65af4de8b622ba12e689f07ae0037162b7..f36e99d4cfcfc4d714279627c2f35751d722fb40 100644 --- a/Modules/Visualization/Ice/include/otbGlVectorActor.h +++ b/Modules/Visualization/Ice/include/otbGlVectorActor.h @@ -64,19 +64,19 @@ public: void SetCurrentLayer(const std::string & layername); // Retrieve the full extent of the actor - virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; // Return actor extent in its own geometry void GetBoundingBox(double & ulx, double & uly, double & lrx, double & lry) const; // Update internal actor state with respect to ViewSettings - virtual void ProcessViewSettings(); + void ProcessViewSettings() ITK_OVERRIDE; // Heavy load/unload operations of data - virtual void UpdateData(); + void UpdateData() ITK_OVERRIDE; // Gl rendering of current state - virtual void Render(); + void Render() ITK_OVERRIDE; PointType ViewportToVectorTransform(const PointType & point) const; @@ -103,21 +103,21 @@ public: itkSetMacro(LineWidth,double); itkGetConstReferenceMacro(LineWidth,double); - std::string GetWkt() const; + std::string GetWkt() const ITK_OVERRIDE; // // otb::GlActor overloads. // - virtual bool TransformFromViewport( Point2d & out, + bool TransformFromViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const; + bool isPhysical = true ) const ITK_OVERRIDE; protected: GlVectorActor(); - virtual ~GlVectorActor(); + ~GlVectorActor() ITK_OVERRIDE; // Internal class to hold tiles diff --git a/Modules/Visualization/Ice/include/otbGlView.h b/Modules/Visualization/Ice/include/otbGlView.h index 4538835ec7a0d238059402307c2560db438154eb..1383e6a12757621e13ff09145d6c543646803c29 100644 --- a/Modules/Visualization/Ice/include/otbGlView.h +++ b/Modules/Visualization/Ice/include/otbGlView.h @@ -104,7 +104,7 @@ public: void Initialize(unsigned int sx, unsigned int sy); /** - * This method allows to add a new actor (deriving from GlActor) to + * This method allows adding a new actor (deriving from GlActor) to * the GlView. The actor can be identified by an optional key. If * not provided, and the default value is used, the method will * generate a key to identify the actor. In both case, the key is @@ -132,7 +132,7 @@ public: void ClearActors(); /** - * This method allows to retrieve a pointer to the actor identified + * This method allows retrieving a pointer to the actor identified * by the given key. * \param key The key identifying the actor to retrieve * \return A pointer to the retrieved actor. This pointer will be @@ -236,7 +236,7 @@ public: /** */ template< typename P > - bool GetExtent( P & origin, P & extent, bool isOverlay =false ) const; + size_t GetExtent( P & origin, P & extent, bool isOverlay =false ) const; /** */ @@ -277,7 +277,7 @@ public: protected: GlView(); - virtual ~GlView(); + ~GlView() ITK_OVERRIDE; private: // prevent implementation @@ -325,7 +325,7 @@ GlView const otb::GeoInterface * geo = dynamic_cast< const GeoInterface * >( actor.GetPointer() ); - if( geo==NULL ) + if( geo==ITK_NULLPTR ) return false; @@ -416,7 +416,7 @@ GlView template< typename P > -bool +size_t GlView ::GetExtent( P & origin, P & extent, bool isOverlay ) const { @@ -425,7 +425,7 @@ GlView origin.Fill( 0 ); extent.Fill( 0 ); - return false; + return 0; } @@ -435,6 +435,8 @@ GlView extent[ 0 ] = -std::numeric_limits< typename P::ValueType >::infinity(); extent[ 1 ] = -std::numeric_limits< typename P::ValueType >::infinity(); + size_t count = 0; + for( ActorMapType::const_iterator it( m_Actors.begin() ); it!=m_Actors.end(); ++it ) @@ -476,10 +478,18 @@ GlView if( e[ 1 ]>extent[ 1 ] ) extent[ 1 ] = e[ 1 ]; + + ++ count; } } - return true; + if( count==0 ) + { + origin.Fill( 0 ); + extent.Fill( 0 ); + } + + return count; } @@ -495,7 +505,7 @@ GlView e.Fill( 0 ); // Get origin and extent of all layers in viewport system. - if( !GetExtent( o, e ) ) + if( GetExtent( o, e )==0 ) return false; // std::cout << "origin: [ " << o[ 0 ] << ", " << o[ 1 ] << " ]" << std::endl; @@ -544,9 +554,9 @@ GlView // std::cout // << std::hex << this << std::dec // << "::ZoomToRegion( " - // << "[ " << origin[ 0 ] << ", " << origin[ 1 ] << "], " - // << "[ " << extent[ 0 ] << ", " << extent[ 1 ] << "], " - // << "[ " << native[ 0 ] << ", " << native[ 1 ] << "] )" + // << "[" << origin[ 0 ] << ", " << origin[ 1 ] << "], " + // << "[" << extent[ 0 ] << ", " << extent[ 1 ] << "], " + // << "[" << native[ 0 ] << ", " << native[ 1 ] << "] )" // << std::endl; // Compute center point. @@ -619,7 +629,7 @@ GlView const GeoInterface * geo = dynamic_cast< const GeoInterface * >( actor.GetPointer() ); - if( geo==NULL ) + if( geo==ITK_NULLPTR ) return false; // Get viewport current center and spacing. diff --git a/Modules/Visualization/Ice/include/otbImageSettings.h b/Modules/Visualization/Ice/include/otbImageSettings.h index 16b2de0deab33cb3e001b6f75fe36edca56c3b5f..fadf4000d55bfa70937180948c486af554a298cd 100644 --- a/Modules/Visualization/Ice/include/otbImageSettings.h +++ b/Modules/Visualization/Ice/include/otbImageSettings.h @@ -78,7 +78,7 @@ public: protected: ImageSettings(); - virtual ~ImageSettings(); + ~ImageSettings() ITK_OVERRIDE; private: diff --git a/Modules/Visualization/Ice/include/otbStandardShader.h b/Modules/Visualization/Ice/include/otbStandardShader.h index 3ce2d7863f3289394c1569e698c9512c60808fc7..551264ed884cc36000adedc8354c08358a7bf5a7 100644 --- a/Modules/Visualization/Ice/include/otbStandardShader.h +++ b/Modules/Visualization/Ice/include/otbStandardShader.h @@ -78,18 +78,18 @@ public: itkSetMacro(Center,PointType); itkGetConstReferenceMacro(Center,PointType); - virtual void SetupShader(); + void SetupShader() ITK_OVERRIDE; itkNewMacro(Self); protected: StandardShader(); - virtual ~StandardShader(); + ~StandardShader() ITK_OVERRIDE; - virtual std::string GetSource() const; + std::string GetSource() const ITK_OVERRIDE; - virtual std::string GetName() const; + std::string GetName() const ITK_OVERRIDE; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbViewSettings.h b/Modules/Visualization/Ice/include/otbViewSettings.h index 14d28bc8e4e07f4085dfe16095962d94810038d1..82dac52ef08a4d1cccae8e544f433cca9ac7cdc5 100644 --- a/Modules/Visualization/Ice/include/otbViewSettings.h +++ b/Modules/Visualization/Ice/include/otbViewSettings.h @@ -53,6 +53,8 @@ public: itkSetMacro(ViewportSize,SizeType); itkGetConstReferenceMacro(ViewportSize,SizeType); + void Reset(); + void SetRotationCenter(const PointType & center) { m_RotationCenter = center; @@ -141,22 +143,22 @@ public: protected: ViewSettings(); - virtual ~ViewSettings(); + ~ViewSettings() ITK_OVERRIDE; private: // prevent implementation ViewSettings(const Self&); void operator=(const Self&); - PointType m_Origin; + PointType m_Origin; SpacingType m_Spacing; - SizeType m_ViewportSize; + SizeType m_ViewportSize; std::string m_Wkt; KeywordListType m_KeywordList; - bool m_UseProjection; - bool m_GeometryChanged; - PointType m_RotationCenter; - double m_RotationAngle; + PointType m_RotationCenter; + double m_RotationAngle; + bool m_UseProjection : 1; + bool m_GeometryChanged : 1; }; // End class ViewSettings diff --git a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx b/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx index 6cc5b293ccca85eae27c9a875b90a63cc92d6336..d0265c5fe66bb2a75272675a75b1bef053449709 100644 --- a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx +++ b/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx @@ -56,7 +56,7 @@ void FragmentShaderRegistry::RegisterShader(const std::string& name, const std:: const char * source_cstr = source.c_str(); - glShaderSource(shader, 1, &source_cstr,NULL); + glShaderSource(shader, 1, &source_cstr,ITK_NULLPTR); glCompileShader(shader); GLint compiled; @@ -75,7 +75,7 @@ void FragmentShaderRegistry::RegisterShader(const std::string& name, const std:: delete [] logs; // For safety! - logs = NULL; + logs = ITK_NULLPTR; // Shader must be destroyed here! glDeleteShader( shader ); diff --git a/Modules/Visualization/Ice/src/otbGlVectorActor.cxx b/Modules/Visualization/Ice/src/otbGlVectorActor.cxx index d16f27579b83f77cf9b61e6f9ab0c65796fc922c..d707d63846a346318dff778c890219659179b868 100644 --- a/Modules/Visualization/Ice/src/otbGlVectorActor.cxx +++ b/Modules/Visualization/Ice/src/otbGlVectorActor.cxx @@ -207,8 +207,8 @@ void GlVectorActor::SetCurrentLayer(const std::string & layername) m_CurrentLayer = m_OGRDataSource->GetLayerChecked(layername).GetName(); // Clear transforms - m_VectorToViewportTransform = NULL; - m_ViewportToVectorTransform = NULL; + m_VectorToViewportTransform = ITK_NULLPTR; + m_ViewportToVectorTransform = ITK_NULLPTR; // Clear features m_InternalFeatures.clear(); @@ -368,7 +368,7 @@ void GlVectorActor::UpdateData() { std::ostringstream oss; oss<<"SELECT * FROM "<<m_CurrentLayer<<" WHERE OGR_GEOM_AREA>"<<100*areaOfScreenPixel; - filtered = m_OGRDataSource->ExecuteSQL(oss.str(), &spatialFilter,NULL); + filtered = m_OGRDataSource->ExecuteSQL(oss.str(), &spatialFilter,ITK_NULLPTR); } m_InternalFeatures.clear(); @@ -424,7 +424,7 @@ void GeometryRender(const OGRPolygon * in, GLUtesselator * tesselator, bool fill gluTessProperty(tesselator, GLU_TESS_BOUNDARY_ONLY, !fill); // Begin a new polygon - gluTessBeginPolygon(tesselator, NULL); + gluTessBeginPolygon(tesselator, ITK_NULLPTR); // Render the outer boundary gluTessBeginContour(tesselator); @@ -470,7 +470,7 @@ void GeometryRender(const OGRPolygon * in, GLUtesselator * tesselator, bool fill gluTessProperty(tesselator, GLU_TESS_BOUNDARY_ONLY, true); // Begin a new polygon - gluTessBeginPolygon(tesselator, NULL); + gluTessBeginPolygon(tesselator, ITK_NULLPTR); // Render the outer boundary gluTessBeginContour(tesselator); diff --git a/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx b/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx index 5ed75842efe7ea1bf23318c47dcd1ce6cb042672..e881c803880c121c6a91b0b1c5d52f4574e8fc4e 100644 --- a/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx +++ b/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx @@ -27,6 +27,8 @@ #include <cstring> #include <cstdlib> +#include "itkMacro.h" + namespace otb { @@ -39,7 +41,7 @@ GlVersionChecker { const GLubyte * glVersionStr = glGetString( GL_VERSION ); - if( glVersionStr==NULL ) + if( glVersionStr==ITK_NULLPTR ) { std::ostringstream oss; @@ -60,7 +62,7 @@ GlVersionChecker { const GLubyte * slVersionStr = glGetString( GL_SHADING_LANGUAGE_VERSION ); - if( slVersionStr==NULL ) + if( slVersionStr==ITK_NULLPTR ) { std::ostringstream oss; @@ -85,7 +87,7 @@ GlVersionChecker // If OpenGL version is at least 2.0, get (and return) GLSL version // (before checking against OpenGL required version). if( GlVersionChecker::VerCmp( glVersion, "2.0" )<0 ) - glslVersion = NULL; + glslVersion = ITK_NULLPTR; else glslVersion = GlVersionChecker::GLSLVersion(); @@ -113,7 +115,7 @@ GlVersionChecker { // // Special case: empty strings returns 0.0.0 and true. - if( version==NULL || strlen( version )==0 ) + if( version==ITK_NULLPTR || strlen( version )==0 ) { major = 0; minor = 0; @@ -142,7 +144,7 @@ GlVersionChecker const char * minorStr = strchr( version, '.' ); - if( minorStr==NULL ) + if( minorStr==ITK_NULLPTR ) return false; minor = atoi( ++minorStr ); @@ -156,7 +158,7 @@ GlVersionChecker // In this case, it is Ok to return because version of the form // Major.minor are handled. - if( releaseStr==NULL ) + if( releaseStr==ITK_NULLPTR ) return true; release = atoi( ++releaseStr ); diff --git a/Modules/Visualization/Ice/src/otbGlView.cxx b/Modules/Visualization/Ice/src/otbGlView.cxx index cb4a287d90a0043cd92cdbb3b6371bcb9feae2f7..05bbcf788cb003af8127f7cd3b2ce0df7d378d59 100644 --- a/Modules/Visualization/Ice/src/otbGlView.cxx +++ b/Modules/Visualization/Ice/src/otbGlView.cxx @@ -55,7 +55,6 @@ void GlView::Initialize(unsigned int sx, unsigned int sy) this->ClearActors(); this->Resize(sx,sy); - } void GlView::Resize(unsigned int sx, unsigned int sy) @@ -461,7 +460,7 @@ GlView } delete[] glBuffer; - glBuffer = NULL; + glBuffer = ITK_NULLPTR; // // Setup import RGBA-image filter. diff --git a/Modules/Visualization/Ice/src/otbStandardShader.cxx b/Modules/Visualization/Ice/src/otbStandardShader.cxx index b82b7699547f5b65fa971c4840f33c6362f30022..66e4817f56f9e2bbb84c897e298f5cfcf6aa73b1 100644 --- a/Modules/Visualization/Ice/src/otbStandardShader.cxx +++ b/Modules/Visualization/Ice/src/otbStandardShader.cxx @@ -46,8 +46,8 @@ StandardShader::~StandardShader() std::string StandardShader::GetSource() const { - const char * glVersion = NULL; - const char * glslVersion = NULL; + const char * glVersion = ITK_NULLPTR; + const char * glslVersion = ITK_NULLPTR; if(!otb::GlVersionChecker::CheckGLCapabilities( glVersion, glslVersion)) { itkExceptionMacro(<<" Required GL and GLSL versions were not found (GL version is "<<glVersion<<", should be at least "<<otb::GlVersionChecker::REQUIRED_GL_VERSION<<", GLSL version is "<<glslVersion<<", should be at least "<<otb::GlVersionChecker::REQUIRED_GLSL_VERSION<<")"); diff --git a/Modules/Visualization/Ice/src/otbViewSettings.cxx b/Modules/Visualization/Ice/src/otbViewSettings.cxx index 9e5b2933a017b5bcaa03aa630da82b597d31d089..2ffb824a9d1755aa464e9fa3195e87ad46b94490 100644 --- a/Modules/Visualization/Ice/src/otbViewSettings.cxx +++ b/Modules/Visualization/Ice/src/otbViewSettings.cxx @@ -22,21 +22,41 @@ namespace otb { -ViewSettings::ViewSettings() +ViewSettings::ViewSettings() : + m_Wkt( "" ), + m_RotationAngle( 0.0 ), + m_UseProjection( true ), + m_GeometryChanged( false ) { - m_Origin.Fill(0); - m_Spacing.Fill(1); - m_ViewportSize.Fill(0); - m_Wkt=""; - m_UseProjection = true; - m_GeometryChanged = false; - m_RotationCenter.Fill(0); - m_RotationAngle = 0; + m_Origin.Fill( 0 ); + m_Spacing.Fill( 1 ); + m_ViewportSize.Fill( 0 ); + m_RotationCenter.Fill( 0 ); } ViewSettings::~ViewSettings() {} +void +ViewSettings +::Reset() +{ + m_Origin.Fill( 0 ); + m_Spacing.Fill( 1 ); + m_ViewportSize.Fill( 0 ); + + m_Wkt = ""; + + m_KeywordList = KeywordListType(); + + m_UseProjection = true; + m_GeometryChanged = false; + + m_RotationCenter.Fill( 0 ); + + m_RotationAngle = 0.0; +} + void ViewSettings::GetViewportExtent(double & ulx, double & uly, double & lrx, double & lry) const { ulx = m_Origin[0]; @@ -177,6 +197,9 @@ ViewSettings { SpacingType spacing; + assert( m_ViewportSize[ 0 ]!=0 ); + assert( m_ViewportSize[ 1 ]!=0 ); + spacing[ 0 ] = ( extent[ 0 ] - origin[ 0 ] ) / m_ViewportSize[ 0 ]; spacing[ 1 ] = ( extent[ 1 ] - origin[ 1 ] ) / m_ViewportSize[ 1 ]; diff --git a/Modules/Visualization/IceViewer/include/otbIceViewer.h b/Modules/Visualization/IceViewer/include/otbIceViewer.h index 17ef657c780681ebfa98efd8d5b886e224a0f41b..c4fb0b426df991f1b88c491a17c593ec686d6f82 100644 --- a/Modules/Visualization/IceViewer/include/otbIceViewer.h +++ b/Modules/Visualization/IceViewer/include/otbIceViewer.h @@ -73,7 +73,7 @@ protected: IceViewer(); - virtual ~IceViewer(); + ~IceViewer() ITK_OVERRIDE; // Non-static callbacks virtual void scroll_callback(GLFWwindow * window, double xoffset, double yoffset); diff --git a/Modules/Visualization/IceViewer/src/otbIce.cxx b/Modules/Visualization/IceViewer/src/otbIce.cxx index 6d3ec67a9470c081c028deff77f377dfeadc9ce8..e43df3d85d9ae61ebd51388135537107c337c6b3 100644 --- a/Modules/Visualization/IceViewer/src/otbIce.cxx +++ b/Modules/Visualization/IceViewer/src/otbIce.cxx @@ -39,13 +39,13 @@ int main(int argc, char * argv[]) otb::DEMHandler::Pointer demHandler = otb::DEMHandler::Instance(); - if(demdir != NULL) + if(demdir != ITK_NULLPTR) { std::cout<<"Configuring DEM directory: "<<demdir<<std::endl; demHandler->OpenDEMDirectory(demdir); } - if(geoidfile != NULL) + if(geoidfile != ITK_NULLPTR) { std::cout<<"Configuring geoid file: "<<geoidfile<<std::endl; demHandler->OpenGeoidFile(geoidfile); diff --git a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx index 3782d2705e19383295bb573598d1a92228f4b7f9..7f38e909ba9f96351530422ca238ab50f47d8e28 100644 --- a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx +++ b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx @@ -38,7 +38,7 @@ GlVectorActor::ColorType BuildColor(double r, double g, double b) } IceViewer::IceViewer() - : m_Window(NULL), + : m_Window(ITK_NULLPTR), m_View(), m_FastRendering(false), m_SelectedActor(""), @@ -71,7 +71,7 @@ IceViewer::IceViewer() IceViewer::~IceViewer() { - if(m_Window != NULL) + if(m_Window != ITK_NULLPTR) { glfwDestroyWindow(m_Window); } @@ -88,8 +88,8 @@ void IceViewer::AddImage(const std::string & fname, const std::string & key, con otb::GlImageActor::Pointer actor = otb::GlImageActor::New(); - const char * glVersion = NULL; - const char * glslVersion = NULL; + const char * glVersion = ITK_NULLPTR; + const char * glslVersion = ITK_NULLPTR; if( GlVersionChecker::CheckGLCapabilities( glVersion, glslVersion ) ) @@ -226,19 +226,19 @@ void IceViewer::Initialize(unsigned int w, unsigned int h, const std::string & n // Initialize glut (ugly workaround) int fake_argc = 1; char fake_name[] = "fake"; - char * fake_argv[] = {fake_name,NULL}; + char * fake_argv[] = {fake_name,ITK_NULLPTR}; glutInit(&fake_argc,fake_argv); // Set glfw errors callback glfwSetErrorCallback(error_callback); // Create the window - if(m_Window != NULL) + if(m_Window != ITK_NULLPTR) { glfwDestroyWindow(m_Window); } - m_Window = glfwCreateWindow(w, h,name.c_str(), NULL, NULL); + m_Window = glfwCreateWindow(w, h,name.c_str(), ITK_NULLPTR, ITK_NULLPTR); if (!m_Window) { itkExceptionMacro(<<"Could not create glfw window."); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h index f8ee6e658ee0258fef663cbf87d34367d24bb4c4..f99ae35449254d6f7cb98aebfa683d623a2e24aa 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperAddProcessToWatchEvent_h -#define __otbWrapperAddProcessToWatchEvent_h +#ifndef otbWrapperAddProcessToWatchEvent_h +#define otbWrapperAddProcessToWatchEvent_h #include "itkEventObject.h" #include "itkProcessObject.h" @@ -42,7 +42,7 @@ public: AddProcessToWatchEvent(){} AddProcessToWatchEvent(const Self& s) :itk::EventObject(s){}; - virtual ~AddProcessToWatchEvent() {} + ~AddProcessToWatchEvent() ITK_OVERRIDE {} /** Set/Get the process to watch */ virtual void SetProcess(itk::ProcessObject * process) @@ -66,16 +66,16 @@ public: } /** Virtual pure method to implement */ - virtual itk::EventObject* MakeObject() const + itk::EventObject* MakeObject() const ITK_OVERRIDE { return new Self; } - virtual const char* GetEventName() const + const char* GetEventName() const ITK_OVERRIDE { return "AddProcess"; } - virtual bool CheckEvent(const itk::EventObject* e) const + bool CheckEvent(const itk::EventObject* e) const ITK_OVERRIDE { return dynamic_cast<const Self*>(e); } diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 955a76b4359918001c2a1a4fa58bd68147a37c71..1ec72194ec614b9509bbc849b6549dc45f77373d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperApplication_h -#define __otbWrapperApplication_h +#ifndef otbWrapperApplication_h +#define otbWrapperApplication_h #include <string> #include "otbWrapperTypes.h" @@ -653,7 +653,7 @@ protected: Application(); /** Destructor */ - virtual ~Application(); + ~Application() ITK_OVERRIDE; /* Register a ProcessObject as a new progress source */ void AddProcess(itk::ProcessObject* object, std::string description); @@ -833,4 +833,4 @@ private: //#include "otbWrapperApplication.txx" //#endif -#endif // __otbWrapperApplication_h_ +#endif // otbWrapperApplication_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h index 755cb26926a4421bf44a7ae34f5a648c59de6359..854568a3c67490b8e6c3299c8fec220cc660fb93 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperApplicationFactory_h -#define __otbWrapperApplicationFactory_h +#ifndef otbWrapperApplicationFactory_h +#define otbWrapperApplicationFactory_h #include "otbWrapperApplicationFactoryBase.h" #include "itkVersion.h" @@ -37,12 +37,12 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const + const char* GetITKSourceVersion(void) const ITK_OVERRIDE { return ITK_SOURCE_VERSION; } - virtual const char* GetDescription(void) const + const char* GetDescription(void) const ITK_OVERRIDE { return "ApplicationFactory"; } @@ -71,7 +71,7 @@ protected: } - virtual ~ApplicationFactory() + ~ApplicationFactory() ITK_OVERRIDE { } @@ -79,7 +79,7 @@ protected: /** This method is provided by sub-classes of ObjectFactoryBase. * It should create the named itk object or return 0 if that object * is not supported by the factory implementation. */ - virtual LightObject::Pointer CreateObject(const char* itkclassname ) + LightObject::Pointer CreateObject(const char* itkclassname ) ITK_OVERRIDE { LightObject::Pointer ret; if ( m_ClassName == itkclassname) @@ -91,8 +91,8 @@ protected: /** This method creates all the objects with the class overide of * itkclass name, which are provide by this object */ - virtual std::list<LightObject::Pointer> - CreateAllObject(const char* itkclassname) + std::list<LightObject::Pointer> + CreateAllObject(const char* itkclassname) ITK_OVERRIDE { const std::string applicationClass("otbWrapperApplication"); std::list<LightObject::Pointer> list; @@ -133,4 +133,4 @@ private: } -#endif // __otbWrapperApplication_h_ +#endif // otbWrapperApplication_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h index 095cc88264d7379f01df60335835fa977bd6ebea..5be4af950c4fb26307149358f1de2c4a4712f4cf 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperApplicationFactoryBase_h -#define __otbWrapperApplicationFactoryBase_h +#ifndef otbWrapperApplicationFactoryBase_h +#define otbWrapperApplicationFactoryBase_h #include "itkObjectFactoryBase.h" #include "otbWrapperApplication.h" @@ -44,7 +44,7 @@ public: protected: ApplicationFactoryBase(){} - virtual ~ApplicationFactoryBase(){} + ~ApplicationFactoryBase() ITK_OVERRIDE{} private: ApplicationFactoryBase(const Self &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h index 407aa35f299c25dd2bc6f20123d0010c3acca1f0..29fda60cc1966ce768c66d645c3e2ddd76d826db 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperApplicationHtmlDocGenerator_h -#define __otbWrapperApplicationHtmlDocGenerator_h +#ifndef otbWrapperApplicationHtmlDocGenerator_h +#define otbWrapperApplicationHtmlDocGenerator_h #include "otbWrapperApplication.h" diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h index ba6a46771e7ae17bda62838de7a629f9af490790..6b0e95f0f9ab635a72a829326a3c80d72d17a8fa 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperApplicationRegistry_h -#define __otbWrapperApplicationRegistry_h +#ifndef otbWrapperApplicationRegistry_h +#define otbWrapperApplicationRegistry_h #include <string> #include "itkObject.h" @@ -76,7 +76,7 @@ public: protected: ApplicationRegistry(); - virtual ~ApplicationRegistry(); + ~ApplicationRegistry() ITK_OVERRIDE; private: ApplicationRegistry(const Self&); //purposely not implemented @@ -90,4 +90,4 @@ private: } // end namespace Wrapper } //end namespace otb -#endif // __otbWrapperApplication_h_ +#endif // otbWrapperApplication_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h index 5cff129f7f3810093460739f5735f96b795c0300..fe81a7e7766526abd0d98e1c659bc46ee5ad08e4 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperChoiceParameter_h -#define __otbWrapperChoiceParameter_h +#ifndef otbWrapperChoiceParameter_h +#define otbWrapperChoiceParameter_h #include "otbWrapperParameterGroup.h" @@ -85,13 +85,13 @@ public: /** Return any value */ virtual unsigned int GetValue(); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { // a choice parameter always has a value return true; } - void ClearValue() + void ClearValue() ITK_OVERRIDE { // nothing to do : a choice parameter always has a value } @@ -101,7 +101,7 @@ protected: ChoiceParameter(); /** Destructor */ - virtual ~ChoiceParameter(); + ~ChoiceParameter() ITK_OVERRIDE; struct Choice { diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h index 14eccd1f253c8a433b71912c8066f1dae79d3e3f..04ff1e1a4b1ebf4e893ca75580358973a3511d29 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperComplexInputImageParameter_h -#define __otbWrapperComplexInputImageParameter_h +#ifndef otbWrapperComplexInputImageParameter_h +#define otbWrapperComplexInputImageParameter_h #include "otbImageFileReader.h" #include "itkImageBase.h" @@ -87,9 +87,9 @@ public: template <class TComplexInputImage, class TOutputImage> TOutputImage* CastVectorImageFromImage(); - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; - void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: @@ -97,7 +97,7 @@ protected: ComplexInputImageParameter(); /** Destructor */ - virtual ~ComplexInputImageParameter(); + ~ComplexInputImageParameter() ITK_OVERRIDE; ImageBaseType::Pointer m_Image; std::string m_FileName; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx index a9c9ac2c8fc38be21eb9c0fe56554027b0fbdb71..e4359ecfba6b9f1845d629e864479f446552825a 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperComplexInputImageParameter_txx -#define __otbWrapperComplexInputImageParameter_txx +#ifndef otbWrapperComplexInputImageParameter_txx +#define otbWrapperComplexInputImageParameter_txx #include "otbWrapperComplexInputImageParameter.h" diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h index 5edf833fba0223b968eb6e8170199453c066996b..b1019af68fcbd87e817cb000b8e3a1d21a3819b5 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperComplexOutputImageParameter_h -#define __otbWrapperComplexOutputImageParameter_h +#ifndef otbWrapperComplexOutputImageParameter_h +#define otbWrapperComplexOutputImageParameter_h #include "itkImageBase.h" #include "otbWrapperParameter.h" @@ -74,7 +74,7 @@ public: itkGetMacro(RAMValue, unsigned int); /** Implement the reset method (replace pixel type by default type) */ - virtual void Reset() + void Reset() ITK_OVERRIDE { m_ComplexPixelType = m_DefaultComplexPixelType; } @@ -83,7 +83,7 @@ public: static std::string ConvertPixelTypeToString(ComplexImagePixelType type); /** Return true if a filename is set */ - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; void SetFileName (const char* filename) { @@ -107,7 +107,7 @@ protected: /** Constructor */ ComplexOutputImageParameter(); /** Destructor */ - virtual ~ComplexOutputImageParameter(); + ~ComplexOutputImageParameter() ITK_OVERRIDE; template <class TInputImageType> void SwitchImageWrite(); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h index 9051bef4d3c6047e6c960e134ea0ee22141c827c..965f08fe7d9e8240c85e86d97206aed2e73e6797 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperDirectoryParameter_h -#define __otbWrapperDirectoryParameter_h +#ifndef otbWrapperDirectoryParameter_h +#define otbWrapperDirectoryParameter_h #include "otbWrapperStringParameter.h" #include "otbMacro.h" @@ -49,7 +49,7 @@ public: /** RTTI support */ itkTypeMacro(DirectoryParameter, Parameter); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return m_StringParam->HasValue(); } @@ -59,13 +59,13 @@ public: otbGetObjectMemberMacro(StringParam, Value , std::string); // Clear Value - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_StringParam->ClearValue(); } // Reimplement the SetActive method - void SetActive( const bool value ) + void SetActive( const bool value ) ITK_OVERRIDE { Superclass::SetActive( value ); m_StringParam->SetActive( value ); @@ -82,7 +82,7 @@ protected: } /** Destructor */ - virtual ~DirectoryParameter() + ~DirectoryParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h index c5573a114e3e21265eae751d1cee741bb5146381..7ba66bb1caf411809e4bc539cca84335f4f492db 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperDocExampleStructure_h -#define __otbWrapperDocExampleStructure_h +#ifndef otbWrapperDocExampleStructure_h +#define otbWrapperDocExampleStructure_h #include "itkObject.h" #include "itkObjectFactory.h" @@ -117,7 +117,7 @@ protected: /** Constructor */ DocExampleStructure(); /** Destructor */ - virtual ~DocExampleStructure(); + ~DocExampleStructure() ITK_OVERRIDE; private: DocExampleStructure(const DocExampleStructure &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperElevationParametersHandler.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperElevationParametersHandler.h index a7b2750f1eba4ffd9e2695671d7f8192b1410344..225400704ce2ff13f3bfe5b7842ff7415d2d8dfc 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperElevationParametersHandler.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperElevationParametersHandler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperElevationParametersHandler_h -#define __otbWrapperElevationParametersHandler_h +#ifndef otbWrapperElevationParametersHandler_h +#define otbWrapperElevationParametersHandler_h #include "otbWrapperApplication.h" @@ -67,4 +67,4 @@ protected: } -#endif // __otbWrapperElevationParametersHandler_h_ +#endif // otbWrapperElevationParametersHandler_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h index 0a13ef1469ee27998f19802e327ecd3f9fe55fa3..1ff87d48a9b5a2713ef09ec7d8db0665d4a83739 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperEmptyParameter_h -#define __otbWrapperEmptyParameter_h +#ifndef otbWrapperEmptyParameter_h +#define otbWrapperEmptyParameter_h #include "otbWrapperParameter.h" @@ -47,12 +47,12 @@ public: itkTypeMacro(EmptyParameter, Parameter); /** HasValue */ - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return false; } - bool HasUserValue() const + bool HasUserValue() const ITK_OVERRIDE { return this->m_UserValue; } @@ -66,7 +66,7 @@ protected: } /** Destructor */ - virtual ~EmptyParameter() + ~EmptyParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameListParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameListParameter.h index 1992608db84c832ad547a6eeb5e9f9d885de3a2c..11c34b61efd80dcc18b8d384e66b9fb6b170c797 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameListParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputFilenameListParameter_h -#define __otbWrapperInputFilenameListParameter_h +#ifndef otbWrapperInputFilenameListParameter_h +#define otbWrapperInputFilenameListParameter_h #include <string> #include "otbWrapperStringParameter.h" @@ -73,14 +73,14 @@ public: /** Get one list of the stored files. */ StringParameterListPointerType GetFileList() const; - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; /** Erase one element of the list. */ void Erase( unsigned int id ); /** Clear all the list. */ - virtual void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: @@ -88,7 +88,7 @@ protected: InputFilenameListParameter(); /** Destructor */ - virtual ~InputFilenameListParameter(); + ~InputFilenameListParameter() ITK_OVERRIDE; StringParameterListType::Pointer m_FilenameList; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h index 9c2f295418cedf5d3a561715ace7dd651dfb21e1..f35349024c919645e0cbf927cc0f925e44234d88 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputFilenameParameter_h -#define __otbWrapperInputFilenameParameter_h +#ifndef otbWrapperInputFilenameParameter_h +#define otbWrapperInputFilenameParameter_h #include <string> #include "otbWrapperStringParameter.h" @@ -48,7 +48,7 @@ public: itkTypeMacro(InputFilenameParameter, Parameter); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return m_StringParam->HasValue(); } @@ -66,7 +66,7 @@ public: } // Clear Value - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_StringParam->ClearValue(); } @@ -82,7 +82,7 @@ protected: } /** Destructor */ - virtual ~InputFilenameParameter() + ~InputFilenameParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h index cb86b1e86621d035b97a4ee7708835b1c7e60326..9fc934287e056e6a6880a17fecfc1fe6b3e0f63b 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputImageListParameter_h -#define __otbWrapperInputImageListParameter_h +#ifndef otbWrapperInputImageListParameter_h +#define otbWrapperInputImageListParameter_h #include "otbImageFileReader.h" @@ -82,14 +82,14 @@ public: /** Add an image to the list. */ void AddImage(FloatVectorImageType* image); - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; /** Erase one element of the list. */ void Erase( unsigned int id ); /** Clear all the list. */ - virtual void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: @@ -97,7 +97,7 @@ protected: InputImageListParameter(); /** Destructor */ - virtual ~InputImageListParameter(); + ~InputImageListParameter() ITK_OVERRIDE; FloatVectorImageListType::Pointer m_ImageList; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h index 4c0e2fe9cea5f6a4e1311729f2b9a9f8ad162323..df467e6adf2efc888c769d82f36ec30c76b32d93 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputImageParameter_h -#define __otbWrapperInputImageParameter_h +#ifndef otbWrapperInputImageParameter_h +#define otbWrapperInputImageParameter_h #include "otbImageFileReader.h" #include "itkImageBase.h" @@ -105,9 +105,9 @@ public: TOutputImage* CastVectorImageFromImage(); - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; - void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: @@ -115,7 +115,7 @@ protected: InputImageParameter(); /** Destructor */ - virtual ~InputImageParameter(); + ~InputImageParameter() ITK_OVERRIDE; ImageBaseType::Pointer m_Image; std::string m_FileName; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx index 3c16f47a1858d938e3b39283fb39daa1c2603a3b..ccec52397e7d4fc3e6ff6c7b9cf17c41bbce798f 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputImageParameter_txx -#define __otbWrapperInputImageParameter_txx +#ifndef otbWrapperInputImageParameter_txx +#define otbWrapperInputImageParameter_txx #include "otbWrapperInputImageParameter.h" diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h index 1db4f6ecc2cacbee7ee630af05c5a61a0030b6cf..3f596e4a49650e8634d2c1d34ebba00741391937 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h @@ -1,5 +1,5 @@ -#ifndef __otbWrapperInputProcessXMLParameter_h -#define __otbWrapperInputProcessXMLParameter_h +#ifndef otbWrapperInputProcessXMLParameter_h +#define otbWrapperInputProcessXMLParameter_h #include "otbWrapperApplication.h" #include "otb_tinyxml.h" #include <sstream> @@ -32,7 +32,7 @@ public: itkGetStringMacro(FileName); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { if(m_FileName.empty()) return false; @@ -66,7 +66,7 @@ protected: InputProcessXMLParameter(); /** Destructor */ - virtual ~InputProcessXMLParameter(); + ~InputProcessXMLParameter() ITK_OVERRIDE; private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataListParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataListParameter.h index 71df9b3830e10a575db919fdfe506f4c873d1704..35920d5ad0c88ab7d31715578ee323da8a617e4d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataListParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputVectorDataListParameter_h -#define __otbWrapperInputVectorDataListParameter_h +#ifndef otbWrapperInputVectorDataListParameter_h +#define otbWrapperInputVectorDataListParameter_h #include "otbVectorDataFileReader.h" @@ -82,14 +82,14 @@ public: /** Add an image to the list. */ void AddVectorData(VectorDataType* image); - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; /** Erase one element of the list. */ void Erase( unsigned int id ); /** Clear all the list. */ - virtual void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: @@ -97,7 +97,7 @@ protected: InputVectorDataListParameter(); /** Destructor */ - virtual ~InputVectorDataListParameter(); + ~InputVectorDataListParameter() ITK_OVERRIDE; VectorDataListType::Pointer m_VectorDataList; VectorDataFileReaderListType::Pointer m_ReaderList; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h index 7f9aac71f2ed4de160006c6eebce4df01d57a6d4..494408bb5885c923536afb92b729027f25ee4274 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputVectorDataParameter_h -#define __otbWrapperInputVectorDataParameter_h +#ifndef otbWrapperInputVectorDataParameter_h +#define otbWrapperInputVectorDataParameter_h #include "otbVectorDataFileReader.h" #include "otbWrapperParameter.h" @@ -58,16 +58,16 @@ public: void SetVectorData(VectorDataType* vectorData); - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; - void ClearValue(); + void ClearValue() ITK_OVERRIDE; protected: /** Constructor */ InputVectorDataParameter(); /** Destructor */ - virtual ~InputVectorDataParameter(); + ~InputVectorDataParameter() ITK_OVERRIDE; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataType::Pointer m_VectorData; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h index b50fa171e059e209a476146731a323f0dabb4fef..daf800d6e88ae9aa6be2a01b6153defa8b5111c7 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperListViewParameter_h -#define __otbWrapperListViewParameter_h +#ifndef otbWrapperListViewParameter_h +#define otbWrapperListViewParameter_h #include "otbWrapperParameterGroup.h" @@ -77,13 +77,13 @@ public: /** Return any value */ virtual unsigned int GetValue(); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { // a choice parameter always has a value return true; } - void ClearValue() + void ClearValue() ITK_OVERRIDE { // nothing to do : a choice parameter always has a value } @@ -155,7 +155,7 @@ protected: ListViewParameter(); /** Destructor */ - virtual ~ListViewParameter(); + ~ListViewParameter() ITK_OVERRIDE; struct ListViewChoice { diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperMacros.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMacros.h index 71a46fae169948deb19874454b485323a26bd427..75b584f9daa96a5764f780583ed48b9e013d5ef1 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperMacros.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMacros.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperMacros_h -#define __otbWrapperMacros_h +#ifndef otbWrapperMacros_h +#define otbWrapperMacros_h #define otbAppLogFATAL(x) \ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperMapProjectionParametersHandler.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMapProjectionParametersHandler.h index 08d1de8cf8f588431877ca02fb8ea3b849eb6e91..491949433ccb6cf58e6ab9cdbf401e01a4688d8f 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperMapProjectionParametersHandler.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMapProjectionParametersHandler.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperMapProjectionParametersHandler_h -#define __otbWrapperMapProjectionParametersHandler_h +#ifndef otbWrapperMapProjectionParametersHandler_h +#define otbWrapperMapProjectionParametersHandler_h #include "otbWrapperApplication.h" @@ -82,4 +82,4 @@ protected: } -#endif // __otbWrapperMapProjectionParametersHandler_h_ +#endif // otbWrapperMapProjectionParametersHandler_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h index 5117a3af48c9561be0cf46c134e67164d6f433ce..c15e8f88259ddb3d5f299068baf529945541d5b9 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperNumericalParameter_h -#define __otbWrapperNumericalParameter_h +#ifndef otbWrapperNumericalParameter_h +#define otbWrapperNumericalParameter_h #include "otbWrapperParameter.h" #include "itkNumericTraits.h" @@ -51,7 +51,7 @@ public: typedef T ScalarType; /** Implement the reset method (replace value by default value) */ - virtual void Reset() + void Reset() ITK_OVERRIDE { m_Value = m_DefaultValue; } @@ -85,12 +85,12 @@ public: return boost::any_cast<ScalarType>(m_Value); } - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return !m_Value.empty(); } - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_Value = boost::any(); } @@ -122,7 +122,7 @@ protected: {} /** Destructor */ - virtual ~NumericalParameter() + ~NumericalParameter() ITK_OVERRIDE {} /** Value */ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h index 31bacce37456176bebae679041bd3c5f6d7bb658..62d10fc93de8a0051f474bb0b62c1daca7eb648c 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperOutputFilenameParameter_h -#define __otbWrapperOutputFilenameParameter_h +#ifndef otbWrapperOutputFilenameParameter_h +#define otbWrapperOutputFilenameParameter_h #include <string> #include "otbWrapperStringParameter.h" @@ -48,7 +48,7 @@ public: itkTypeMacro(OutputFilenameParameter, Parameter); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return m_StringParam->HasValue(); } @@ -66,7 +66,7 @@ public: } // Clear Value - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_StringParam->ClearValue(); } @@ -82,7 +82,7 @@ protected: } /** Destructor */ - virtual ~OutputFilenameParameter() + ~OutputFilenameParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index 3313e5a8d201cc230bc33d2b11fd533d9a0f8f32..4c2c0960d5f47d2193f710e36d812abaa9a74f98 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperOutputImageParameter_h -#define __otbWrapperOutputImageParameter_h +#ifndef otbWrapperOutputImageParameter_h +#define otbWrapperOutputImageParameter_h //#include "otbVectorImage.h" #include "itkImageBase.h" @@ -75,7 +75,7 @@ public: itkGetMacro(RAMValue, unsigned int); /** Implement the reset method (replace pixel type by default type) */ - virtual void Reset() + void Reset() ITK_OVERRIDE { m_PixelType = m_DefaultPixelType; } @@ -84,7 +84,7 @@ public: static std::string ConvertPixelTypeToString(ImagePixelType type); /** Return true if a filename is set */ - bool HasValue() const; + bool HasValue() const ITK_OVERRIDE; void SetFileName (const char* filename) { @@ -108,7 +108,7 @@ protected: /** Constructor */ OutputImageParameter(); /** Destructor */ - virtual ~OutputImageParameter(); + ~OutputImageParameter() ITK_OVERRIDE; template <class TInputImageType> void SwitchImageWrite(); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h index 671caeef1c7b991f89652507a1d56940da9e05e9..8a983b3a8ad9da2c925f2d56b16d253c790f0710 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h @@ -1,5 +1,5 @@ -#ifndef __otbWrapperOutputProcessXMLParameter_h -#define __otbWrapperOutputProcessXMLParameter_h +#ifndef otbWrapperOutputProcessXMLParameter_h +#define otbWrapperOutputProcessXMLParameter_h #include "otbWrapperApplication.h" #include "otb_tinyxml.h" @@ -46,7 +46,7 @@ public: this->Modified(); } - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { if(m_FileName.empty()) return false; @@ -54,7 +54,7 @@ public: return true; } - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_FileName = ""; } @@ -72,7 +72,7 @@ protected: OutputProcessXMLParameter(); /** Destructor */ - virtual ~OutputProcessXMLParameter(); + ~OutputProcessXMLParameter() ITK_OVERRIDE; private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h index c06d25dc47288b6c99e2fe675bb1db708efae1ec..155a72880245c064a6c2b612c8c20eda0db9b13d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperOutputVectorDataParameter_h -#define __otbWrapperOutputVectorDataParameter_h +#ifndef otbWrapperOutputVectorDataParameter_h +#define otbWrapperOutputVectorDataParameter_h #include "otbWrapperParameter.h" @@ -56,7 +56,7 @@ public: itkGetObjectMacro(VectorData, VectorDataType); /** Return true if a filename is set */ - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { std::string filename(this->GetFileName()); return !filename.empty(); @@ -113,7 +113,7 @@ protected: } /** Destructor */ - virtual ~OutputVectorDataParameter() + ~OutputVectorDataParameter() ITK_OVERRIDE {} diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h index c9bdcfd0ebf2b4d99bb368d3fbe3e8eb8c225812..aed8f8891690fd6cfe192cffe917353cc7e4d872 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperParameter_h -#define __otbWrapperParameter_h +#ifndef otbWrapperParameter_h +#define otbWrapperParameter_h #include "otbMacro.h" #include "itkObjectFactory.h" @@ -231,7 +231,7 @@ protected: {} /** Destructor */ - virtual ~Parameter() + ~Parameter() ITK_OVERRIDE {} /** Name of the parameter */ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h index e03311025f6aee9b0be9bf046b7a912d09be7014..31600e910300e423e82c60f56b11c6a91d04837d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperParameterGroup_h -#define __otbWrapperParameterGroup_h +#ifndef otbWrapperParameterGroup_h +#define otbWrapperParameterGroup_h #include "itkObject.h" #include "otbWrapperParameter.h" @@ -88,14 +88,14 @@ public: std::vector<std::string> GetParametersKeys(bool recursive = true); // Always has value - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return true; } protected: ParameterGroup(); - virtual ~ParameterGroup(); + ~ParameterGroup() ITK_OVERRIDE; typedef std::vector<Parameter::Pointer> ParameterListType; ParameterListType m_ParameterList; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterKey.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterKey.h index d7f17907dfa49b322a61bb3f30bbc38d189d4e41..ac0f9d616a79b264f320583e50c36cde87405aaf 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterKey.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterKey.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperParameterKey_h -#define __otbWrapperParameterKey_h +#ifndef otbWrapperParameterKey_h +#define otbWrapperParameterKey_h #include <string> #include <vector> @@ -117,4 +117,4 @@ private: } // end namespace Wrapper } //end namespace otb -#endif // __otbWrapperParameterKey_h_ +#endif // otbWrapperParameterKey_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h index d4fc76029137fc4501638ff78d2f58d6003d9de5..1a234e9d99b282d2fdac3166bd7b721137311883 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperRAMParameter_h -#define __otbWrapperRAMParameter_h +#ifndef otbWrapperRAMParameter_h +#define otbWrapperRAMParameter_h #include "otbWrapperNumericalParameter.h" @@ -49,7 +49,7 @@ public: typedef NumericalParameter<unsigned int> UnsignedIntParameter; typedef UnsignedIntParameter::ScalarType ScalarType; - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return m_UnsignedIntParam->HasValue(); } @@ -68,19 +68,19 @@ public: otbGetObjectMemberMacro(UnsignedIntParam, MaximumValue, ScalarType); // Clear Value - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_UnsignedIntParam->ClearValue(); } // Reset - virtual void Reset() + void Reset() ITK_OVERRIDE { m_UnsignedIntParam->Reset(); } // Reimplement the SetActive method - void SetActive( const bool value ) + void SetActive( const bool value ) ITK_OVERRIDE { Superclass::SetActive( value ); m_UnsignedIntParam->SetActive( value ); @@ -104,7 +104,7 @@ protected: } /** Destructor */ - virtual ~RAMParameter() + ~RAMParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h index 07cd91aeaa8337e5feb4936f0c7ded91dd995643..29d88153f4ea9df32891efd824c70e17163f343f 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperRadiusParameter_h -#define __otbWrapperRadiusParameter_h +#ifndef otbWrapperRadiusParameter_h +#define otbWrapperRadiusParameter_h #include "otbWrapperNumericalParameter.h" @@ -46,7 +46,7 @@ public: /** RTTI support */ itkTypeMacro(RadiusParameter, Parameter); - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return true; } @@ -61,7 +61,7 @@ protected: } /** Destructor */ - virtual ~RadiusParameter() + ~RadiusParameter() ITK_OVERRIDE {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringListParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringListParameter.h index 2adb1c3550edd7039e67ad57dcb3e5a3ab148936..8ca06375235c86223351c1b7d321e878039cbbea 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringListParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperStringListParameter_h -#define __otbWrapperStringListParameter_h +#ifndef otbWrapperStringListParameter_h +#define otbWrapperStringListParameter_h #include <string> #include "otbWrapperParameter.h" @@ -100,12 +100,12 @@ public: m_Value[i] = value; } - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return !m_Value.empty(); } - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_Value.clear(); } @@ -126,7 +126,7 @@ protected: } /** Destructor */ - virtual ~StringListParameter() + ~StringListParameter() ITK_OVERRIDE { } diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h index 101eee7f74e2117328aa197b33f3994c45df93a7..e023b8f6ad2b3c6ce7f46fcb2b5299a3ddcb65e4 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperStringParameter_h -#define __otbWrapperStringParameter_h +#ifndef otbWrapperStringParameter_h +#define otbWrapperStringParameter_h #include <string> #include "otbWrapperParameter.h" @@ -60,12 +60,12 @@ public: return m_Value; } - bool HasValue() const + bool HasValue() const ITK_OVERRIDE { return !m_Value.empty(); } - void ClearValue() + void ClearValue() ITK_OVERRIDE { m_Value = ""; } @@ -76,7 +76,7 @@ protected: {} /** Destructor */ - virtual ~StringParameter() + ~StringParameter() ITK_OVERRIDE {} std::string m_Value; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTags.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTags.h index 0def0d95d20b4264fee3a44fe941f02eac696d3b..c19a1a50e07b72c8f396cb7d647fdad2645386d1 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTags.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTags.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperTags_h -#define __otbWrapperTags_h +#ifndef otbWrapperTags_h +#define otbWrapperTags_h #include <string> @@ -51,4 +51,4 @@ static const std::string Vector="Vector Data Manipulation"; } // end namespace Tags } // end namespace otb -#endif // __otbWrapperTags_h_ +#endif // otbWrapperTags_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h index b976af24e38bae1d46f19609a65ecc6b6880b00e..56985c0060e3d41e5e8f948f211fabc7bc41bdce 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperTypes_h -#define __otbWrapperTypes_h +#ifndef otbWrapperTypes_h +#define otbWrapperTypes_h #include <complex> #include "itkRGBPixel.h" @@ -142,4 +142,4 @@ typedef otb::ObjectList<FloatImageType> FloatImageListType; } // end namespace Wrapper } // end namespace otb -#endif // __otbWrapperApplication_h_ +#endif // otbWrapperApplication_h_ diff --git a/Modules/Wrappers/ApplicationEngine/otb-module.cmake b/Modules/Wrappers/ApplicationEngine/otb-module.cmake index d7421d1b3c22d5f52ddfb8566a1388e027245d9c..3f1a4c74c6b36fa46f01d4f4c66ca58e4e9b0f5a 100644 --- a/Modules/Wrappers/ApplicationEngine/otb-module.cmake +++ b/Modules/Wrappers/ApplicationEngine/otb-module.cmake @@ -17,6 +17,10 @@ otb_module(OTBApplicationEngine OTBOSSIMAdapters OTBITK + OPTIONAL_DEPENDS + OTBMPIVrtWriter + OTBMPITiffWriter + TEST_DEPENDS OTBTestKernel OTBCommandLine diff --git a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt index 29a4a468014133ccdd7e8ebab47a4d1ae3fc2ce4..6d11c565ee8af5638682141dc0a8f911369203b5 100644 --- a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt @@ -42,7 +42,10 @@ target_link_libraries(OTBApplicationEngine ${OTBImageBase_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBOSSIMAdapters_LIBRARIES} - + ${OTBMPI_LIBRARIES} + ${OTBMPIConfig_LIBRARIES} + ${OTBMPITiffWriter_LIBRARIES} + ${OTBMPIVrtWriter_LIBRARIES} ) otb_module_target(OTBApplicationEngine) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 3df1c1937b3efdacfef62d4d37cacb606cf4174d..a98e762721c589d5a32fc623f05975cfa8a66085 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -178,7 +178,7 @@ void Application::UpdateParameters() { Parameter* param = GetParameterByKey(inXMLKey); InputProcessXMLParameter* inXMLParam = dynamic_cast<InputProcessXMLParameter*>(param); - if(inXMLParam!=NULL) + if(inXMLParam!=ITK_NULLPTR) { inXMLParam->Read(this); m_IsInXMLParsed = true; @@ -208,7 +208,7 @@ int Application::Execute() UseSpecificSeed = true; Parameter* param = GetParameterByKey(key); IntParameter* randParam = dynamic_cast<IntParameter*> (param); - if(randParam!=NULL) + if(randParam!=ITK_NULLPTR) { int seed = randParam->GetValue(); itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->SetSeed(seed); @@ -247,7 +247,7 @@ int Application::ExecuteAndWriteOutput() { Parameter* param = GetParameterByKey(key); RAMParameter* ramParam = dynamic_cast<RAMParameter*>(param); - if(ramParam!=NULL) + if(ramParam!=ITK_NULLPTR) { ram = ramParam->GetValue(); useRAM = true; @@ -266,7 +266,7 @@ int Application::ExecuteAndWriteOutput() Parameter* param = GetParameterByKey(key); OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*>(param); - if(outputParam!=NULL) + if(outputParam!=ITK_NULLPTR) { outputParam->InitializeWriters(); if (useRAM) @@ -284,7 +284,7 @@ int Application::ExecuteAndWriteOutput() { Parameter* param = GetParameterByKey(key); OutputVectorDataParameter* outputParam = dynamic_cast<OutputVectorDataParameter*>(param); - if(outputParam!=NULL) + if(outputParam!=ITK_NULLPTR) { outputParam->InitializeWriters(); std::ostringstream progressId; @@ -299,7 +299,7 @@ int Application::ExecuteAndWriteOutput() Parameter* param = GetParameterByKey(key); ComplexOutputImageParameter* outputParam = dynamic_cast<ComplexOutputImageParameter*>(param); - if(outputParam!=NULL) + if(outputParam!=ITK_NULLPTR) { outputParam->InitializeWriters(); if (useRAM) @@ -319,7 +319,7 @@ int Application::ExecuteAndWriteOutput() { Parameter* param = GetParameterByKey(key); OutputProcessXMLParameter* outXMLParam = dynamic_cast<OutputProcessXMLParameter*>(param); - if(outXMLParam!=NULL) + if(outXMLParam!=ITK_NULLPTR) { outXMLParam->Write(this); } @@ -1140,7 +1140,7 @@ std::vector<std::string> Application::GetParameterStringList(std::string paramet FloatVectorImageType* Application::GetParameterImage(std::string parameter) { - FloatVectorImageType::Pointer ret = NULL; + FloatVectorImageType::Pointer ret = ITK_NULLPTR; Parameter* param = GetParameterByKey(parameter); if (dynamic_cast<InputImageParameter*> (param)) @@ -1158,7 +1158,7 @@ FloatVectorImageType* Application::GetParameterImage(std::string parameter) FloatVectorImageListType* Application::GetParameterImageList(std::string parameter) { - FloatVectorImageListType::Pointer ret=NULL; + FloatVectorImageListType::Pointer ret=ITK_NULLPTR; Parameter* param = GetParameterByKey(parameter); if (dynamic_cast<InputImageListParameter*>(param)) @@ -1176,7 +1176,7 @@ FloatVectorImageListType* Application::GetParameterImageList(std::string paramet ComplexFloatVectorImageType* Application::GetParameterComplexImage(std::string parameter) { - ComplexFloatVectorImageType::Pointer ret=NULL; + ComplexFloatVectorImageType::Pointer ret=ITK_NULLPTR; Parameter* param = GetParameterByKey(parameter); if (dynamic_cast<ComplexInputImageParameter*>(param)) @@ -1194,7 +1194,7 @@ ComplexFloatVectorImageType* Application::GetParameterComplexImage(std::string p VectorDataType* Application::GetParameterVectorData(std::string parameter) { - VectorDataType::Pointer ret=NULL; + VectorDataType::Pointer ret=ITK_NULLPTR; Parameter* param = GetParameterByKey(parameter); if (dynamic_cast<InputVectorDataParameter*>(param)) @@ -1211,7 +1211,7 @@ VectorDataType* Application::GetParameterVectorData(std::string parameter) VectorDataListType* Application::GetParameterVectorDataList(std::string parameter) { - VectorDataListType::Pointer ret=NULL; + VectorDataListType::Pointer ret=ITK_NULLPTR; Parameter* param = GetParameterByKey(parameter); if (dynamic_cast<InputVectorDataListParameter*>(param)) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx index ea668936fe0b9d70de53a3190e8d14fa8f88d365..aa2cb096c31a090e7d907ea735443e825b809cfb 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx @@ -68,7 +68,7 @@ public: { if ((*it).first == app) { - (*it).first = NULL; + (*it).first = ITK_NULLPTR; } ++it; } @@ -82,13 +82,13 @@ public: AppHandleContainerType::iterator it; for (it = m_Container.begin() ; it != m_Container.end() ; ++it) { - if ((*it).first == NULL) + if ((*it).first == ITK_NULLPTR) { itk::DynamicLoader::CloseLibrary( static_cast<itk::LibHandle>((*it).second)); - (*it).second = NULL; + (*it).second = ITK_NULLPTR; } } - m_Container.remove(AppHandlePairType((Application*) NULL, (void*) NULL)); + m_Container.remove(AppHandlePairType((Application*) ITK_NULLPTR, (void*) ITK_NULLPTR)); } /** close all handles at program exit */ @@ -223,7 +223,7 @@ typedef itk::ObjectFactoryBase * ( *ITK_LOAD_FUNCTION )(); Application::Pointer ApplicationRegistry::CreateApplicationFaster(const std::string& name) { - ApplicationPointer appli = NULL; + ApplicationPointer appli = ITK_NULLPTR; std::string appExtension = itksys::DynamicLoader::LibExtension(); #ifdef __APPLE__ @@ -329,7 +329,7 @@ ApplicationRegistry::GetAvailableApplications(bool useFactory) { appSet.insert(name); } - appli = NULL; + appli = ITK_NULLPTR; } } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx index 7f4bb8cfe32fcbd10fec3484a5fdf1a873af6f76..63ad78e157814c40839d7c127cd12dc3b8de968f 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx @@ -148,9 +148,9 @@ ComplexInputImageParameter::HasValue() const void ComplexInputImageParameter::ClearValue() { - m_Image = NULL; - m_Reader = NULL; - m_Caster = NULL; + m_Image = ITK_NULLPTR; + m_Reader = ITK_NULLPTR; + m_Caster = ITK_NULLPTR; m_FileName = ""; m_PreviousFileName=""; m_UseFilename = true; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx index 2421c4fe81851b4f26f2d41f0a2ade417cbc74e8..382d87a66780a9d15dba00c73b360fb35e51287c 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx @@ -20,6 +20,18 @@ #include "itkCastImageFilter.h" #include "itkVectorCastImageFilter.h" +#ifdef OTB_USE_MPI + +#include "otbMPIConfig.h" +#include "otbMPIVrtWriter.h" + +#ifdef OTB_USE_SPTW +#include "otbSimpleParallelTiffWriter.h" +#endif + +#endif + + namespace otb { namespace Wrapper @@ -67,20 +79,62 @@ void ComplexOutputImageParameter::InitializeWriters() m_ComplexVectorDoubleWriter = ComplexVectorDoubleWriterType::New(); } +template <typename TInput, typename TOutput> void CastAndWriteImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput> * writer, const std::string & filename, const unsigned int & ramValue) +{ + typedef itk::CastImageFilter<TInput, TOutput> ClampFilterType; + typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); + clampFilter->SetInput( dynamic_cast<TInput*>(in)); + + bool useStandardWriter = true; + + #ifdef OTB_USE_MPI -#define otbCastAndWriteImageMacro(InputImageType, OutputImageType, writer) \ - { \ - typedef itk::CastImageFilter<InputImageType, OutputImageType> CastFilterType; \ - typename CastFilterType::Pointer caster = CastFilterType::New(); \ - caster->SetInput( dynamic_cast<InputImageType*>(m_Image.GetPointer()) ); \ - caster->InPlaceOn(); \ - writer->SetFileName( this->GetFileName() ); \ - writer->SetInput(caster->GetOutput()); \ - if (m_RAMValue != 0) \ - writer->SetAutomaticAdaptativeStreaming(m_RAMValue); \ - writer->Update(); \ - } + otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + + if (mpiConfig->GetNbProcs() > 1) + { + useStandardWriter = false; + + // Get file extension + std::string extension = itksys::SystemTools::GetFilenameExtension(filename); + if(extension == ".vrt") + { + // Use the WriteMPI function + WriteMPI(clampFilter->GetOutput(),filename,ramValue); + } + #ifdef OTB_USE_SPTW + else if (extension == ".tif") + { + // Use simple parallel tiff writer + typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType; + + typename SPTWriterType::Pointer sptWriter = SPTWriterType::New(); + sptWriter->SetFileName(filename); + sptWriter->SetInput(clampFilter->GetOutput()); + sptWriter->SetAutomaticAdaptativeStreaming(ramValue); + sptWriter->Update(); + } + + #endif + else + { + itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported."); + } + + } + + #endif + + if(useStandardWriter) + { + + writer->SetFileName( filename ); + writer->SetInput(clampFilter->GetOutput()); + writer->SetAutomaticAdaptativeStreaming(ramValue); + writer->Update(); + } +} template <class TInputImageType> void @@ -90,12 +144,12 @@ ComplexOutputImageParameter::SwitchImageWrite() { case ComplexImagePixelType_float: { - otbCastAndWriteImageMacro(TInputImageType, ComplexFloatImageType, m_ComplexFloatWriter); + CastAndWriteImage<TInputImageType,ComplexFloatImageType>(m_Image,m_ComplexFloatWriter,m_FileName,m_RAMValue); break; } case ComplexImagePixelType_double: { - otbCastAndWriteImageMacro(TInputImageType, ComplexDoubleImageType, m_ComplexDoubleWriter); + CastAndWriteImage<TInputImageType,ComplexDoubleImageType>(m_Image,m_ComplexDoubleWriter,m_FileName,m_RAMValue); break; } } @@ -110,12 +164,12 @@ ComplexOutputImageParameter::SwitchVectorImageWrite() { case ComplexImagePixelType_float: { - otbCastAndWriteImageMacro(TInputVectorImageType, ComplexFloatVectorImageType, m_ComplexVectorFloatWriter); + CastAndWriteImage<TInputVectorImageType,ComplexFloatVectorImageType>(m_Image,m_ComplexVectorFloatWriter,m_FileName,m_RAMValue); break; } case ComplexImagePixelType_double: { - otbCastAndWriteImageMacro(TInputVectorImageType, ComplexDoubleVectorImageType, m_ComplexVectorDoubleWriter); + CastAndWriteImage<TInputVectorImageType,ComplexDoubleVectorImageType>(m_Image,m_ComplexVectorDoubleWriter,m_FileName,m_RAMValue); break; } } @@ -162,7 +216,7 @@ ComplexOutputImageParameter::GetWriter() type = 1; } - itk::ProcessObject* writer = 0; + itk::ProcessObject* writer = ITK_NULLPTR; switch ( GetComplexPixelType() ) { case ComplexImagePixelType_float: diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx index ac470c61136632e849cbf84cf8e72116092f9b3d..2fce37f4841735edfc8a3a1efc4b720b609a650f 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx @@ -15,12 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperDocExampleStructure_cxx -#define __otbWrapperDocExampleStructure_cxx - #include "otbWrapperDocExampleStructure.h" - namespace otb { namespace Wrapper @@ -227,5 +223,3 @@ DocExampleStructure::GenerateHtmlExample() } // End namespace Wrapper } // End namespace otb - -#endif diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputFilenameListParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputFilenameListParameter.cxx index 226a412a2d1a7bd17a60f7ce1a0f7b9dc77ad6fe..9169676cd0c9a0cabdeee1239c697be4f1b502c4 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputFilenameListParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputFilenameListParameter.cxx @@ -81,7 +81,7 @@ InputFilenameListParameter::SetListFromFileName(const std::vector<std::string> & void InputFilenameListParameter::AddNullElement() { - m_FilenameList->PushBack(NULL); + m_FilenameList->PushBack(ITK_NULLPTR); SetActive(false); this->Modified(); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx index 1516830f431007ad6b84f9666003ccd4b87ded55..ae1acf31b3bc357df601d4d68990bfe059f22e79 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx @@ -83,8 +83,8 @@ InputImageListParameter::SetListFromFileName(const std::vector<std::string> & fi void InputImageListParameter::AddNullElement() { - m_ReaderList->PushBack(NULL); - m_ImageList->PushBack(NULL); + m_ReaderList->PushBack(ITK_NULLPTR); + m_ImageList->PushBack(ITK_NULLPTR); SetActive(false); this->Modified(); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx index 98f7d9d843b437789fd7776d4f59eba4a584be55..5d15296a5cfa020ad5db9ebf5edf2c3d85afd9da 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx @@ -104,9 +104,9 @@ InputImageParameter::HasValue() const void InputImageParameter::ClearValue() { - m_Image = NULL; - m_Reader = NULL; - m_Caster = NULL; + m_Image = ITK_NULLPTR; + m_Reader = ITK_NULLPTR; + m_Caster = ITK_NULLPTR; m_FileName = ""; m_PreviousFileName=""; m_UseFilename = true; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h index f68248d4c57897ecc148668a1d8b4c0add175392..038cae0207d588653f789fe81805a551e9190323 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperInputImageParameterMacros__h -#define __otbWrapperInputImageParameterMacros__h +#ifndef otbWrapperInputImageParameterMacros__h +#define otbWrapperInputImageParameterMacros__h #define otbGetImageMacro(image) \ image##Type * \ diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx index be17bb948f81ea97a661a1e7fb6165db44f0ccd3..4f267cdda639de6b7d95ab83082c02d4a57d7c4f 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx @@ -137,7 +137,7 @@ InputProcessXMLParameter::GetChildNodeTextOf(TiXmlElement *parentElement, std::s if(parentElement) { - TiXmlElement* childElement = 0; + TiXmlElement* childElement = ITK_NULLPTR; childElement = parentElement->FirstChildElement(key.c_str()); //same as childElement->GetText() does but that call is failing if there is @@ -251,7 +251,7 @@ InputProcessXMLParameter::Read(Application::Pointer this_) ParameterGroup::Pointer paramGroup = this_->GetParameterList(); // Iterate through the parameter list - for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != NULL; + for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != ITK_NULLPTR; n_Parameter = n_Parameter->NextSiblingElement() ) { std::string key,typeAsString, value, paramName; @@ -273,11 +273,11 @@ InputProcessXMLParameter::Read(Application::Pointer this_) param->SetUserValue(true); param->SetActive(true); - TiXmlElement* n_Values = NULL; + TiXmlElement* n_Values = ITK_NULLPTR; n_Values = n_Parameter->FirstChildElement("values"); if(n_Values) { - for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != NULL; + for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != ITK_NULLPTR; n_Value = n_Value->NextSiblingElement()) { values.push_back(n_Value->GetText()); @@ -292,7 +292,7 @@ InputProcessXMLParameter::Read(Application::Pointer this_) else if (type == ParameterType_OutputImage) { OutputImageParameter *paramDown = dynamic_cast<OutputImageParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) { paramDown->SetFileName(value); std::string pixTypeAsString = GetChildNodeTextOf(n_Parameter, "pixtype"); @@ -303,19 +303,19 @@ InputProcessXMLParameter::Read(Application::Pointer this_) else if (type == ParameterType_ComplexOutputImage) { ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) paramDown->SetFileName(value); } else if (type == ParameterType_Directory) { DirectoryParameter* paramDown = dynamic_cast<DirectoryParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) paramDown->SetValue(value); } else if (type == ParameterType_InputFilename) { InputFilenameParameter* paramDown = dynamic_cast<InputFilenameParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) paramDown->SetValue(value); } else if (type == ParameterType_InputImage) @@ -323,7 +323,7 @@ InputProcessXMLParameter::Read(Application::Pointer this_) if(itksys::SystemTools::FileExists(value.c_str())) { InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) { paramDown->SetFromFileName(value); if (!paramDown->SetFromFileName(value)) @@ -342,7 +342,7 @@ InputProcessXMLParameter::Read(Application::Pointer this_) if(itksys::SystemTools::FileExists(value.c_str())) { ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); - if(paramDown!=NULL) + if(paramDown!=ITK_NULLPTR) paramDown->SetFromFileName(value); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataListParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataListParameter.cxx index b6784a8ff613045a2c1cf216fac98c7efadd7d97..b065d11a679b5f1ec86fe6474add252ca8124fd7 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataListParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataListParameter.cxx @@ -84,8 +84,8 @@ InputVectorDataListParameter::SetListFromFileName(const std::vector<std::string> void InputVectorDataListParameter::AddNullElement() { - m_ReaderList->PushBack(NULL); - m_VectorDataList->PushBack(NULL); + m_ReaderList->PushBack(ITK_NULLPTR); + m_VectorDataList->PushBack(ITK_NULLPTR); SetActive(false); this->Modified(); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataParameter.cxx index a2ed97c85221c5443e81ff72c47733cd229894c1..83705329c1d27981b746dff41c8df62449363e97 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputVectorDataParameter.cxx @@ -120,8 +120,8 @@ InputVectorDataParameter::HasValue() const void InputVectorDataParameter::ClearValue() { - m_VectorData = NULL; - m_Reader = NULL; + m_VectorData = ITK_NULLPTR; + m_Reader = ITK_NULLPTR; m_FileName = ""; } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx index ec02594f477975de87349a3276a0e9c162e40d72..475e445d1012d63aaaba3122a94af70cf41f4171 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -19,6 +19,17 @@ #include "otbClampImageFilter.h" #include "otbClampVectorImageFilter.h" +#ifdef OTB_USE_MPI + +#include "otbMPIConfig.h" +#include "otbMPIVrtWriter.h" + +#ifdef OTB_USE_SPTW +#include "otbSimpleParallelTiffWriter.h" +#endif + +#endif + namespace otb { namespace Wrapper @@ -105,27 +116,117 @@ void OutputImageParameter::InitializeWriters() } -#define otbClampAndWriteImageMacro(InputImageType, OutputImageType, writer) \ - { \ - typedef otb::ClampImageFilter<InputImageType, OutputImageType> ClampFilterType; \ - typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); \ - clampFilter->SetInput( dynamic_cast<InputImageType*>(m_Image.GetPointer()) ); \ - writer->SetFileName( this->GetFileName() ); \ - writer->SetInput(clampFilter->GetOutput()); \ - writer->SetAutomaticAdaptativeStreaming(m_RAMValue); \ - writer->Update(); \ - } +template <typename TInput, typename TOutput> void ClampAndWriteImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput> * writer, const std::string & filename, const unsigned int & ramValue) +{ + typedef otb::ClampImageFilter<TInput, TOutput> ClampFilterType; + typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); + clampFilter->SetInput( dynamic_cast<TInput*>(in)); + + bool useStandardWriter = true; -#define otbClampAndWriteVectorImageMacro(InputImageType, OutputImageType, writer) \ - { \ - typedef otb::ClampVectorImageFilter<InputImageType, OutputImageType> ClampFilterType; \ - typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); \ - clampFilter->SetInput( dynamic_cast<InputImageType*>(m_Image.GetPointer()) ); \ - writer->SetFileName(this->GetFileName() ); \ - writer->SetInput(clampFilter->GetOutput()); \ - writer->SetAutomaticAdaptativeStreaming(m_RAMValue); \ - writer->Update(); \ - } + #ifdef OTB_USE_MPI + + otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + + if (mpiConfig->GetNbProcs() > 1) + { + useStandardWriter = false; + + // Get file extension + std::string extension = itksys::SystemTools::GetFilenameExtension(filename); + + if(extension == ".vrt") + { + // Use the WriteMPI function + WriteMPI(clampFilter->GetOutput(),filename,ramValue); + } + #ifdef OTB_USE_SPTW + else if (extension == ".tif") + { + // Use simple parallel tiff writer + typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType; + + typename SPTWriterType::Pointer sptWriter = SPTWriterType::New(); + sptWriter->SetFileName(filename); + sptWriter->SetInput(clampFilter->GetOutput()); + sptWriter->SetAutomaticAdaptativeStreaming(ramValue); + sptWriter->Update(); + } + + #endif + else + { + itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported."); + } + + } + + #endif + + if(useStandardWriter) + { + + writer->SetFileName( filename ); + writer->SetInput(clampFilter->GetOutput()); + writer->SetAutomaticAdaptativeStreaming(ramValue); + writer->Update(); + } +} + +template <typename TInput, typename TOutput > void ClampAndWriteVectorImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput > * writer, const std::string & filename, const unsigned int & ramValue) +{ + typedef otb::ClampVectorImageFilter<TInput, TOutput> ClampFilterType; + typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); + clampFilter->SetInput( dynamic_cast<TInput*>(in)); + + bool useStandardWriter = true; + +#ifdef OTB_USE_MPI + + otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + + if (mpiConfig->GetNbProcs() > 1) + { + useStandardWriter = false; + + // Get file extension + std::string extension = itksys::SystemTools::GetFilenameExtension(filename); + + if(extension == ".vrt") + { + // Use the WriteMPI function + WriteMPI(clampFilter->GetOutput(),filename,ramValue); + } + #ifdef OTB_USE_SPTW + else if (extension == ".tif") + { + // Use simple parallel tiff writer + typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType; + + typename SPTWriterType::Pointer sptWriter = SPTWriterType::New(); + sptWriter->SetFileName(filename); + sptWriter->SetInput(clampFilter->GetOutput()); + sptWriter->SetAutomaticAdaptativeStreaming(ramValue); + sptWriter->Update(); + } + + #endif + else + { + itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported."); + } + } + #endif + + if(useStandardWriter) + { + + writer->SetFileName( filename ); + writer->SetInput(clampFilter->GetOutput()); + writer->SetAutomaticAdaptativeStreaming(ramValue); + writer->Update(); + } +} template <class TInputImageType> @@ -136,37 +237,37 @@ OutputImageParameter::SwitchImageWrite() { case ImagePixelType_uint8: { - otbClampAndWriteImageMacro(TInputImageType, UInt8ImageType, m_UInt8Writer); + ClampAndWriteImage<TInputImageType,UInt8ImageType>(m_Image,m_UInt8Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_int16: { - otbClampAndWriteImageMacro(TInputImageType, Int16ImageType, m_Int16Writer); + ClampAndWriteImage<TInputImageType,Int16ImageType>(m_Image,m_Int16Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_uint16: { - otbClampAndWriteImageMacro(TInputImageType, UInt16ImageType, m_UInt16Writer); + ClampAndWriteImage<TInputImageType,UInt16ImageType>(m_Image,m_UInt16Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_int32: { - otbClampAndWriteImageMacro(TInputImageType, Int32ImageType, m_Int32Writer); + ClampAndWriteImage<TInputImageType,Int32ImageType>(m_Image,m_Int32Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_uint32: { - otbClampAndWriteImageMacro(TInputImageType, UInt32ImageType, m_UInt32Writer); + ClampAndWriteImage<TInputImageType,UInt32ImageType>(m_Image,m_UInt32Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_float: { - otbClampAndWriteImageMacro(TInputImageType, FloatImageType, m_FloatWriter); + ClampAndWriteImage<TInputImageType,FloatImageType>(m_Image,m_FloatWriter,m_FileName,m_RAMValue); break; } case ImagePixelType_double: { - otbClampAndWriteImageMacro(TInputImageType, DoubleImageType, m_DoubleWriter); + ClampAndWriteImage<TInputImageType,DoubleImageType>(m_Image,m_DoubleWriter,m_FileName,m_RAMValue); break; } } @@ -181,37 +282,37 @@ OutputImageParameter::SwitchVectorImageWrite() { case ImagePixelType_uint8: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, UInt8VectorImageType, m_VectorUInt8Writer); + ClampAndWriteVectorImage<TInputVectorImageType,UInt8VectorImageType>(m_Image,m_VectorUInt8Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_int16: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, Int16VectorImageType, m_VectorInt16Writer); + ClampAndWriteVectorImage<TInputVectorImageType,Int16VectorImageType>(m_Image,m_VectorInt16Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_uint16: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, UInt16VectorImageType, m_VectorUInt16Writer); + ClampAndWriteVectorImage<TInputVectorImageType,UInt16VectorImageType>(m_Image,m_VectorUInt16Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_int32: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, Int32VectorImageType, m_VectorInt32Writer); + ClampAndWriteVectorImage<TInputVectorImageType,Int32VectorImageType>(m_Image,m_VectorInt32Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_uint32: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, UInt32VectorImageType, m_VectorUInt32Writer); + ClampAndWriteVectorImage<TInputVectorImageType,UInt32VectorImageType>(m_Image,m_VectorUInt32Writer,m_FileName,m_RAMValue); break; } case ImagePixelType_float: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, FloatVectorImageType, m_VectorFloatWriter); + ClampAndWriteVectorImage<TInputVectorImageType,FloatVectorImageType>(m_Image,m_VectorFloatWriter,m_FileName,m_RAMValue); break; } case ImagePixelType_double: { - otbClampAndWriteVectorImageMacro(TInputVectorImageType, DoubleVectorImageType, m_VectorDoubleWriter); + ClampAndWriteVectorImage<TInputVectorImageType,DoubleVectorImageType>(m_Image,m_VectorDoubleWriter,m_FileName,m_RAMValue); break; } } @@ -332,7 +433,7 @@ OutputImageParameter::GetWriter() // 1 : VectorImage // 2 : RGBAImage // 3 : RGBImage - itk::ProcessObject* writer = 0; + itk::ProcessObject* writer = ITK_NULLPTR; if (dynamic_cast<UInt8VectorImageType*> (m_Image.GetPointer()) || dynamic_cast<Int16VectorImageType*> (m_Image.GetPointer()) || dynamic_cast<UInt16VectorImageType*> (m_Image.GetPointer()) @@ -428,7 +529,7 @@ OutputImageParameter::GetWriter() break; } } - if (0 == writer) + if (ITK_NULLPTR == writer) { itkExceptionMacro("Unknown Writer type."); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx index b03401d2970ab006f93e165ff3bd422369f37f25..faa67a7c8b6289647cfc4490c1f4eb5c52fa1e79 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx @@ -181,7 +181,7 @@ OutputProcessXMLParameter::Write(Application::Pointer app) { EmptyParameter* eParam = dynamic_cast<EmptyParameter *> (param); - if(eParam!=NULL) + if(eParam!=ITK_NULLPTR) { //Dont use app->HasUserValue which returns false always because of //EmptyParameter::HasValue() is false for EmptyParameter @@ -211,7 +211,7 @@ OutputProcessXMLParameter::Write(Application::Pointer app) { OutputImageParameter *imgParam = dynamic_cast<OutputImageParameter *>(param); - if(imgParam!=NULL) + if(imgParam!=ITK_NULLPTR) { value = imgParam->GetFileName(); ImagePixelType pixType = imgParam->GetPixelType(); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx index e172ad37c8ecbbcd1e21ccea41a51286bfa5887e..2ccd5b153cf831b787bee2ffd991306d7bdba1ea 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx @@ -173,7 +173,7 @@ const std::string defaultXMLFileName = std::string(GetName()) + ".xml"; tmpParam->SetActive(false); AddParameter(tmpParam); - tmpParam = NULL; + tmpParam = ITK_NULLPTR; /* AddParameter(ParameterType_OutputProcessXML, key, descr); SetParameterDescription(key, descr); @@ -193,7 +193,7 @@ void ParameterGroup::AddInXMLParameter() tmpParam->SetActive(false); AddParameter(tmpParam); - tmpParam = NULL; + tmpParam = ITK_NULLPTR; /* AddParameter(ParameterType_InputProcessXML, key, descr); SetParameterDescription(key, descr); diff --git a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h index 26203558e19aefc4cb1bc8674f86603d1b76de19..1f03dcf906334279fe728f3238f6d5948464a3c0 100644 --- a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h +++ b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperCommandLineLauncher_h -#define __otbWrapperCommandLineLauncher_h +#ifndef otbWrapperCommandLineLauncher_h +#define otbWrapperCommandLineLauncher_h #include "otbWrapperApplication.h" @@ -122,7 +122,7 @@ protected: CommandLineLauncher(const char * exp); /** Destructor */ - virtual ~CommandLineLauncher(); + ~CommandLineLauncher() ITK_OVERRIDE; /** Load the executable path. It looks for the key --modulePath, * extract and interpret as path the following strings. @@ -190,4 +190,4 @@ private: } // end namespace Wrapper } //end namespace otb -#endif // __otbWrapperCommandLineLauncher_h_ +#endif // otbWrapperCommandLineLauncher_h_ diff --git a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h index be529fbffb27c65ebccc425e1ea6f4f97bcef91c..12cfe9122651ad0881cdd3352a7dece4b69f856f 100644 --- a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h +++ b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperCommandLineParser_h -#define __otbWrapperCommandLineParser_h +#ifndef otbWrapperCommandLineParser_h +#define otbWrapperCommandLineParser_h #include "itkObjectFactory.h" @@ -87,7 +87,7 @@ protected: CommandLineParser(); /** Destructor */ - virtual ~CommandLineParser(); + ~CommandLineParser() ITK_OVERRIDE; private: CommandLineParser(const CommandLineParser &); //purposely not implemented @@ -103,4 +103,4 @@ private: } // end namespace Wrapper } //end namespace otb -#endif // __otbWrapperCommandLineParser_h_ +#endif // otbWrapperCommandLineParser_h_ diff --git a/Modules/Wrappers/CommandLine/otb-module.cmake b/Modules/Wrappers/CommandLine/otb-module.cmake index 5ae1a6f62ad4050d8148b9f6ab9b87f601703a31..31e4551d5edcb3e11b8021c466c9e268ae0fd164 100644 --- a/Modules/Wrappers/CommandLine/otb-module.cmake +++ b/Modules/Wrappers/CommandLine/otb-module.cmake @@ -7,6 +7,9 @@ otb_module(OTBCommandLine OTBTinyXML OTBApplicationEngine + OPTIONAL_DEPENDS + OTBMPIConfig + TEST_DEPENDS OTBTestKernel OTBAppImageUtils diff --git a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx index 20971d4032a15f16424bf26759edd7feb9a0c45e..05d439d7fa689d3b8cfca4d9879760d2cb3d8372 100644 --- a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx +++ b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx @@ -20,6 +20,10 @@ #include "otb_tinyxml.h" #include <vector> +#ifdef OTB_USE_MPI +#include "otbMPIConfig.h" +#endif + const std::string GetChildNodeTextOf(TiXmlElement *parentElement, std::string key); std::string PrepareExpressionFromXML(std::string filename); std::vector<std::string> PrepareVectorExpressionFromXML(std::string filename); @@ -100,18 +104,18 @@ std::string PrepareExpressionFromXML(std::string filename) expression.append(moduleName); - for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != NULL; + for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != ITK_NULLPTR; n_Parameter = n_Parameter->NextSiblingElement() ) { std::string key="-"; key.append(GetChildNodeTextOf(n_Parameter, "key")); - TiXmlElement* n_Values = NULL; + TiXmlElement* n_Values = ITK_NULLPTR; n_Values = n_Parameter->FirstChildElement("values"); if(n_Values) { std::string values; - for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != NULL; + for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != ITK_NULLPTR; n_Value = n_Value->NextSiblingElement()) { values.append(n_Value->GetText()); @@ -197,19 +201,19 @@ std::vector<std::string> PrepareVectorExpressionFromXML(std::string filename) expression.push_back(CleanWord(moduleName)); - for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != NULL; + for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != ITK_NULLPTR; n_Parameter = n_Parameter->NextSiblingElement() ) { std::string key="-"; key.append(GetChildNodeTextOf(n_Parameter, "key")); expression.push_back(CleanWord(key)); - TiXmlElement* n_Values = NULL; + TiXmlElement* n_Values = ITK_NULLPTR; n_Values = n_Parameter->FirstChildElement("values"); if(n_Values) { std::string values; - for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != NULL; + for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != ITK_NULLPTR; n_Value = n_Value->NextSiblingElement()) { expression.push_back(CleanWord(n_Value->GetText())); @@ -241,15 +245,20 @@ std::string CleanWord(const std::string & word) // Suppress whitespace characters at the beginning and ending of the string std::string::size_type cleanStart = word.find_first_not_of(" \t"); std::string::size_type cleanEnd = word.find_last_not_of(" \t\f\v\n\r"); + // cleanStart == npos implies cleanEnd == npos if (cleanEnd != std::string::npos) { - res = word.substr(cleanStart,cleanEnd+1); + res = word.substr(cleanStart, cleanEnd - cleanStart + 1); } return res; } int main(int argc, char* argv[]) { + #ifdef OTB_USE_MPI + otb::MPIConfig::Instance()->Init(argc,argv); + #endif + if (argc < 2) { std::cerr << "Usage : " << argv[0] << " module_name [MODULEPATH] [arguments]" << std::endl; @@ -257,7 +266,7 @@ int main(int argc, char* argv[]) } std::vector<std::string> vexp; - + std::string exp; if (strcmp(argv[1], "-inxml") == 0) { @@ -315,7 +324,7 @@ const std::string GetChildNodeTextOf(TiXmlElement *parentElement, std::string ke if(parentElement) { - TiXmlElement* childElement = 0; + TiXmlElement* childElement = ITK_NULLPTR; childElement = parentElement->FirstChildElement(key.c_str()); //same as childElement->GetText() does but that call is failing if there is diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index 48b82b9a6fecc73d99b1ec612a02f632633060b9..e44342f69894bea9638eed5a67b537024520495b 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -54,7 +54,7 @@ namespace Wrapper CommandLineLauncher::CommandLineLauncher() : /*m_Expression(""),*/m_VExpression(), m_WatcherList(), m_ReportProgress(true), m_MaxKeySize(0) { - m_Application = NULL; + m_Application = ITK_NULLPTR; m_Parser = CommandLineParser::New(); m_LogOutput = itk::StdStreamLogOutput::New(); m_LogOutput->SetStream(std::cout); @@ -67,13 +67,15 @@ CommandLineLauncher::CommandLineLauncher() : CommandLineLauncher::CommandLineLauncher(const char *) /*: m_Expression(exp)*/ { - m_Application = NULL; + m_Application = ITK_NULLPTR; m_Parser = CommandLineParser::New(); } CommandLineLauncher::~CommandLineLauncher() { this->DeleteWatcherList(); + m_Application = ITK_NULLPTR; + ApplicationRegistry::CleanRegistry(); } void CommandLineLauncher::DeleteWatcherList() @@ -81,7 +83,7 @@ void CommandLineLauncher::DeleteWatcherList() for (unsigned int i = 0; i < m_WatcherList.size(); i++) { delete m_WatcherList[i]; - m_WatcherList[i] = NULL; + m_WatcherList[i] = ITK_NULLPTR; } m_WatcherList.clear(); } diff --git a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h index c5719356821b0bd5fe01e85521b697a9f4e9e21a..9584e18d89132024fd7f792f89114973c2cf3065 100644 --- a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h +++ b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h @@ -36,7 +36,7 @@ public: QtProgressBar( QWidget *parent ); /** Destructor */ - ~QtProgressBar(); + ~QtProgressBar() ITK_OVERRIDE; /** Get Command */ RedrawCommandType * GetRedrawCommand( void ) const; diff --git a/Modules/Wrappers/QtWidget/include/otbQtApplication.h b/Modules/Wrappers/QtWidget/include/otbQtApplication.h index 59febb90b7ef09799097eef7437206fcced72801..0ca7fd6572639a58403c547ef33c6ad5b96b3bd1 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtApplication.h +++ b/Modules/Wrappers/QtWidget/include/otbQtApplication.h @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef __otbQtApplication_h -#define __otbQtApplication_h +#ifndef otbQtApplication_h +#define otbQtApplication_h #include <QtGui> #include <QString> @@ -35,7 +35,7 @@ class ITK_ABI_EXPORT QtApplication : public QApplication public: QtApplication(int& argc, char** argv); - bool notify(QObject *object, QEvent* event); + bool notify(QObject *object, QEvent* event) ITK_OVERRIDE; signals: diff --git a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h index f372525ea200e3b69d54af60544b1b20dd0bf8f9..9ddaacc42a816c4f2ea0fbbe69cef7024ed4dd1f 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQtFileSelectionWidget_h -#define __otbQtFileSelectionWidget_h +#ifndef otbQtFileSelectionWidget_h +#define otbQtFileSelectionWidget_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -41,7 +41,7 @@ class ITK_ABI_EXPORT QtFileSelectionWidget : public QWidget Q_OBJECT public: QtFileSelectionWidget(); - virtual ~QtFileSelectionWidget(); + ~QtFileSelectionWidget() ITK_OVERRIDE; bool IsChecked() { diff --git a/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h b/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h index b5b170a1ddd37b4cafec688d613381eb1e3ea1f4..e0e411cae3f41f3786cfeeeb1bf331474914c5b9 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h +++ b/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQtLogOutput_h -#define __otbQtLogOutput_h +#ifndef otbQtLogOutput_h +#define otbQtLogOutput_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -50,16 +50,16 @@ public: itkNewMacro(QtLogOutput); /** flush a buffer */ - virtual void Flush(); + void Flush() ITK_OVERRIDE; /** Write to multiple outputs */ - virtual void Write(double timestamp); + void Write(double timestamp) ITK_OVERRIDE; /** Write to a buffer */ - virtual void Write(std::string const &content); + void Write(std::string const &content) ITK_OVERRIDE; /** Write to a buffer */ - virtual void Write(std::string const &content, double timestamp); + void Write(std::string const &content, double timestamp) ITK_OVERRIDE; signals: void NewContentLog(QString); @@ -69,9 +69,9 @@ protected: QtLogOutput(); /** Destructor */ - virtual ~QtLogOutput(); + ~QtLogOutput() ITK_OVERRIDE; - void PrintSelf(std::ostream &os, itk::Indent indent) const; + void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE; }; } diff --git a/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h index b5dd7353d38d2fed6a60206c801ced637039cbf9..6d830fafb49c7894ff6ac5feb1c299d995229dbe 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbQtStringSelectionWidget_h -#define __otbQtStringSelectionWidget_h +#ifndef otbQtStringSelectionWidget_h +#define otbQtStringSelectionWidget_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -46,7 +46,7 @@ signals: public: QtStringSelectionWidget(); - virtual ~QtStringSelectionWidget(); + ~QtStringSelectionWidget() ITK_OVERRIDE; bool IsChecked() { diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h index 71c9918f388e81a1287810d6833b46234cdadba1..f347bac6700a7fcc48fa77aea509e3c90f60e710 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetChoiceParameter_h -#define __otbWrapperQtWidgetChoiceParameter_h +#ifndef otbWrapperQtWidgetChoiceParameter_h +#define otbWrapperQtWidgetChoiceParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetChoiceParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetChoiceParameter(ChoiceParameter*, QtWidgetModel*); - virtual ~QtWidgetChoiceParameter(); + ~QtWidgetChoiceParameter() ITK_OVERRIDE; protected slots: void SetValue( int value ); @@ -48,9 +48,9 @@ private: QtWidgetChoiceParameter(const QtWidgetChoiceParameter&); //purposely not implemented void operator=(const QtWidgetChoiceParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; ChoiceParameter::Pointer m_ChoiceParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h index 35a2eb8aa17ddd0bec369d2915e778ada9a682c9..c09ebe7d71386f678e6a368544f27f1722992058 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetComplexInputImageParameter_h -#define __otbWrapperQtWidgetComplexInputImageParameter_h +#ifndef otbWrapperQtWidgetComplexInputImageParameter_h +#define otbWrapperQtWidgetComplexInputImageParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetComplexInputImageParameter : public QtWidgetParamet Q_OBJECT public: QtWidgetComplexInputImageParameter(ComplexInputImageParameter*, QtWidgetModel*); - virtual ~QtWidgetComplexInputImageParameter(); + ~QtWidgetComplexInputImageParameter() ITK_OVERRIDE; protected slots: bool SetFileName( const QString& value ); @@ -50,9 +50,9 @@ private: QtWidgetComplexInputImageParameter(const QtWidgetComplexInputImageParameter&); //purposely not implemented void operator=(const QtWidgetComplexInputImageParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; ComplexInputImageParameter::Pointer m_ComplexInputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h index 853a9f10c4b68f593d84161698cc7914c4076bd8..2aab53c181fb6eef1d1cd7ccc95bac7bc5babeab 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetComplexOutputImageParameter_h -#define __otbWrapperQtWidgetComplexOutputImageParameter_h +#ifndef otbWrapperQtWidgetComplexOutputImageParameter_h +#define otbWrapperQtWidgetComplexOutputImageParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetComplexOutputImageParameter : public QtWidgetParame Q_OBJECT public: QtWidgetComplexOutputImageParameter(ComplexOutputImageParameter*, QtWidgetModel*); - virtual ~QtWidgetComplexOutputImageParameter(); + ~QtWidgetComplexOutputImageParameter() ITK_OVERRIDE; /** Get the PixelType*/ //itkGetMacro(PixelType, int); @@ -54,9 +54,9 @@ private: QtWidgetComplexOutputImageParameter(const QtWidgetComplexOutputImageParameter&); //purposely not implemented void operator=(const QtWidgetComplexOutputImageParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; std::string m_FileName; ComplexOutputImageParameter::Pointer m_OutputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h index ebc23afcd215f80cbc4c45124902154ac671143f..561ffe38b8b6ff9e855a4196552e0319bf2ff657 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetDirectoryParameter_h -#define __otbWrapperQtWidgetDirectoryParameter_h +#ifndef otbWrapperQtWidgetDirectoryParameter_h +#define otbWrapperQtWidgetDirectoryParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetDirectoryParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetDirectoryParameter(DirectoryParameter*, QtWidgetModel*); - virtual ~QtWidgetDirectoryParameter(); + ~QtWidgetDirectoryParameter() ITK_OVERRIDE; protected slots: void SetFileName( const QString& value ); @@ -50,9 +50,9 @@ private: QtWidgetDirectoryParameter(const QtWidgetDirectoryParameter&); //purposely not implemented void operator=(const QtWidgetDirectoryParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; DirectoryParameter::Pointer m_DirectoryParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h index 452c2cbaba5692bba08f634b3cc2c5edf024498f..ec1273f3c8aa13adbb65e21fa82cafade3235a6e 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetEmptyParameter_h -#define __otbWrapperQtWidgetEmptyParameter_h +#ifndef otbWrapperQtWidgetEmptyParameter_h +#define otbWrapperQtWidgetEmptyParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,15 +40,15 @@ class ITK_ABI_EXPORT QtWidgetEmptyParameter : public QtWidgetParameterBase public: QtWidgetEmptyParameter(EmptyParameter*, QtWidgetModel*); - virtual ~QtWidgetEmptyParameter(); + ~QtWidgetEmptyParameter() ITK_OVERRIDE; private: QtWidgetEmptyParameter(const QtWidgetEmptyParameter&); //purposely not implemented void operator=(const QtWidgetEmptyParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; }; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h index 6873261ed5c3f9c36a48433c568b6cb18c32ce45..6ed4196ce0e98ed36874ddd1ff0ffda3ac1e7137 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetFloatParameter_h -#define __otbWrapperQtWidgetFloatParameter_h +#ifndef otbWrapperQtWidgetFloatParameter_h +#define otbWrapperQtWidgetFloatParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetFloatParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetFloatParameter(FloatParameter*, QtWidgetModel*); - virtual ~QtWidgetFloatParameter(); + ~QtWidgetFloatParameter() ITK_OVERRIDE; protected slots: void SetValue( double value ); @@ -48,9 +48,9 @@ private: QtWidgetFloatParameter(const QtWidgetFloatParameter&); //purposely not implemented void operator=(const QtWidgetFloatParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; QHBoxLayout * m_QHBoxLayout; QDoubleSpinBox * m_QDoubleSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h index e47bb74f93b80114602eacff24b6b7972ab771dc..9b44f3dee77157cfc9ca63263e7601f512ddd416 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputFilenameListParameter_h -#define __otbWrapperQtWidgetInputFilenameListParameter_h +#ifndef otbWrapperQtWidgetInputFilenameListParameter_h +#define otbWrapperQtWidgetInputFilenameListParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -38,7 +38,7 @@ class ITK_ABI_EXPORT QtWidgetInputFilenameListParameter : public QtWidgetParamet Q_OBJECT public: QtWidgetInputFilenameListParameter(InputFilenameListParameter*, QtWidgetModel*); - virtual ~QtWidgetInputFilenameListParameter(); + ~QtWidgetInputFilenameListParameter() ITK_OVERRIDE; signals: @@ -59,9 +59,9 @@ private: QtWidgetInputFilenameListParameter(const QtWidgetInputFilenameListParameter&); //purposely not implemented void operator=(const QtWidgetInputFilenameListParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; void RecreateFilenameList(); void UpdateFileList( std::map<unsigned int, unsigned int> idMap ); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h index 8669a837353b31f7c222ac368908464842ad2e53..38c345bffeedd9ee7369d8c181a1a8a49115c5e5 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputFilenameParameter_h -#define __otbWrapperQtWidgetInputFilenameParameter_h +#ifndef otbWrapperQtWidgetInputFilenameParameter_h +#define otbWrapperQtWidgetInputFilenameParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetInputFilenameParameter : public QtWidgetParameterBa Q_OBJECT public: QtWidgetInputFilenameParameter(InputFilenameParameter*, QtWidgetModel*); - virtual ~QtWidgetInputFilenameParameter(); + ~QtWidgetInputFilenameParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -53,9 +53,9 @@ private: QtWidgetInputFilenameParameter(const QtWidgetInputFilenameParameter&); //purposely not implemented void operator=(const QtWidgetInputFilenameParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; InputFilenameParameter::Pointer m_FilenameParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h index b127e8b67bd450e33e67053e7f13a907b88bb9c7..86133f60a84304b6a476e1a7bce246d04fbaacb7 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputImageListParameter_h -#define __otbWrapperQtWidgetInputImageListParameter_h +#ifndef otbWrapperQtWidgetInputImageListParameter_h +#define otbWrapperQtWidgetInputImageListParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -38,7 +38,7 @@ class ITK_ABI_EXPORT QtWidgetInputImageListParameter : public QtWidgetParameterB Q_OBJECT public: QtWidgetInputImageListParameter(InputImageListParameter*, QtWidgetModel*); - virtual ~QtWidgetInputImageListParameter(); + ~QtWidgetInputImageListParameter() ITK_OVERRIDE; signals: @@ -59,9 +59,9 @@ private: QtWidgetInputImageListParameter(const QtWidgetInputImageListParameter&); //purposely not implemented void operator=(const QtWidgetInputImageListParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; void RecreateImageList(); void UpdateFileList( std::map<unsigned int, unsigned int> idMap ); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h index 7fff85424a1d031713c3195bd9df87e2e506d4b2..70552c86666c6ec7d5da0f64f3e796eadb3f66f3 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputImageParameter_h -#define __otbWrapperQtWidgetInputImageParameter_h +#ifndef otbWrapperQtWidgetInputImageParameter_h +#define otbWrapperQtWidgetInputImageParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetInputImageParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetInputImageParameter(InputImageParameter*, QtWidgetModel*); - virtual ~QtWidgetInputImageParameter(); + ~QtWidgetInputImageParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -53,9 +53,9 @@ private: QtWidgetInputImageParameter(const QtWidgetInputImageParameter&); //purposely not implemented void operator=(const QtWidgetInputImageParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; InputImageParameter::Pointer m_InputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h index 952b1dec9fd0aaf1efbf9a213a54b1a6ff0fbf60..10fc787a2b689f8e0c1e8d0920deddc76fd97446 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputProcessXMLParameter_h -#define __otbWrapperQtWidgetInputProcessXMLParameter_h +#ifndef otbWrapperQtWidgetInputProcessXMLParameter_h +#define otbWrapperQtWidgetInputProcessXMLParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetInputProcessXMLParameter : public QtWidgetParameter Q_OBJECT public: QtWidgetInputProcessXMLParameter(InputProcessXMLParameter*, QtWidgetModel*); - virtual ~QtWidgetInputProcessXMLParameter(); + ~QtWidgetInputProcessXMLParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -53,9 +53,9 @@ private: QtWidgetInputProcessXMLParameter(const QtWidgetInputProcessXMLParameter&); //purposely not implemented void operator=(const QtWidgetInputProcessXMLParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; InputProcessXMLParameter::Pointer m_XMLParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h index 1a4100b7bd1c2b6d1f8a9d0bd487344b68fb7b09..4796c4d90f30bad17ba2b695e4dda714775bebd5 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputVectorDataListParameter_h -#define __otbWrapperQtWidgetInputVectorDataListParameter_h +#ifndef otbWrapperQtWidgetInputVectorDataListParameter_h +#define otbWrapperQtWidgetInputVectorDataListParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetInputVectorDataListParameter : public QtWidgetParam Q_OBJECT public: QtWidgetInputVectorDataListParameter(InputVectorDataListParameter*, QtWidgetModel*); - virtual ~QtWidgetInputVectorDataListParameter(); + ~QtWidgetInputVectorDataListParameter() ITK_OVERRIDE; signals: @@ -60,9 +60,9 @@ private: QtWidgetInputVectorDataListParameter(const QtWidgetInputVectorDataListParameter&); //purposely not implemented void operator=(const QtWidgetInputVectorDataListParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; void RecreateVectorDataList(); void UpdateFileList( std::map<unsigned int, unsigned int> idMap ); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h index 1d1e49adc76484798959019b6e91c5dea72f9159..4a265d7bc8d1648e88316cd6ba72e9c3a4893b7b 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetInputVectorDataParameter_h -#define __otbWrapperQtWidgetInputVectorDataParameter_h +#ifndef otbWrapperQtWidgetInputVectorDataParameter_h +#define otbWrapperQtWidgetInputVectorDataParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetInputVectorDataParameter : public QtWidgetParameter Q_OBJECT public: QtWidgetInputVectorDataParameter(InputVectorDataParameter*, QtWidgetModel*); - virtual ~QtWidgetInputVectorDataParameter(); + ~QtWidgetInputVectorDataParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -53,9 +53,9 @@ private: QtWidgetInputVectorDataParameter(const QtWidgetInputVectorDataParameter&); //purposely not implemented void operator=(const QtWidgetInputVectorDataParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; InputVectorDataParameter::Pointer m_InputVectorDataParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h index 9205b5110fd1876358e896d9211d074ab16acb4b..fe62aec9052095e0d09b67428a09de29adade57e 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetIntParameter_h -#define __otbWrapperQtWidgetIntParameter_h +#ifndef otbWrapperQtWidgetIntParameter_h +#define otbWrapperQtWidgetIntParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetIntParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetIntParameter(IntParameter*, QtWidgetModel*); - virtual ~QtWidgetIntParameter(); + ~QtWidgetIntParameter() ITK_OVERRIDE; protected slots: void SetValue( int value ); @@ -49,9 +49,9 @@ private: QtWidgetIntParameter(const QtWidgetIntParameter&); //purposely not implemented void operator=(const QtWidgetIntParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; QHBoxLayout * m_QHBoxLayout; QSpinBox * m_QSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h index d96884738ac83c0e04c3911d0f5891a64d8cf9f4..15dbefee24bca9019dd967417619044439a4d151 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetListViewParameter_h -#define __otbWrapperQtWidgetListViewParameter_h +#ifndef otbWrapperQtWidgetListViewParameter_h +#define otbWrapperQtWidgetListViewParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetListViewParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetListViewParameter(ListViewParameter*, QtWidgetModel*); - virtual ~QtWidgetListViewParameter(); + ~QtWidgetListViewParameter() ITK_OVERRIDE; std::vector<int> GetSelectedItems() { @@ -53,9 +53,9 @@ private: QtWidgetListViewParameter(const QtWidgetListViewParameter&); //purposely not implemented void operator=(const QtWidgetListViewParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; ListViewParameter::Pointer m_ListViewParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h index 209d17a6fc4ff8a2fd2477eae7b0bf9a38b991c3..7b2dfbe670250373c41e8bdee64ab3dfb0331bcd 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetModel_h -#define __otbWrapperQtWidgetModel_h +#ifndef otbWrapperQtWidgetModel_h +#define otbWrapperQtWidgetModel_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT AppliThread : public QThread m_Application = app; } - virtual ~AppliThread(); + ~AppliThread() ITK_OVERRIDE; inline void Execute() { @@ -65,7 +65,7 @@ signals: void ExceptionRaised( QString what ); protected: - virtual void run(); + void run() ITK_OVERRIDE; private: AppliThread(const AppliThread&); //purposely not implemented @@ -86,7 +86,7 @@ class ITK_ABI_EXPORT QtWidgetModel : public QObject public: QtWidgetModel(Application* app); - virtual ~QtWidgetModel(); + ~QtWidgetModel() ITK_OVERRIDE; Application* GetApplication() { @@ -169,6 +169,8 @@ private: Application::Pointer m_Application; QtLogOutput::Pointer m_LogOutput; + + bool m_IsRunning; }; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h index e0459938f3aa64816164a57c9650320da379ae95..bef99179959d5251b85937bae64ed6c9ac034787 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetOutputFilenameParameter_h -#define __otbWrapperQtWidgetOutputFilenameParameter_h +#ifndef otbWrapperQtWidgetOutputFilenameParameter_h +#define otbWrapperQtWidgetOutputFilenameParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetOutputFilenameParameter : public QtWidgetParameterB Q_OBJECT public: QtWidgetOutputFilenameParameter(OutputFilenameParameter*, QtWidgetModel*); - virtual ~QtWidgetOutputFilenameParameter(); + ~QtWidgetOutputFilenameParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -55,9 +55,9 @@ private: QtWidgetOutputFilenameParameter(const QtWidgetOutputFilenameParameter&); //purposely not implemented void operator=(const QtWidgetOutputFilenameParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; OutputFilenameParameter::Pointer m_FilenameParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h index d0906049e1be304af383749692a695db8d015466..7481978e24d14c0f50f26d5148acd15e825623e3 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetOutputImageParameter_h -#define __otbWrapperQtWidgetOutputImageParameter_h +#ifndef otbWrapperQtWidgetOutputImageParameter_h +#define otbWrapperQtWidgetOutputImageParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetOutputImageParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetOutputImageParameter(OutputImageParameter*, QtWidgetModel*); - virtual ~QtWidgetOutputImageParameter(); + ~QtWidgetOutputImageParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -59,9 +59,9 @@ private: QtWidgetOutputImageParameter(const QtWidgetOutputImageParameter&); //purposely not implemented void operator=(const QtWidgetOutputImageParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; std::string m_FileName; OutputImageParameter::Pointer m_OutputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h index 20c6bf5e9c060ddb0686a6402f16836b9d6a3745..1de0fb0fde2a2ed9cc8b9028667f3e32de5bea07 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetOutputProcessXMLParameter_h -#define __otbWrapperQtWidgetOutputProcessXMLParameter_h +#ifndef otbWrapperQtWidgetOutputProcessXMLParameter_h +#define otbWrapperQtWidgetOutputProcessXMLParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetOutputProcessXMLParameter : public QtWidgetParamete Q_OBJECT public: QtWidgetOutputProcessXMLParameter(OutputProcessXMLParameter*, QtWidgetModel*); - virtual ~QtWidgetOutputProcessXMLParameter(); + ~QtWidgetOutputProcessXMLParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -55,9 +55,9 @@ private: QtWidgetOutputProcessXMLParameter(const QtWidgetOutputProcessXMLParameter&); //purposely not implemented void operator=(const QtWidgetOutputProcessXMLParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; OutputProcessXMLParameter::Pointer m_XMLParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h index c5697100d3c43e4f1f97cc0dfee8fc442169ee1a..432116b590beca4b528ecdb8c9ecf4704ff9ca29 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetOutputVectorDataParameter_h -#define __otbWrapperQtWidgetOutputVectorDataParameter_h +#ifndef otbWrapperQtWidgetOutputVectorDataParameter_h +#define otbWrapperQtWidgetOutputVectorDataParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetOutputVectorDataParameter : public QtWidgetParamete Q_OBJECT public: QtWidgetOutputVectorDataParameter(OutputVectorDataParameter*, QtWidgetModel*); - virtual ~QtWidgetOutputVectorDataParameter(); + ~QtWidgetOutputVectorDataParameter() ITK_OVERRIDE; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -58,9 +58,9 @@ private: QtWidgetOutputVectorDataParameter(const QtWidgetOutputVectorDataParameter&); //purposely not implemented void operator=(const QtWidgetOutputVectorDataParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; std::string m_FileName; OutputVectorDataParameter::Pointer m_OutputVectorDataParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h index 97cd087a8c5f0ae7ba7ccf15e0ce440df502ab4e..43bca0ef6c174ff45fcc492085fc3886b0f48b91 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetParameterBase_h -#define __otbWrapperQtWidgetParameterBase_h +#ifndef otbWrapperQtWidgetParameterBase_h +#define otbWrapperQtWidgetParameterBase_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetParameterBase : public QWidget Q_OBJECT public: QtWidgetParameterBase(Parameter *, QtWidgetModel*); - virtual ~QtWidgetParameterBase(); + ~QtWidgetParameterBase() ITK_OVERRIDE; void CreateWidget(); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h index d8b1c2cde7309232cc50736527d3ade358fc3184..0c8c71459b0ab4371337ba825b751fb278018587 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetFactory_h -#define __otbWrapperQtWidgetFactory_h +#ifndef otbWrapperQtWidgetFactory_h +#define otbWrapperQtWidgetFactory_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -59,7 +59,7 @@ public: protected: QtWidgetParameterFactory(); - virtual ~QtWidgetParameterFactory(); + ~QtWidgetParameterFactory() ITK_OVERRIDE; private: QtWidgetParameterFactory(const Self&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h index b9fad1c6a40cf473bd6cccc586165de664272af1..0d0558cfb1b738ac2c82904ef1144d80f34c8f37 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetParameterGroup_h -#define __otbWrapperQtWidgetParameterGroup_h +#ifndef otbWrapperQtWidgetParameterGroup_h +#define otbWrapperQtWidgetParameterGroup_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -43,18 +43,18 @@ class ITK_ABI_EXPORT QtWidgetParameterGroup : public QtWidgetParameterBase Q_OBJECT public: QtWidgetParameterGroup(ParameterGroup::Pointer, QtWidgetModel*); - virtual ~QtWidgetParameterGroup(); + ~QtWidgetParameterGroup() ITK_OVERRIDE; public slots: - virtual void SetActivationState( bool value ); + void SetActivationState( bool value ) ITK_OVERRIDE; private: QtWidgetParameterGroup(const QtWidgetParameterGroup&); //purposely not implemented void operator=(const QtWidgetParameterGroup&); //purposely not implemented - void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; virtual void ProcessChild(Parameter * currentNode, bool status); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h index 7ccbfcc9b8f5b4bd6579fcb7a8691935b50be096..e02de71fafd11dbea7a28f7fa4417fc92de4cc5a 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetParameterLabel_h -#define __otbWrapperQtWidgetParameterLabel_h +#ifndef otbWrapperQtWidgetParameterLabel_h +#define otbWrapperQtWidgetParameterLabel_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -38,7 +38,7 @@ class ITK_ABI_EXPORT QtWidgetParameterLabel : public QWidget Q_OBJECT public: QtWidgetParameterLabel(Parameter*); - virtual ~QtWidgetParameterLabel(); + ~QtWidgetParameterLabel() ITK_OVERRIDE; private: QtWidgetParameterLabel(const QtWidgetParameterLabel&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h index ed2b8275cb9f2bdd09254e88619257e73850dea8..48828cfd4e02def99a61d6ea21ada1a8f1591c2c 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetProgressReport_h -#define __otbWrapperQtWidgetProgressReport_h +#ifndef otbWrapperQtWidgetProgressReport_h +#define otbWrapperQtWidgetProgressReport_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -42,7 +42,7 @@ class ITK_ABI_EXPORT QtWidgetProgressReport : public QWidget Q_OBJECT public: QtWidgetProgressReport(QtWidgetModel * model); - virtual ~QtWidgetProgressReport(); + ~QtWidgetProgressReport() ITK_OVERRIDE; void SetApplication(Application::Pointer app); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h index be60186e602e77b4c4349a31827a8e75e60613cc..0fa0a33dbb30197f6da4be7ef39ffae210f52ad9 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetRAMParameter_h -#define __otbWrapperQtWidgetRAMParameter_h +#ifndef otbWrapperQtWidgetRAMParameter_h +#define otbWrapperQtWidgetRAMParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -40,7 +40,7 @@ class ITK_ABI_EXPORT QtWidgetRAMParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetRAMParameter(RAMParameter*, QtWidgetModel*); - virtual ~QtWidgetRAMParameter(); + ~QtWidgetRAMParameter() ITK_OVERRIDE; protected slots: void SetValue( int value ); @@ -49,9 +49,9 @@ private: QtWidgetRAMParameter(const QtWidgetRAMParameter&); //purposely not implemented void operator=(const QtWidgetRAMParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; QHBoxLayout * m_QHBoxLayout; QSpinBox * m_QSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h index 7f64b46509b052b15e2a62c7588b0ac5d544c10c..29d34484fb4b521c45f49c55c93e722c39499fdb 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetSimpleProgressReport_h -#define __otbWrapperQtWidgetSimpleProgressReport_h +#ifndef otbWrapperQtWidgetSimpleProgressReport_h +#define otbWrapperQtWidgetSimpleProgressReport_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -42,7 +42,7 @@ class ITK_ABI_EXPORT QtWidgetSimpleProgressReport : public QWidget Q_OBJECT public: QtWidgetSimpleProgressReport(QtWidgetModel * model); - virtual ~QtWidgetSimpleProgressReport(); + ~QtWidgetSimpleProgressReport() ITK_OVERRIDE; void SetApplication(Application::Pointer app); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringListParameter.h index 9e7acdb2cd8784a587288ff8828386c277f79f01..b65ebc9d8573a1de66592eb0e8d55192141b4877 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringListParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetStringListParameter_h -#define __otbWrapperQtWidgetStringListParameter_h +#ifndef otbWrapperQtWidgetStringListParameter_h +#define otbWrapperQtWidgetStringListParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -38,7 +38,7 @@ class ITK_ABI_EXPORT QtWidgetStringListParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetStringListParameter(StringListParameter*, QtWidgetModel*); - virtual ~QtWidgetStringListParameter(); + ~QtWidgetStringListParameter() ITK_OVERRIDE; signals: void Change(); @@ -53,9 +53,9 @@ private: QtWidgetStringListParameter(const QtWidgetStringListParameter&); //purposely not implemented void operator=(const QtWidgetStringListParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; StringListParameter::Pointer m_StringListParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h index ee5daeb1ff3e7f98edea42a5d7696729424e3443..145d9036e513393a5f8d97d36a74be7bb93eeb47 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetStringParameter_h -#define __otbWrapperQtWidgetStringParameter_h +#ifndef otbWrapperQtWidgetStringParameter_h +#define otbWrapperQtWidgetStringParameter_h #include <QtGui> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetStringParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetStringParameter(StringParameter*, QtWidgetModel*); - virtual ~QtWidgetStringParameter(); + ~QtWidgetStringParameter() ITK_OVERRIDE; protected slots: void SetValue( const QString& value ); @@ -48,9 +48,9 @@ private: QtWidgetStringParameter(const QtWidgetStringParameter&); //purposely not implemented void operator=(const QtWidgetStringParameter&); //purposely not implemented - virtual void DoCreateWidget(); + void DoCreateWidget() ITK_OVERRIDE; - virtual void DoUpdateGUI(); + void DoUpdateGUI() ITK_OVERRIDE; StringParameter::Pointer m_StringParam; QHBoxLayout * m_HLayout; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h index 71d145a046d5724dd067808e4a048d4c7de0eb18..ebfb20509b04a25c49546a2fed60ddedd3026579 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperQtWidgetView_h -#define __otbWrapperQtWidgetView_h +#ifndef otbWrapperQtWidgetView_h +#define otbWrapperQtWidgetView_h #include <QtGui> #include <QObject> @@ -39,7 +39,7 @@ class ITK_ABI_EXPORT QtWidgetView : public QWidget Q_OBJECT public: QtWidgetView(Application* app); - virtual ~QtWidgetView(); + ~QtWidgetView() ITK_OVERRIDE; void CreateGui(); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetChoiceParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetChoiceParameter.cxx index e9761c669c01fb82596f79c24e0a7b463b542158..30ceffaf0724b7b74ae5a40f669b8b6c7772c281 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetChoiceParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetChoiceParameter.cxx @@ -29,10 +29,10 @@ QtWidgetChoiceParameter::QtWidgetChoiceParameter( ChoiceParameter* param, QtWidgetModel* m ) : QtWidgetParameterBase(param, m), m_ChoiceParam(param), - m_ComboBox( NULL ), - m_StackWidget( NULL ), - m_VLayout( NULL ), - m_VLayoutGroup( NULL ), + m_ComboBox( ITK_NULLPTR ), + m_StackWidget( ITK_NULLPTR ), + m_VLayout( ITK_NULLPTR ), + m_VLayoutGroup( ITK_NULLPTR ), m_WidgetList() { } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx index d7d486b7a96a2cd2f3b830fb9abc37fc62939fe3..596adee725abc357e7bdb0fec4ba65afcd1583ed 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx @@ -26,9 +26,9 @@ namespace Wrapper QtWidgetInputFilenameParameter::QtWidgetInputFilenameParameter(InputFilenameParameter* param, QtWidgetModel* m) : QtWidgetParameterBase(param, m), m_FilenameParam(param), - m_HLayout( NULL ), - m_Input( NULL ), - m_Button( NULL ) + m_HLayout( ITK_NULLPTR ), + m_Input( ITK_NULLPTR ), + m_Button( ITK_NULLPTR ) { } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx index f3d52f95161e8e64e73bd91201ca23bc8df9f3ea..2ffc527bea6ae74deb3144d7d9684517ea3c3189 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx @@ -26,9 +26,9 @@ namespace Wrapper QtWidgetInputImageParameter::QtWidgetInputImageParameter(InputImageParameter* param, QtWidgetModel* m) : QtWidgetParameterBase(param, m), m_InputImageParam(param), - m_HLayout( NULL ), - m_Input( NULL ), - m_Button( NULL ) + m_HLayout( ITK_NULLPTR ), + m_Input( ITK_NULLPTR ), + m_Button( ITK_NULLPTR ) { } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx index 1fb3033ee74d345c9c15b187df4fa7e6350bad4b..a227ec5997dc48bddb0bec7bada491af8a45ab31 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx @@ -25,9 +25,9 @@ namespace Wrapper QtWidgetInputVectorDataParameter::QtWidgetInputVectorDataParameter(InputVectorDataParameter* param, QtWidgetModel* m) : QtWidgetParameterBase(param, m), m_InputVectorDataParam(param), - m_HLayout( NULL ), - m_Input( NULL ), - m_Button( NULL ) + m_HLayout( ITK_NULLPTR ), + m_Input( ITK_NULLPTR ), + m_Button( ITK_NULLPTR ) { } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx index 29baa7328fc484ea941cc7e9f0196c85e1d45e4c..73157927ab95baa74e73b252ca3e7ca9973c5f48 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx @@ -26,7 +26,8 @@ namespace Wrapper QtWidgetModel ::QtWidgetModel(Application* app) : m_Application(app), - m_LogOutput() + m_LogOutput(), + m_IsRunning(false) { // Init only if not already done if(!m_Application->IsInitialized()) @@ -54,8 +55,11 @@ QtWidgetModel emit UpdateGui(); // Notify all - bool applicationStatus = m_Application->IsApplicationReady(); - emit SetApplicationReady(applicationStatus); + if (!m_IsRunning) + { + bool applicationStatus = m_Application->IsApplicationReady(); + emit SetApplicationReady(applicationStatus); + } } void @@ -64,6 +68,7 @@ QtWidgetModel { // Deactivate the Execute button while processing emit SetApplicationReady(false); + m_IsRunning = true; // launch the output image writing AppliThread * taskAppli = new AppliThread( m_Application ); @@ -94,6 +99,8 @@ void QtWidgetModel ::OnApplicationExecutionDone( int status ) { + m_IsRunning = false; + // Require GUI update. NotifyUpdate(); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx index 4fa6519fc89ad7bf059de83fb330c2decc9662d3..c1b2dac7befb4f15a0dc274f2a76956981faabc9 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx @@ -58,12 +58,12 @@ public: static bool CanCreate( Parameter* param ) { - return dynamic_cast<TParameterType *>(param) != 0; + return dynamic_cast<TParameterType *>(param) != ITK_NULLPTR; } static QtWidgetParameterBase* Create( Parameter* param, QtWidgetModel* model ) { - QtWidgetParameterBase* widget = 0; + QtWidgetParameterBase* widget = ITK_NULLPTR; TParameterType* specificParam = dynamic_cast<TParameterType *>(param); if (specificParam) @@ -85,7 +85,7 @@ QtWidgetParameterFactory::~QtWidgetParameterFactory() QtWidgetParameterBase* QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model ) { - QtWidgetParameterBase* widget = 0; + QtWidgetParameterBase* widget = ITK_NULLPTR; #define CREATEWIDGET( ParameterType, WidgetType ) \ else if ( QtWidgetParameterGenericFactory<ParameterType, WidgetType>::CanCreate(param) ) \ diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx index d6a20a385b46375398b61f84b0723a53762f6cce..2f1ae5aa5b8c6d4a21d72bf7b9deac6e2e7e82a4 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx @@ -56,7 +56,7 @@ void QtWidgetParameterGroup::DoCreateWidget() { Parameter* param = m_ParamList->GetParameterByIndex(i); - if (param != 0) + if (param != ITK_NULLPTR) { ParameterGroup* paramAsGroup = dynamic_cast<ParameterGroup*>(param); ChoiceParameter* paramAsChoice = dynamic_cast<ChoiceParameter*>(param); @@ -64,10 +64,10 @@ void QtWidgetParameterGroup::DoCreateWidget() InputProcessXMLParameter* paramAsOutXML = dynamic_cast<InputProcessXMLParameter*>(param); bool paramIsXML = false; - if(paramAsInXML != 0 || paramAsOutXML != 0) + if(paramAsInXML != ITK_NULLPTR || paramAsOutXML != ITK_NULLPTR) paramIsXML = true; - if (paramAsGroup == 0 && paramAsChoice == 0 && !paramIsXML) + if (paramAsGroup == ITK_NULLPTR && paramAsChoice == ITK_NULLPTR && !paramIsXML) { // Label (col 1) QWidget* label = new QtWidgetParameterLabel( param ); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetProgressReport.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetProgressReport.cxx index 67c4e4787ec3cff5b367e4ef559432ff5f68a1d4..8d3fa58dd321cb17159e20baee99581250d56a46 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetProgressReport.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetProgressReport.cxx @@ -96,7 +96,7 @@ void QtWidgetProgressReport::RemoveLayout() { // Remove the children of the layout (progress bar widgets) QLayoutItem *child; - while ((child = this->layout()->takeAt(0)) != 0) + while ((child = this->layout()->takeAt(0)) != ITK_NULLPTR) { delete child->widget(); delete child; diff --git a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx index 160cd82bd7fba0e836bf23f0a6afc180483a1ad3..0b8694954b557204bcfb0adc6cf9cc1c21aa2342 100644 --- a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx @@ -51,19 +51,19 @@ protected: { } - virtual ~StubApplication() + ~StubApplication() ITK_OVERRIDE { } - void DoInit() + void DoInit() ITK_OVERRIDE { } - void DoUpdateParameters() + void DoUpdateParameters() ITK_OVERRIDE { } - void DoExecute() + void DoExecute() ITK_OVERRIDE { } }; diff --git a/Modules/Wrappers/SWIG/src/itkPyCommand.cxx b/Modules/Wrappers/SWIG/src/itkPyCommand.cxx index e7b17d9f23e0df157bff10bc859104faeee5a307..e3f3916d3e0e802a4d2e67d1f4f961858c504f79 100644 --- a/Modules/Wrappers/SWIG/src/itkPyCommand.cxx +++ b/Modules/Wrappers/SWIG/src/itkPyCommand.cxx @@ -21,7 +21,7 @@ namespace itk PyCommand::PyCommand() { - this->obj = NULL; + this->obj = ITK_NULLPTR; } PyCommand::~PyCommand() @@ -30,7 +30,7 @@ PyCommand::~PyCommand() { Py_DECREF(this->obj); } - this->obj = NULL; + this->obj = ITK_NULLPTR; } void PyCommand::SetCommandCallable(PyObject *theObj) @@ -87,7 +87,7 @@ void PyCommand::PyExecute() { PyObject *result; - result = PyEval_CallObject(this->obj, (PyObject *)NULL); + result = PyEval_CallObject(this->obj, (PyObject *)ITK_NULLPTR); if (result) { diff --git a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h index 80459d30c634d15b49e5f5fe345e9f2e27991c94..bd2af22261bf843c955303965be6ac6591a18a52 100644 --- a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h +++ b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbWrapperSWIGIncludes_h -#define __otbWrapperSWIGIncludes_h +#ifndef otbWrapperSWIGIncludes_h +#define otbWrapperSWIGIncludes_h #include "otbWrapperApplicationRegistry.h" #include "otbWrapperAddProcessToWatchEvent.h" diff --git a/Modules/Wrappers/SWIG/test/java/CMakeLists.txt b/Modules/Wrappers/SWIG/test/java/CMakeLists.txt index 3b0917f47872a0f4444c3992754904e04f584eb7..70e8f367e1f8ffb76d6c5ea1ad655b67486affed 100644 --- a/Modules/Wrappers/SWIG/test/java/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/test/java/CMakeLists.txt @@ -7,6 +7,10 @@ set(TEST_DRIVER otbTestDriver set( PATH_SEPARATOR ":") if (WIN32) set( PATH_SEPARATOR ";") + # on windows, loading the module _otbApplication requires the otbossimplugins*.dll + # which is in the 'bin' folder + set(TEST_DRIVER ${TEST_DRIVER} + --add-before-env PATH ${OTB_BINARY_DIR}/bin) endif() set( CMAKE_JAVA_INCLUDE_PATH ${OTBSWIGWrapper_BINARY_DIR}/src/org.otb.application.jar ) diff --git a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt index b3dbcfdafab5093752e51d2e831b2c594175eacb..da9cdd777136f4c8303a6fc5a5783258a21a45ee 100644 --- a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt @@ -3,6 +3,13 @@ set(TEST_DRIVER otbTestDriver --add-before-env PYTHONPATH $<TARGET_FILE_DIR:_otbApplication> --add-before-env OTB_APPLICATION_PATH $<TARGET_FILE_DIR:otbapp_Smoothing> ) +if(WIN32) + # on windows, loading the module _otbApplication requires the otbossimplugins*.dll + # which is in the 'bin' folder + set(TEST_DRIVER ${TEST_DRIVER} + --add-before-env PATH ${OTB_BINARY_DIR}/bin) +endif(WIN32) + add_test( NAME pyTvSmoothing COMMAND ${TEST_DRIVER} Execute ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonSmoothingTest.py diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index d3b8167f5f86235982ccfb0254ae40d25f45e569..ec9c38396ad536e50ce83d51193e9fabe131c97e 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,53 @@ +OTB-v.5.6.0 - Changes since version 5.4.0 (July 28th, 2016) +------------------------------------------------------------ + +* Request for Changes (http://wiki.orfeo-toolbox.org/index.php/Requests_for_Changes): + * Request for Changes-49: Improve classification on vectors + * Request for Changes-48: Add geometric correction to S1 Sensor Model + * Request for Changes-47: Improve the CompareImages app + * Request for Changes-46: Sample extractor + * Request for Changes-45: CMake uninstall target + * Request for Changes-43: Update SuperBuild cmake script and thirdparty versions + * Request for Changes-42: Generator for completion scripts + * Request for Changes-40: clang modernize + * Request for Changes-41: Provide a summary after cmake configuration + * Request for Changes-38: update gdal to 2.x version in superbuild + * Request for Changes-37: Enhance ManageNodata application + * Request for Changes-36: Samples selection filter + * Request for Changes-26: MPI Image File Writer + +* Bugfixes: + * MANTIS-1255: Remaining log when opening Sentinel1 product in Monteverdi + * MANTIS-1254: Checking/Unchecking parameters re-enable execute button on running application + * MANTIS-1252: msvc warning C4838 la conversion de 'double' en 'const float' requiert une conversion restrictive + * MANTIS-1251: OTB Superbuild does not forward compiler versions to external projects anymore + * MANTIS-1249: ioTvMultiChannelROI_*_JPEG2000_2_TIF_res5 are failing when using gdal openjpeg driver + * MANTIS-1247: Patch for various spelling errors + * MANTIS-1246: Inputs do not occupy the same physical space! + * MANTIS-1243: apTvCl*RegressionTest_monovar failing due to error in opencv + * MANTIS-1242: otbMapProjectionAdapter.cxx WARNING: Impossible to create the projection from Wkt: ossimUtmProjection + * MANTIS-1241: dl_close appears on apTvClTrainMethodANNImagesClassifierQB1 + * MANTIS-1240: [ComputeImagesStatistics] Filename extension in uppercase are not supported + * MANTIS-1238: Train regression with ANN crashes + * MANTIS-1237: Inconsistent parameter order in OTB application + * MANTIS-1234: more tests are failing in superbuild + * MANTIS-1233: Exception in example Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx + * MANTIS-1227: set all USE_SYSTEM_* to FALSE by default + * MANTIS-1225: internal openjpeg driver and confusing OTB_USE_OPENJPEG + * MANTIS-1223: Possible error in function "template <typename T> T InverseValue(const T & value)" defined in otbMath.h + * MANTIS-1220: show last git commit message during cmake configure + * MANTIS-1218: Segmentation fails - error message not understandable + * MANTIS-1217: Degree symbol badly displayed in OTB applications + * MANTIS-1215: OTB-FAQ page not found contribute.html (404) + * MANTIS-1214: incorrect install instruction for Mac OSX in OTBCookBook 5.4 + * MANTIS-1213: incorrect years calculated in cookbook + * MANTIS-1212: OTB windows package contains two copies of otbapp_* dll + * MANTIS-1211: Patch for various spelling errors + * MANTIS-1210: make fails at downloading 'LIBSVM' + * MANTIS-1209: superbuild: fix qt build on osx + * MANTIS-1208: Need to click in image view to force computation of quantiles (shortcut 'Q') + * MANTIS-1207: OTB_SB_CMAKE_COMMAND uses in External_otb.cmake but not set + OTB-v.5.4.0 - Changes since version 5.2.1 (2016/05/04) ------------------------------------------ * Core diff --git a/SuperBuild/CMake/CTestCustom.cmake.in b/SuperBuild/CMake/CTestCustom.cmake.in index 932ce493e75ed8166baacb8db50bc78f6f66cd7b..784e9d8cb0f659857bf2db05b25122646ddbdffa 100644 --- a/SuperBuild/CMake/CTestCustom.cmake.in +++ b/SuperBuild/CMake/CTestCustom.cmake.in @@ -4,13 +4,21 @@ set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50) set(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} - ".*SuperBuild.*LIBKML.*warning.*" ".*SuperBuild.GEOS.*" ".*SuperBuild.JPEG.*warning" ".*SuperBuild.TIFF.*warning.*" ".*SuperBuild.GEOTIFF.*warning.*" + "ranlib:.*file:.*has no symbols" + "libtool:.*file:.*has no symbols" + "libtool:.install:.warning:.relinking.*" + "make.*jobserver.unavailable.*" + "configure:.WARNING:.*" + ".*SuperBuild.OSSIM.src.OSSIM.*" + ".*SuperBuild.LIBKML.src.LIBKML.*" ".*SuperBuild.GDAL.config.status.*WARNING.*" - ".*SuperBuild.OSSIM.*warning.*" + ".bin.bash:.*config.rpath:.*directory" + "loading.initial.cache.file.*CURL-cache.cmake" + "SuperBuild.OPENCV.src.OPENCV.modules" ) # We disable all compiler warnings on superbuild. They are too numerous and pretty much useless diff --git a/SuperBuild/CMake/External_boost.cmake b/SuperBuild/CMake/External_boost.cmake index ff0dd1e44c57f8f0d1cdb957c3a218d39350688b..f451b94ef1dc667aad8d7cb52a3f1636e2c17e61 100644 --- a/SuperBuild/CMake/External_boost.cmake +++ b/SuperBuild/CMake/External_boost.cmake @@ -1,132 +1,31 @@ -# Use boost 1.54. There was previously incompatibilities between boost and Qt which leads -# to compilation errors for OTB. We could increase boost version to last stable -# release in future version of superbuild as we've patchedOTB code to -# support both libraries. See the related changeset in OTB trunk: -# http://hg.orfeo-toolbox.org/OTB/r# ev/8da67e36c78d +INCLUDE_ONCE_MACRO(BOOST) -if(NOT __EXTERNAL_BOOST__) -set(__EXTERNAL_BOOST__ 1) +SETUP_SUPERBUILD(BOOST) -if(USE_SYSTEM_BOOST) - message(STATUS " Using Boost system version") -else() - SETUP_SUPERBUILD(PROJECT BOOST) - - message(STATUS " Using Boost superbuild version") - - option(SUPERBUILD_BOOST_HEADER_ONLY "Only use Boost headers" ON) - mark_as_advanced(SUPERBUILD_BOOST_HEADER_ONLY) - - if(UNIX) - if(SUPERBUILD_BOOST_HEADER_ONLY) - ExternalProject_Add(BOOST - PREFIX BOOST - URL "http://sourceforge.net/projects/boost/files/boost/1.50.0/boost_1_50_0.tar.bz2/download" - URL_MD5 52dd00be775e689f55a987baebccc462 - BINARY_DIR ${BOOST_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/BOOST/CMakeLists.txt - ${BOOST_SB_SRC} - ) - else() - ExternalProject_Add(BOOST - PREFIX BOOST - URL "http://sourceforge.net/projects/boost/files/boost/1.50.0/boost_1_50_0.tar.bz2/download" - URL_MD5 52dd00be775e689f55a987baebccc462 - BINARY_DIR ${BOOST_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND - ${BOOST_SB_BUILD_DIR}/bootstrap.sh - --prefix=${SB_INSTALL_PREFIX} - --with-libraries=graph,test,regex - BUILD_COMMAND ./b2 - INSTALL_COMMAND ./b2 install - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_SOURCE_DIR}/patches/BOOST/1.54.0 - ${BOOST_SB_SRC} - ) - - ExternalProject_Add_Step(BOOST copy_source - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${BOOST_SB_SRC} ${BOOST_SB_BUILD_DIR} - DEPENDEES patch update - DEPENDERS configure - ) - endif() - - message(STATUS " Using Boost SuperBuild version") - - else(MSVC) - #TODO: find hash for archives properly - set(BOOST_HEADERS_URL_HASH 1605dc6085cb2dc778ef5ab6c0e59083) - set(BOOST_GRAPH_URL_HASH c246516ca84a3c79ae8a0b22fceb0344) - set(BOOST_REGEX_URL_HASH a3bfc2dc9a3ebe3c050518ecb29d6f8b) - set(BOOST_UTF_URL_HASH 75971963a74c76d32e01974a8e48be11) - - if(MSVC10) - set(BOOST_HEADERS_URL_HASH 1605dc6085cb2dc778ef5ab6c0e59083) - set(BOOST_GRAPH_URL_HASH c246516ca84a3c79ae8a0b22fceb0344) - set(BOOST_REGEX_URL_HASH a3bfc2dc9a3ebe3c050518ecb29d6f8b) - set(BOOST_UTF_URL_HASH 75971963a74c76d32e01974a8e48be11) - else(MSVC80) - - else(CMAKE_COMPILER_2005) - - endif() +#all we loose is one single test from not building boost unit-testing-framework. +#That is single test code. I don't see why we can't use something in-house +#change test code to not use boost unit-testing-framework and all is well. - set(BOOST_HEADERS_URL "http://sourceforge.net/projects/boost/files/boost-binaries/1.50.0/boost_1_50_headers.zip/download") - set(BOOST_GRAPH_URL "http://sourceforge.net/projects/boost/files/boost-binaries/1.50.0/libboost_graph-vc100-mt-1_50.zip/download") - set(BOOST_UTF_URL "http://sourceforge.net/projects/boost/files/boost-binaries/1.50.0/boost_unit_test_framework-vc100-mt-1_50.zip/download") - set(BOOST_REGEX_URL "http://sourceforge.net/projects/boost/files/boost-binaries/1.50.0/libboost_regex-vc100-mt-1_50.zip/download") - - ExternalProject_Add(BOOST_HEADERS - PREFIX BOOST/_HEADERS - URL ${BOOST_HEADERS_URL} - URL_MD5 ${BOOST_HEADERS_URL_HASH} - SOURCE_DIR ${BOOST_SB_SRC}/include/boost - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${BOOST_SB_SRC}/include/ ${SB_INSTALL_PREFIX}/include/ - ) - set(BOOSTLIBS) - foreach(BOOSTLIB "REGEX" "GRAPH" "UTF") - ExternalProject_Add(BOOST_${BOOSTLIB} - PREFIX BOOST/_${BOOSTLIB} - URL ${BOOST_${BOOSTLIB}_URL} - URL_MD5 ${BOOST_${BOOSTLIB}_URL_HASH} - SOURCE_DIR ${BOOST_SB_SRC}/lib - DEPENDS BOOST_HEADERS - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${BOOST_SB_SRC}/lib ${SB_INSTALL_PREFIX}/lib - ) - list(APPEND BOOSTLIBS BOOST_${BOOSTLIB}) - endforeach() - - ExternalProject_Add(BOOST - PREFIX BOOST - DOWNLOAD_COMMAND "" - SOURCE_DIR ${BOOST_SB_SRC} - DEPENDS ${BOOSTLIBS} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - ) - - message(STATUS " Using Boost SuperBuild version (prebuilt binaries)") - - endif() #end else MSVC - - set(_SB_Boost_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - set(_SB_Boost_LIBRARY_DIR ${SB_INSTALL_PREFIX}/lib) - - -endif() +if(MSVC) + set(BOOST_URL "http://download.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2") + set(BOOST_URL_MD5 "65a840e1a0b13a558ff19eeb2c4f0cbe") +else() + set(BOOST_URL "http://download.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2") + set(BOOST_URL_MD5 "52dd00be775e689f55a987baebccc462") endif() + +ExternalProject_Add(BOOST + PREFIX BOOST + URL "${BOOST_URL}" + URL_MD5 ${BOOST_URL_MD5} + BINARY_DIR ${BOOST_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/BOOST/CMakeLists.txt + ${BOOST_SB_SRC} + ) + +set(_SB_Boost_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +set(_SB_Boost_LIBRARY_DIR ${SB_INSTALL_PREFIX}/lib) diff --git a/SuperBuild/CMake/External_curl.cmake b/SuperBuild/CMake/External_curl.cmake index 15cee8a0347713e6212d00de436b7764decfeaf3..3f370ee93856bb1c0812937f23e135ad6dc1d5aa 100644 --- a/SuperBuild/CMake/External_curl.cmake +++ b/SuperBuild/CMake/External_curl.cmake @@ -1,71 +1,75 @@ -if(NOT __EXTERNAL_CURL__) -set(__EXTERNAL_CURL__ 1) +INCLUDE_ONCE_MACRO(CURL) -if(USE_SYSTEM_CURL) - message(STATUS " Using cURL system version") -else() - SETUP_SUPERBUILD(PROJECT CURL) - message(STATUS " Using cURL SuperBuild version") +SETUP_SUPERBUILD(CURL) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(CURL ZLIB) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(CURL ZLIB) - if(NOT APPLE) - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENSSL) - endif() +if(NOT APPLE) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENSSL) +endif() - if(USE_SYSTEM_GEOS) #why geos here?. discuss with GP. - ADD_SUPERBUILD_CMAKE_VAR(CURL ZLIB_ROOT) - endif() - #TODO: add openssl and other dependencies - if(MSVC) - ExternalProject_Add(CURL - PREFIX CURL - URL "http://curl.haxx.se/download/curl-7.40.0.tar.gz" - URL_MD5 58943642ea0ed050ab0431ea1caf3a6f - SOURCE_DIR ${CURL_SB_SRC} - BINARY_DIR ${CURL_SB_BUILD_DIR}/winbuild - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${CURL_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CURL_SB_SRC} ${CURL_SB_BUILD_DIR} - CONFIGURE_COMMAND "" - BUILD_COMMAND nmake /f ${CURL_SB_BUILD_DIR}/winbuild/Makefile.vc mode=dll WITH_ZLIB=dll WITH_DEVEL=${SB_INSTALL_PREFIX} - INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir ${CURL_SB_BUILD_DIR}/builds/ ${CMAKE_COMMAND} -E copy_directory libcurl-vc-x86-release-dll-zlib-dll-ipv6-sspi-winssl ${SB_INSTALL_PREFIX} - ) +if(MSVC) + if(NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "static build or curl not supported") + return() +endif() - else(UNIX) - ExternalProject_Add(CURL - PREFIX CURL - URL "http://curl.haxx.se/download/curl-7.40.0.tar.gz" - URL_MD5 58943642ea0ed050ab0431ea1caf3a6f - BINARY_DIR ${CURL_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_CURL_TESTS:BOOL=OFF - -DBUILD_CURL_EXE:BOOL=ON - -DCMAKE_USE_OPENSSL:BOOL=${SB_ENABLE_OPENSSL_CURL} - -DCMAKE_USE_LIBSSH2:BOOL=OFF - -DCURL_DISABLE_LDAP:BOOL=ON - -DCMAKE_USE_OPENLDAP:BOOL=OFF - ${CURL_SB_CONFIG} - DEPENDS ${CURL_DEPENDENCIES} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) - endif() +if(NOT DEFINED ENV{PROCESSOR_ARCHITECTURE}) + message(FATAL_ERROR "PROCESSOR_ARCHITECTURE env variable is not defined") + return() +endif() - set(_SB_CURL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_CURL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libcurl.lib) - elseif(UNIX) - set(_SB_CURL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libcurl${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +if("$ENV{PROCESSOR_ARCHITECTURE}" MATCHES "AMD64" ) + set(CURL_INSTALL_DIR_PREFIX "libcurl-vc-x64") +else() + set(CURL_INSTALL_DIR_PREFIX "libcurl-vc-x86") +endif() +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + set(CURL_INSTALL_DIR_PREFIX "${CURL_INSTALL_DIR_PREFIX}-release") +else() + set(CURL_INSTALL_DIR_PREFIX "${CURL_INSTALL_DIR_PREFIX}-debug") endif() + +set(CURL_INSTALL_DIR_PREFIX "${CURL_INSTALL_DIR_PREFIX}-dll-zlib-dll-ipv6-sspi-winssl") + +ExternalProject_Add(CURL + PREFIX CURL + URL "http://curl.haxx.se/download/curl-7.40.0.tar.gz" + URL_MD5 58943642ea0ed050ab0431ea1caf3a6f + SOURCE_DIR ${CURL_SB_SRC} + BINARY_DIR ${CURL_SB_SRC}/winbuild + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${CURL_DEPENDENCIES} + CONFIGURE_COMMAND "" + BUILD_COMMAND nmake /f ${CURL_SB_SRC}/winbuild/Makefile.vc mode=dll WITH_ZLIB=dll WITH_DEVEL=${SB_INSTALL_PREFIX} + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CURL_SB_SRC}/builds/${CURL_INSTALL_DIR_PREFIX}/ ${SB_INSTALL_PREFIX} + ) + +else(UNIX) + ExternalProject_Add(CURL + PREFIX CURL + URL "http://curl.haxx.se/download/curl-7.40.0.tar.gz" + URL_MD5 58943642ea0ed050ab0431ea1caf3a6f + BINARY_DIR ${CURL_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_CURL_TESTS:BOOL=OFF + -DBUILD_CURL_EXE:BOOL=ON + -DCMAKE_USE_OPENSSL:BOOL=${SB_ENABLE_OPENSSL_CURL} + -DCMAKE_USE_LIBSSH2:BOOL=OFF + -DCURL_DISABLE_LDAP:BOOL=ON + -DCMAKE_USE_OPENLDAP:BOOL=OFF + ${CURL_SB_CONFIG} + DEPENDS ${CURL_DEPENDENCIES} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) endif() + +SUPERBUILD_UPDATE_CMAKE_VARIABLES(CURL TRUE) diff --git a/SuperBuild/CMake/External_expat.cmake b/SuperBuild/CMake/External_expat.cmake index 5721afd4c59437bbac0bb079e2722dc6b54e35a0..dba167ebb1f565aa9fc61a01a3371b1a342d2148 100644 --- a/SuperBuild/CMake/External_expat.cmake +++ b/SuperBuild/CMake/External_expat.cmake @@ -1,35 +1,20 @@ -if(NOT __EXTERNAL_EXPAT__) -set(__EXTERNAL_EXPAT__ 1) +INCLUDE_ONCE_MACRO(EXPAT) -if(USE_SYSTEM_EXPAT) - message(STATUS " Using expat system version") -else() - SETUP_SUPERBUILD(PROJECT EXPAT) - message(STATUS " Using Expat SuperBuild version") +SETUP_SUPERBUILD(EXPAT) - ExternalProject_Add(EXPAT - PREFIX EXPAT - URL "http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download" - URL_MD5 dd7dab7a5fea97d2a6a43f511449b7cd - BINARY_DIR ${EXPAT_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_examples:BOOL=OFF - -DBUILD_tests:BOOL=OFF - -DBUILD_tools:BOOL=OFF - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(EXPAT + PREFIX EXPAT + URL "http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download" + URL_MD5 dd7dab7a5fea97d2a6a43f511449b7cd + BINARY_DIR ${EXPAT_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_examples:BOOL=OFF + -DBUILD_tests:BOOL=OFF + -DBUILD_tools:BOOL=OFF + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_EXPAT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_EXPAT_LIBRARY ${SB_INSTALL_PREFIX}/lib/expat.lib) - elseif(UNIX) - set(_SB_EXPAT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libexpat${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(EXPAT FALSE) diff --git a/SuperBuild/CMake/External_fftw.cmake b/SuperBuild/CMake/External_fftw.cmake index 77f4b54e2998bb219f97909d6c21b468a7e5585c..926e1928988df0276a033b62d6a9286e1d7b87ef 100644 --- a/SuperBuild/CMake/External_fftw.cmake +++ b/SuperBuild/CMake/External_fftw.cmake @@ -1,15 +1,6 @@ -if( __EXTERNAL_FFTW__) - return() -else() - set(__EXTERNAL_FFTW__ 1) -endif() - -if(USE_SYSTEM_FFTW) - message(STATUS " Using FFTW system version") - return() -endif() +INCLUDE_ONCE_MACRO(FFTW) -SETUP_SUPERBUILD(PROJECT FFTW) +SETUP_SUPERBUILD(FFTW) set(FFTWF_SB_SRC ${CMAKE_BINARY_DIR}/FFTW/src/FFTWF) set(FFTWD_SB_SRC ${CMAKE_BINARY_DIR}/FFTW/src/FFTWD) @@ -22,7 +13,6 @@ if(MSVC) endif() -message(STATUS " Using FFTW SuperBuild version") # Compile the float version of FFTW ExternalProject_Add(FFTWF @@ -46,7 +36,7 @@ ExternalProject_Add(FFTWF DEPENDS ${FFTW_DEPENDENCIES} ) -SUPERBUILD_PATCH_SOURCE(FFTWF "patch-for-at-rpath") +SUPERBUILD_PATCH_SOURCE(FFTWF) # Compile the double version of FFTW ExternalProject_Add(FFTWD @@ -67,10 +57,11 @@ ExternalProject_Add(FFTWD --enable-threads --disable-fortran --disable-dependency-tracking + DEPENDS FFTWF ) -SUPERBUILD_PATCH_SOURCE(FFTWD "patch-for-at-rpath") +SUPERBUILD_PATCH_SOURCE(FFTWD) ExternalProject_Add(FFTW PREFIX FFTW @@ -78,7 +69,7 @@ ExternalProject_Add(FFTW CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - DEPENDS FFTWF FFTWD + DEPENDS FFTWD ) set(_SB_FFTW_INCLUDE_PATH ${SB_INSTALL_PREFIX}/include) diff --git a/SuperBuild/CMake/External_freetype.cmake b/SuperBuild/CMake/External_freetype.cmake index 6d624ac10ec33fa2125ae3466daba72ae8ec2f7a..756b02afa176b463d2ab9169fd1835b81e9f6644 100644 --- a/SuperBuild/CMake/External_freetype.cmake +++ b/SuperBuild/CMake/External_freetype.cmake @@ -1,32 +1,29 @@ -if(NOT __EXTERNAL_FREETYPE__) -set(__EXTERNAL_FREETYPE__ 1) +INCLUDE_ONCE_MACRO(FREETYPE) -if(USE_SYSTEM_FREETYPE) - message(STATUS " Using FreeType system version") -else() - SETUP_SUPERBUILD(PROJECT FREETYPE) - message(STATUS " Using FreeType SuperBuild version") +SETUP_SUPERBUILD(FREETYPE) - ExternalProject_Add(FREETYPE - PREFIX FREETYPE - URL "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.tar.gz" - URL_MD5 1d733ea6c1b7b3df38169fbdbec47d2b - BINARY_DIR ${FREETYPE_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +set(FREETYPE_SB_CONFIG) +if(MSVC AND BUILD_SHARED_LIBS) + list(APPEND FREETYPE_SB_CONFIG + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=TRUE) +endif() - set(_SB_FREETYPE_INCLUDE_DIRS ${SB_INSTALL_PREFIX}/include/freetype2) - if(WIN32) - set(_SB_FREETYPE_LIBRARY ${SB_INSTALL_PREFIX}/lib/freetype.lib) - elseif(UNIX) - set(_SB_FREETYPE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreetype${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +ExternalProject_Add(FREETYPE + PREFIX FREETYPE + URL "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.tar.gz" + URL_MD5 1d733ea6c1b7b3df38169fbdbec47d2b + BINARY_DIR ${FREETYPE_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + ${FREETYPE_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) -endif() +set(_SB_FREETYPE_INCLUDE_DIRS ${SB_INSTALL_PREFIX}/include/freetype2) +if(WIN32) + set(_SB_FREETYPE_LIBRARY ${SB_INSTALL_PREFIX}/lib/freetype.lib) +elseif(UNIX) + set(_SB_FREETYPE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreetype${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_gdal.cmake b/SuperBuild/CMake/External_gdal.cmake index 3bf41cced8827694eef82595aebcca6d70a47dc4..405329287b4a934313eb82f3d9193c8af8e84fa7 100644 --- a/SuperBuild/CMake/External_gdal.cmake +++ b/SuperBuild/CMake/External_gdal.cmake @@ -1,108 +1,130 @@ -if(NOT __EXTERNAL_GDAL__) -set(__EXTERNAL_GDAL__ 1) +INCLUDE_ONCE_MACRO(GDAL) -if(USE_SYSTEM_GDAL) - find_package ( GDAL ) - message(STATUS " Using GDAL system version") -else() - SETUP_SUPERBUILD(PROJECT GDAL) - message(STATUS " Using GDAL SuperBuild version") +SETUP_SUPERBUILD(GDAL) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GDAL TIFF CURL GEOTIFF PNG JPEG OPENJPEG SQLITE GEOS ZLIB EXPAT) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GDAL CURL OPENJPEG TIFF GEOTIFF PNG JPEG SQLITE GEOS ZLIB EXPAT) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL TIFF_ROOT --with-libtiff) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOTIFF_ROOT --with-geotiff) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL PNG_ROOT --with-png) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL JPEG_ROOT --with-jpeg) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL OPENJPEG_ROOT --with-openjpeg) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL SQLITE_ROOT --with-sqlite3) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL ZLIB_ROOT --with-libz) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL EXPAT_ROOT --with-expat) - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL CURL_ROOT --with-curl "/bin/curl-config") - ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOS_ROOT --with-geos "/bin/geos-config") +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL TIFF_ROOT --with-libtiff) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOTIFF_ROOT --with-geotiff) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL PNG_ROOT --with-png) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL JPEG_ROOT --with-jpeg) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL OPENJPEG_ROOT --with-openjpeg) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL SQLITE_ROOT --with-sqlite3) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL ZLIB_ROOT --with-libz) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL EXPAT_ROOT --with-expat) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL CURL_ROOT --with-curl "/bin/curl-config") +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOS_ROOT --with-geos "/bin/geos-config") - if(UNIX) - set(GDAL_SB_EXTRA_OPTIONS "" CACHE STRING "Extra options to be passed to GDAL configure script") - mark_as_advanced(GDAL_SB_EXTRA_OPTIONS) - #Convert GDAL_SB_EXTRA_OPTIONS to a list to allow to add multiple instructions to the CONFIGURE_COMMAND - separate_arguments(GDAL_SB_EXTRA_OPTIONS) +set(GDAL_CONFIGURE_COMMAND) +set(GDAL_BUILD_COMMAND) +set(GDAL_INSTALL_COMMAND) - #we dont do any framework build on osx. So let's be sure on case of gdal - if(APPLE) - list(APPEND GDAL_SB_CONFIG "--with-macosx-framework=no") - endif() - - ExternalProject_Add(GDAL - PREFIX GDAL - URL "http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz" - URL_MD5 866a46f72b1feadd60310206439c1a76 - SOURCE_DIR ${GDAL_SB_SRC} - BINARY_DIR ${GDAL_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${GDAL_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${GDAL_SB_SRC}/config.rpath - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/GNUmakefile ${GDAL_SB_SRC}/swig/python/GNUmakefile - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/GDAL/S2_patch ${GDAL_SB_SRC} - CONFIGURE_COMMAND - # use 'env' because CTest launcher doesn't perform shell interpretation - ${SB_ENV_CONFIGURE_CMD} - ${GDAL_SB_SRC}/configure - --prefix=${SB_INSTALL_PREFIX} - --enable-static=no - --without-ogdi - --without-jasper - --with-sentinel2 - --without-netcdf #netcdf is not added by superbuild. better to deactivate it. - --without-hdf4 - --without-hdf5 - --without-xml2 - ${GDAL_SB_CONFIG} - ${GDAL_SB_EXTRA_OPTIONS} - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install - ) +if(UNIX) + set(GDAL_SB_EXTRA_OPTIONS "" CACHE STRING "Extra options to be passed to GDAL configure script") + mark_as_advanced(GDAL_SB_EXTRA_OPTIONS) + #Convert GDAL_SB_EXTRA_OPTIONS to a list to allow to add multiple instructions to the CONFIGURE_COMMAND + separate_arguments(GDAL_SB_EXTRA_OPTIONS) + #we dont do any framework build on osx. So let's be sure on case of gdal if(APPLE) - SUPERBUILD_PATCH_SOURCE(GDAL "patch-for-at-rpath") + list(APPEND GDAL_SB_CONFIG "--with-macosx-framework=no") endif() - else(MSVC) - ##add libkml - ##https://trac.osgeo.org/gdal/ticket/5725 - ##is needed for SQLITE driver - list(REMOVE_ITEM GDAL_DEPENDENCIES LIBKML) + # PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${GDAL_SB_SRC}/config.rpath + # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/GNUmakefile ${GDAL_SB_SRC}/swig/python/GNUmakefile - STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) - STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) - configure_file(${CMAKE_SOURCE_DIR}/patches/GDAL/nmake_gdal_extra.opt.in ${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt) + list(APPEND GDAL_SB_CONFIG "--with-libkml=no") + if(OTB_USE_LIBKML) + #RK: disabled libkml. Here are in External_otb.cmake + #ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(LIBKML) + #ADD_SUPERBUILD_CONFIGURE_VAR(GDAL LIBKML_ROOT --with-libkml) + endif() - ExternalProject_Add(GDAL - PREFIX GDAL - URL "http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz" - URL_MD5 866a46f72b1feadd60310206439c1a76 - SOURCE_DIR ${GDAL_SB_SRC} - BINARY_DIR ${GDAL_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${GDAL_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/GNUmakefile ${GDAL_SB_SRC}/swig/python/GNUmakefile - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/GDAL/S2_patch ${GDAL_SB_SRC} - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/ogrsqlitevirtualogr.cpp - ${GDAL_SB_SRC}/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp - BUILD_COMMAND nmake /f ${GDAL_SB_SRC}/makefile.vc MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt - INSTALL_COMMAND nmake /f ${GDAL_SB_SRC}/makefile.vc devinstall MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt + set(GDAL_CONFIGURE_COMMAND "${SB_ENV_CONFIGURE_CMD};${GDAL_SB_SRC}/configure" + --prefix=${SB_INSTALL_PREFIX} + --enable-static=no + --enable-shared=yes + --with-cfitsio=no + --with-dods-root=no + --with-dwgdirect=no + --with-ecw=no + --with-epsilon=no + --with-fme=no + --with-gif=no + --with-grass=no + --with-gta=no + --with-hdf4=no + --with-hdf5=no + --with-idb=no + --with-ingres=no + --with-jp2mrsid=no + --with-kakadu=no + --with-jasper=no + --with-libgrass=no + --with-mrsid=no + --with-msg=no + --with-mysql=no + --with-netcdf=no + --with-oci=no + --with-odbc=no + --with-ogdi=no + --with-pam + --with-pcidsk=yes + --with-pcraster=no + --with-pcre=no + --with-perl=no + --with-php=no + --with-python=no + --with-qhull=internal + --with-sde=no + --with-spatialite=no + --with-xerces=no + --with-xml2=no + --with-pg=no + ${GDAL_SB_CONFIG} + ${GDAL_SB_EXTRA_OPTIONS} ) + #set(GDAL_BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}) + #set(GDAL_INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install) - endif() - - set(_SB_GDAL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GDAL_LIBRARY ${SB_INSTALL_PREFIX}/lib/gdal_i.lib) - elseif(UNIX) - set(_SB_GDAL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libgdal${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +else(MSVC) + STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) + STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) + configure_file(${CMAKE_SOURCE_DIR}/patches/GDAL/nmake_gdal_extra.opt.in ${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt) + set(GDAL_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/configure) + set(GDAL_BUILD_COMMAND nmake + /f ${GDAL_SB_SRC}/makefile.vc + MSVC_VER=${MSVC_VERSION} + EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt + ) + set(GDAL_INSTALL_COMMAND nmake + /f ${GDAL_SB_SRC}/makefile.vc devinstall + MSVC_VER=${MSVC_VERSION} + EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt + ) endif() + +ExternalProject_Add(GDAL + PREFIX GDAL + URL "http://download.osgeo.org/gdal/2.1.0/gdal-2.1.0.tar.gz" + URL_MD5 0fc165cd947c54b132204233dfb243f1 + SOURCE_DIR ${GDAL_SB_SRC} + BINARY_DIR ${GDAL_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${GDAL_DEPENDENCIES} + CONFIGURE_COMMAND ${GDAL_CONFIGURE_COMMAND} + BUILD_COMMAND ${GDAL_BUILD_COMMAND} + INSTALL_COMMAND ${GDAL_INSTALL_COMMAND} + ) + +SUPERBUILD_PATCH_SOURCE(GDAL) + +set(_SB_GDAL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_GDAL_LIBRARY ${SB_INSTALL_PREFIX}/lib/gdal_i.lib) +elseif(UNIX) + set(_SB_GDAL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libgdal${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_geos.cmake b/SuperBuild/CMake/External_geos.cmake index 921407a63ad0314d6b7b176c68203cd81addd019..13e79e6155e137d661518784377b8bebaeba868d 100644 --- a/SuperBuild/CMake/External_geos.cmake +++ b/SuperBuild/CMake/External_geos.cmake @@ -1,41 +1,33 @@ -if(NOT __EXTERNAL_GEOS__) -set(__EXTERNAL_GEOS__ 1) +INCLUDE_ONCE_MACRO(GEOS) -if(USE_SYSTEM_GEOS) - # TODO : FindGEOS.cmake - find_package ( GEOS ) - message(STATUS " Using GEOS system version") -else() - SETUP_SUPERBUILD(PROJECT GEOS) - message(STATUS " Using GEOS SuperBuild version") +SETUP_SUPERBUILD(GEOS) - ExternalProject_Add(GEOS - PREFIX GEOS - URL "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2" - URL_MD5 fc5df2d926eb7e67f988a43a92683bae - SOURCE_DIR ${GEOS_SB_SRC} - BINARY_DIR ${GEOS_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_TESTING:BOOL=OFF - -DGEOS_ENABLE_TESTS:BOOL=OFF - CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) +if(MSVC) + set(GEOS_URL "https://github.com/libgeos/libgeos/archive/714127ef49087634e7f6687424fdf041d18c3d0f.zip") + set(GEOS_URL_MD5 "d4bc49008dc712e8c612e8b8a91030c0") + set(GEOS_SB_CONFIG "-DProject_WC_REVISION:STRING=99999") + list(APPEND GEOS_SB_CONFIG "-DGEOS_BUILD_PACKAGED:BOOL=OFF") +else() + set(GEOS_URL "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2") + set(GEOS_URL_MD5 "fc5df2d926eb7e67f988a43a92683bae") + set(GEOS_SB_CONFIG) +endif() - ExternalProject_Add_Step(GEOS remove_static - COMMAND ${CMAKE_COMMAND} -E remove - ${SB_INSTALL_PREFIX}/lib/libgeos.a - DEPENDEES install) +ExternalProject_Add(GEOS + PREFIX GEOS + URL "${GEOS_URL}" + URL_MD5 ${GEOS_URL_MD5} + SOURCE_DIR ${GEOS_SB_SRC} + BINARY_DIR ${GEOS_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_TESTING:BOOL=OFF + -DGEOS_ENABLE_TESTS:BOOL=OFF + ${GEOS_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) - set(_SB_GEOS_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GEOS_LIBRARY ${SB_INSTALL_PREFIX}/lib/geos.lib) - elseif(UNIX) - set(_SB_GEOS_LIBRARY ${SB_INSTALL_PREFIX}/lib/libgeos${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +SUPERBUILD_PATCH_SOURCE(GEOS) - endif() -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(GEOS FALSE) \ No newline at end of file diff --git a/SuperBuild/CMake/External_geotiff.cmake b/SuperBuild/CMake/External_geotiff.cmake index e7902dd5307c18a3eeb36cd646cfd0a9bd5db5be..679c73bc9db4ce57553b93c367f930cfa3e872e2 100644 --- a/SuperBuild/CMake/External_geotiff.cmake +++ b/SuperBuild/CMake/External_geotiff.cmake @@ -1,82 +1,73 @@ -if(NOT __EXTERNAL_GEOTIFF__) -set(__EXTERNAL_GEOTIFF__ 1) +INCLUDE_ONCE_MACRO(GEOTIFF) -if(USE_SYSTEM_GEOTIFF) - message(STATUS " Using libgeotiff system version") -else() - SETUP_SUPERBUILD(PROJECT GEOTIFF) - message(STATUS " Using GeoTIFF SuperBuild version") - - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GEOTIFF TIFF PROJ JPEG ZLIB) +SETUP_SUPERBUILD(GEOTIFF) - set(GEOTIFF_SB_CONFIG) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ4_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ4_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_LIBRARY) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GEOTIFF TIFF PROJ JPEG ZLIB) - #RK: we are forced to use autoconf on osx due to cmake's find_* functions - #Do we need to use the same of Linux ? - if(APPLE) - set(GEOTIFF_SB_CONFIG) - ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF PROJ_ROOT --with-proj) - ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF TIFF_ROOT --with-libtiff) - ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF JPEG_ROOT --with-jpeg) - ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF ZLIB_ROOT --with-libz) +set(GEOTIFF_SB_CONFIG) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF TIFF_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF PROJ_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF JPEG_LIBRARY) - ExternalProject_Add(GEOTIFF - PREFIX GEOTIFF - URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz" - URL_MD5 48bdf817e6e7a37671cc1f41b01e10fc - SOURCE_DIR ${GEOTIFF_SB_SRC} - BINARY_DIR ${GEOTIFF_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${GEOTIFF_DEPENDENCIES} - CONFIGURE_COMMAND - ${SB_ENV_CONFIGURE_CMD} - ${GEOTIFF_SB_SRC}/configure - --prefix=${SB_INSTALL_PREFIX} - --enable-static=no - ${GEOTIFF_SB_CONFIG} - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install) +#RK: we are forced to use autoconf on osx due to cmake's find_* functions +#Do we need to use the same of Linux ? +if(UNIX) + set(GEOTIFF_SB_CONFIG) + ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF PROJ_ROOT --with-proj) + ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF TIFF_ROOT --with-libtiff) + ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF JPEG_ROOT --with-jpeg) + ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF ZLIB_ROOT --with-libz) - SUPERBUILD_PATCH_SOURCE(GEOTIFF "patch-configure-rpath") + ExternalProject_Add(GEOTIFF + PREFIX GEOTIFF + URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz" + URL_MD5 48bdf817e6e7a37671cc1f41b01e10fc + SOURCE_DIR ${GEOTIFF_SB_SRC} + BINARY_DIR ${GEOTIFF_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${GEOTIFF_DEPENDENCIES} + CONFIGURE_COMMAND + ${SB_ENV_CONFIGURE_CMD} + ${GEOTIFF_SB_SRC}/configure + --prefix=${SB_INSTALL_PREFIX} + --enable-static=no + ${GEOTIFF_SB_CONFIG} + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install) - else() + SUPERBUILD_PATCH_SOURCE(GEOTIFF) - ExternalProject_Add(GEOTIFF - PREFIX GEOTIFF - URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz" - URL_MD5 48bdf817e6e7a37671cc1f41b01e10fc - SOURCE_DIR ${GEOTIFF_SB_SRC} - BINARY_DIR ${GEOTIFF_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${GEOTIFF_DEPENDENCIES} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_TESTING:BOOL=OFF - -DPROJ4_OSGEO4W_HOME:PATH=${SB_INSTALL_PREFIX} - ${GEOTIFF_SB_CONFIG} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) - endif() +else() - set(_SB_GEOTIFF_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GEOTIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/geotiff_i.lib) - elseif(UNIX) - set(_SB_GEOTIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libgeotiff${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() + ExternalProject_Add(GEOTIFF + PREFIX GEOTIFF + URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz" + URL_MD5 48bdf817e6e7a37671cc1f41b01e10fc + SOURCE_DIR ${GEOTIFF_SB_SRC} + BINARY_DIR ${GEOTIFF_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${GEOTIFF_DEPENDENCIES} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_TESTING:BOOL=OFF + -DPROJ4_OSGEO4W_HOME:PATH=${SB_INSTALL_PREFIX} + ${GEOTIFF_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) endif() + +set(_SB_GEOTIFF_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_GEOTIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/geotiff_i.lib) +elseif(UNIX) + set(_SB_GEOTIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libgeotiff${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_glew.cmake b/SuperBuild/CMake/External_glew.cmake index 99018acb2c2f8e24c3011ee89924b276e9a340b0..8673593e85e5c7e134c680fe911a3edbda990c78 100644 --- a/SuperBuild/CMake/External_glew.cmake +++ b/SuperBuild/CMake/External_glew.cmake @@ -1,58 +1,21 @@ -if(NOT __EXTERNAL_GLEW__) -set(__EXTERNAL_GLEW__ 1) +INCLUDE_ONCE_MACRO(GLEW) -if(USE_SYSTEM_GLEW) - message(STATUS " Using GLEW system version") -else() - SETUP_SUPERBUILD(PROJECT GLEW) - message(STATUS " Using GLEW SuperBuild version") +SETUP_SUPERBUILD(GLEW) - if(UNIX) - ExternalProject_Add(GLEW - PREFIX GLEW - URL "https://sourceforge.net/projects/glew/files/glew/1.13.0/glew-1.13.0.tgz/download" - URL_MD5 7cbada3166d2aadfc4169c4283701066 - BINARY_DIR ${GLEW_SB_BUILD_DIR} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - INSTALL_DIR ${SB_INSTALL_PREFIX} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${GLEW_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/GLEW/CMakeLists.txt - ${GLEW_SB_SRC} - ) +ExternalProject_Add(GLEW + PREFIX GLEW + URL "https://sourceforge.net/projects/glew/files/glew/1.13.0/glew-1.13.0.tgz/download" + URL_MD5 7cbada3166d2aadfc4169c4283701066 + SOURCE_DIR ${GLEW_SB_SRC} + BINARY_DIR ${GLEW_SB_BUILD_DIR} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + INSTALL_DIR ${SB_INSTALL_PREFIX} + CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} ${SB_CMAKE_CACHE_ARGS} -DBUILD_UTILS:BOOL=OFF ${GLEW_SB_SRC}/build/cmake/ + ) - elseif(MSVC) - set(SB_GLEW_DIR "Release/Win32") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(SB_GLEW_DIR "Release/x64") - endif() - ExternalProject_Add(GLEW - PREFIX GLEW - URL "https://sourceforge.net/projects/glew/files/glew/1.13.0/glew-1.13.0-win32.zip/download" - URL_MD5 a2c0e4d75bdb84217550e51c0f1e7090 - BINARY_DIR ${GLEW_SB_BUILD_DIR} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${GLEW_SB_SRC}/include ${CMAKE_INSTALL_PREFIX}/include - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${GLEW_SB_SRC}/lib/${SB_GLEW_DIR}/glew32s.lib ${CMAKE_INSTALL_PREFIX}/lib - BUILD_COMMAND ${CMAKE_COMMAND} -E copy ${GLEW_SB_SRC}/lib/${SB_GLEW_DIR}/glew32.lib ${CMAKE_INSTALL_PREFIX}/lib - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${GLEW_SB_SRC}/bin/${SB_GLEW_DIR}/glew32.dll ${CMAKE_INSTALL_PREFIX}/bin/ - ) - - message(STATUS " Pre-built binaries of GLEW are used for MSVC") - endif() - - set(_SB_GLEW_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GLEW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libGLEW.lib) - elseif(UNIX) - set(_SB_GLEW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libGLEW${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() +set(_SB_GLEW_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_GLEW_LIBRARY ${SB_INSTALL_PREFIX}/lib/glew32.lib) +elseif(UNIX) + set(_SB_GLEW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libGLEW${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_glfw.cmake b/SuperBuild/CMake/External_glfw.cmake index cca1592ec5bafe921bfe110cdc4ea1d29f60061d..1ff1714a387fbdbf2067c76a18c4cb82c243e0dc 100644 --- a/SuperBuild/CMake/External_glfw.cmake +++ b/SuperBuild/CMake/External_glfw.cmake @@ -1,35 +1,25 @@ -if(NOT __EXTERNAL_GLFW__w) - set(__EXTERNAL_GLFW__ 1) +INCLUDE_ONCE_MACRO(GLFW) - if(USE_SYSTEM_GLFW) - message(STATUS " Using GLFW system version") - else() - SETUP_SUPERBUILD(PROJECT GLFW) - message(STATUS " Using GLFW SuperBuild version") +SETUP_SUPERBUILD(GLFW) - ExternalProject_Add(GLFW - PREFIX GLFW - URL "https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip" - URL_MD5 8023327bfe979b3fe735e449e2f54842 - BINARY_DIR ${GLFW_SB_BUILD_DIR} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DGLFW_BUILD_EXAMPLES:BOOL=OFF - -DGLFW_BUILD_DOCS:BOOL=OFF - -DGLFW_BUILD_TESTS:BOOL=OFF - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(GLFW + PREFIX GLFW + URL "https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip" + URL_MD5 8023327bfe979b3fe735e449e2f54842 + BINARY_DIR ${GLFW_SB_BUILD_DIR} + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DGLFW_BUILD_EXAMPLES:BOOL=OFF + -DGLFW_BUILD_DOCS:BOOL=OFF + -DGLFW_BUILD_TESTS:BOOL=OFF + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_GLFW_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GLFW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libglfw.lib) - elseif(UNIX) - set(_SB_GLFW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libglfw${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - - endif() +set(_SB_GLFW_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_GLFW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libglfw.lib) +elseif(UNIX) + set(_SB_GLFW_LIBRARY ${SB_INSTALL_PREFIX}/lib/libglfw${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_glut.cmake b/SuperBuild/CMake/External_glut.cmake index 98e3d12a24fd755540f8bff4239441135a04dfcd..cdc8cfc17876b3c0d3976cc33245d9fe02abf095 100644 --- a/SuperBuild/CMake/External_glut.cmake +++ b/SuperBuild/CMake/External_glut.cmake @@ -1,41 +1,29 @@ -if(NOT __EXTERNAL_GLUT__) -set(__EXTERNAL_GLUT__ 1) +INCLUDE_ONCE_MACRO(GLUT) -if(USE_SYSTEM_GLUT) - message(STATUS " Using GLUT system version") -else() - - if(APPLE) - message(FATAL_ERROR "Cannot activate GLUT on OSX. See manits issue #1194") - endif() +if(APPLE) + message(FATAL_ERROR "Cannot activate GLUT on OSX. See manits issue #1194") + retunr() +endif() - SETUP_SUPERBUILD(PROJECT GLUT) - message(STATUS " Using GLUT SuperBuild version") +SETUP_SUPERBUILD(GLUT) - ExternalProject_Add(GLUT - PREFIX GLUT - URL "http://downloads.sourceforge.net/project/freeglut/freeglut/2.8.1/freeglut-2.8.1.tar.gz" - URL_MD5 918ffbddcffbac83c218bc52355b6d5a - BINARY_DIR ${GLUT_SB_BUILD_DIR} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/GLUT/CMakeLists.txt - ${GLUT_SB_SRC} - CMAKE_CACHE_ARGS - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} +ExternalProject_Add(GLUT + PREFIX GLUT + URL "http://downloads.sourceforge.net/project/freeglut/freeglut/2.8.1/freeglut-2.8.1.tar.gz" + URL_MD5 918ffbddcffbac83c218bc52355b6d5a + BINARY_DIR ${GLUT_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/GLUT/CMakeLists.txt + ${GLUT_SB_SRC} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) - set(_SB_GLUT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_GLUT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreeglut.lib) - elseif(UNIX) - set(_SB_GLUT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreeglut${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - - message(STATUS " Using glut SuperBuild version") -endif() +set(_SB_GLUT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_GLUT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreeglut.lib) +elseif(UNIX) + set(_SB_GLUT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libfreeglut${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_itk.cmake b/SuperBuild/CMake/External_itk.cmake index 4bd69addb8e7e2b6358e776e90822f4ce7814c10..889f88b6f783a5c74cc4c45830a06fddd5af603c 100644 --- a/SuperBuild/CMake/External_itk.cmake +++ b/SuperBuild/CMake/External_itk.cmake @@ -1,169 +1,171 @@ -if(NOT __EXTERNAL_ITK__) -set(__EXTERNAL_ITK__ 1) +INCLUDE_ONCE_MACRO(ITK) -if(USE_SYSTEM_ITK) - message(STATUS " Using ITK system version") -else() - SETUP_SUPERBUILD(PROJECT ITK) - message(STATUS " Using ITK SuperBuild version") - - # if(MSVC) - # set(ITK_SB_SRC "C:/Temp/ITK") - # set(ITK_SB_BUILD_DIR ${ITK_SB_SRC}/build) - # endif() - - set(ITK_ENABLED_MODULES - Common - FiniteDifference - GPUCommon - GPUFiniteDifference - ImageAdaptors - ImageFunction - Mesh - QuadEdgeMesh - SpatialObjects - #TestKernel - Transform - - AnisotropicSmoothing - AntiAlias - BiasCorrection - BinaryMathematicalMorphology - Colormap - Convolution - CurvatureFlow - Deconvolution - Denoising - #DiffusionTensorImage - DisplacementField - DistanceMap - FastMarching - FFT - GPUAnisotropicSmoothing - GPUImageFilterBase - GPUSmoothing - GPUThresholding - ImageCompare - ImageCompose - ImageFeature - ImageFilterBase - ImageFusion - ImageGradient - ImageGrid - ImageIntensity - ImageLabel - ImageSources - ImageStatistics - LabelMap - MathematicalMorphology - Path - QuadEdgeMeshFiltering - Smoothing - SpatialFunction - Thresholding - - Eigen - #FEM - NarrowBand - NeuralNetworks - Optimizers - Optimizersv4 - Polynomials - Statistics - - RegistrationCommon - #FEMRegistration - GPURegistrationCommon - GPUPDEDeformableRegistration - Metricsv4 - PDEDeformableRegistration - RegistrationMethodsv4 - - #BioCell - Classifiers - ConnectedComponents - DeformableMesh - KLMRegionGrowing - LabelVoting - LevelSets - LevelSetsv4 - #LevelSetsv4Visualization - MarkovRandomFieldsClassifiers - RegionGrowing - SignedDistanceFunction - Voronoi - Watersheds - ) +SETUP_SUPERBUILD(ITK) - set(ITK_MODULES_CMAKE_CACHE) - foreach(ITK_MODULE ${ITK_ENABLED_MODULES}) - list(APPEND ITK_MODULES_CMAKE_CACHE -DModule_ITK${ITK_MODULE}:BOOL=ON) - endforeach() +# if(MSVC) +# set(ITK_SB_SRC "C:/Temp/ITK") +# set(ITK_SB_BUILD_DIR ${ITK_SB_SRC}/build) +# endif() - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(ITK ZLIB FFTW) - ADD_SUPERBUILD_CMAKE_VAR(ITK ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(ITK ZLIB_LIBRARY) +set(ITK_ENABLED_MODULES + Common + FiniteDifference + GPUCommon + GPUFiniteDifference + ImageAdaptors + ImageFunction + Mesh + QuadEdgeMesh + SpatialObjects + #TestKernel + Transform - # By default activate FFTW, but with an external fftw build - # These variables are used in ITK to initialize the value of the ITK_USE_FFTW_XXX options - if (WIN32) - list(APPEND ITK_SB_CONFIG - -DUSE_FFTWF:BOOL=OFF - -DUSE_FFTWD:BOOL=OFF - ) - else() + AnisotropicSmoothing + AntiAlias + BiasCorrection + BinaryMathematicalMorphology + Colormap + Convolution + CurvatureFlow + Deconvolution + Denoising + #DiffusionTensorImage + DisplacementField + DistanceMap + FastMarching + FFT + GPUAnisotropicSmoothing + GPUImageFilterBase + GPUSmoothing + GPUThresholding + ImageCompare + ImageCompose + ImageFeature + ImageFilterBase + ImageFusion + ImageGradient + ImageGrid + ImageIntensity + ImageLabel + ImageSources + ImageStatistics + LabelMap + MathematicalMorphology + Path + QuadEdgeMeshFiltering + Smoothing + SpatialFunction + Thresholding + + Eigen + #FEM + NarrowBand + NeuralNetworks + Optimizers + Optimizersv4 + Polynomials + Statistics + + RegistrationCommon + #FEMRegistration + GPURegistrationCommon + GPUPDEDeformableRegistration + Metricsv4 + PDEDeformableRegistration + RegistrationMethodsv4 + + #BioCell + Classifiers + ConnectedComponents + DeformableMesh + KLMRegionGrowing + LabelVoting + LevelSets + LevelSetsv4 + #LevelSetsv4Visualization + MarkovRandomFieldsClassifiers + RegionGrowing + SignedDistanceFunction + Voronoi + Watersheds + ) + +set(ITK_MODULES_CMAKE_CACHE) +foreach(ITK_MODULE ${ITK_ENABLED_MODULES}) + list(APPEND ITK_MODULES_CMAKE_CACHE -DModule_ITK${ITK_MODULE}:BOOL=ON) +endforeach() + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(ITK ZLIB FFTW) +ADD_SUPERBUILD_CMAKE_VAR(ITK ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(ITK ZLIB_LIBRARY) + +# By default activate FFTW, but with an external fftw build +# These variables are used in ITK to initialize the value of the ITK_USE_FFTW_XXX options +if (WIN32) + list(APPEND ITK_SB_CONFIG + -DUSE_FFTWF:BOOL=OFF + -DUSE_FFTWD:BOOL=OFF + ) + if(MSVC AND BUILD_SHARED_LIBS) list(APPEND ITK_SB_CONFIG - -DUSE_FFTWF:BOOL=ON - -DUSE_FFTWD:BOOL=ON - -DUSE_SYSTEM_FFTW:BOOL=ON - ) - ADD_SUPERBUILD_CMAKE_VAR(ITK FFTW_INCLUDE_PATH) + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=TRUE) endif() - - # forward compilation flags - set(ITK_SB_COMPILATION_FLAGS - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} - -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} - -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} - -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} - -DCMAKE_STATIC_LINKER_FLAGS:STRING=${CMAKE_STATIC_LINKER_FLAGS} +else() + list(APPEND ITK_SB_CONFIG + -DUSE_FFTWF:BOOL=ON + -DUSE_FFTWD:BOOL=ON + -DUSE_SYSTEM_FFTW:BOOL=ON ) + ADD_SUPERBUILD_CMAKE_VAR(ITK FFTW_INCLUDE_PATH) +endif() - #later used below for _SB_ITK_DIR and then in packaging - set(ITK_SB_VERSION 4.8) - set(ITK_SB_VERSION_FULL ${ITK_SB_VERSION}.1) - - ExternalProject_Add(ITK - PREFIX ITK - URL "http://sourceforge.net/projects/itk/files/itk/4.8/InsightToolkit-4.8.1.tar.gz/download" - URL_MD5 b1ed53604de854501cb61f34f410420e - SOURCE_DIR ${ITK_SB_SRC} - BINARY_DIR ${ITK_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - ${ITK_SB_COMPILATION_FLAGS} - -DITK_BUILD_DEFAULT_MODULES:BOOL=OFF - ${ITK_MODULES_CMAKE_CACHE} - -DITKGroup_Core:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=${SB_BUILD_SHARED_LIBS} - -DBUILD_TESTING:BOOL=OFF - -DBUILD_EXAMPLES:BOOL=OFF - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - -DITK_USE_SYSTEM_EXPAT:BOOL=ON - -DITK_USE_SYSTEM_ZLIB:BOOL=ON - -DITK_USE_SYSTEM_TIFF:BOOL=ON - -DITK_USE_SYSTEM_PNG:BOOL=ON - ${ITK_SB_CONFIG} - DEPENDS ${ITK_DEPENDENCIES} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +# forward compilation flags +set(ITK_SB_COMPILATION_FLAGS + -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} + -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} + -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} + -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} + -DCMAKE_STATIC_LINKER_FLAGS:STRING=${CMAKE_STATIC_LINKER_FLAGS} + ) - set(_SB_ITK_DIR ${SB_INSTALL_PREFIX}/lib/cmake/ITK-${ITK_SB_VERSION}) +#later used below for _SB_ITK_DIR and then in packaging +set(ITK_SB_VERSION 4.10) +set(ITK_SB_VERSION_FULL ${ITK_SB_VERSION}.0) +set(_SB_ITK_DIR ${SB_INSTALL_PREFIX}/lib/cmake/ITK-${ITK_SB_VERSION}) +ExternalProject_Add(ITK + PREFIX ITK + URL "http://downloads.sourceforge.net/project/itk/itk/4.10/InsightToolkit-4.10.0.tar.gz" + URL_MD5 8c67ba296da3835fb67bb29d98dcff3e + SOURCE_DIR ${ITK_SB_SRC} + BINARY_DIR ${ITK_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + ${ITK_SB_COMPILATION_FLAGS} + -DITK_BUILD_DEFAULT_MODULES:BOOL=OFF + ${ITK_MODULES_CMAKE_CACHE} + -DITKGroup_Core:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -DBUILD_EXAMPLES:BOOL=OFF + -DITK_USE_SYSTEM_EXPAT:BOOL=ON + -DITK_USE_SYSTEM_ZLIB:BOOL=ON + -DITK_USE_SYSTEM_TIFF:BOOL=ON + -DITK_USE_SYSTEM_PNG:BOOL=ON + ${ITK_SB_CONFIG} + DEPENDS ${ITK_DEPENDENCIES} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) + +set(ITK_DIFF_FILES ${CMAKE_SOURCE_DIR}/patches/ITK/itk-1-fftw-all.diff) + +if(UNIX AND NOT APPLE) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2) + set (ITK_DIFF_FILES "${ITK_DIFF_FILES} ${CMAKE_SOURCE_DIR}/patches/ITK/itk-2-dlopen_gcc41-linux.diff") + endif() endif() -endif() + +SUPERBUILD_PATCH_SOURCE(ITK "" ${ITK_DIFF_FILES}) diff --git a/SuperBuild/CMake/External_jpeg.cmake b/SuperBuild/CMake/External_jpeg.cmake index 4867cd37eda516ab31962f6192386100fcd51149..ecd7ca02a7f0eb3944a073cf8de2d2f58ef36a9c 100644 --- a/SuperBuild/CMake/External_jpeg.cmake +++ b/SuperBuild/CMake/External_jpeg.cmake @@ -1,16 +1,6 @@ -if( __EXTERNAL_JPEG__) - return() -else() - set(__EXTERNAL_JPEG__ 1) -endif() - -if(USE_SYSTEM_JPEG) - message(STATUS " Using libjpeg system version") - return() -endif() +INCLUDE_ONCE_MACRO(JPEG) -SETUP_SUPERBUILD(PROJECT JPEG) -message(STATUS " Using libjpeg SuperBuild version") +SETUP_SUPERBUILD(JPEG) if(WIN32) set(JPEG_PATCH_COMMAND ${CMAKE_COMMAND} @@ -30,24 +20,18 @@ ExternalProject_Add(JPEG BINARY_DIR ${JPEG_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} - -DCMAKE_BUILD_TYPE=Release + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} -DENABLE_SHARED=TRUE -DENABLE_STATIC=FALSE -DWITH_SIMD=FALSE -DWITH_TURBOJPEG=FALSE -DWITH_ARITH_DEC=TRUE -DWITH_JAVA=FALSE - -DCMAKE_INSTALL_PREFIX=${SB_INSTALL_PREFIX} ${JPEG_SB_SRC} PATCH_COMMAND ${JPEG_PATCH_COMMAND} ) -SUPERBUILD_PATCH_SOURCE(JPEG "patch-for-unix") +SUPERBUILD_PATCH_SOURCE(JPEG) -set(_SB_JPEG_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) -if(WIN32) - set(_SB_JPEG_LIBRARY ${SB_INSTALL_PREFIX}/lib/jpeg.lib) -elseif(UNIX) - set(_SB_JPEG_LIBRARY ${SB_INSTALL_PREFIX}/lib/libjpeg${CMAKE_SHARED_LIBRARY_SUFFIX}) -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(JPEG FALSE) diff --git a/SuperBuild/CMake/External_libkml.cmake b/SuperBuild/CMake/External_libkml.cmake index 0470e4492f978b110177d2cabd0509e18cccd20e..a55c309ac936df89d438f18c2b2ae15eb4d6a2c5 100644 --- a/SuperBuild/CMake/External_libkml.cmake +++ b/SuperBuild/CMake/External_libkml.cmake @@ -1,65 +1,53 @@ -if(NOT __EXTERNAL_LIBKML__) -set(__EXTERNAL_LIBKML__ 1) +INCLUDE_ONCE_MACRO(LIBKML) -if(USE_SYSTEM_LIBKML) - message(STATUS " Using libKML system version") -else() - SETUP_SUPERBUILD(PROJECT LIBKML) - message(STATUS " Using libKML SuperBuild version") +SETUP_SUPERBUILD(LIBKML) - # declare dependencies - ##set(LIBKML_DEPENDENCIES EXPAT ZLIB BOOST) - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(LIBKML EXPAT ZLIB BOOST) +# declare dependencies +##set(LIBKML_DEPENDENCIES EXPAT ZLIB BOOST) +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(LIBKML EXPAT ZLIB BOOST) - ADD_SUPERBUILD_CMAKE_VAR(LIBKML EXPAT_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(LIBKML EXPAT_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(LIBKML ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(LIBKML ZLIB_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(LIBKML Boost_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(LIBKML EXPAT_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(LIBKML EXPAT_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(LIBKML ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(LIBKML ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(LIBKML Boost_INCLUDE_DIR) - ExternalProject_Add(LIBKML - PREFIX LIBKML - URL "http://ftp.de.debian.org/debian/pool/main/libk/libkml/libkml_1.3.0~r863.orig.tar.gz" - URL_MD5 211ed5fdf2dd45aeb9c0abc8e1fe42be - BINARY_DIR ${LIBKML_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${LIBKML_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/LIBKML ${LIBKML_SB_SRC} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - ${LIBKML_SB_CONFIG} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(LIBKML + PREFIX LIBKML + URL "http://ftp.de.debian.org/debian/pool/main/libk/libkml/libkml_1.3.0~r863.orig.tar.gz" + URL_MD5 211ed5fdf2dd45aeb9c0abc8e1fe42be + BINARY_DIR ${LIBKML_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${LIBKML_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/LIBKML ${LIBKML_SB_SRC} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + ${LIBKML_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_LIBKML_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - list(APPEND _SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlbase.lib) - if(USE_SYSTEM_EXPAT) - list(APPEND _SB_LIBKML_BASE_LIBRARY ${EXPAT_LIBRARY}) - else() - list(APPEND _SB_LIBKML_BASE_LIBRARY ${_SB_EXPAT_LIBRARY}) - endif() - list(APPEND _SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/uriparser.lib) - - set(_SB_LIBKML_CONVENIENCE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlconvenience.lib) - set(_SB_LIBKML_DOM_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmldom.lib) - set(_SB_LIBKML_ENGINE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlengine.lib) - set(_SB_LIBKML_REGIONATOR_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlregionator.lib) - set(_SB_LIBKML_XSD_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlxsd.lib) - set(_SB_LIBKML_MINIZIP_LIBRARY ${SB_INSTALL_PREFIX}/lib/minizip.lib) - elseif(UNIX) - set(_SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlbase${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_CONVENIENCE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlconvenience${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_DOM_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmldom${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_ENGINE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlengine${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_REGIONATOR_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlregionator${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_XSD_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlxsd${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(_SB_LIBKML_MINIZIP_LIBRARY ${SB_INSTALL_PREFIX}/lib/libminizip${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(_SB_LIBKML_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + list(APPEND _SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlbase.lib) + if(USE_SYSTEM_EXPAT) + list(APPEND _SB_LIBKML_BASE_LIBRARY ${EXPAT_LIBRARY}) + else() + list(APPEND _SB_LIBKML_BASE_LIBRARY ${_SB_EXPAT_LIBRARY}) endif() + list(APPEND _SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/uriparser.lib) -endif() + set(_SB_LIBKML_CONVENIENCE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlconvenience.lib) + set(_SB_LIBKML_DOM_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmldom.lib) + set(_SB_LIBKML_ENGINE_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlengine.lib) + set(_SB_LIBKML_REGIONATOR_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlregionator.lib) + set(_SB_LIBKML_XSD_LIBRARY ${SB_INSTALL_PREFIX}/lib/kmlxsd.lib) + set(_SB_LIBKML_MINIZIP_LIBRARY ${SB_INSTALL_PREFIX}/lib/minizip.lib) +elseif(UNIX) + set(_SB_LIBKML_BASE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlbase${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_CONVENIENCE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlconvenience${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_DOM_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmldom${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_ENGINE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlengine${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_REGIONATOR_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlregionator${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_XSD_LIBRARY ${SB_INSTALL_PREFIX}/lib/libkmlxsd${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_LIBKML_MINIZIP_LIBRARY ${SB_INSTALL_PREFIX}/lib/libminizip${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_libsvm.cmake b/SuperBuild/CMake/External_libsvm.cmake index 20e1884477cac831b8b4f138e3dd8b9343f8dd59..3c81b65c05365a8c8520e22e17ec2bc31bcf3e34 100644 --- a/SuperBuild/CMake/External_libsvm.cmake +++ b/SuperBuild/CMake/External_libsvm.cmake @@ -1,37 +1,25 @@ -if(NOT __EXTERNAL_LIBSVM__) -set(__EXTERNAL_LIBSVM__ 1) +INCLUDE_ONCE_MACRO(LIBSVM) -if(USE_SYSTEM_LIBSVM) - message(STATUS " Using LibSVM system version") -else() - SETUP_SUPERBUILD(PROJECT LIBSVM) - message(STATUS " Using LibSVM SuperBuild version") +SETUP_SUPERBUILD(LIBSVM) - ExternalProject_Add(LIBSVM - PREFIX LIBSVM - URL "http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz" - URL_MD5 5f088e5f89da1c65b642300c9c5ea772 - BINARY_DIR ${LIBSVM_SB_BUILD_DIR} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - INSTALL_DIR ${SB_INSTALL_PREFIX} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - ${LIBSVM_FLAGS} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${LIBSVM_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/LIBSVM/CMakeLists.txt - ${LIBSVM_SB_SRC} - ) +ExternalProject_Add(LIBSVM + PREFIX LIBSVM + URL "http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz" + URL_MD5 5f088e5f89da1c65b642300c9c5ea772 + BINARY_DIR ${LIBSVM_SB_BUILD_DIR} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + INSTALL_DIR ${SB_INSTALL_PREFIX} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + DEPENDS ${LIBSVM_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/LIBSVM/CMakeLists.txt + ${LIBSVM_SB_SRC} + ) - set(_SB_LIBSVM_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_LIBSVM_LIBRARY ${SB_INSTALL_PREFIX}/lib/svm.lib) - elseif(UNIX) - set(_SB_LIBSVM_LIBRARY ${SB_INSTALL_PREFIX}/lib/libsvm${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() +set(_SB_LIBSVM_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_LIBSVM_LIBRARY ${SB_INSTALL_PREFIX}/lib/svm.lib) +elseif(UNIX) + set(_SB_LIBSVM_LIBRARY ${SB_INSTALL_PREFIX}/lib/libsvm${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_muparser.cmake b/SuperBuild/CMake/External_muparser.cmake index 2c0647ca1600da3f576158c5a96ad5702b3ecfe8..2e6a5e702bdd54e9780699ff314741e54329b063 100644 --- a/SuperBuild/CMake/External_muparser.cmake +++ b/SuperBuild/CMake/External_muparser.cmake @@ -1,35 +1,20 @@ -if(NOT __EXTERNAL_MUPARSER__) -set(__EXTERNAL_MUPARSER__ 1) +INCLUDE_ONCE_MACRO(MUPARSER) -if(USE_SYSTEM_MUPARSER) - message(STATUS " Using muParser system version") -else() - SETUP_SUPERBUILD(PROJECT MUPARSER) - message(STATUS " Using muParser SuperBuild version") +SETUP_SUPERBUILD(MUPARSER) - ExternalProject_Add(MUPARSER - PREFIX MUPARSER - URL "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz" - URL_MD5 02dae671aa5ad955fdcbcd3fee313fb7 - BINARY_DIR ${MUPARSER_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${MUPARSER_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSER/CMakeLists.txt - ${MUPARSER_SB_SRC} - ) +ExternalProject_Add(MUPARSER + PREFIX MUPARSER + URL "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz" + URL_MD5 02dae671aa5ad955fdcbcd3fee313fb7 + BINARY_DIR ${MUPARSER_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + DEPENDS ${MUPARSER_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/MUPARSER/CMakeLists.txt + ${MUPARSER_SB_SRC} + ) - set(_SB_MUPARSER_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/muparser.lib) - elseif(UNIX) - set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/libmuparser${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSER FALSE) \ No newline at end of file diff --git a/SuperBuild/CMake/External_muparserx.cmake b/SuperBuild/CMake/External_muparserx.cmake index f29dca5520ad9d64f05856c9f385a7a64e62ce1a..fe64272d9138f71270efd9940a784f046339c29e 100644 --- a/SuperBuild/CMake/External_muparserx.cmake +++ b/SuperBuild/CMake/External_muparserx.cmake @@ -1,50 +1,34 @@ -if(NOT __EXTERNAL_MUPARSERX__) -set(__EXTERNAL_MUPARSERX__ 1) +INCLUDE_ONCE_MACRO(MUPARSERX) -if(USE_SYSTEM_MUPARSERX) - message(STATUS " Using muParserX system version") -else() - SETUP_SUPERBUILD(PROJECT MUPARSERX) - message(STATUS " Using muParserX SuperBuild version") +SETUP_SUPERBUILD(MUPARSERX) - set(MUPARSERX_FLAGS) - if(APPLE) - set(MUPARSERX_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-std=c++0x") - endif() +set(MUPARSERX_FLAGS) +if(APPLE) + set(MUPARSERX_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-std=c++0x") +endif() - # We provide a zip archive of last muparserx release (3.0.5) - # Archive was generated using commit sha on muparserx github page - # Commands to create source archive: - # wget https://github.com/beltoforion/muparserx/archive/2ace83b5411f1ab9940653c2bab0efa5140efb71.zip - # mv 2ace83b5411f1ab9940653c2bab0efa5140efb71.zip muparserx_v3_0_5.zip +# We provide a zip archive of last muparserx release (3.0.5) +# Archive was generated using commit sha on muparserx github page +# Commands to create source archive: +# wget https://github.com/beltoforion/muparserx/archive/2ace83b5411f1ab9940653c2bab0efa5140efb71.zip +# mv 2ace83b5411f1ab9940653c2bab0efa5140efb71.zip muparserx_v3_0_5.zip - ExternalProject_Add(MUPARSERX - PREFIX MUPARSERX - URL "https://www.orfeo-toolbox.org/packages/muparserx_v3_0_5.zip" - URL_MD5 ad86b88c159ab68f4bfc99d71166e3c5 - BINARY_DIR ${MUPARSERX_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - ${MUPARSERX_FLAGS} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${MUPARSERX_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/CMakeLists.txt - ${MUPARSERX_SB_SRC} - UPDATE_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/mpParserMessageProvider.cpp - ${MUPARSERX_SB_SRC}/parser/ - ) +ExternalProject_Add(MUPARSERX + PREFIX MUPARSERX + URL "https://www.orfeo-toolbox.org/packages/muparserx_v3_0_5.zip" + URL_MD5 ad86b88c159ab68f4bfc99d71166e3c5 + BINARY_DIR ${MUPARSERX_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} ${MUPARSERX_FLAGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + DEPENDS ${MUPARSERX_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/CMakeLists.txt + ${MUPARSERX_SB_SRC} + UPDATE_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/mpParserMessageProvider.cpp + ${MUPARSERX_SB_SRC}/parser/ + ) - set(_SB_MUPARSERX_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_MUPARSERX_LIBRARY ${SB_INSTALL_PREFIX}/lib/muparserx.lib) - elseif(UNIX) - set(_SB_MUPARSERX_LIBRARY ${SB_INSTALL_PREFIX}/lib/libmuparserx${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() -endif() -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSERX FALSE) \ No newline at end of file diff --git a/SuperBuild/CMake/External_mvd.cmake b/SuperBuild/CMake/External_mvd.cmake index d5ac422d5d0e43fe0417378fa01cff329298010b..6191668df3998206ba9dd3dd260cb89b11a58362 100644 --- a/SuperBuild/CMake/External_mvd.cmake +++ b/SuperBuild/CMake/External_mvd.cmake @@ -1,8 +1,12 @@ -if(NOT __EXTERNAL_MVD__) -set(__EXTERNAL_MVD__ 1) +if( __EXTERNAL_MVD__) + return() +else() + set(__EXTERNAL_MVD__ 1) +endif() + +SETUP_SUPERBUILD(MVD) -SETUP_SUPERBUILD(PROJECT MVD) -message(STATUS " Using Monteverdi SuperBuild version") +set(MONTEVERDI_GIT_TAG "develop" CACHE STRING "branch name of monteverdi to build. Default is 'develop'") # declare dependencies ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(MVD OTB QWT QT4) @@ -14,25 +18,19 @@ ADD_SUPERBUILD_CMAKE_VAR(MVD QWT_LIBRARY) ADD_SUPERBUILD_CMAKE_VAR(MVD QT_QMAKE_EXECUTABLE) #TODO: control build testing via cmake variable properly + ExternalProject_Add(MVD PREFIX MVD GIT_REPOSITORY "https://git@git.orfeo-toolbox.org/git/monteverdi2.git" - GIT_TAG "release-3.2" + GIT_TAG "${MONTEVERDI_GIT_TAG}" SOURCE_DIR ${MVD_SB_SRC} BINARY_DIR ${MVD_SB_BUILD_DIR} INSTALL_DIR ${CMAKE_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} DEPENDS ${MVD_DEPENDENCIES} - CMAKE_CACHE_ARGS - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=${SB_BUILD_SHARED_LIBS} - -DBUILD_TESTING:BOOL=OFF - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} -DMonteverdi_INSTALL_LIB_DIR:STRING=lib - -DCMAKE_PREFIX_PATH:STRING=${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} -DOTB_DATA_ROOT:STRING=${OTB_DATA_ROOT} ${MVD_SB_CONFIG} CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) - -endif() diff --git a/SuperBuild/CMake/External_opencv.cmake b/SuperBuild/CMake/External_opencv.cmake index cfed98e3fa116fb6b22c127f3a6c00be1f2986d0..f7d2b9af843371cb0775525ad56f01ce25a8bdfd 100644 --- a/SuperBuild/CMake/External_opencv.cmake +++ b/SuperBuild/CMake/External_opencv.cmake @@ -1,84 +1,88 @@ -if(NOT __EXTERNAL_OPENCV__) -set(__EXTERNAL_OPENCV__ 1) +INCLUDE_ONCE_MACRO(OPENCV) -if(USE_SYSTEM_OPENCV) - message(STATUS " Using OpenCV system version") -else() - SETUP_SUPERBUILD(PROJECT OPENCV) - message(STATUS " Using OpenCV SuperBuild version") +SETUP_SUPERBUILD(OPENCV) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENCV ZLIB TIFF PNG) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENCV ZLIB TIFF PNG) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV ZLIB_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV TIFF_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV TIFF_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV PNG_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENCV PNG_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV TIFF_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV TIFF_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV PNG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENCV PNG_LIBRARY) - ExternalProject_Add(OPENCV - PREFIX OPENCV - URL "http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip/download" - URL_MD5 32f498451bff1817a60e1aabc2939575 - BINARY_DIR ${OPENCV_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_DOCS:BOOL=OFF - -DBUILD_EXAMPLES:BOOL=OFF - -DBUILD_JASPER:BOOL=OFF - -DWITH_JASPER:BOOL=OFF - -DBUILD_JPEG:BOOL=OFF - -DWITH_JPEG:BOOL=OFF - -DWITH_FFMPEG:BOOL=OFF - -DWITH_VFW:BOOL=OFF - -DBUILD_OPENEXR:BOOL=OFF - -DBUILD_PACKAGE:BOOL=ON - -DBUILD_PERF_TESTS:BOOL=OFF - -DBUILD_PNG:BOOL=OFF - -DBUILD_TBB:BOOL=OFF - -DBUILD_TESTS:BOOL=OFF - -DBUILD_TIFF:BOOL=OFF - -DBUILD_ZLIB:BOOL=OFF - -DBUILD_opencv_apps:BOOL=OFF - -DBUILD_opencv_calib3d:BOOL=OFF - -DBUILD_opencv_contrib:BOOL=OFF - -DBUILD_opencv_core:BOOL=ON - -DBUILD_opencv_features2d:BOOL=OFF - -DBUILD_opencv_flann:BOOL=OFF - -DBUILD_opencv_gpu:BOOL=OFF - -DBUILD_opencv_highgui:BOOL=OFF - -DBUILD_opencv_imgproc:BOOL=OFF - -DBUILD_opencv_java:BOOL=OFF - -DBUILD_opencv_legacy:BOOL=OFF - -DBUILD_opencv_ml:BOOL=ON - -DBUILD_opencv_nonfree:BOOL=OFF - -DBUILD_opencv_objdetect:BOOL=OFF - -DBUILD_opencv_ocl:BOOL=OFF - -DBUILD_opencv_photo:BOOL=OFF - -DBUILD_opencv_python:BOOL=OFF - -DBUILD_opencv_stitching:BOOL=OFF - -DBUILD_opencv_superres:BOOL=OFF - -DBUILD_opencv_ts:BOOL=OFF - -DBUILD_opencv_video:BOOL=OFF - -DBUILD_opencv_videostab:BOOL=OFF - -DBUILD_opencv_world:BOOL=OFF - -DWITH_CUDA:BOOL=OFF - -DWITH_OPENCL:BOOL=OFF - ${OPENCV_SB_CONFIG} - DEPENDS ${OPENCV_DEPENDENCIES} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(OPENCV + PREFIX OPENCV + URL "http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.11/opencv-2.4.11.zip" + URL_MD5 32f498451bff1817a60e1aabc2939575 + BINARY_DIR ${OPENCV_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_DOCS:BOOL=OFF + -DBUILD_EXAMPLES:BOOL=OFF + -DBUILD_JASPER:BOOL=OFF + -DWITH_JASPER:BOOL=OFF + -DBUILD_JPEG:BOOL=OFF + -DWITH_JPEG:BOOL=OFF + -DWITH_FFMPEG:BOOL=OFF + -DWITH_VFW:BOOL=OFF + -DBUILD_OPENEXR:BOOL=OFF + -DBUILD_PACKAGE:BOOL=ON + -DBUILD_PERF_TESTS:BOOL=OFF + -DBUILD_PNG:BOOL=OFF + -DBUILD_TBB:BOOL=OFF + -DBUILD_TESTS:BOOL=OFF + -DBUILD_TIFF:BOOL=OFF + -DBUILD_ZLIB:BOOL=OFF + -DWITH_CUDA:BOOL=OFF + -DWITH_OPENCL:BOOL=OFF + -DWITH_CUFFT:BOOL=OFF + -DWITH_GIGEAPI:BOOL=OFF + -DWITH_GSTREAMER:BOOL=OFF + -DWITH_GTK:BOOL=OFF + -DWITH_OPENCLAMDBLAS:BOOL=OFF + -DWITH_OPENCLAMDFFT:BOOL=OFF + -DWITH_OPENEXR:BOOL=OFF + -DWITH_PVAPI:BOOL=OFF + -DWITH_QT:BOOL=OFF + -DWITH_UNICAP:BOOL=OFF + -DWITH_LIBV4L:BOOL=OFF + -DWITH_V4L:BOOL=OFF + -DWITH_VTK:BOOL=OFF + -DWITH_XIMEA:BOOL=OFF + -DWITH_XINE:BOOL=OFF + -DBUILD_opencv_apps:BOOL=OFF + -DBUILD_opencv_calib3d:BOOL=OFF + -DBUILD_opencv_contrib:BOOL=OFF + -DBUILD_opencv_core:BOOL=ON + -DBUILD_opencv_features2d:BOOL=OFF + -DBUILD_opencv_flann:BOOL=OFF + -DBUILD_opencv_gpu:BOOL=OFF + -DBUILD_opencv_highgui:BOOL=OFF + -DBUILD_opencv_imgproc:BOOL=OFF + -DBUILD_opencv_java:BOOL=OFF + -DBUILD_opencv_legacy:BOOL=OFF + -DBUILD_opencv_ml:BOOL=ON + -DBUILD_opencv_nonfree:BOOL=OFF + -DBUILD_opencv_objdetect:BOOL=OFF + -DBUILD_opencv_ocl:BOOL=OFF + -DBUILD_opencv_photo:BOOL=OFF + -DBUILD_opencv_python:BOOL=OFF + -DBUILD_opencv_stitching:BOOL=OFF + -DBUILD_opencv_superres:BOOL=OFF + -DBUILD_opencv_ts:BOOL=OFF + -DBUILD_opencv_video:BOOL=OFF + -DBUILD_opencv_videostab:BOOL=OFF + -DBUILD_opencv_world:BOOL=OFF + ${OPENCV_SB_CONFIG} + DEPENDS ${OPENCV_DEPENDENCIES} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - if(APPLE) - SUPERBUILD_PATCH_SOURCE(OPENCV "patch-for-at-rpath") - endif() - set(_SB_OpenCV_DIR ${SB_INSTALL_PREFIX}/share/OpenCV) -endif() -endif() +SUPERBUILD_PATCH_SOURCE(OPENCV) + +set(_SB_OpenCV_DIR ${SB_INSTALL_PREFIX}/share/OpenCV) diff --git a/SuperBuild/CMake/External_openjpeg.cmake b/SuperBuild/CMake/External_openjpeg.cmake index 0cd3b016d4d35b4ae907b795a3cbc099381f562d..49a8d4bafc0d2b516ce88bc72fbbd4c2ab0b0045 100644 --- a/SuperBuild/CMake/External_openjpeg.cmake +++ b/SuperBuild/CMake/External_openjpeg.cmake @@ -1,57 +1,44 @@ -if(NOT __EXTERNAL_OPENJPEG__) -set(__EXTERNAL_OPENJPEG__ 1) +INCLUDE_ONCE_MACRO(OPENJPEG) -if(USE_SYSTEM_OPENJPEG) - message(STATUS " Using OpenJpeg system version") -else() - SETUP_SUPERBUILD(PROJECT OPENJPEG) - message(STATUS " Using OpenJPEG SuperBuild version") +SETUP_SUPERBUILD(OPENJPEG) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENJPEG ZLIB TIFF PNG) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENJPEG ZLIB TIFF PNG) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG TIFF_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG TIFF_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG ZLIB_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG TIFF_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG TIFF_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_PNG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_LIBRARY) - if(MSVC) - #TODO: add LCMS dependency - endif() +#GIT_REPOSITORY "https://github.com/uclouvain/openjpeg.git" +#GIT_TAG d0babeb6f6cdd1887308137df37bb2b4724a6592 - ExternalProject_Add(OPENJPEG - PREFIX OPENJPEG - URL "http://sourceforge.net/projects/openjpeg.mirror/files/2.1.0/openjpeg-2.1.0.tar.gz/download" - URL_MD5 f6419fcc233df84f9a81eb36633c6db6 - BINARY_DIR ${OPENJPEG_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_CODEC:BOOL=ON - -DBUILD_DOC:BOOL=OFF - -DBUILD_JPIP:BOOL=OFF - -DBUILD_JPWL:BOOL=OFF - -DBUILD_MJ2:BOOL=OFF - -DBUILD_PKGCONFIG_FILES:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_TESTING:BOOL=OFF - -DBUILD_THIRDPARTY:BOOL=OFF - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - ${OPENJPEG_SB_CONFIG} - DEPENDS ${OPENJPEG_DEPENDENCIES} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(OPENJPEG + PREFIX OPENJPEG + URL "https://github.com/uclouvain/openjpeg/archive/d0babeb6f6cdd1887308137df37bb2b4724a6592.zip" + URL_MD5 e84a8cca9892a5f80ce91c1174c3fd41 + BINARY_DIR ${OPENJPEG_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_CODEC:BOOL=ON + -DBUILD_DOC:BOOL=OFF + -DBUILD_JPIP:BOOL=OFF + -DBUILD_JPWL:BOOL=OFF + -DBUILD_MJ2:BOOL=OFF + -DBUILD_PKGCONFIG_FILES:BOOL=ON + -DBUILD_THIRDPARTY:BOOL=OFF + -DBUILD_THIRDPARTY_LCMS:BOOL=ON + ${OPENJPEG_SB_CONFIG} + DEPENDS ${OPENJPEG_DEPENDENCIES} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_OPENJPEG_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_OPENJPEG_LIBRARY ${SB_INSTALL_PREFIX}/lib/openjp2.lib) - elseif(UNIX) - set(_SB_OPENJPEG_LIBRARY ${SB_INSTALL_PREFIX}/lib/libopenjp2${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(OPENJPEG FALSE) -endif() -endif() +#Apply patches to openjpeg (for now Even Roualt optim) +SUPERBUILD_PATCH_SOURCE(OPENJPEG "-ut") diff --git a/SuperBuild/CMake/External_openssl.cmake b/SuperBuild/CMake/External_openssl.cmake index c0f7245838d867762ea04994cd2d444539a24bd4..c097b58ab949883c3e2920a16e80486b5aa51c7a 100644 --- a/SuperBuild/CMake/External_openssl.cmake +++ b/SuperBuild/CMake/External_openssl.cmake @@ -1,79 +1,68 @@ -if(NOT __EXTERNAL_OPENSSL__) -set(__EXTERNAL_OPENSSL__ 1) +INCLUDE_ONCE_MACRO(OPENSSL) +SETUP_SUPERBUILD(OPENSSL) -#RK: OPENSSL is deactivated in QT4 build. -#revisit that when you have a clean openssl -if(USE_SYSTEM_OPENSSL) - message(STATUS " Using OpenSSL system version") -else() - SETUP_SUPERBUILD(PROJECT OPENSSL) - message(STATUS " Using OpenSSL SuperBuild version") +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENSSL ZLIB) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OPENSSL ZLIB) - - if(WIN32) - set(OPENSSL_BUILD_ARCH "linux-x32") - set(OPENSSL_BUILD_ARCH "VC-WIN32") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(OPENSSL_BUILD_ARCH "linux-x86_64") - set(OPENSSL_BUILD_ARCH "VC-WIN64A") - endif() +if(WIN32) + set(OPENSSL_BUILD_ARCH "linux-x32") + set(OPENSSL_BUILD_ARCH "VC-WIN32") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(OPENSSL_BUILD_ARCH "linux-x86_64") + set(OPENSSL_BUILD_ARCH "VC-WIN64A") endif() +endif() - if(MSVC) - STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) - STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) - ExternalProject_Add(OPENSSL - PREFIX OPENSSL - URL "https://github.com/openssl/openssl/archive/OpenSSL_1_0_1p.tar.gz" - URL_MD5 6bc1f9a9d9d474aceceb377e758e48ec - DEPENDS ${OPENSSL_DEPENDENCIES} - BINARY_DIR ${OPENSSL_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${OPENSSL_SB_SRC} ${OPENSSL_SB_BUILD_DIR} - CONFIGURE_COMMAND - ${SB_ENV_CONFIGURE_CMD} - ${CMAKE_COMMAND} -E chdir ${OPENSSL_SB_BUILD_DIR} - perl Configure ${OPENSSL_BUILD_ARCH} no-asm --prefix=${CMAKE_WIN_INSTALL_PREFIX} --openssldir=${CMAKE_WIN_INSTALL_PREFIX} - BUILD_COMMAND ms/do_ms.bat - INSTALL_COMMAND nmake -f ms/ntdll.mak install +if(MSVC) + STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) + STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) + ExternalProject_Add(OPENSSL + PREFIX OPENSSL + URL "https://github.com/openssl/openssl/archive/OpenSSL_1_0_1p.tar.gz" + URL_MD5 6bc1f9a9d9d474aceceb377e758e48ec + DEPENDS ${OPENSSL_DEPENDENCIES} + BINARY_DIR ${OPENSSL_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${OPENSSL_SB_SRC} ${OPENSSL_SB_BUILD_DIR} + CONFIGURE_COMMAND + ${SB_ENV_CONFIGURE_CMD} + ${CMAKE_COMMAND} -E chdir ${OPENSSL_SB_BUILD_DIR} + perl Configure ${OPENSSL_BUILD_ARCH} no-asm --prefix=${CMAKE_WIN_INSTALL_PREFIX} --openssldir=${CMAKE_WIN_INSTALL_PREFIX} + BUILD_COMMAND ms/do_ms.bat + INSTALL_COMMAND nmake -f ms/ntdll.mak install ) - else(UNIX) - ExternalProject_Add(OPENSSL - PREFIX OPENSSL - DEPENDS ${OPENSSL_DEPENDENCIES} - URL "https://github.com/openssl/openssl/archive/OpenSSL_1_0_1p.tar.gz" - URL_MD5 6bc1f9a9d9d474aceceb377e758e48ec - BINARY_DIR ${OPENSSL_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${OPENSSL_SB_SRC} ${OPENSSL_SB_BUILD_DIR} - CONFIGURE_COMMAND - ${SB_ENV_CONFIGURE_CMD} - ${CMAKE_COMMAND} -E chdir ${OPENSSL_SB_BUILD_DIR} ./config ${OPENSSL_BUILD_ARCH} - --prefix=${SB_INSTALL_PREFIX} shared zlib zlib-dynamic -I${SB_INSTALL_PREFIX}/include -L${SB_INSTALL_PREFIX}/lib - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install) +else(UNIX) + ExternalProject_Add(OPENSSL + PREFIX OPENSSL + DEPENDS ${OPENSSL_DEPENDENCIES} + URL "https://github.com/openssl/openssl/archive/OpenSSL_1_0_1p.tar.gz" + URL_MD5 6bc1f9a9d9d474aceceb377e758e48ec + BINARY_DIR ${OPENSSL_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${OPENSSL_SB_SRC} ${OPENSSL_SB_BUILD_DIR} + CONFIGURE_COMMAND + ${SB_ENV_CONFIGURE_CMD} + ${CMAKE_COMMAND} -E chdir ${OPENSSL_SB_BUILD_DIR} ./config ${OPENSSL_BUILD_ARCH} + --prefix=${SB_INSTALL_PREFIX} shared zlib zlib-dynamic -I${SB_INSTALL_PREFIX}/include -L${SB_INSTALL_PREFIX}/lib + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install) - ExternalProject_Add_Step(OPENSSL remove_static - COMMAND ${CMAKE_COMMAND} -E remove - ${SB_INSTALL_PREFIX}/lib/libssl.a - ${SB_INSTALL_PREFIX}/lib/libcrypto.a - ${SB_INSTALL_PREFIX}/bin/openssl - ${SB_INSTALL_PREFIX}/bin/c_rehash - DEPENDEES install) - - endif() - - set(_SB_OPENSSL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_OPENSSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libcurl.lib) - elseif(UNIX) - set(_SB_OPENSSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libssl${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() + ExternalProject_Add_Step(OPENSSL remove_static + COMMAND ${CMAKE_COMMAND} -E remove + ${SB_INSTALL_PREFIX}/lib/libssl.a + ${SB_INSTALL_PREFIX}/lib/libcrypto.a + ${SB_INSTALL_PREFIX}/bin/openssl + ${SB_INSTALL_PREFIX}/bin/c_rehash + DEPENDEES install) endif() + +set(_SB_OPENSSL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_OPENSSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libcurl.lib) +elseif(UNIX) + set(_SB_OPENSSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libssl${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_openthreads.cmake b/SuperBuild/CMake/External_openthreads.cmake index 3cc5c222c5c29f50be6f16e4ee99808ec9ee02e0..7a003c1ea773e23612466bb72c67684c7b37757f 100644 --- a/SuperBuild/CMake/External_openthreads.cmake +++ b/SuperBuild/CMake/External_openthreads.cmake @@ -1,63 +1,27 @@ -if(NOT __EXTERNAL_OPENTHREADS__) -set(__EXTERNAL_OPENTHREADS__ 1) +INCLUDE_ONCE_MACRO(OPENTHREADS) -if(MSVC) -set(USE_SYSTEM_OPENTHREADS OFF) -endif() - -if(USE_SYSTEM_OPENTHREADS) - message(STATUS " Using OpenThread system version") -else() - SETUP_SUPERBUILD(PROJECT OPENTHREADS) - message(STATUS " Using OpenThreads SuperBuild version") +SETUP_SUPERBUILD(OPENTHREADS) - #TODO: try to use cmake variable for DOWNLOAD_COMMAND for different platforms - #if(MSVC) - if(0) - ExternalProject_Add(OPENTHREADS - PREFIX OPENTHREADS - SVN_REPOSITORY "http://svn.openscenegraph.org/osg/OpenThreads/tags/OpenThreads-2.3.0/" - SVN_REVISION -r 14667 - SOURCE_DIR ${OPENTHREADS_SB_SRC} - BINARY_DIR ${OPENTHREADS_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/OPENTHREADS/CMakeLists.txt ${OPENTHREADS_SB_SRC} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) - #else(UNIX or APPLE) - else() - ExternalProject_Add(OPENTHREADS - PREFIX OPENTHREADS - URL "http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.4.0/source/OpenSceneGraph-3.4.0.zip" - URL_MD5 a5e762c64373a46932e444f6f7332496 - SOURCE_DIR ${OPENTHREADS_SB_SRC} - BINARY_DIR ${OPENTHREADS_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${OPENTHREADS_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/OPENTHREADS/CMakeLists.txt - ${OPENTHREADS_SB_SRC} - ) - endif() +ExternalProject_Add(OPENTHREADS + PREFIX OPENTHREADS + URL "http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.4.0/source/OpenSceneGraph-3.4.0.zip" + URL_MD5 a5e762c64373a46932e444f6f7332496 + SOURCE_DIR ${OPENTHREADS_SB_SRC} + BINARY_DIR ${OPENTHREADS_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + DEPENDS ${OPENTHREADS_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/OPENTHREADS/CMakeLists.txt + ${OPENTHREADS_SB_SRC} + ) - set(_SB_OPENTHREADS_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_OPENTHREADS_LIBRARY ${SB_INSTALL_PREFIX}/lib/OpenThreads.lib) - elseif(UNIX) - set(_SB_OPENTHREADS_LIBRARY ${SB_INSTALL_PREFIX}/lib/libOpenThreads${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() +set(_SB_OPENTHREADS_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_OPENTHREADS_LIBRARY ${SB_INSTALL_PREFIX}/lib/OpenThreads.lib) +elseif(UNIX) + set(_SB_OPENTHREADS_LIBRARY ${SB_INSTALL_PREFIX}/lib/libOpenThreads${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_ossim.cmake b/SuperBuild/CMake/External_ossim.cmake index 4cbcf9872db4a129bdbb8f0401e6fd12885f4095..8d6d6fa6ffc1eeec9a5191ed365bedcc0ce4bf52 100644 --- a/SuperBuild/CMake/External_ossim.cmake +++ b/SuperBuild/CMake/External_ossim.cmake @@ -1,88 +1,61 @@ -if(NOT __EXTERNAL_OSSIM__) -set(__EXTERNAL_OSSIM__ 1) - -# OSGeo4W provides an "ossim" package : use it otherwise if it is installed and not used by OTB -# we get conflicts (because OSGeo4W include dir is included for other dependencies -#if(WIN32) -# set(DEFAULT_USE_SYSTEM_OSSIM ON) -#endif() - -if(USE_SYSTEM_OSSIM) - message(STATUS " Using OSSIM system version") -else() - SETUP_SUPERBUILD(PROJECT OSSIM) - message(STATUS " Using OSSIM SuperBuild version") - - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OSSIM TIFF GEOTIFF GEOS JPEG OPENTHREADS FREETYPE) - - ADD_SUPERBUILD_CMAKE_VAR(OSSIM TIFF_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM TIFF_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOTIFF_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOTIFF_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOS_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOS_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM JPEG_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM JPEG_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_INCLUDE_DIRS) - ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_LIBRARY) - - set(OSSIM_CXX_FLAGS -D__STDC_CONSTANT_MACROS) - - if(MSVC) - set(OSSIM_CXX_FLAGS /EHsc) - list(APPEND OSSIM_SB_CONFIG "-GNMake\ Makefiles") - endif() - - # archive version - ExternalProject_Add(OSSIM - PREFIX OSSIM - URL "http://download.osgeo.org/ossim/source/ossim-1.8.20/ossim-1.8.20-3.tar.gz" - URL_MD5 eb2265db0d4d9201e255b92317121cfd - BINARY_DIR ${OSSIM_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DProject_WC_REVISION:STRING=23665 - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DCMAKE_CXX_FLAGS:STRING=${OSSIM_CXX_FLAGS} - -DBUILD_OSSIM_MPI_SUPPORT:BOOL=OFF - -DBUILD_OSSIM_FREETYPE_SUPPORT:BOOL=ON - -DBUILD_OSSIM_APPS:BOOL=OFF - -DBUILD_OSSIM_TESTS:BOOL=OFF - -DBUILD_OSSIM_TEST_APPS:BOOL=OFF - -DBUILD_OSSIM_FRAMEWORKS:BOOL=OFF - -DINSTALL_ARCHIVE_DIR:STRING=lib - -DINSTALL_LIBRARY_DIR:STRING=lib - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX} - ${OSSIM_SB_CONFIG} - DEPENDS ${OSSIM_DEPENDENCIES} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) - - ExternalProject_Add_Step(OSSIM patch_no_cmakelists - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/OSSIM/CMakeLists.txt - ${OSSIM_SB_SRC} - DEPENDEES patch - DEPENDERS configure ) - - - if(APPLE) - SUPERBUILD_PATCH_SOURCE(OSSIM "patch-for-at-rpath") - endif() - - - set(_SB_OSSIM_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_OSSIM_LIBRARY ${SB_INSTALL_PREFIX}/lib/ossim.lib) - elseif(UNIX) - set(_SB_OSSIM_LIBRARY ${SB_INSTALL_PREFIX}/lib/libossim${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - +INCLUDE_ONCE_MACRO(OSSIM) + +SETUP_SUPERBUILD(OSSIM) + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OSSIM TIFF GEOTIFF GEOS JPEG OPENTHREADS FREETYPE) + +ADD_SUPERBUILD_CMAKE_VAR(OSSIM TIFF_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM TIFF_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOTIFF_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOTIFF_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOS_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM GEOS_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM JPEG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM JPEG_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_INCLUDE_DIRS) +ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_LIBRARY) + +set(OSSIM_CXX_FLAGS -D__STDC_CONSTANT_MACROS) + +if(MSVC) + set(OSSIM_CXX_FLAGS /EHsc) endif() -endif() +# archive version +ExternalProject_Add(OSSIM + PREFIX OSSIM + URL "http://download.osgeo.org/ossim/source/ossim-1.8.20/ossim-1.8.20-3.tar.gz" + URL_MD5 eb2265db0d4d9201e255b92317121cfd + BINARY_DIR ${OSSIM_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DProject_WC_REVISION:STRING=23665 + -DCMAKE_CXX_FLAGS:STRING=${OSSIM_CXX_FLAGS} + -DBUILD_OSSIM_MPI_SUPPORT:BOOL=OFF + -DBUILD_OSSIM_FREETYPE_SUPPORT:BOOL=ON + -DBUILD_OSSIM_APPS:BOOL=OFF + -DBUILD_OSSIM_TESTS:BOOL=OFF + -DBUILD_OSSIM_TEST_APPS:BOOL=OFF + -DBUILD_OSSIM_FRAMEWORKS:BOOL=OFF + -DINSTALL_ARCHIVE_DIR:STRING=lib + -DINSTALL_LIBRARY_DIR:STRING=lib + ${OSSIM_SB_CONFIG} + DEPENDS ${OSSIM_DEPENDENCIES} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) + +ExternalProject_Add_Step(OSSIM patch_no_cmakelists + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/OSSIM/CMakeLists.txt + ${OSSIM_SB_SRC} + DEPENDEES patch + DEPENDERS configure ) + +SUPERBUILD_PATCH_SOURCE(OSSIM) + +SUPERBUILD_UPDATE_CMAKE_VARIABLES(OSSIM FALSE) diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake index 135ca6bc06f6891baa3b6d7c0d4b350531851673..4b20ee0c1242236a6ca7a5103f45786798a26356 100644 --- a/SuperBuild/CMake/External_otb.cmake +++ b/SuperBuild/CMake/External_otb.cmake @@ -1,16 +1,8 @@ -if(NOT __EXTERNAL_OTB__) -set(__EXTERNAL_OTB__ 1) +INCLUDE_ONCE_MACRO(OTB) -SETUP_SUPERBUILD(PROJECT OTB) -message(STATUS " Using OTB SuperBuild version") +SETUP_SUPERBUILD(OTB) -if(SUPERBUILD_IN_OTB_TREE) - set(OTB_SB_SRC ${CMAKE_SOURCE_DIR}/..) -endif() - -set(OTB_ADDITIONAL_CACHE) - -#set(BUILD_EXAMPLES ON) +set(OTB_SB_SRC ${CMAKE_SOURCE_DIR}/..) if(ENABLE_OTB_LARGE_INPUTS) set(OTB_SB_LARGEINPUT_CONFIG @@ -23,52 +15,76 @@ else() ) endif() - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GDAL OSSIM ITK TINYXML BOOST) ##get_property(OTB_DEPENDENCIES GLOBAL PROPERTY GLOBAL_OTB_DEPENDENCIES) if(OTB_USE_CURL) ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB CURL) + ADD_SUPERBUILD_CMAKE_VAR(OTB CURL_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB CURL_LIBRARY) endif() + if(OTB_USE_LIBKML) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB LIBKML) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB LIBKML) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_BASE_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_CONVENIENCE_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_DOM_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_ENGINE_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_REGIONATOR_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_XSD_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_MINIZIP_LIBRARY) endif() if(OTB_USE_OPENCV) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB OPENCV) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB OPENCV) + ADD_SUPERBUILD_CMAKE_VAR(OTB OpenCV_DIR) endif() if(OTB_USE_LIBSVM) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB LIBSVM) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB LIBSVM) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBSVM_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB LIBSVM_LIBRARY) endif() if(OTB_USE_MUPARSER) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB MUPARSER) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB MUPARSER) + ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSER_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSER_LIBRARY) endif() if(OTB_USE_MUPARSERX) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB MUPARSERX) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB MUPARSERX) + ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSERX_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSERX_LIBRARY) endif() if(OTB_WRAP_PYTHON OR OTB_WRAP_JAVA) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB SWIG) + ADD_SUPERBUILD_CMAKE_VAR(OTB SWIG_EXECUTABLE) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB SWIG) endif() if(OTB_USE_QT4) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB QT4) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB QT4) endif() if(OTB_USE_GLEW) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLEW) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLEW) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLEW_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLEW_LIBRARY) endif() if(OTB_USE_GLFW) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLFW) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLFW) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLFW_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLFW_LIBRARY) endif() if(OTB_USE_GLUT) -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLUT) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GLUT) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLUT_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(OTB GLUT_LIBRARY) endif() ADD_SUPERBUILD_CMAKE_VAR(OTB GDAL_INCLUDE_DIR) @@ -79,129 +95,75 @@ ADD_SUPERBUILD_CMAKE_VAR(OTB OSSIM_LIBRARY) ADD_SUPERBUILD_CMAKE_VAR(OTB ITK_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSER_INCLUDE_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSER_LIBRARY) - -ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSERX_INCLUDE_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB MUPARSERX_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(OTB TINYXML_INCLUDE_DIR) ADD_SUPERBUILD_CMAKE_VAR(OTB TINYXML_LIBRARY) ADD_SUPERBUILD_CMAKE_VAR(OTB Boost_INCLUDE_DIR) ADD_SUPERBUILD_CMAKE_VAR(OTB Boost_LIBRARY_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_INCLUDE_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_BASE_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_CONVENIENCE_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_DOM_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_ENGINE_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_REGIONATOR_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_XSD_LIBRARY) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBKML_MINIZIP_LIBRARY) - -ADD_SUPERBUILD_CMAKE_VAR(OTB OpenCV_DIR) - -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBSVM_INCLUDE_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB LIBSVM_LIBRARY) - -if(OTB_USE_CURL) -ADD_SUPERBUILD_CMAKE_VAR(OTB CURL_INCLUDE_DIR) -ADD_SUPERBUILD_CMAKE_VAR(OTB CURL_LIBRARY) -endif() - if(MSVC) ADD_SUPERBUILD_CMAKE_VAR(OTB JPEG_LIBRARY) endif() -ADD_SUPERBUILD_CMAKE_VAR(OTB SWIG_EXECUTABLE) - -if(OTB_USE_GLEW) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLEW_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLEW_LIBRARY) -endif() -if(OTB_USE_GLFW) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLFW_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLFW_LIBRARY) -endif() -if(OTB_USE_GLUT) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLUT_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(OTB GLUT_LIBRARY) -endif() - -if(SUPERBUILD_IN_OTB_TREE) - set(OTB_HG_SOURCES DOWNLOAD_COMMAND "") -else() - set(OTB_HG_SOURCES - HG_REPOSITORY "http://hg.orfeo-toolbox.org/OTB" - HG_TAG tip - ) -endif() - # forward compilation flags set(OTB_SB_C_FLAGS "${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_C_FLAGS}") set(OTB_SB_CXX_FLAGS "${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_CXX_FLAGS}") + set(OTB_SB_COMPILATION_FLAGS - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_C_FLAGS:STRING=${OTB_SB_C_FLAGS} - -DCMAKE_CXX_FLAGS:STRING=${OTB_SB_CXX_FLAGS} - -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} - -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} - -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} - -DCMAKE_STATIC_LINKER_FLAGS:STRING=${CMAKE_STATIC_LINKER_FLAGS} - ) + -DCMAKE_C_FLAGS:STRING=${OTB_SB_C_FLAGS} + -DCMAKE_CXX_FLAGS:STRING=${OTB_SB_CXX_FLAGS} + -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} + -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} + -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} + -DCMAKE_STATIC_LINKER_FLAGS:STRING=${CMAKE_STATIC_LINKER_FLAGS} + ) ExternalProject_Add(OTB - DEPENDS ${OTB_DEPENDENCIES} - PREFIX OTB - ${OTB_HG_SOURCES} - SOURCE_DIR ${OTB_SB_SRC} - BINARY_DIR ${OTB_SB_BUILD_DIR} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX} - ${OTB_SB_COMPILATION_FLAGS} - -DBUILD_SHARED_LIBS:BOOL=${SB_BUILD_SHARED_LIBS} - -DBUILD_TESTING:BOOL=${BUILD_TESTING} - -DBUILD_EXAMPLES:BOOL=${BUILD_EXAMPLES} - -DCMAKE_PREFIX_PATH:STRING=${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - -DOTB_DATA_ROOT:STRING=${OTB_DATA_ROOT} - -DOTB_USE_6S:BOOL=${OTB_USE_6S} - -DOTB_USE_CURL:BOOL=${OTB_USE_CURL} - -DOTB_USE_LIBKML:BOOL=${OTB_USE_LIBKML} - -DOTB_USE_LIBSVM:BOOL=${OTB_USE_LIBSVM} - -DOTB_USE_MAPNIK:BOOL=${OTB_USE_MAPNIK} - -DOTB_USE_MUPARSER:BOOL=${OTB_USE_MUPARSER} - -DOTB_USE_MUPARSERX:BOOL=${OTB_USE_MUPARSERX} - -DOTB_USE_OPENCV:BOOL=${OTB_USE_OPENCV} - -DOTB_USE_OPENJPEG:BOOL=${OTB_USE_OPENJPEG} - -DOTB_USE_QT4:BOOL=${OTB_USE_QT4} - -DOTB_USE_SIFTFAST:BOOL=${OTB_USE_SIFTFAST} - -DOTB_USE_OPENGL:BOOL=${OTB_USE_OPENGL} - -DOTB_USE_GLEW:BOOL=${OTB_USE_GLEW} - -DOTB_USE_GLFW:BOOL=${OTB_USE_GLFW} - -DOTB_USE_GLUT:BOOL=${OTB_USE_GLUT} - ${OTB_SB_CONFIG} - ${OTB_SB_LARGEINPUT_CONFIG} - -DOTB_WRAP_PYTHON:BOOL=${OTB_WRAP_PYTHON} - -DOTB_WRAP_JAVA:BOOL=${OTB_WRAP_JAVA} - ${OTB_ADDITIONAL_CACHE} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) + DEPENDS ${OTB_DEPENDENCIES} + PREFIX OTB + DOWNLOAD_COMMAND "" + SOURCE_DIR ${OTB_SB_SRC} + BINARY_DIR ${OTB_SB_BUILD_DIR} + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + ${OTB_SB_COMPILATION_FLAGS} + -DBUILD_TESTING:BOOL=${BUILD_TESTING} + -DBUILD_EXAMPLES:BOOL=${BUILD_EXAMPLES} + -DOTB_DATA_ROOT:STRING=${OTB_DATA_ROOT} + -DOTB_USE_6S:BOOL=${OTB_USE_6S} + -DOTB_USE_CURL:BOOL=${OTB_USE_CURL} + -DOTB_USE_LIBKML:BOOL=${OTB_USE_LIBKML} + -DOTB_USE_LIBSVM:BOOL=${OTB_USE_LIBSVM} + -DOTB_USE_MAPNIK:BOOL=${OTB_USE_MAPNIK} + -DOTB_USE_MUPARSER:BOOL=${OTB_USE_MUPARSER} + -DOTB_USE_MUPARSERX:BOOL=${OTB_USE_MUPARSERX} + -DOTB_USE_OPENCV:BOOL=${OTB_USE_OPENCV} + -DOTB_USE_OPENJPEG:BOOL=OFF + -DOTB_USE_QT4:BOOL=${OTB_USE_QT4} + -DOTB_USE_SIFTFAST:BOOL=${OTB_USE_SIFTFAST} + -DOTB_USE_OPENGL:BOOL=${OTB_USE_OPENGL} + -DOTB_USE_GLEW:BOOL=${OTB_USE_GLEW} + -DOTB_USE_GLFW:BOOL=${OTB_USE_GLFW} + -DOTB_USE_GLUT:BOOL=${OTB_USE_GLUT} + ${OTB_SB_CONFIG} + ${OTB_SB_LARGEINPUT_CONFIG} + -DOTB_WRAP_PYTHON:BOOL=${OTB_WRAP_PYTHON} + -DOTB_WRAP_JAVA:BOOL=${OTB_WRAP_JAVA} + ${OTB_ADDITIONAL_CACHE} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) ExternalProject_Add_Step(OTB install_copyright COMMAND ${CMAKE_COMMAND} -E copy_directory ${OTB_SB_SRC}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright DEPENDEES install) - # detect OTB version number - if (SUPERBUILD_OTB_VERSION) - set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR}) - else() - set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}) - endif() - - +# detect OTB version number +if (SUPERBUILD_OTB_VERSION) + set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR}) +else() + set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}) endif() diff --git a/SuperBuild/CMake/External_pcre.cmake b/SuperBuild/CMake/External_pcre.cmake index 7344b7bda83131b079f63614b069c564e22bec02..ea5ff0b6e15ce5cc93ad0ac6a563e39f8bd0cffa 100644 --- a/SuperBuild/CMake/External_pcre.cmake +++ b/SuperBuild/CMake/External_pcre.cmake @@ -1,38 +1,28 @@ -if(NOT __EXTERNAL_PCRE__) -set(__EXTERNAL_PCRE__ 1) - -if(USE_SYSTEM_PCRE) - message(STATUS " Using pcre system version") +INCLUDE_ONCE_MACRO(PCRE) +SETUP_SUPERBUILD(PCRE) +if(MSVC) + # TODO ? else() - SETUP_SUPERBUILD(PROJECT PCRE) - message(STATUS " Using pcre SuperBuild version") - - if(MSVC) - # TODO ? - else() - ExternalProject_Add(PCRE - PREFIX PCRE - URL "http://sourceforge.net/projects/pcre/files/pcre/8.36/pcre-8.36.tar.gz/download" - URL_MD5 ff7b4bb14e355f04885cf18ff4125c98 - BINARY_DIR ${PCRE_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND - ${PCRE_SB_BUILD_DIR}/configure - --prefix=${SB_INSTALL_PREFIX} - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install - DEPENDS ${PCRE_DEPENDENCIES} - ) + ExternalProject_Add(PCRE + PREFIX PCRE + URL "http://sourceforge.net/projects/pcre/files/pcre/8.36/pcre-8.36.tar.gz/download" + URL_MD5 ff7b4bb14e355f04885cf18ff4125c98 + BINARY_DIR ${PCRE_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND + ${PCRE_SB_BUILD_DIR}/configure + --prefix=${SB_INSTALL_PREFIX} + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install + DEPENDS ${PCRE_DEPENDENCIES} + ) - ExternalProject_Add_Step(PCRE copy_source - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${PCRE_SB_SRC} ${PCRE_SB_BUILD_DIR} - DEPENDEES patch update - DEPENDERS configure - ) + ExternalProject_Add_Step(PCRE copy_source + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${PCRE_SB_SRC} ${PCRE_SB_BUILD_DIR} + DEPENDEES patch update + DEPENDERS configure + ) - endif() - -endif() endif() diff --git a/SuperBuild/CMake/External_png.cmake b/SuperBuild/CMake/External_png.cmake index 799beede38294327675aa100f474478c46161e41..b9ad8a6293f39b58b3a7974d03b6021d60d9faf9 100644 --- a/SuperBuild/CMake/External_png.cmake +++ b/SuperBuild/CMake/External_png.cmake @@ -1,57 +1,45 @@ -if(NOT __EXTERNAL_PNG__) -set(__EXTERNAL_PNG__ 1) +INCLUDE_ONCE_MACRO(PNG) -if(USE_SYSTEM_PNG) - message(STATUS " Using libpng system version") -else() - SETUP_SUPERBUILD(PROJECT PNG) - message(STATUS " Using libpng SuperBuild version") +SETUP_SUPERBUILD(PNG) - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(PNG ZLIB) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(PNG ZLIB) - ADD_SUPERBUILD_CMAKE_VAR(PNG ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(PNG ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(PNG ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(PNG ZLIB_LIBRARY) - ExternalProject_Add(PNG - PREFIX PNG - URL "http://sourceforge.net/projects/libpng/files/libpng16/older-releases/1.6.16/lpng1616.zip/download" - URL_MD5 c90c9587c9a5c735327fb3f6900f6b03 - BINARY_DIR ${PNG_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${PNG_DEPENDENCIES} - CMAKE_CACHE_ARGS - -DCMAKE_BUILD_TYPE:STRING=Release - -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_PREFIX} - -DSKIP_INSTALL_EXECUTABLES:BOOL=OFF - -DPNG_STATIC:BOOL=OFF - -DPNG_SHARED:BOOL=ON - -DPNG_TESTS:BOOL=OFF - -DCMAKE_PREFIX_PATH:STRING=${SB_INSTALL_PREFIX};${CMAKE_PREFIX_PATH} - ${PNG_SB_CONFIG} - CMAKE_COMMAND ${SB_CMAKE_COMMAND} +ExternalProject_Add(PNG + PREFIX PNG + URL "http://sourceforge.net/projects/libpng/files/libpng16/older-releases/1.6.16/lpng1616.zip/download" + URL_MD5 c90c9587c9a5c735327fb3f6900f6b03 + BINARY_DIR ${PNG_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${PNG_DEPENDENCIES} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DSKIP_INSTALL_EXECUTABLES:BOOL=OFF + -DPNG_STATIC:BOOL=OFF + -DPNG_SHARED:BOOL=ON + -DPNG_TESTS:BOOL=OFF + ${PNG_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) +#having -DPNGLIB_NAME:STRING=libpng in CMAKE_CACHE_ARGS doesnt work +#libpng library built in the name libpng16.lib and other libs (Qt4) +#reports libpng.lib is not found As Qt is strict on the name of libpng +#below we copy the libpng16.lib to libpng.lib. +#modifying CMakeLists.txt in libpng is another way but then whole +#CMakeLists.txt must be kept in superbuild repository. +if(MSVC) + ExternalProject_Add_Step(PNG duplicate_pnglib + COMMAND ${CMAKE_COMMAND} -E copy + ${SB_INSTALL_PREFIX}/lib/libpng16.lib ${SB_INSTALL_PREFIX}/lib/libpng.lib + DEPENDEES install ) - #having -DPNGLIB_NAME:STRING=libpng in CMAKE_CACHE_ARGS doesnt work - #libpng library built in the name libpng16.lib and other libs (Qt4) - #reports libpng.lib is not found As Qt is strict on the name of libpng - #below we copy the libpng16.lib to libpng.lib. - #modifying CMakeLists.txt in libpng is another way but then whole - #CMakeLists.txt must be kept in superbuild repository. - if(MSVC) - ExternalProject_Add_Step(PNG duplicate_pnglib - COMMAND ${CMAKE_COMMAND} -E copy - ${SB_INSTALL_PREFIX}/lib/libpng16.lib ${SB_INSTALL_PREFIX}/lib/libpng.lib - DEPENDEES install - ) - endif() +endif() - set(_SB_PNG_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_PNG_LIBRARY ${SB_INSTALL_PREFIX}/lib/libpng.lib) - elseif(UNIX) - set(_SB_PNG_LIBRARY ${SB_INSTALL_PREFIX}/lib/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() -endif() -endif() +set(_SB_PNG_PNG_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) + +SUPERBUILD_UPDATE_CMAKE_VARIABLES(PNG TRUE) diff --git a/SuperBuild/CMake/External_proj.cmake b/SuperBuild/CMake/External_proj.cmake index bc6ee0b2842280702eab41902f54a35b0239dc86..ff30d40bb0db554c8f508c205690124d75f07640 100644 --- a/SuperBuild/CMake/External_proj.cmake +++ b/SuperBuild/CMake/External_proj.cmake @@ -1,73 +1,46 @@ -if(NOT __EXTERNAL_PROJ__) -set(__EXTERNAL_PROJ__ 1) +INCLUDE_ONCE_MACRO(PROJ) + +SETUP_SUPERBUILD(PROJ) + +if(MSVC) + ExternalProject_Add(PROJ + PREFIX PROJ + URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz" + URL_MD5 d815838c92a29179298c126effbb1537 + SOURCE_DIR ${PROJ_SB_SRC} + BINARY_DIR ${PROJ_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND "" + BUILD_COMMAND nmake /f ${PROJ_SB_SRC}/makefile.vc + INSTALL_COMMAND nmake /f ${PROJ_SB_SRC}/makefile.vc install-all INSTDIR=${SB_INSTALL_PREFIX_NATIVE} + ) -if(USE_SYSTEM_PROJ) - message(STATUS " Using Proj4 system version") else() - SETUP_SUPERBUILD(PROJECT PROJ) - message(STATUS " Using Proj4 SuperBuild version") - - if(MSVC) - - ExternalProject_Add(PROJ_build - PREFIX PROJ - URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz" - URL_MD5 d815838c92a29179298c126effbb1537 - SOURCE_DIR ${PROJ_SB_SRC} - BINARY_DIR ${PROJ_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND "" - BUILD_COMMAND nmake /f ${PROJ_SB_SRC}/makefile.vc - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/PROJ/CMakeLists.txt - ${CMAKE_BINARY_DIR}/PROJ/_install - ) - ExternalProject_Add(PROJ - PREFIX PROJ/_install - DOWNLOAD_COMMAND "" - SOURCE_DIR PROJ/_install - BINARY_DIR ${PROJ_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DPROJ4_BUILD_DIR:STRING=${PROJ_SB_SRC}/src - DEPENDS PROJ_build - CMAKE_COMMAND + ExternalProject_Add(PROJ + PREFIX PROJ + URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz" + URL_MD5 d815838c92a29179298c126effbb1537 + BINARY_DIR ${PROJ_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND + ${SB_ENV_CONFIGURE_CMD} + ${PROJ_SB_SRC}/configure + --prefix=${SB_INSTALL_PREFIX} + --enable-static=no + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install ) - else() - ExternalProject_Add(PROJ - PREFIX PROJ - URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz" - URL_MD5 d815838c92a29179298c126effbb1537 - BINARY_DIR ${PROJ_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND - # use 'env' because CTest launcher doesn't perform shell interpretation - ${SB_ENV_CONFIGURE_CMD} - ${PROJ_SB_SRC}/configure - --prefix=${SB_INSTALL_PREFIX} - --enable-static=no - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install - ) - - if(APPLE) - SUPERBUILD_PATCH_SOURCE(PROJ "patch-for-at-rpath") - endif() - - endif() +endif() - set(_SB_PROJ_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_PROJ_LIBRARY ${SB_INSTALL_PREFIX}/lib/proj_i.lib) - elseif(UNIX) - set(_SB_PROJ_LIBRARY ${SB_INSTALL_PREFIX}/lib/libproj${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +SUPERBUILD_PATCH_SOURCE(PROJ) -endif() +set(_SB_PROJ_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_PROJ_LIBRARY ${SB_INSTALL_PREFIX}/lib/proj_i.lib) +elseif(UNIX) + set(_SB_PROJ_LIBRARY ${SB_INSTALL_PREFIX}/lib/libproj${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_qt4.cmake b/SuperBuild/CMake/External_qt4.cmake index ececb6e6e32471e8d6e090be3a432d7b72edd8a8..b82913703509e772621f96cd89cf244d748986f8 100644 --- a/SuperBuild/CMake/External_qt4.cmake +++ b/SuperBuild/CMake/External_qt4.cmake @@ -1,98 +1,126 @@ -if(NOT __EXTERNAL_QT4__) - set(__EXTERNAL_QT4__ 1) - - if(USE_SYSTEM_QT4) - message(STATUS " Using Qt4 system version") - else() - SETUP_SUPERBUILD(PROJECT QT4) - message(STATUS " Using Qt4 SuperBuild version") - if(UNIX AND NOT APPLE) - message(STATUS " SuperBuild may fail to compile Qt4. If so, you should install it via package manager.") - endif() +INCLUDE_ONCE_MACRO(QT4) - if(NOT DEFINED git_protocol) - set(git_protocol "git") - endif() +SETUP_SUPERBUILD(QT4) - #NOTE: make sure your superbuild install directory does not contain any - #Qt files from previous install of superbuild QT. - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QT4 ZLIB SQLITE FREETYPE) +#RK: are we ready for QT4 build on linux?. +#This comment here scares me away. +#Installing QT4 from packages also need sqlite otherwise there is issue - #use system libs always for Qt4 as we build them from source or have already in system - set(QT4_SB_CONFIG) - #RK: building faling on mac. png include is in a macframework - if(USE_SYSTEM_PNG) - set(QT4_SB_CONFIG "-I ${PNG_PNG_INCLUDE_DIR}") - endif() +# if(UNIX AND NOT APPLE) +# message(STATUS " SuperBuild may fail to compile Qt4. If so, you should install it via package manager.") +# endif() - if(UNIX) - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-openssl") - if(APPLE) - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework") - else() #Linux - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-sm -no-xrender -no-fontconfig -no-gtkstyle -no-glib") - endif() - endif() - STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) - STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) - - if(MSVC) - configure_file( - ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.bat.in - ${CMAKE_BINARY_DIR}/configure_qt4.bat - @ONLY) - - ExternalProject_Add(QT4 - PREFIX QT4 - URL "http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz" - URL_MD5 d990ee66bf7ab0c785589776f35ba6ad - BINARY_DIR ${QT4_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/configure_qt4.bat - ${QT4_SB_SRC} - CONFIGURE_COMMAND - configure_qt4.bat - DEPENDS ${QT4_DEPENDENCIES} ) - - ExternalProject_Add_Step(QT4 _jpeg_lib_name - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/QT4/qjpeghandler.pri - ${QT4_SB_SRC}/src/gui/image/ - DEPENDEES patch update - DEPENDERS configure ) - else() - configure_file( - ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.sh.in - ${CMAKE_BINARY_DIR}/configure_qt4.sh - @ONLY) - - ExternalProject_Add(QT4 - PREFIX QT4 - URL "http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz" - URL_MD5 d990ee66bf7ab0c785589776f35ba6ad - BINARY_DIR ${QT4_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND - ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/configure_qt4.sh - ${QT4_SB_SRC} - CONFIGURE_COMMAND - ${CMAKE_BINARY_DIR}/configure_qt4.sh - DEPENDS ${QT4_DEPENDENCIES} - ) +option(QT4_SB_ENABLE_GTK "Enable GTK+ stlye with qt using -gtkstlye. Default is OFF" OFF) - endif() +if(NOT DEFINED git_protocol) + set(git_protocol "git") +endif() - if(APPLE) - SUPERBUILD_PATCH_SOURCE(QT4 "patch-for-at-rpath") - endif() +#NOTE: make sure your superbuild install directory does not contain any +#Qt files from previous install of superbuild QT. +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QT4 ZLIB PNG JPEG SQLITE FREETYPE) - set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake) +#use system libs always for Qt4 as we build them from source or have already in system +set(QT4_SB_CONFIG) +#RK: building faling on mac. png include is in a macframework +if(USE_SYSTEM_PNG) + set(QT4_SB_CONFIG "-I ${PNG_PNG_INCLUDE_DIR}") +endif() +if(UNIX) + if(APPLE) + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework") + else() #Linux + if(QT4_SB_ENABLE_GTK) + message(STATUS "QT4_SB_ENABLE_GTK is activated. QT4 build includes gtk+ and libfreetype, libpng (dependencies of gtk+ package)") + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -sm -xrender -xrandr -gtkstyle") + else() + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-gtkstyle") + endif() endif() + #common for all unix + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-nis -no-javascript-jit -v") +elseif(MSVC) + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -mp") +endif() + +if(SB_INSTALL_PREFIX) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX} QT4_INSTALL_PREFIX_NATIVE) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include QT4_INCLUDE_PREFIX_NATIVE) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/lib QT4_LIB_PREFIX_NATIVE) endif() + +if(WIN32) + set(QT4_BIN_EXT ".exe") + file(TO_NATIVE_PATH ${QT4_SB_SRC}/configure.exe QT4_CONFIGURE_SCRIPT) + set(QT4_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt4.bat) + set(QT4_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.bat.in) +else() + set(QT4_BIN_EXT "") + file(TO_NATIVE_PATH ${QT4_SB_SRC}/configure QT4_CONFIGURE_SCRIPT) + set(QT4_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt4.sh) + set(QT4_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.sh.in) +endif() + +configure_file(${QT4_CONFIGURE_COMMAND_IN} ${QT4_CONFIGURE_COMMAND} @ONLY ) + +#Remove left over or previous installation from install prefix. +#Existing files in install prefix was disturbing a second installation. +#even afer the QT4 directory is removed from build + +add_custom_target(QT4-uninstall + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtCore" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtDBus" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtGui" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtNetwork" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtOpenGL" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtSql" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtSvg" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtTest" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtXml" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/mkspecs" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/plugins" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/translations" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/lib/libQt*" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/qmake${QT4_BIN_EXT}" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/lrelease${QT4_BIN_EXT}" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/moc${QT4_BIN_EXT}" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/rcc${QT4_BIN_EXT}" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/uic${QT4_BIN_EXT}" + COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/libQt*" + WORKING_DIRECTORY "${SB_INSTALL_PREFIX}" + ) + +#adding it to dependencies will remove the files when configure QWT +#list(APPEND QT4_DEPENDENCIES QT4-uninstall) + + ExternalProject_Add(QT4 + PREFIX QT4 + URL "http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz" + URL_MD5 d990ee66bf7ab0c785589776f35ba6ad + BINARY_DIR ${QT4_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND ${QT4_CONFIGURE_COMMAND} + DEPENDS ${QT4_DEPENDENCIES} + ) + + + if(MSVC) + #Q: why this copy here?. + #RK: Because QT4 sucks with qmake -query. + ExternalProject_Add_Step(QT4 patches + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${QT4_SB_SRC}/mkspecs ${SB_INSTALL_PREFIX}/mkspecs + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/QT4/qjpeghandler.pri + ${QT4_SB_SRC}/src/gui/image/ + DEPENDEES patch update + DEPENDERS configure ) +endif() + +SUPERBUILD_PATCH_SOURCE(QT4) + +set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake) diff --git a/SuperBuild/CMake/External_qwt.cmake b/SuperBuild/CMake/External_qwt.cmake index bf12e0dbb6d4c2073bfc3bbed71b5b804903038a..c4acbe4861526abc903795e63bc4e82c84b9f991 100644 --- a/SuperBuild/CMake/External_qwt.cmake +++ b/SuperBuild/CMake/External_qwt.cmake @@ -1,55 +1,47 @@ -if(NOT __EXTERNAL_QWT__) -set(__EXTERNAL_QWT__ 1) - -if(USE_SYSTEM_QWT) - message(STATUS " Using QWT system version") -else() - SETUP_SUPERBUILD(PROJECT QWT) - message(STATUS " Using Qwt SuperBuild version") - - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QWT QT4) - - set(QWT_SB_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) - if(MSVC) - set(QWT_SB_MAKE_PROGRAM "nmake") - endif() - - configure_file(${CMAKE_SOURCE_DIR}/patches/QWT/qwtconfig.pri - ${CMAKE_BINARY_DIR}/qwtconfig.pri - @ONLY) - - if(_SB_QT_QMAKE_EXECUTABLE) - set(QWT_SB_CONFIGURE_PROGRAM ${_SB_QT_QMAKE_EXECUTABLE}) - elseif(QT_QMAKE_EXECUTABLE) - set(QWT_SB_CONFIGURE_PROGRAM ${QT_QMAKE_EXECUTABLE}) - else() - set(QT_QMAKE_EXECUTABLE "" CACHE FILEPATH "Path to qmake executable") - message(FATAL_ERROR "Please set the qmake executable to use (QT_QMAKE_EXECUTABLE)") - endif() - - ExternalProject_Add(QWT - PREFIX QWT - URL "http://sourceforge.net/projects/qwt/files/qwt/5.2.3/qwt-5.2.3.zip/download" - URL_MD5 310a1c8ab831f4b2219505dcb7691cf1 - SOURCE_DIR ${QWT_SB_SRC} - BINARY_DIR ${QWT_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${QWT_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${QWT_SB_SRC} ${QWT_SB_BUILD_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/qwtconfig.pri ${QWT_SB_BUILD_DIR} - CONFIGURE_COMMAND ${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_BUILD_DIR}/qwt.pro - BUILD_COMMAND ${QWT_SB_MAKE_PROGRAM} - INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install - ) - - set(_SB_QWT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt.lib) - elseif(UNIX) - set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() -endif() +INCLUDE_ONCE_MACRO(QWT) + +SETUP_SUPERBUILD(QWT) + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QWT QT4) + +set(QWT_SB_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) +if(MSVC) + set(QWT_SB_MAKE_PROGRAM "nmake") +endif() + +configure_file(${CMAKE_SOURCE_DIR}/patches/QWT/qwtconfig.pri + ${CMAKE_BINARY_DIR}/qwtconfig.pri + @ONLY) + +if(_SB_QT_QMAKE_EXECUTABLE) + set(QWT_SB_CONFIGURE_PROGRAM ${_SB_QT_QMAKE_EXECUTABLE}) +elseif(QT_QMAKE_EXECUTABLE) + set(QWT_SB_CONFIGURE_PROGRAM ${QT_QMAKE_EXECUTABLE}) +else() + set(QT_QMAKE_EXECUTABLE "" CACHE FILEPATH "Path to qmake executable") + message(FATAL_ERROR "Please set the qmake executable to use (QT_QMAKE_EXECUTABLE)") +endif() + +ExternalProject_Add(QWT + PREFIX QWT + URL "http://sourceforge.net/projects/qwt/files/qwt/5.2.3/qwt-5.2.3.zip/download" + URL_MD5 310a1c8ab831f4b2219505dcb7691cf1 + SOURCE_DIR ${QWT_SB_SRC} + BINARY_DIR ${QWT_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${QWT_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${QWT_SB_SRC} ${QWT_SB_BUILD_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/qwtconfig.pri ${QWT_SB_BUILD_DIR} + CONFIGURE_COMMAND ${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_BUILD_DIR}/qwt.pro + BUILD_COMMAND ${QWT_SB_MAKE_PROGRAM} + INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install + ) + +set(_SB_QWT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/qwt5.lib) +elseif(UNIX) + set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() \ No newline at end of file diff --git a/SuperBuild/CMake/External_sqlite.cmake b/SuperBuild/CMake/External_sqlite.cmake index abe2179c71a8889b7544355cd93084d2abc5e644..9e2db6d6d544ae9fb1dc4563f8b59b8ce1cca5ae 100644 --- a/SuperBuild/CMake/External_sqlite.cmake +++ b/SuperBuild/CMake/External_sqlite.cmake @@ -1,34 +1,23 @@ -if(NOT __EXTERNAL_SQLITE__) -set(__EXTERNAL_SQLITE__ 1) +INCLUDE_ONCE_MACRO(SQLITE) -if(USE_SYSTEM_SQLITE) - message(STATUS " Using SQLite system version") -else() - SETUP_SUPERBUILD(PROJECT SQLITE) - message(STATUS " Using SQLite SuperBuild version") +SETUP_SUPERBUILD(SQLITE) - ExternalProject_Add(SQLITE - PREFIX SQLITE - URL "http://www.sqlite.org/2015/sqlite-amalgamation-3080801.zip" - URL_MD5 b1cbcbd710bdfd762dc169f1676053b5 - SOURCE_DIR ${SQLITE_SB_SRC} - BINARY_DIR ${SQLITE_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/SQLITE ${SQLITE_SB_SRC} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - ) +ExternalProject_Add(SQLITE + PREFIX SQLITE + URL "http://www.sqlite.org/2015/sqlite-amalgamation-3080801.zip" + URL_MD5 b1cbcbd710bdfd762dc169f1676053b5 + SOURCE_DIR ${SQLITE_SB_SRC} + BINARY_DIR ${SQLITE_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/SQLITE ${SQLITE_SB_SRC} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_SQLITE_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_SQLITE_LIBRARY ${SB_INSTALL_PREFIX}/lib/sqlite3.lib) - elseif(UNIX) - set(_SB_SQLITE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libsqlite3${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() +set(_SB_SQLITE_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_SQLITE_LIBRARY ${SB_INSTALL_PREFIX}/lib/sqlite3.lib) +elseif(UNIX) + set(_SB_SQLITE_LIBRARY ${SB_INSTALL_PREFIX}/lib/libsqlite3${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_swig.cmake b/SuperBuild/CMake/External_swig.cmake index a40a5a53f020215881a2cfcd9fc48beabef64e64..95412f969ee466f0da932c761cad5f3e17dff7c2 100644 --- a/SuperBuild/CMake/External_swig.cmake +++ b/SuperBuild/CMake/External_swig.cmake @@ -1,82 +1,74 @@ -if(NOT __EXTERNAL_SWIG__) -set(__EXTERNAL_SWIG__ 1) +INCLUDE_ONCE_MACRO(SWIG) -if(USE_SYSTEM_SWIG) - message(STATUS " Using swig system version") -else() - SETUP_SUPERBUILD(PROJECT SWIG) - message(STATUS " Using swig SuperBuild version") - - set(PythonInterp_FIND_VERSION 2.7) - find_package(PythonInterp) - if(PYTHONINTERP_FOUND) - set(SWIG_SB_PYTHON_CONFIG "--with-python=${PYTHON_EXECUTABLE}") - else() - set(SWIG_SB_PYTHON_CONFIG) - message(WARNING " No suitable python interpreter was found !") - endif() - - find_package(Java) - if(JAVA_FOUND) - set(SWIG_SB_JAVA_CONFIG "--with-java=${Java_JAVA_EXECUTABLE}") - else() - set(SWIG_SB_JAVA_CONFIG) - message(WARNING " No Java executable was found !") - endif() +SETUP_SUPERBUILD(SWIG) - if(MSVC) - # Use pre-built swig executable (no linking is required, no install done) - ExternalProject_Add(SWIG - PREFIX SWIG - URL "http://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.7/swigwin-3.0.7.zip/download" - URL_MD5 d8b5a9ce49c819cc1bfc1e797b85ba7a - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - DEPENDS ${SWIG_DEPENDENCIES} - ) +set(PythonInterp_FIND_VERSION 2.7) +find_package(PythonInterp) +if(PYTHONINTERP_FOUND) + set(SWIG_SB_PYTHON_CONFIG "--with-python=${PYTHON_EXECUTABLE}") +else() + set(SWIG_SB_PYTHON_CONFIG) + message(WARNING " No suitable python interpreter was found !") +endif() - else() - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(SWIG PCRE BOOST) +find_package(Java) +if(JAVA_FOUND) + set(SWIG_SB_JAVA_CONFIG "--with-java=${Java_JAVA_EXECUTABLE}") +else() + set(SWIG_SB_JAVA_CONFIG) + message(WARNING " No Java executable was found !") +endif() - ADD_SUPERBUILD_CONFIGURE_VAR(PCRE_ROOT --with-pcre-prefix) - ADD_SUPERBUILD_CONFIGURE_VAR(BOOST_ROOT --with-boost) +if(MSVC) + # Use pre-built swig executable (no linking is required, no install done) + ExternalProject_Add(SWIG + PREFIX SWIG + URL "http://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.7/swigwin-3.0.7.zip/download" + URL_MD5 d8b5a9ce49c819cc1bfc1e797b85ba7a + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS ${SWIG_DEPENDENCIES} + ) - ExternalProject_Add(SWIG - PREFIX SWIG - URL "http://sourceforge.net/projects/swig/files/swig/swig-3.0.7/swig-3.0.7.tar.gz/download" - URL_MD5 7fff46c84b8c630ede5b0f0827e3d90a - BINARY_DIR ${SWIG_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND - ${SWIG_SB_BUILD_DIR}/configure - --prefix=${SB_INSTALL_PREFIX} - ${SWIG_SB_PYTHON_CONFIG} - ${SWIG_SB_JAVA_CONFIG} - ${SWIG_SB_CONFIG} - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install - DEPENDS ${SWIG_DEPENDENCIES} - ) +else() + # declare dependencies + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(SWIG PCRE BOOST) - ExternalProject_Add_Step(SWIG copy_source - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${SWIG_SB_SRC} ${SWIG_SB_BUILD_DIR} - DEPENDEES patch update - DEPENDERS configure - ) + ADD_SUPERBUILD_CONFIGURE_VAR(PCRE_ROOT --with-pcre-prefix) + ADD_SUPERBUILD_CONFIGURE_VAR(BOOST_ROOT --with-boost) - endif() + ExternalProject_Add(SWIG + PREFIX SWIG + URL "http://sourceforge.net/projects/swig/files/swig/swig-3.0.7/swig-3.0.7.tar.gz/download" + URL_MD5 7fff46c84b8c630ede5b0f0827e3d90a + BINARY_DIR ${SWIG_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND + ${SWIG_SB_BUILD_DIR}/configure + --prefix=${SB_INSTALL_PREFIX} + ${SWIG_SB_PYTHON_CONFIG} + ${SWIG_SB_JAVA_CONFIG} + ${SWIG_SB_CONFIG} + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install + DEPENDS ${SWIG_DEPENDENCIES} + ) - if(WIN32) - set(_SB_SWIG_EXECUTABLE ${CMAKE_BINARY_DIR}/SWIG/src/SWIG/swig.exe) - elseif(UNIX) - set(_SB_SWIG_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/swig) - endif() + ExternalProject_Add_Step(SWIG copy_source + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${SWIG_SB_SRC} ${SWIG_SB_BUILD_DIR} + DEPENDEES patch update + DEPENDERS configure + ) endif() + +if(WIN32) + set(_SB_SWIG_EXECUTABLE ${CMAKE_BINARY_DIR}/SWIG/src/SWIG/swig.exe) +elseif(UNIX) + set(_SB_SWIG_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/swig) endif() diff --git a/SuperBuild/CMake/External_tiff.cmake b/SuperBuild/CMake/External_tiff.cmake index 3c34af343b768f10adc928a9d361d1631fb7bdf6..db9f2caad3f68958d14ccf4aa0007c8d6b801968 100644 --- a/SuperBuild/CMake/External_tiff.cmake +++ b/SuperBuild/CMake/External_tiff.cmake @@ -1,58 +1,51 @@ -if(NOT __EXTERNAL_TIFF__) -set(__EXTERNAL_TIFF__ 1) +INCLUDE_ONCE_MACRO(TIFF) -if(USE_SYSTEM_TIFF) - message(STATUS " Using libtiff system version") -else() - SETUP_SUPERBUILD(PROJECT TIFF) - message(STATUS " Using libtiff SuperBuild version") - - # declare dependencies - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(TIFF ZLIB JPEG) - - ADD_SUPERBUILD_CMAKE_VAR(TIFF ZLIB_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(TIFF ZLIB_LIBRARY) - ADD_SUPERBUILD_CMAKE_VAR(TIFF JPEG_INCLUDE_DIR) - ADD_SUPERBUILD_CMAKE_VAR(TIFF JPEG_LIBRARY) +SETUP_SUPERBUILD(TIFF) - if(MSVC) +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(TIFF ZLIB JPEG) - STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) - STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) - configure_file(${CMAKE_SOURCE_DIR}/patches/TIFF/nmake.opt ${CMAKE_BINARY_DIR}/nmake_libtiff_extra.opt) +ADD_SUPERBUILD_CMAKE_VAR(TIFF ZLIB_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(TIFF ZLIB_LIBRARY) +ADD_SUPERBUILD_CMAKE_VAR(TIFF JPEG_INCLUDE_DIR) +ADD_SUPERBUILD_CMAKE_VAR(TIFF JPEG_LIBRARY) - ExternalProject_Add(TIFF_build - PREFIX TIFF - URL "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz" - URL_MD5 d1d2e940dea0b5ad435f21f03d96dd72 - SOURCE_DIR ${TIFF_SB_SRC} - BINARY_DIR ${TIFF_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - DEPENDS ${TIFF_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/nmake_libtiff_extra.opt ${TIFF_SB_SRC}/nmake.opt - CONFIGURE_COMMAND "" - BUILD_COMMAND nmake /f ${TIFF_SB_SRC}/Makefile.vc - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/TIFF/CMakeLists.txt - ${CMAKE_BINARY_DIR}/TIFF/_install +if(MSVC) + STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX}) + STRING(REGEX REPLACE "/" "\\\\" CMAKE_WIN_INSTALL_PREFIX ${CMAKE_WIN_INSTALL_PREFIX}) + configure_file(${CMAKE_SOURCE_DIR}/patches/TIFF/nmake.opt ${CMAKE_BINARY_DIR}/nmake_libtiff_extra.opt) + ExternalProject_Add(TIFF_build + PREFIX TIFF + URL "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz" + URL_MD5 d1d2e940dea0b5ad435f21f03d96dd72 + SOURCE_DIR ${TIFF_SB_SRC} + BINARY_DIR ${TIFF_SB_SRC} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${TIFF_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/nmake_libtiff_extra.opt ${TIFF_SB_SRC}/nmake.opt + CONFIGURE_COMMAND "" + BUILD_COMMAND nmake /f ${TIFF_SB_SRC}/Makefile.vc + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/TIFF/CMakeLists.txt + ${CMAKE_BINARY_DIR}/TIFF/_install ) - ExternalProject_Add(TIFF - PREFIX TIFF/_install - DOWNLOAD_COMMAND "" - SOURCE_DIR TIFF/_install - BINARY_DIR ${TIFF_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + ExternalProject_Add(TIFF + PREFIX TIFF/_install + DOWNLOAD_COMMAND "" + SOURCE_DIR TIFF/_install + BINARY_DIR ${TIFF_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DTIFF_BUILD_DIR:STRING=${TIFF_SB_SRC}/libtiff - DEPENDS TIFF_build - CMAKE_COMMAND + -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} + -DCMAKE_BUILD_TYPE:STRING=Release + -DTIFF_BUILD_DIR:STRING=${TIFF_SB_SRC}/libtiff + DEPENDS TIFF_build + CMAKE_COMMAND ) - else() +else() ExternalProject_Add(TIFF PREFIX TIFF URL "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz" @@ -63,11 +56,9 @@ else() DOWNLOAD_DIR ${DOWNLOAD_LOCATION} DEPENDS ${TIFF_DEPENDENCIES} CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} -DCMAKE_INSTALL_LIBDIR:PATH=lib -DCMAKE_INSTALL_BINDIR:PATH=bin - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_TESTING:BOOL=OFF -Djpeg:BOOL=TRUE -Dlzma:BOOL=FALSE @@ -78,12 +69,10 @@ else() CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) endif() - set(_SB_TIFF_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_TIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libtiff_i.lib) - elseif(UNIX) - set(_SB_TIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libtiff${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() -endif() +set(_SB_TIFF_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_TIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libtiff_i.lib) +elseif(UNIX) + set(_SB_TIFF_LIBRARY ${SB_INSTALL_PREFIX}/lib/libtiff${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_tinyxml.cmake b/SuperBuild/CMake/External_tinyxml.cmake index 52f784f7265b38ccc57556357f7981eb2f003a8f..b5ddb25e582c594782781356eedf4ae5c9993732 100644 --- a/SuperBuild/CMake/External_tinyxml.cmake +++ b/SuperBuild/CMake/External_tinyxml.cmake @@ -1,35 +1,20 @@ -if(NOT __EXTERNAL_TINYXML__) -set(__EXTERNAL_TINYXML__ 1) +INCLUDE_ONCE_MACRO(TINYXML) -if(USE_SYSTEM_TINYXML) - message(STATUS " Using TinyXML system version") -else() - SETUP_SUPERBUILD(PROJECT TINYXML) - message(STATUS " Using TinyXML SuperBuild version") +SETUP_SUPERBUILD(TINYXML) - ExternalProject_Add(TINYXML - PREFIX TINYXML - URL "http://sourceforge.net/projects/tinyxml/files/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz/download" - URL_MD5 c1b864c96804a10526540c664ade67f0 - BINARY_DIR ${TINYXML_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - CMAKE_COMMAND ${SB_CMAKE_COMMAND} - DEPENDS ${TINYXML_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/TINYXML/CMakeLists.txt - ${TINYXML_SB_SRC} - ) +ExternalProject_Add(TINYXML + PREFIX TINYXML + URL "http://sourceforge.net/projects/tinyxml/files/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz/download" + URL_MD5 c1b864c96804a10526540c664ade67f0 + BINARY_DIR ${TINYXML_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${TINYXML_DEPENDENCIES} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/patches/TINYXML/CMakeLists.txt + ${TINYXML_SB_SRC} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - set(_SB_TINYXML_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_TINYXML_LIBRARY ${SB_INSTALL_PREFIX}/lib/tinyXML.lib) - elseif(UNIX) - set(_SB_TINYXML_LIBRARY ${SB_INSTALL_PREFIX}/lib/libtinyxml${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - -endif() -endif() +SUPERBUILD_UPDATE_CMAKE_VARIABLES(TINYXML FALSE) diff --git a/SuperBuild/CMake/External_zlib.cmake b/SuperBuild/CMake/External_zlib.cmake index 7bc9c72494120561c6e36cef868437f7732087a0..c86bd4a25089e30e7eddf853c5176019d8d85a21 100644 --- a/SuperBuild/CMake/External_zlib.cmake +++ b/SuperBuild/CMake/External_zlib.cmake @@ -1,47 +1,35 @@ -if(NOT __EXTERNAL_ZLIB__) -set(__EXTERNAL_ZLIB__ 1) +INCLUDE_ONCE_MACRO(ZLIB) -if(USE_SYSTEM_ZLIB) - message(STATUS " Using Zlib system version") -else() - SETUP_SUPERBUILD(PROJECT ZLIB) - message(STATUS " Using zlib SuperBuild version") +SETUP_SUPERBUILD(ZLIB) - # Try official release 1.2.8 - ExternalProject_Add(ZLIB - PREFIX ZLIB - URL "http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download" - URL_MD5 44d667c142d7cda120332623eab69f40 - BINARY_DIR ${ZLIB_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE:STRING=Release - #-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - #-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DBUILD_SHARED_LIBS:BOOL=ON - CMAKE_COMMAND ${SB_CMAKE_COMMAND}) - if(UNIX) - ExternalProject_Add_Step(ZLIB remove_static - COMMAND ${CMAKE_COMMAND} -E remove ${SB_INSTALL_PREFIX}/lib/libz.a - DEPENDEES install) - endif() +# Try official release 1.2.8 +ExternalProject_Add(ZLIB + PREFIX ZLIB + URL "http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download" + URL_MD5 44d667c142d7cda120332623eab69f40 + BINARY_DIR ${ZLIB_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + ) - if(MSVC) - ExternalProject_Add_Step(ZLIB msvc_copy_hell - COMMAND ${CMAKE_COMMAND} -E copy ${ZLIB_SB_BUILD_DIR}/zlib.lib ${SB_INSTALL_PREFIX}/lib/zdll.lib - DEPENDEES install) - endif() - - set(_SB_ZLIB_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) - if(WIN32) - set(_SB_ZLIB_LIBRARY ${SB_INSTALL_PREFIX}/lib/zdll.lib) - elseif(UNIX) - set(_SB_ZLIB_LIBRARY ${SB_INSTALL_PREFIX}/lib/libz${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() +if(UNIX) + ExternalProject_Add_Step(ZLIB remove_static + COMMAND ${CMAKE_COMMAND} -E remove ${SB_INSTALL_PREFIX}/lib/libz.a + DEPENDEES install) +endif() +if(MSVC) + ExternalProject_Add_Step(ZLIB msvc_copy_hell + COMMAND ${CMAKE_COMMAND} -E copy ${ZLIB_SB_BUILD_DIR}/zlib.lib ${SB_INSTALL_PREFIX}/lib/zdll.lib + DEPENDEES install) endif() +set(_SB_ZLIB_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_ZLIB_LIBRARY ${SB_INSTALL_PREFIX}/lib/zdll.lib) +elseif(UNIX) + set(_SB_ZLIB_LIBRARY ${SB_INSTALL_PREFIX}/lib/libz${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/SuperBuild_Macro.cmake b/SuperBuild/CMake/SuperBuild_Macro.cmake index 6f52aac2174c70a352dd7096a9a9fe2152760013..8491077fbd52fce8e7a133fa8a7a7e30043d03fc 100644 --- a/SuperBuild/CMake/SuperBuild_Macro.cmake +++ b/SuperBuild/CMake/SuperBuild_Macro.cmake @@ -1,63 +1,23 @@ include(CMakeParseArguments) -# Macro SETUP_SYSTEM_LIBRARY : defines USE_SYSTEM_XXX option, initialize -# internal variables -macro(SETUP_SYSTEM_LIBRARY) - cmake_parse_arguments(NEW_SYSLIB "" "PROJECT;DEFAULT" "" ${ARGN}) - option(USE_SYSTEM_${NEW_SYSLIB_PROJECT} - " Use a system build of ${NEW_SYSLIB_PROJECT}." - ${NEW_SYSLIB_DEFAULT} - ) - set(SYSTEM_${NEW_SYSLIB_PROJECT}_CMAKE_CACHE) -endmacro(SETUP_SYSTEM_LIBRARY) - -# Macro ADD_SYSTEM_LOCATION : define variables to specific system locations -macro(ADD_SYSTEM_LOCATION) - cmake_parse_arguments(NEW_SYSLOC "" "PROJECT" "VARIABLES" ${ARGN}) - foreach(var ${NEW_SYSLOC_VARIABLES}) - set(${var} "" CACHE FILEPATH "Set a custom system location") - mark_as_advanced(${var}) - if(USE_SYSTEM_${NEW_SYSLOC_PROJECT}) - set_property(CACHE ${var} PROPERTY TYPE FILEPATH) - else() - set_property(CACHE ${var} PROPERTY TYPE INTERNAL) - endif() - # add variable to cache if not empty - if(NOT ${var} STREQUAL "") - # additional argument for CMake cache - set(ITEM_FOR_CMAKE_CACHE "-D${var}:STRING=${${var}}") - list(APPEND SYSTEM_${NEW_SYSLOC_PROJECT}_CMAKE_CACHE ${ITEM_FOR_CMAKE_CACHE}) - endif() - endforeach(var) -endmacro(ADD_SYSTEM_LOCATION) - -# Macro ADD_SYSTEM_PREFIX : defines a system prefix for the given project -# - creates a cache variable SYSTEM_${PROJECT}_PREFIX -# - if CMAKE_ALIAS is defined, it is used to add an entry in cache -# -D${CMAKE_ALIAS}:PATH=${SYSTEM_${PROJECT}_PREFIX} -macro(ADD_SYSTEM_PREFIX) - cmake_parse_arguments(NEW_SYSPREFIX "" "PROJECT;CMAKE_ALIAS" "" ${ARGN}) - set(SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX "" CACHE PATH "Set a custom system prefix") - mark_as_advanced(SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX) - if(USE_SYSTEM_${NEW_SYSPREFIX_PROJECT}) - set_property(CACHE SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX PROPERTY TYPE PATH) - else() - set_property(CACHE SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX PROPERTY TYPE INTERNAL) - endif() - if(NOT ${NEW_SYSPREFIX_CMAKE_ALIAS} STREQUAL "") - if(NOT SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX STREQUAL "") - set(ITEM_FOR_CMAKE_CACHE - "-D${NEW_SYSPREFIX_CMAKE_ALIAS}:PATH=${SYSTEM_${NEW_SYSPREFIX_PROJECT}_PREFIX}") - list(APPEND SYSTEM_${NEW_SYSLOC_PROJECT}_CMAKE_CACHE ${ITEM_FOR_CMAKE_CACHE}) - endif() - endif() -endmacro(ADD_SYSTEM_PREFIX) +macro(INCLUDE_ONCE_MACRO project) + if( __included_${project}__) + return() +else() + set(__included_${project}__ 1) +endif() + +if(USE_SYSTEM_${project}) + #message(STATUS " Using ${project} system version") + list(APPEND FROM_SYSTEM_LIST ${project}) + return() +endif() +endmacro() # Macro SETUP_SUPERBUILD # Initialize usefull variables to build a superbuild project -macro(SETUP_SUPERBUILD) - cmake_parse_arguments(NEW_SB "" "PROJECT" "" ${ARGN}) - #set_property(GLOBAL PROPERTY prop_${project}_DEPENDENCIES "") +macro(SETUP_SUPERBUILD NEW_SB_PROJECT) + list(APPEND FROM_SUPERBUILD_LIST ${NEW_SB_PROJECT}) set(${NEW_SB_PROJECT}_DEPENDENCIES "") set(${NEW_SB_PROJECT}_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${NEW_SB_PROJECT}/build) set(${NEW_SB_PROJECT}_SB_SRC ${CMAKE_BINARY_DIR}/${NEW_SB_PROJECT}/src/${NEW_SB_PROJECT}) @@ -122,21 +82,24 @@ endmacro(ADD_SUPERBUILD_CMAKE_VAR) macro(ADD_SUPERBUILD_CONFIGURE_VAR project var name) set(suffix "${ARGV3}") if(DEFINED _SB_${var}) - list(APPEND ${project}_SB_CONFIG - ${name}=${_SB_${var}}${suffix} - ) + set(${project}_SB_CONFIG + ${${project}_SB_CONFIG} ${name}=${_SB_${var}}${suffix}) elseif(DEFINED ${var}) - list(APPEND ${project}_SB_CONFIG - ${name}=${${var}}${suffix} - ) + set(${project}_SB_CONFIG + ${${project}_SB_CONFIG} ${name}=${${var}}${suffix}) endif() endmacro(ADD_SUPERBUILD_CONFIGURE_VAR) -macro(SUPERBUILD_PATCH_SOURCE project external_project_step_name) +macro(SUPERBUILD_PATCH_SOURCE project) set(${project}_PATCH_DIR ${CMAKE_SOURCE_DIR}/patches/${project}) - string(TOLOWER ${project} project_) + string(TOLOWER ${project} patch_dir_prefix) + set(PATCH_ARGS "${ARGV1}") + if(WIN32) set(DIFF_FILE_MATCH_STRING "win") + if(NOT PATCH_ARGS) + set(PATCH_ARGS "--binary") + endif() else() if(APPLE) set(DIFF_FILE_MATCH_STRING "macx") @@ -144,15 +107,37 @@ macro(SUPERBUILD_PATCH_SOURCE project external_project_step_name) set(DIFF_FILE_MATCH_STRING "linux") endif() endif() #WIN32 - file(GLOB files_list "${${project}_PATCH_DIR}/${project_}*${DIFF_FILE_MATCH_STRING}*diff") - if(files_list) + + #if an optional diff file is mentioned. then only that is applied + set(DOT_DIFF_FILES "${ARGV2}") + + if(NOT DOT_DIFF_FILES) + #If DOT_DIFF_FILES is empty, + #we try to list files ending with all.diff of <DIFF_FILE_MATCH_STRING>.diff + #the final list is stored in DOT_DIFF_FILES and applied using patch.cmake + #Custom patches requrired for... + + #glob all files ending with DIFF_FILE_MATCH_STRING.diff + file(GLOB files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*${DIFF_FILE_MATCH_STRING}.diff") + + #glob all files ending with all.diff + file(GLOB all_files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*all.diff") + + #merge two list for the final one + list(APPEND files_list ${all_files_list}) + + #because we are passing it cmake_command using -D!! + string(REPLACE ";" " " DOT_DIFF_FILES "${files_list}") + endif() + + if(DOT_DIFF_FILES) message(STATUS " Custom patches required for ${project}") ExternalProject_Add_Step(${project} ${project}_custom_patch COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${${project}_SB_SRC} - -DPATCH_DIR=${${project}_PATCH_DIR} - -DDIFF_FILE_MATCH_STRING=${DIFF_FILE_MATCH_STRING} + -DDOT_DIFF_FILES=${DOT_DIFF_FILES} + -DPATCH_ARGS=${PATCH_ARGS} -P ${CMAKE_SOURCE_DIR}/CMake/patch.cmake DEPENDEES patch update DEPENDERS configure @@ -160,3 +145,32 @@ macro(SUPERBUILD_PATCH_SOURCE project external_project_step_name) endif() endmacro(SUPERBUILD_PATCH_SOURCE) + +macro(SUPERBUILD_UPDATE_CMAKE_VARIABLES PROJECT with_prefix) + + if("${ARGV3}" STREQUAL "") + string(TOLOWER ${PROJECT} lib_file_we) + else() + set(lib_file_we "${ARGV3}") + endif() + + if("${ARGV4}" STREQUAL "") + set(include_dir "include") + else() + set(include_dir "include/${ARGV4}") + endif() + + if(WIN32) + if(${with_prefix}) + set(lib_file lib${lib_file_we}${CMAKE_LINK_LIBRARY_SUFFIX}) + else() + set(lib_file ${lib_file_we}${CMAKE_LINK_LIBRARY_SUFFIX}) + endif() + else() + set(lib_file "lib${lib_file_we}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + + set(_SB_${PROJECT}_INCLUDE_DIR ${SB_INSTALL_PREFIX}/${include_dir}) + set(_SB_${PROJECT}_LIBRARY ${SB_INSTALL_PREFIX}/lib/${lib_file}) + +endmacro() diff --git a/SuperBuild/CMake/patch.cmake b/SuperBuild/CMake/patch.cmake index d677939c675d6911ca33a71117715ec1e9c2d32c..1836283c121fc916eeb73ad16265edaa0ab949b3 100644 --- a/SuperBuild/CMake/patch.cmake +++ b/SuperBuild/CMake/patch.cmake @@ -1,26 +1,45 @@ -file(GLOB all_dot_diff_files "${PATCH_DIR}/*${DIFF_FILE_MATCH_STRING}*diff") + find_program(PATCH_PROGRAM NAMES patch) -if(PATCH_PROGRAM) - list(REVERSE all_dot_diff_files) - foreach(dot_diff_file ${all_dot_diff_files}) - # message("dot_diff_file=${dot_diff_file}") - execute_process( - COMMAND - ${CMAKE_COMMAND} -E chdir ${SOURCE_DIR} ${PATCH_PROGRAM} "-p1" INPUT_FILE "${dot_diff_file}" - RESULT_VARIABLE patch_rv - OUTPUT_VARIABLE patch_ov - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) - if(NOT "${patch_rv}" STREQUAL "0") - if( NOT "${patch_ov}" MATCHES "previously applied") - message(FATAL_ERROR "${PATCH_PROGRAM} returned non-zero exit status '${patch_ov}'") - endif() - else() - message(STATUS "${patch_ov}") +if(NOT PATCH_PROGRAM) + message(FATAL_ERROR "patch program not found. PATCH_PROGRAM. search names :' patch'") +endif() + +separate_arguments(DOT_DIFF_FILES) +list(SORT DOT_DIFF_FILES) + +if(NOT PATCH_ARGS) + set(PATCH_ARGS "-ut") +endif() + +foreach(dot_diff_file ${DOT_DIFF_FILES}) + message("Input patch file: ${dot_diff_file}") + execute_process( + COMMAND + ${CMAKE_COMMAND} -E chdir ${SOURCE_DIR} + ${PATCH_PROGRAM} "${PATCH_ARGS}" "-p1" "-i" "${dot_diff_file}" + RESULT_VARIABLE patch_rv + OUTPUT_VARIABLE patch_ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE) + + set(PATCHING_FAILED FALSE) + + if(NOT "${patch_rv}" STREQUAL "0") + if( NOT "${patch_ov}" MATCHES "previously applied") + set(PATCHING_FAILED TRUE) endif() - endforeach() -else() - if(NOT WIN32) - #Raise a fatal error if not on windows - message(FATAL_ERROR "patch program not found. PATCH_PROGRAM. search names :' patch'") endif() -endif() \ No newline at end of file + + if( "${patch_ov}" MATCHES "FAILED") + set(PATCHING_FAILED TRUE) + endif() + + if(PATCHING_FAILED) + message(FATAL_ERROR "${PATCH_PROGRAM} returned non-zero exit status \n ${patch_ov} \n") + else() + message("${patch_ov}") + endif() + + unset(patch_rv) + unset(patch_ov) +endforeach() diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index fea7c77e4a3db07f80ee3f712f37470ac94bb33b..f4bbbd772b078c870f7eaf96bfac2b3d9cd43909 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -11,27 +11,32 @@ set(CMAKE_MODULE_PATH include(ExternalProject) +option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON) + +set(OTB_ADDITIONAL_CACHE "" CACHE STRING "Additional cmake option for OTB -DVAR:TYPE=VALUE ...") + if(APPLE) if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() set(CMAKE_MACOSX_RPATH TRUE) - # use, i.e. don't skip the full RPATH for the build tree - set(CMAKE_SKIP_BUILD_RPATH FALSE) - # when building, don't use the install RPATH already - # (but later on when installing) - set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - # add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - # the RPATH to be used when installing, but only if it's not a system directory - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) - if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - endif("${isSystemDir}" STREQUAL "-1") endif() +# use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) +# when building, don't use the install RPATH already +# (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +# the RPATH to be used when installing, but only if it's not a system directory +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +endif("${isSystemDir}" STREQUAL "-1") + # TODO BUILD_TESTING is created by default by CTest.cmake, and is ON by default. option(BUILD_TESTING "Build the testing tree." OFF) @@ -49,27 +54,23 @@ option(ENABLE_OTB_LARGE_INPUTS " Use the OTB-LargeInputs for testing" OFF) option(BUILD_EXAMPLES " Build the OTB Examples directory" OFF) option(ENABLE_MONTEVERDI " Build Monteverdi on top of OTB" OFF) -# check if superbuild is in OTB source or in stand-alone mode -set(SUPERBUILD_IN_OTB_TREE OFF) if(EXISTS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt") file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _CONTENT_CMAKELIST REGEX "project\\\(OTB\\\)") if(NOT "${_CONTENT_CMAKELIST}" STREQUAL "") - set(SUPERBUILD_IN_OTB_TREE ON) # parse the version number file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _FULL_CONTENT_CMAKELIST) string(REGEX REPLACE ".*set\\(OTB_VERSION_MAJOR \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_MAJOR "${_FULL_CONTENT_CMAKELIST}") string(REGEX REPLACE ".*set\\(OTB_VERSION_MINOR \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_MINOR "${_FULL_CONTENT_CMAKELIST}") string(REGEX REPLACE ".*set\\(OTB_VERSION_PATCH \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_PATCH "${_FULL_CONTENT_CMAKELIST}") set(SUPERBUILD_OTB_VERSION "${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR}.${SUPERBUILD_OTB_VERSION_PATCH}") - message(STATUS "Found OTB version : ${SUPERBUILD_OTB_VERSION}") + message(STATUS "OTB version : ${SUPERBUILD_OTB_VERSION}") endif() endif() -message(STATUS "Check if superbuild is in OTB tree : ${SUPERBUILD_IN_OTB_TREE}") set(SB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) -set(SB_BUILD_SHARED_LIBS ON) +file(TO_NATIVE_PATH "${SB_INSTALL_PREFIX}" SB_INSTALL_PREFIX_NATIVE) # Check if CMAKE_INSTALL_PREFIX is set by default if(WIN32) @@ -91,108 +92,122 @@ elseif(UNIX) endif() endif() +if(NOT CMAKE_BUILD_TYPE) + message(STATUS "CMake build type is none. Setting it to Release") + set(CMAKE_BUILD_TYPE Release) +endif() -if(WIN32) - if(MSVC) - set(SB_CMAKE_COMMAND ${CMAKE_COMMAND}) - set(SB_BUILD_SHARED_LIBS OFF) - set(SB_PRIOR_INCLUDE_FLAGS "/I ${CMAKE_INSTALL_PREFIX}/include") - endif() -else(UNIX) - if(APPLE) - set(LDLIBVAR DYLD_LIBRARY_PATH) - set(OSX_CMAKE_OPTS) - list(APPEND OSX_CMAKE_OPTS "-DCMAKE_MACOSX_RPATH:BOOL=${CMAKE_MACOSX_RPATH}") - list(APPEND OSX_CMAKE_OPTS "-DCMAKE_SKIP_BUILD_RPATH:BOOL=${CMAKE_SKIP_BUILD_RPATH}") - list(APPEND OSX_CMAKE_OPTS "-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=${CMAKE_BUILD_WITH_INSTALL_RPATH}") - list(APPEND OSX_CMAKE_OPTS "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=${CMAKE_INSTALL_RPATH_USE_LINK_PATH}") - list(APPEND OSX_CMAKE_OPTS "-DCMAKE_INSTALL_RPATH:STRING=${CMAKE_INSTALL_RPATH}") - set(SB_CMAKE_COMMAND ${CMAKE_COMMAND} ${OSX_CMAKE_OPTS}) - set(SB_ENV_CONFIGURE_CMD env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) +if(MSVC) + set(BUILD_SHARED_LIBS OFF) + if(CMAKE_MAJOR_VERSION GREATER 2 AND CMAKE_MINOR_VERSION GREATER 2) + set(BUILD_SHARED_LIBS ON) else() - set(LDLIBVAR LD_LIBRARY_PATH) - set(SB_ENV_CONFIGURE_CMD env ${LDLIBVAR}=${SB_INSTALL_PREFIX}/lib:$ENV{${LDLIBVAR}} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) - set(SB_CMAKE_COMMAND env ${LDLIBVAR}=${CMAKE_INSTALL_PREFIX}/lib:$ENV{${LDLIBVAR}} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND}) - message(STATUS "Environment setup for Configure : ${SB_ENV_CONFIGURE_CMD}") + message(WARNING "BUILD_SHARED_LIBS is set to OFF with CMake < 3.3") endif() - set(SB_PRIOR_INCLUDE_FLAGS "-I${CMAKE_INSTALL_PREFIX}/include") endif() -# Call external projects -if(USE_SYSTEM_GDAL) - set(CURL_DEFAULT ON) -else() - set(CURL_DEFAULT OFF) +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE") + if(MSVC_VERSION GREATER 1310) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + endif() endif() -if(USE_SYSTEM_QT4) - set(SQLITE_DEFAULT ON) +if(DEFINED ENV{CMAKE_PREFIX_PATH}) + set(SB_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${SB_INSTALL_PREFIX}") else() - set(SQLITE_DEFAULT OFF) + set(SB_CMAKE_PREFIX_PATH "${SB_INSTALL_PREFIX}") endif() -if(USE_SYSTEM_SQLITE) - set(QT4_DEFAULT ON) -else() - set(QT4_DEFAULT OFF) +set(SB_CMAKE_CACHE_ARGS) +list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}") +list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_PREFIX}") +list(APPEND SB_CMAKE_CACHE_ARGS "-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}") +list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_PREFIX_PATH:PATH=${SB_CMAKE_PREFIX_PATH}") + +if(APPLE) + list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_MACOSX_RPATH:BOOL=${CMAKE_MACOSX_RPATH}") endif() -if(USE_SYSTEM_ZLIB) - set(PNG_DEFAULT ON) -else() - set(PNG_DEFAULT OFF) +if(UNIX) + list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_SKIP_BUILD_RPATH:BOOL=${CMAKE_SKIP_BUILD_RPATH}") + list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=${CMAKE_BUILD_WITH_INSTALL_RPATH}") + list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=${CMAKE_INSTALL_RPATH_USE_LINK_PATH}") + list(APPEND SB_CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_RPATH:PATH=${CMAKE_INSTALL_RPATH}") endif() -if(WIN32) - set(OSSIM_DEFAULT ON) +set(SB_CMAKE_ARGS "-G${CMAKE_GENERATOR}") +if(UNIX) + if(APPLE) + set(SB_CMAKE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) + set(SB_ENV_CONFIGURE_CMD env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) + else() + if( DEFINED ENV{LD_LIBRARY_PATH} ) + set(LD_LIBRARY_PATH_VALUE ${SB_INSTALL_PREFIX}/lib:$ENV{LD_LIBRARY_PATH}) + else() + set(LD_LIBRARY_PATH_VALUE ${SB_INSTALL_PREFIX}/lib) + endif() + set(SB_ENV_CONFIGURE_CMD env LD_LIBRARY_PATH=${LD_LIBRARY_PATH_VALUE} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) + set(SB_CMAKE_COMMAND env LD_LIBRARY_PATH=${LD_LIBRARY_PATH_VALUE} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) + endif() + message(STATUS "Environment setup for Configure (SB_ENV_CONFIGURE_CMD): ${SB_ENV_CONFIGURE_CMD}") else() - set(OSSIM_DEFAULT OFF) + #windows + set(SB_CMAKE_COMMAND ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) endif() +message(STATUS "Environment setup for CMake (SB_CMAKE_COMMAND) : ${SB_CMAKE_COMMAND}") + +set(FROM_SYSTEM_LIST) +set(FROM_SUPERBUILD_LIST) #TODO: enforce check from ITK on directory length # Setup third parties -SETUP_SYSTEM_LIBRARY(PROJECT ZLIB DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT JPEG DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT EXPAT DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT PNG DEFAULT ${PNG_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT TIFF DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT PROJ DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT GEOTIFF DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT SQLITE DEFAULT ${SQLITE_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT GEOS DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT OPENJPEG DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT BOOST DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT LIBKML DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT CURL DEFAULT ${CURL_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT OPENSSL DEFAULT ${CURL_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT GDAL DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT FFTW DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT ITK DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT OPENTHREADS DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT OSSIM DEFAULT ${OSSIM_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT MUPARSER DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT MUPARSERX DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT TINYXML DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT OPENCV DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT LIBSVM DEFAULT OFF) -SETUP_SYSTEM_LIBRARY(PROJECT PCRE DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT SWIG DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT QT4 DEFAULT ${QT4_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT QWT DEFAULT ${QT4_DEFAULT}) -SETUP_SYSTEM_LIBRARY(PROJECT GLEW DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT GLFW DEFAULT ON) -SETUP_SYSTEM_LIBRARY(PROJECT GLUT DEFAULT ON) +option(USE_SYSTEM_ZLIB "Use a system build of zlib" OFF) +option(USE_SYSTEM_JPEG "Use a system build of JPEG" OFF) +option(USE_SYSTEM_EXPAT "Use a system build of expat" OFF) +option(USE_SYSTEM_PNG "Use a system build of libpng" OFF) +option(USE_SYSTEM_TIFF "Use a system build of libtiff" OFF) +option(USE_SYSTEM_PROJ "Use a system build of Proj.4" OFF) +option(USE_SYSTEM_GEOTIFF "Use a system build of GeoTIFF" OFF) +option(USE_SYSTEM_SQLITE "Use a system build of sqlite" OFF) +option(USE_SYSTEM_GEOS "Use a system build of GEOS" OFF) +option(USE_SYSTEM_OPENJPEG "Use a system build of OpenJPEG" OFF) +option(USE_SYSTEM_BOOST "Use a system build of Boost" OFF) +option(USE_SYSTEM_LIBKML "Use a system build of LibKML" OFF) +option(USE_SYSTEM_CURL "Use a system build of cURL" OFF) +option(USE_SYSTEM_OPENSSL "Use a system build of OpenSSL" OFF) +option(USE_SYSTEM_GDAL "Use a system build of GDAL" OFF) +option(USE_SYSTEM_FFTW "Use a system build of FFTW" OFF) +option(USE_SYSTEM_ITK "Use a system build of ITK" OFF) +option(USE_SYSTEM_OPENTHREADS "Use a system build of OpenThreads" OFF) +option(USE_SYSTEM_MUPARSER "Use a system build of muParser" OFF) +option(USE_SYSTEM_MUPARSERX "Use a system build of muParserX" OFF) +option(USE_SYSTEM_TINYXML "Use a system build of TinyXML" OFF) +option(USE_SYSTEM_OPENCV "Use a system build of OpenCV" OFF) +option(USE_SYSTEM_LIBSVM "Use a system build of libsvm" OFF) +option(USE_SYSTEM_PCRE "Use a system build of PCRE" ON) +option(USE_SYSTEM_SWIG "Use a system build of swig" ON) +option(USE_SYSTEM_QT4 "Use a system build of QT4" OFF) +option(USE_SYSTEM_QWT "Use a system build of Qwt" OFF) +option(USE_SYSTEM_GLEW "Use a system build of GLEW" OFF) +option(USE_SYSTEM_GLFW "Use a system build of glfw" OFF) +option(USE_SYSTEM_GLUT "Use a system build of glut" OFF) +option(USE_SYSTEM_FREETYPE "Use a system build of freetype" OFF) # Call OTB option(OTB_USE_6S "Enable module 6S in OTB" ON) option(OTB_USE_CURL "Enable module Curl in OTB" ON) -option(OTB_USE_LIBKML "Enable module libKML in OTB" ON) +#RK: disabled libkml. problems on windows msvc +if(MSVC) + option(OTB_USE_LIBKML "Enable module libKML in OTB" OFF) +else() + option(OTB_USE_LIBKML "Enable module libKML in OTB" ON) +endif() option(OTB_USE_LIBSVM "Enable module libSVM in OTB" ON) option(OTB_USE_MAPNIK "Enable module Mapnik in OTB" OFF) option(OTB_USE_MUPARSER "Enable module muparser in OTB" ON) option(OTB_USE_MUPARSERX "Enable module muparserX in OTB" ON) option(OTB_USE_OPENCV "Enable module OpenCV in OTB" ON) -option(OTB_USE_OPENJPEG "Enable module openjpeg in OTB" OFF) option(OTB_USE_QT4 "Enable module QT4 in OTB" ON) option(OTB_USE_SIFTFAST "Enable module Siftfast in OTB" ON) option(OTB_USE_OPENGL "Enable module OpenGL in OTB" OFF) @@ -249,6 +264,20 @@ else() include(External_otb) endif() -if(UNIX) - add_subdirectory(Packaging) +if(UNIX OR MSVC) + add_subdirectory(Packaging) +endif() + +if(FROM_SYSTEM_LIST) + list(SORT FROM_SYSTEM_LIST) +foreach( item ${FROM_SYSTEM_LIST}) + message(STATUS " Using system version of ${item}") +endforeach() endif() + +if(FROM_SUPERBUILD_LIST) + list(SORT FROM_SUPERBUILD_LIST) +foreach( item ${FROM_SUPERBUILD_LIST}) + message(STATUS " Using SuperBuild version of ${item}") +endforeach() +endif() \ No newline at end of file diff --git a/SuperBuild/Packaging/CMakeLists.txt b/SuperBuild/Packaging/CMakeLists.txt index a191f2eb15510abcb5489aa6d65b315d78c4109f..771e7f3f5f24266e171f252a65215d9bb66ad270 100644 --- a/SuperBuild/Packaging/CMakeLists.txt +++ b/SuperBuild/Packaging/CMakeLists.txt @@ -24,11 +24,10 @@ if(NOT GENERATE_PACKAGE AND NOT GENERATE_XDK) return() endif() -if(WIN32) +if(WIN32 AND NOT MSVC) if(NOT MXE_TARGET_DIR) message(FATAL_ERROR "you must set MXE_TARGET_DIR") endif() - if(NOT OTB_SOURCE_DIR) message(FATAL_ERROR "you must set OTB_SOURCE_DIR") endif() @@ -40,7 +39,7 @@ if(OUT_OF_SOURCE_BUILD) if(BUILD_TESTING) include(CTest) endif() - if(WIN32) + if(WIN32 AND NOT MSVC) set(Monteverdi_SOURCE_DIR "" CACHE PATH "monteverdi source directory") set(Monteverdi_BINARY_DIR "" CACHE PATH "monteverdi binary directory") set(MONTEVERDI_INSTALL_DIR "" CACHE PATH "monteverdi install directory") @@ -57,7 +56,7 @@ else(OUT_OF_SOURCE_BUILD) # if doing packages from source tree. set( SUPERBUILD_BINARY_DIR ${CMAKE_BINARY_DIR} ) set( SUPERBUILD_INSTALL_DIR ${SB_INSTALL_PREFIX} ) - if(WIN32) + if(WIN32 AND NOT MSVC) set(MONTEVERDI_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) get_filename_component(OTB_INSTALL_DIR ${OTB_MODULES_DIR} PATH) get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH) @@ -69,7 +68,16 @@ endif(OUT_OF_SOURCE_BUILD) get_filename_component(SUPERBUILD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH) get_filename_component(OTB_SOURCE_DIR ${SUPERBUILD_SOURCE_DIR} PATH) + if(WIN32) + set(ZIP_EXE_NAMES 7z 7za) + find_program(ZIP_EXECUTABLE NAMES ${ZIP_EXE_NAMES}) + if(NOT ZIP_EXECUTABLE) + message(FATAL_ERROR "Cannot find 7z executable. searched names ${ZIP_EXE_NAMES}. Please add it to your path") + endif() +endif() + +if(WIN32 AND NOT MSVC) foreach(req Monteverdi_SOURCE_DIR Monteverdi_BINARY_DIR @@ -81,12 +89,6 @@ if(WIN32) endif() set(vars "${vars} ${req}=[${${req}}]\n") endforeach(req) - - find_program(ZIP_EXECUTABLE zip) - if(NOT ZIP_EXECUTABLE) - message(FATAL_ERROR "Cannot find zip executable. Please add it to your path") - endif() - else() #Unix like foreach(req SUPERBUILD_BINARY_DIR @@ -103,7 +105,7 @@ endif() set(EXTRA_CACHE_CONFIG) -if(WIN32) +if(WIN32 AND NOT MSVC) set(CMAKE_INSTALL_PREFIX "${MONTEVERDI_INSTALL_DIR}") else() set(CMAKE_INSTALL_PREFIX "${SUPERBUILD_INSTALL_DIR}") @@ -112,9 +114,7 @@ endif() set(PACKAGE_NAME OTB) set(PACKAGE_LONG_NAME OrfeoToolBox) -if(WIN32) - set(ITK_VERSION_STRING) - set(PACKAGE_PLATFORM_NAME "win") +if(WIN32 AND NOT MSVC) if(MXE_TARGET_DIR MATCHES "i686") set(MXE_ARCH "i686") set(PACKAGE_ARCH "32") @@ -130,29 +130,32 @@ if(WIN32) set(MXE_ARCH \"${MXE_ARCH}\") set(MXE_MXEROOT \"${MXE_MXEROOT}\")" ) +else() #(WIN32 AND NOT MSVC) + set(PACKAGE_ARCH 32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PACKAGE_ARCH 64) + endif() +endif() - set(PACKAGE_VERSION_STRING ${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}) - -else() #(WIN32) - if(UNIX) - set(PACKAGE_ARCH 32) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(PACKAGE_ARCH 64) - endif() - if(APPLE) - set(PACKAGE_PLATFORM_NAME "Darwin") - else() - set(PACKAGE_PLATFORM_NAME "Linux") - endif() - get_version("${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" "ITK_SB_VERSION" ITK_SB_VERSION) - set(ITK_VERSION_STRING "${get_version_ITK_SB_VERSION}") - endif(UNIX) -endif() #(WIN32) +if(APPLE) + set(PACKAGE_PLATFORM_NAME "Darwin") +elseif(WIN32) + set(PACKAGE_PLATFORM_NAME "win") +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(PACKAGE_PLATFORM_NAME "Linux") +endif() -get_version("${OTB_SOURCE_DIR}/CMakeLists.txt" "OTB_VERSION_" OTB_VERSION_STRING) -set(PACKAGE_VERSION_STRING ${get_version_OTB_VERSION_STRING}) +if(WIN32 AND NOT MSVC) + set(ITK_VERSION_STRING) + set(PACKAGE_VERSION_STRING ${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}) +else() + get_version("${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" "ITK_SB_VERSION" ITK_SB_VERSION) + set(ITK_VERSION_STRING "${get_version_ITK_SB_VERSION}") + get_version("${OTB_SOURCE_DIR}/CMakeLists.txt" "OTB_VERSION_" OTB_VERSION_STRING) + set(PACKAGE_VERSION_STRING ${get_version_OTB_VERSION_STRING}) +endif() #WIN32 AND NOT MSVC -if(WIN32) +if(WIN32 AND NOT MSVC) set(Monteverdi_SOURCE_DIR "${Monteverdi_SOURCE_DIR}") set(Monteverdi_BINARY_DIR "${Monteverdi_BINARY_DIR}") set(MONTEVERDI_INSTALL_DIR "${MONTEVERDI_INSTALL_DIR}") @@ -164,11 +167,11 @@ else() #unixes set(Monteverdi_SOURCE_DIR "${SUPERBUILD_BINARY_DIR}/MVD/src/MVD") set(Monteverdi_BINARY_DIR "${SUPERBUILD_BINARY_DIR}/MVD/build") set(MONTEVERDI_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}") - set(OTB_INSTALL_DIR "${SUPERBUILD_BINARY_DIR}/OTB/build") + set(OTB_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}") set(DEPENDENCIES_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}") set(QT_PLUGINS_DIR "${SUPERBUILD_INSTALL_DIR}/plugins") set(QT_TRANSLATIONS_DIR "${SUPERBUILD_INSTALL_DIR}/translations") - endif() +endif() macro_setup_cmake_project(OTB) if(GENERATE_XDK) diff --git a/SuperBuild/Packaging/Files/linux_pkgsetup.in b/SuperBuild/Packaging/Files/linux_pkgsetup.in index 03580769be252cd7ebc0940e4b976ddeeb0fd233..08c377e4c1bb1722e7fd5969407fd34848ca5bcc 100644 --- a/SuperBuild/Packaging/Files/linux_pkgsetup.in +++ b/SuperBuild/Packaging/Files/linux_pkgsetup.in @@ -10,7 +10,6 @@ CAT=`which cat` RM=`which rm` CHMOD=`which chmod` SED=`which sed` -WHICH_ENV=`which env` PATCH_ELF_EXE=$OUT_DIR/tools/patchelf @@ -34,8 +33,13 @@ if [ "$I_AM_XDK" = true ] ; then $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake else + $CAT > $OUT_DIR/monteverdi.sh << EOF -#!$WHICH_ENV bash +#!/bin/sh +unset LD_LIBRARY_PATH +if [ -z "\$OTB_USE_SYSTEM_GTK" ] || [ "\$OTB_USE_SYSTEM_GTK" == "0" ]; then + export LD_LIBRARY_PATH=$OUT_DIR/lib/gtk +fi export LC_NUMERIC=C export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications export GDAL_DATA=$OUT_DIR/share/gdal @@ -46,8 +50,13 @@ EOF $CHMOD +x $OUT_DIR/monteverdi.sh $CAT > $OUT_DIR/mapla.sh << EOF -#!$WHICH_ENV bash +#!/bin/sh +unset LD_LIBRARY_PATH +if [ -z "\$OTB_USE_SYSTEM_GTK" ] || [ "\$OTB_USE_SYSTEM_GTK" == "0" ]; then + export LD_LIBRARY_PATH=$OUT_DIR/lib/gtk +fi export LC_NUMERIC=C +unset LD_LIBRARY_PATH export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications export GDAL_DATA=$OUT_DIR/share/gdal export GEOTIFF_CSV=$OUT_DIR/share/epsg_csv @@ -57,7 +66,7 @@ EOF $CHMOD +x $OUT_DIR/mapla.sh $CAT > $OUT_DIR/otbenv.profile << EOF -#!$WHICH_ENV bash +#!/bin/sh PATH=\$PATH:$OUT_DIR/bin GDAL_DATA=$OUT_DIR/share/gdal GEOTIFF_CSV=$OUT_DIR/share/espg_csv diff --git a/SuperBuild/Packaging/Files/macx_pkgsetup.in b/SuperBuild/Packaging/Files/macx_pkgsetup.in index 673cccc60b46f249886fb67eee74d81e873a2e75..215d1a53e057a3b6f35ca750ade2af952300a745 100755 --- a/SuperBuild/Packaging/Files/macx_pkgsetup.in +++ b/SuperBuild/Packaging/Files/macx_pkgsetup.in @@ -122,3 +122,6 @@ $RM -fr $OUT_DIR/tools $RM -f $OUT_DIR/pkgsetup $RM -f $OUT_DIR/make_symlinks + + +open $OUT_DIR diff --git a/SuperBuild/Packaging/PMacros.cmake b/SuperBuild/Packaging/PMacros.cmake index 8905306f637cbececf62ad53eb782959a5dcf4e6..f7ac66952a74ff961dd9fe981b42ca3adf1dd4b3 100644 --- a/SuperBuild/Packaging/PMacros.cmake +++ b/SuperBuild/Packaging/PMacros.cmake @@ -52,23 +52,32 @@ endmacro() macro(macro_create_targets_for_package pkg) - if(WIN32) + if(WIN32 AND NOT MSVC) add_custom_target(PACKAGE-${pkg}-check COMMAND ${CMAKE_COMMAND} --build "." --target install WORKING_DIRECTORY "${Monteverdi_BINARY_DIR}" ) - else() #Unxies Using SuperBuild - if(ENABLE_MONTEVERDI) - add_custom_target(PACKAGE-${pkg}-check - COMMAND ${CMAKE_COMMAND} --build "." --target install - WORKING_DIRECTORY "${SUPERBUILD_BINARY_DIR}/MVD/build" - ) - else() + else() #Using SuperBuild + #For out of source build, + #we assume the otb is built correctly with superbuild + if(OUT_OF_SOURCE_BUILD) add_custom_target(PACKAGE-${pkg}-check - COMMAND ${CMAKE_COMMAND} --build "." --target install - WORKING_DIRECTORY "${SUPERBUILD_BINARY_DIR}/OTB/build" - ) - endif(ENABLE_MONTEVERDI) + COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check") + else(OUT_OF_SOURCE_BUILD) + if(ENABLE_MONTEVERDI) + add_custom_target(PACKAGE-${pkg}-check + COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check" + DEPENDS MVD + WORKING_DIRECTORY ${SUPERBUILD_BINARY_DIR} + ) + else(ENABLE_MONTEVERDI) + add_custom_target(PACKAGE-${pkg}-check + COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check" + DEPENDS OTB + WORKING_DIRECTORY ${SUPERBUILD_BINARY_DIR} + ) + endif(ENABLE_MONTEVERDI) + endif(OUT_OF_SOURCE_BUILD) endif() add_dependencies(PACKAGE-${pkg}-check PACKAGE-TOOLS) @@ -90,7 +99,9 @@ macro(macro_create_targets_for_package pkg) #configure add_custom_target(PACKAGE-${pkg}-configure - COMMAND ${CMAKE_COMMAND} + COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_PROJECT_DIR}/build" + WORKING_DIRECTORY "${PACKAGE_PROJECT_DIR}" + COMMAND ${CMAKE_COMMAND} "-G${CMAKE_GENERATOR}" "${PACKAGE_PROJECT_DIR}/src" WORKING_DIRECTORY "${PACKAGE_PROJECT_DIR}/build" DEPENDS PACKAGE-${pkg}-check @@ -108,8 +119,8 @@ macro(macro_create_targets_for_package pkg) # creation of package is different from windows and unix like if(WIN32) add_custom_target(PACKAGE-${pkg} - COMMAND ${ZIP_EXECUTABLE} - "-rq" "${CMAKE_BINARY_DIR}/${archive_name}.zip" "${archive_name}" + COMMAND ${ZIP_EXECUTABLE} "a" "-r" "-y" + "${CMAKE_BINARY_DIR}/${archive_name}.zip" "${archive_name}/*" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" DEPENDS PACKAGE-${pkg}-build COMMENT "Creating ${CMAKE_BINARY_DIR}/${archive_name}.zip" diff --git a/SuperBuild/Packaging/PackageHelper.cmake b/SuperBuild/Packaging/PackageHelper.cmake index b69d7dcb8f1bdd8cf95e811dc0bb005b864e9601..652d40fe8c1e92d038475ce0be01cb9cbfeb8b85 100644 --- a/SuperBuild/Packaging/PackageHelper.cmake +++ b/SuperBuild/Packaging/PackageHelper.cmake @@ -1,5 +1,7 @@ +#RK: TODO: do a sweep when mxe is out and msvc builds are stabilized + macro(macro_super_package) - cmake_parse_arguments(PKG "" "STAGE_DIR" "SEARCHDIRS" ${ARGN} ) + cmake_parse_arguments(PKG "" "STAGE_DIR" "" ${ARGN} ) if(${PKG_STAGE_DIR} STREQUAL "") message(FATAL_ERROR "PKG_STAGE_DIR is emtpy. Just can't continue.") @@ -13,22 +15,28 @@ macro(macro_super_package) set(loader_program_PATHS) if(WIN32) + if(MSVC) + set(loader_program_names "dumpbin") + set(loader_program_PATHS) + set(LOADER_PROGRAM_ARGS "/DEPENDENTS") + else() set(loader_program_names "${MXE_ARCH}-w64-mingw32.shared-objdump") set(loader_program_PATHS "${MXE_MXEROOT}/usr/bin") set(LOADER_PROGRAM_ARGS "-p") + endif() + else() + if(APPLE) + set(loader_program_names otool) + set(LOADER_PROGRAM_ARGS "-l") + set(loader_program_PATHS /opt/local/bin) # a path that is already listed i path on apple else() - if(APPLE) - set(loader_program_names otool) - set(LOADER_PROGRAM_ARGS "-l") - set(loader_program_PATHS /opt/local/bin) # a path that is already listed i path on apple - else() - set(loader_program_names objdump) - set(LOADER_PROGRAM_ARGS "-p") - set(loader_program_PATHS /usr/bin) # a path that is already listed in default path on Linux - endif() - if(NOT DEPENDENCIES_INSTALL_DIR) - message(FATAL_ERROR "DEPENDENCIES_INSTALL_DIR is not set of empty") - endif() + set(loader_program_names objdump) + set(LOADER_PROGRAM_ARGS "-p") + set(loader_program_PATHS /usr/bin) # a path that is already listed in default path on Linux + endif() + if(NOT DEPENDENCIES_INSTALL_DIR) + message(FATAL_ERROR "DEPENDENCIES_INSTALL_DIR is not set of empty") + endif() endif() find_program(LOADER_PROGRAM "${loader_program_names}" PATHS ${loader_program_PATHS}) @@ -40,11 +48,16 @@ macro(macro_super_package) set(PKG_SEARCHDIRS) if(WIN32) - file(GLOB MXE_GCC_LIB_DIR "${DEPENDENCIES_INSTALL_DIR}/bin/gcc*") - list(APPEND PKG_SEARCHDIRS ${MXE_GCC_LIB_DIR}) - list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/bin") #Qt - list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/lib") #Qwt - list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #mxe dlls + if(MSVC) + list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #all other dlls + list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/lib") #Qt & Qwt dlls + else() + file(GLOB MXE_GCC_LIB_DIR "${DEPENDENCIES_INSTALL_DIR}/bin/gcc*") + list(APPEND PKG_SEARCHDIRS ${MXE_GCC_LIB_DIR}) + list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/bin") #Qt + list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/lib") #Qwt + list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #mxe dlls + endif() else() #unixes list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib") #so list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/lib") #superbuild .so /.dylib @@ -185,8 +198,14 @@ function(func_install_xdk_files) set(QT_REQ_DIRS) if(WIN32) #only affects windows due to regex on dll - file(GLOB LIB_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/*dll.*") - install(FILES ${LIB_FILES} DESTINATION ${PKG_STAGE_DIR}/lib ) + if(MSVC) + file(GLOB LIB_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/*.lib") + else() + file(GLOB LIB_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/*dll.*") + endif() + func_lisp(LIB_FILES ) + + install(FILES ${LIB_FILES} DESTINATION ${PKG_STAGE_DIR}/lib ) file(GLOB ITK_EXTRA_DLL_FILES_1 "${DEPENDENCIES_INSTALL_DIR}/bin/libITK*.dll") install(FILES ${ITK_EXTRA_DLL_FILES_1} DESTINATION ${PKG_STAGE_DIR}/bin) @@ -295,6 +314,12 @@ function(func_install_support_files) set(PKG_SHARE_SOURCE_DIR ${DEPENDENCIES_INSTALL_DIR}/share) + set(GDAL_DATA ${PKG_SHARE_SOURCE_DIR}/gdal) + #MSVC install gdal-data in in a different directory. So we don't spoil it + if(MSVC) + set(GDAL_DATA ${DEPENDENCIES_INSTALL_DIR}/data) + endif() + # Just check if required variables are defined. foreach(req DEPENDENCIES_INSTALL_DIR @@ -323,7 +348,6 @@ function(func_install_support_files) endif() #NOT PKG_GENERATE_XDK ####################### install GDAL data ############################ - set(GDAL_DATA ${PKG_SHARE_SOURCE_DIR}/gdal) if(NOT EXISTS "${GDAL_DATA}/epsg.wkt") message(FATAL_ERROR "Cannot generate package without GDAL_DATA : ${GDAL_DATA} ${DEPENDENCIES_INSTALL_DIR}") endif() @@ -349,6 +373,14 @@ function(func_install_support_files) install(FILES ${PKG_SHARE_SOURCE_DIR}/copyright/LICENSE DESTINATION ${PKG_STAGE_DIR}) endif() + ####################### Install VERSION ########################## + file(GLOB OTB_VERSION_FILES ${OTB_INSTALL_DIR}/share/doc/OTB-*/VERSION) + if(OTB_VERSION_FILES) + list(SORT OTB_VERSION_FILES) + list(GET OTB_VERSION_FILES -1 OTB_LATEST_VERSION_FILE) + install(FILES ${OTB_LATEST_VERSION_FILE} DESTINATION ${PKG_STAGE_DIR}) + endif() + endfunction() function(func_install_otb_support_files) @@ -586,13 +618,12 @@ function(func_prepare_package) set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE} lib/otb/applications/${OTB_APP_SO_NAME}") endforeach() - # set(include_mvd 0) - # if(DEFINED Monteverdi_SOURCE_DIR) - # set(include_mvd 1) - # endif() - list(APPEND PKG_PEFILES ${OTB_APPS_LIST}) + set(ALLOWED_SYSTEM_DLLS_SEARCH_PATHS + /usr/lib + /lib64 ) + func_install_support_files() execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_BINARY_DIR}/temp_so_names_dir") @@ -606,13 +637,38 @@ function(func_prepare_package) func_process_deps(${bn}) endforeach() #message(STATUS "Processing done") + list(REMOVE_DUPLICATES notfound_dlls) + if(UNIX AND NOT APPLE) + foreach(allowed_system_dll ${ALLOWED_SYSTEM_DLLS}) + list (FIND notfound_dlls "${allowed_system_dll}" found_index) + if(${found_index} GREATER -1) + #find_file (<VAR> NAMES name PATHS paths... NO_DEFAULT_PATH) + find_file ( ${allowed_system_dll}_abs_path NAMES ${allowed_system_dll} + PATHS ${ALLOWED_SYSTEM_DLLS_SEARCH_PATHS} NO_DEFAULT_PATH) + if(${allowed_system_dll}_abs_path) + file(GLOB fff "${${allowed_system_dll}_abs_path}*") + foreach(f ${fff}) + func_is_file_a_symbolic_link("${f}" is_symlink linked_to_file) + if(is_symlink) + get_filename_component(name_of_f ${f} NAME) + file(APPEND + ${CMAKE_BINARY_DIR}/make_symlinks_temp + "ln -sf $OUT_DIR/lib/gtk/${linked_to_file} $OUT_DIR/lib/gtk/${name_of_f}\n" + ) + else() # is_symlink + install(FILES ${f} DESTINATION ${PKG_STAGE_DIR}/lib/gtk) + endif() + endforeach() + list(REMOVE_ITEM notfound_dlls "${allowed_system_dll}") + endif() + endif() + endforeach() + endif() #UNIX AND NOT APPLE list(LENGTH notfound_dlls nos) if(${nos} GREATER 0) - list(REMOVE_DUPLICATES notfound_dlls) - #string(REPLACE ";" "\r" notfound_dlls ${notfound_dlls}) - message(FATAL_ERROR "Following dlls were not found: ${notfound_dlls}. Please consider adding their paths to PKG_SEARCHDIRS when calling superbuild_package macro.") - endif() + message(FATAL_ERROR "Following dlls were not found: ${notfound_dlls}. Please consider adding their paths to PKG_SEARCHDIRS when calling macro_super_package macro.") + endif() #( ${nos} GREATER 0) file(GLOB temp_files "${CMAKE_BINARY_DIR}/temp_so_names_dir/*") # /lib/otb foreach(temp_file ${temp_files}) @@ -702,10 +758,18 @@ function(func_process_deps infile) if(loader_rv) message(FATAL_ERROR "loader_ev=${loader_ev}\n PACKAGE-OTB: result_variable is '${loader_rv}'") endif() - if(WIN32) - string(REGEX MATCHALL "DLL.Name..[A-Za-z(0-9\\.0-9)+_\\-]*" loader_ov "${loader_ov}") - string(REGEX REPLACE "DLL.Name.." "" needed_dlls "${loader_ov}") + if(MSVC) + string(REGEX MATCHALL "dependencies.(.*[Dd][Ll][Ll])" loader_ov "${loader_ov}") + string(REGEX REPLACE "dependencies.." "" loader_ov "${loader_ov}") + #beware of .DLL and .dll + string(REGEX REPLACE ".DLL" ".dll" loader_ov "${loader_ov}") + #convert to cmake list + string(REGEX REPLACE ".dll" ".dll;" needed_dlls "${loader_ov}") + else() + string(REGEX MATCHALL "DLL.Name..[A-Za-z(0-9\\.0-9)+_\\-]*" loader_ov "${loader_ov}") + string(REGEX REPLACE "DLL.Name.." "" needed_dlls "${loader_ov}") + endif() else() #case for unixes if(APPLE) string(REGEX REPLACE "[^\n]+cmd LC_LOAD_DYLIB\n[^\n]+\n[^\n]+name ([^\n]+).\\(offset[^\n]+\n" "rpath \\1\n" loader_ov "${loader_ov}") @@ -736,7 +800,7 @@ function(func_process_deps infile) set(notfound_dlls "${notfound_dlls}" PARENT_SCOPE ) endif() -endfunction() +endfunction() #function(func_process_deps infile) # The below function is modified from GetPrerequisities.cmake # which is distributed with CMake. @@ -830,6 +894,42 @@ function(func_is_file_a_symbolic_link file result_var1 result_var2) endif() endfunction() +macro(is_system_dll matched value) + set(${matched}) + string(TOLOWER ${value} value_) + foreach (pattern ${SYSTEM_DLLS}) + string(TOLOWER ${pattern} pattern_) + if("${value_}" MATCHES "${pattern_}") + set(${matched} TRUE) + endif() + endforeach() +endmacro() + +macro(list_contains var value) + set(${var}) + foreach(value2 ${ARGN}) + if(${value} STREQUAL ${value2}) + set(${var} TRUE) + endif() + endforeach(value2) +endmacro() + +# Get the translation files coming with Qt, and install them in the bundle +# They are loaded by Monteverdi. +function(get_qt_translation_files RESULT) + # These files are the "qt_<localename>.qm" files + # They are located in QT_TRANSLATIONS_DIR, which comes from FindQt4 + file(GLOB translation_files ${QT_TRANSLATIONS_DIR}/qt_*) + + # We need to remove the "qt_help_<localename>.qm" files from this list + foreach(translation_item ${translation_files}) + if(${translation_item} MATCHES "qt_help") + list(REMOVE_ITEM translation_files ${translation_item}) + endif() + endforeach() + + set(${RESULT} ${translation_files} PARENT_SCOPE) +endfunction() #func_lisp: - A list_process function (func_lisp) #This method process the input list inplace. @@ -862,7 +962,6 @@ function(func_lisp install_list ) endfunction() # func_lisp - set(WINDOWS_SYSTEM_DLLS msvc.*dll user32.dll @@ -884,7 +983,14 @@ set(WINDOWS_SYSTEM_DLLS opengl32.dll glu32.dll rpcrt4.dll - winspool.drv) + winspool.drv + api-ms-win-crt*.*.dll + vcruntime*.*.dll + normaliz.dll + concrt*.*.dll + odbc32.dll + psapi.dll + vcomp*.*.dll) set(LINUX_SYSTEM_DLLS libm.so @@ -905,6 +1011,10 @@ set(LINUX_SYSTEM_DLLS libdrm.so.2 libGL.so* libGLU.so* + libXrender.so* + libSM.so* + libICE.so* + libXrandr.so* ) # libgcc_s.*dylib and other *.framework are dragged by QT @@ -936,39 +1046,20 @@ else() #case for unixes endif() endif(WIN32) -macro(is_system_dll matched value) - set(${matched}) - string(TOLOWER ${value} value_) - foreach (pattern ${SYSTEM_DLLS}) - string(TOLOWER ${pattern} pattern_) - if("${value_}" MATCHES "${pattern_}") - set(${matched} TRUE) - endif() - endforeach() -endmacro() - -macro(list_contains var value) - set(${var}) - foreach(value2 ${ARGN}) - if(${value} STREQUAL ${value2}) - set(${var} TRUE) - endif() - endforeach(value2) -endmacro() - -# Get the translation files coming with Qt, and install them in the bundle -# They are loaded by Monteverdi. -function(get_qt_translation_files RESULT) - # These files are the "qt_<localename>.qm" files - # They are located in QT_TRANSLATIONS_DIR, which comes from FindQt4 - file(GLOB translation_files ${QT_TRANSLATIONS_DIR}/qt_*) - - # We need to remove the "qt_help_<localename>.qm" files from this list - foreach(translation_item ${translation_files}) - if(${translation_item} MATCHES "qt_help") - list(REMOVE_ITEM translation_files ${translation_item}) - endif() - endforeach() - - set(${RESULT} ${translation_files} PARENT_SCOPE) -endfunction() +#superbuild cannot manage build of gtk2+ just for qt gtkstyle. +# -gtkstyle option is deactivated by default in build of QT4 +# So the list of requirements on building OTB with superbuild stays same. +#For our user base, we need monteverdi with a nice look and feel +# rather than simply X11 based windows. Hence we need -gtkstyle +# This forces us to have system gtk+ installed on the system. +# OTB package manager 'this script' will pick them up and put +# into the binary package. Below cmake variable controls the list of +#libraries coming from /usr/lib a.k.a system. +set(ALLOWED_SYSTEM_DLLS + libfreetype.so.6 + libgthread-2.0.so.0 + libglib-2.0.so.0 + libgobject-2.0.so.0 + libXrender.so.1 + libfontconfig.so.1 + ) diff --git a/SuperBuild/patches/BOOST/1.54.0/boost/cstdint.hpp b/SuperBuild/patches/BOOST/1.54.0/boost/cstdint.hpp deleted file mode 100644 index 85a3b3e7ca28c8e7b04180941a6b057f0ab2038e..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/BOOST/1.54.0/boost/cstdint.hpp +++ /dev/null @@ -1,511 +0,0 @@ -// boost cstdint.hpp header file ------------------------------------------// - -// (C) Copyright Beman Dawes 1999. -// (C) Copyright Jens Mauer 2001 -// (C) Copyright John Maddock 2001 -// Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/integer for documentation. - -// Revision History -// 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.) -// 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer) -// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer) -// 12 Nov 00 Merged <boost/stdint.h> (Jens Maurer) -// 23 Sep 00 Added INTXX_C macro support (John Maddock). -// 22 Sep 00 Better 64-bit support (John Maddock) -// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost -// 8 Aug 99 Initial version (Beman Dawes) - - -#ifndef BOOST_CSTDINT_HPP -#define BOOST_CSTDINT_HPP - -// -// Since we always define the INT#_C macros as per C++0x, -// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right -// thing if possible, and so that the user knows that the macros -// are actually defined as per C99. -// -#ifndef __STDC_CONSTANT_MACROS -# define __STDC_CONSTANT_MACROS -#endif - -#include <boost/config.hpp> - -// -// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not -// depending upon what headers happen to have been included first... -// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG. -// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990 -// -#if defined(BOOST_HAS_STDINT_H) \ - && (!defined(__GLIBC__) \ - || defined(__GLIBC_HAVE_LONG_LONG) \ - || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17))))) - -// The following #include is an implementation artifact; not part of interface. -# ifdef __hpux -// HP-UX has a vaguely nice <stdint.h> in a non-standard location -# include <inttypes.h> -# ifdef __STDC_32_MODE__ - // this is triggered with GCC, because it defines __cplusplus < 199707L -# define BOOST_NO_INT64_T -# endif -# elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX) -# include <inttypes.h> -# else -# include <stdint.h> - -// There is a bug in Cygwin two _C macros -# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__) -# undef INTMAX_C -# undef UINTMAX_C -# define INTMAX_C(c) c##LL -# define UINTMAX_C(c) c##ULL -# endif - -# endif - -#ifdef __QNX__ - -// QNX (Dinkumware stdlib) defines these as non-standard names. -// Reflect to the standard names. - -typedef ::intleast8_t int_least8_t; -typedef ::intfast8_t int_fast8_t; -typedef ::uintleast8_t uint_least8_t; -typedef ::uintfast8_t uint_fast8_t; - -typedef ::intleast16_t int_least16_t; -typedef ::intfast16_t int_fast16_t; -typedef ::uintleast16_t uint_least16_t; -typedef ::uintfast16_t uint_fast16_t; - -typedef ::intleast32_t int_least32_t; -typedef ::intfast32_t int_fast32_t; -typedef ::uintleast32_t uint_least32_t; -typedef ::uintfast32_t uint_fast32_t; - -# ifndef BOOST_NO_INT64_T - -typedef ::intleast64_t int_least64_t; -typedef ::intfast64_t int_fast64_t; -typedef ::uintleast64_t uint_least64_t; -typedef ::uintfast64_t uint_fast64_t; - -# endif - -#endif - -namespace boost -{ - - using ::int8_t; - using ::int_least8_t; - using ::int_fast8_t; - using ::uint8_t; - using ::uint_least8_t; - using ::uint_fast8_t; - - using ::int16_t; - using ::int_least16_t; - using ::int_fast16_t; - using ::uint16_t; - using ::uint_least16_t; - using ::uint_fast16_t; - - using ::int32_t; - using ::int_least32_t; - using ::int_fast32_t; - using ::uint32_t; - using ::uint_least32_t; - using ::uint_fast32_t; - -# ifndef BOOST_NO_INT64_T - - using ::int64_t; - using ::int_least64_t; - using ::int_fast64_t; - using ::uint64_t; - using ::uint_least64_t; - using ::uint_fast64_t; - -# endif - - using ::intmax_t; - using ::uintmax_t; - -} // namespace boost - -#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) || defined(__VMS) -// FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need. -# include <inttypes.h> - -namespace boost { - - using ::int8_t; - typedef int8_t int_least8_t; - typedef int8_t int_fast8_t; - using ::uint8_t; - typedef uint8_t uint_least8_t; - typedef uint8_t uint_fast8_t; - - using ::int16_t; - typedef int16_t int_least16_t; - typedef int16_t int_fast16_t; - using ::uint16_t; - typedef uint16_t uint_least16_t; - typedef uint16_t uint_fast16_t; - - using ::int32_t; - typedef int32_t int_least32_t; - typedef int32_t int_fast32_t; - using ::uint32_t; - typedef uint32_t uint_least32_t; - typedef uint32_t uint_fast32_t; - -# ifndef BOOST_NO_INT64_T - - using ::int64_t; - typedef int64_t int_least64_t; - typedef int64_t int_fast64_t; - using ::uint64_t; - typedef uint64_t uint_least64_t; - typedef uint64_t uint_fast64_t; - - typedef int64_t intmax_t; - typedef uint64_t uintmax_t; - -# else - - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; - -# endif - -} // namespace boost - -#else // BOOST_HAS_STDINT_H - -# include <boost/limits.hpp> // implementation artifact; not part of interface -# include <limits.h> // needed for limits macros - - -namespace boost -{ - -// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit -// platforms. For other systems, they will have to be hand tailored. -// -// Because the fast types are assumed to be the same as the undecorated types, -// it may be possible to hand tailor a more efficient implementation. Such -// an optimization may be illusionary; on the Intel x86-family 386 on, for -// example, byte arithmetic and load/stores are as fast as "int" sized ones. - -// 8-bit types ------------------------------------------------------------// - -# if UCHAR_MAX == 0xff - typedef signed char int8_t; - typedef signed char int_least8_t; - typedef signed char int_fast8_t; - typedef unsigned char uint8_t; - typedef unsigned char uint_least8_t; - typedef unsigned char uint_fast8_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 16-bit types -----------------------------------------------------------// - -# if USHRT_MAX == 0xffff -# if defined(__crayx1) - // The Cray X1 has a 16-bit short, however it is not recommend - // for use in performance critical code. - typedef short int16_t; - typedef short int_least16_t; - typedef int int_fast16_t; - typedef unsigned short uint16_t; - typedef unsigned short uint_least16_t; - typedef unsigned int uint_fast16_t; -# else - typedef short int16_t; - typedef short int_least16_t; - typedef short int_fast16_t; - typedef unsigned short uint16_t; - typedef unsigned short uint_least16_t; - typedef unsigned short uint_fast16_t; -# endif -# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__) - // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified - // MTA / XMT does support the following non-standard integer types - typedef __short16 int16_t; - typedef __short16 int_least16_t; - typedef __short16 int_fast16_t; - typedef unsigned __short16 uint16_t; - typedef unsigned __short16 uint_least16_t; - typedef unsigned __short16 uint_fast16_t; -# elif (USHRT_MAX == 0xffffffff) && defined(CRAY) - // no 16-bit types on Cray: - typedef short int_least16_t; - typedef short int_fast16_t; - typedef unsigned short uint_least16_t; - typedef unsigned short uint_fast16_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 32-bit types -----------------------------------------------------------// - -# if UINT_MAX == 0xffffffff - typedef int int32_t; - typedef int int_least32_t; - typedef int int_fast32_t; - typedef unsigned int uint32_t; - typedef unsigned int uint_least32_t; - typedef unsigned int uint_fast32_t; -# elif (USHRT_MAX == 0xffffffff) - typedef short int32_t; - typedef short int_least32_t; - typedef short int_fast32_t; - typedef unsigned short uint32_t; - typedef unsigned short uint_least32_t; - typedef unsigned short uint_fast32_t; -# elif ULONG_MAX == 0xffffffff - typedef long int32_t; - typedef long int_least32_t; - typedef long int_fast32_t; - typedef unsigned long uint32_t; - typedef unsigned long uint_least32_t; - typedef unsigned long uint_fast32_t; -# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__) - // Integers are 64 bits on the MTA / XMT - typedef __int32 int32_t; - typedef __int32 int_least32_t; - typedef __int32 int_fast32_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int32 uint_least32_t; - typedef unsigned __int32 uint_fast32_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 64-bit types + intmax_t and uintmax_t ----------------------------------// - -# if defined(BOOST_HAS_LONG_LONG) && \ - !defined(BOOST_MSVC) && !defined(__BORLANDC__) && \ - (!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \ - (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) -# if defined(__hpux) - // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions -# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) - // 2**64 - 1 -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - - typedef ::boost::long_long_type intmax_t; - typedef ::boost::ulong_long_type uintmax_t; - typedef ::boost::long_long_type int64_t; - typedef ::boost::long_long_type int_least64_t; - typedef ::boost::long_long_type int_fast64_t; - typedef ::boost::ulong_long_type uint64_t; - typedef ::boost::ulong_long_type uint_least64_t; - typedef ::boost::ulong_long_type uint_fast64_t; - -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 - typedef long intmax_t; - typedef unsigned long uintmax_t; - typedef long int64_t; - typedef long int_least64_t; - typedef long int_fast64_t; - typedef unsigned long uint64_t; - typedef unsigned long uint_least64_t; - typedef unsigned long uint_fast64_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG) - __extension__ typedef long long intmax_t; - __extension__ typedef unsigned long long uintmax_t; - __extension__ typedef long long int64_t; - __extension__ typedef long long int_least64_t; - __extension__ typedef long long int_fast64_t; - __extension__ typedef unsigned long long uint64_t; - __extension__ typedef unsigned long long uint_least64_t; - __extension__ typedef unsigned long long uint_fast64_t; -# elif defined(BOOST_HAS_MS_INT64) - // - // we have Borland/Intel/Microsoft __int64: - // - typedef __int64 intmax_t; - typedef unsigned __int64 uintmax_t; - typedef __int64 int64_t; - typedef __int64 int_least64_t; - typedef __int64 int_fast64_t; - typedef unsigned __int64 uint64_t; - typedef unsigned __int64 uint_least64_t; - typedef unsigned __int64 uint_fast64_t; -# else // assume no 64-bit integers -# define BOOST_NO_INT64_T - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# endif - -} // namespace boost - - -#endif // BOOST_HAS_STDINT_H - -#endif // BOOST_CSTDINT_HPP - - -/**************************************************** - -Macro definition section: - -Added 23rd September 2000 (John Maddock). -Modified 11th September 2001 to be excluded when -BOOST_HAS_STDINT_H is defined (John Maddock). -Modified 11th Dec 2009 to always define the -INT#_C macros if they're not already defined (John Maddock). - -******************************************************/ - -#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \ - (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C)) -// -// For the following code we get several warnings along the lines of: -// -// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant -// -// So we declare this a system header to suppress these warnings. -// -#if defined(__GNUC__) && (__GNUC__ >= 4) -#pragma GCC system_header -#endif - -#include <limits.h> -# define BOOST__STDC_CONSTANT_MACROS_DEFINED -# if defined(BOOST_HAS_MS_INT64) -// -// Borland/Intel/Microsoft compilers have width specific suffixes: -// -#ifndef INT8_C -# define INT8_C(value) value##i8 -#endif -#ifndef INT16_C -# define INT16_C(value) value##i16 -#endif -#ifndef INT32_C -# define INT32_C(value) value##i32 -#endif -#ifndef INT64_C -# define INT64_C(value) value##i64 -#endif -# ifdef __BORLANDC__ - // Borland bug: appending ui8 makes the type a signed char -# define UINT8_C(value) static_cast<unsigned char>(value##u) -# else -# define UINT8_C(value) value##ui8 -# endif -#ifndef UINT16_C -# define UINT16_C(value) value##ui16 -#endif -#ifndef UINT32_C -# define UINT32_C(value) value##ui32 -#endif -#ifndef UINT64_C -# define UINT64_C(value) value##ui64 -#endif -#ifndef INTMAX_C -# define INTMAX_C(value) value##i64 -# define UINTMAX_C(value) value##ui64 -#endif - -# else -// do it the old fashioned way: - -// 8-bit types ------------------------------------------------------------// - -# if (UCHAR_MAX == 0xff) && !defined(INT8_C) -# define INT8_C(value) static_cast<boost::int8_t>(value) -# define UINT8_C(value) static_cast<boost::uint8_t>(value##u) -# endif - -// 16-bit types -----------------------------------------------------------// - -# if (USHRT_MAX == 0xffff) && !defined(INT16_C) -# define INT16_C(value) static_cast<boost::int16_t>(value) -# define UINT16_C(value) static_cast<boost::uint16_t>(value##u) -# endif - -// 32-bit types -----------------------------------------------------------// -#ifndef INT32_C -# if (UINT_MAX == 0xffffffff) -# define INT32_C(value) value -# define UINT32_C(value) value##u -# elif ULONG_MAX == 0xffffffff -# define INT32_C(value) value##L -# define UINT32_C(value) value##uL -# endif -#endif - -// 64-bit types + intmax_t and uintmax_t ----------------------------------// -#ifndef INT64_C -# if defined(BOOST_HAS_LONG_LONG) && \ - (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX)) - -# if defined(__hpux) - // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions -# define INT64_C(value) value##LL -# define UINT64_C(value) value##uLL -# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \ - (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \ - (defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL) - -# define INT64_C(value) value##LL -# define UINT64_C(value) value##uLL -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615U // 2**64 - 1 -# define INT64_C(value) value##L -# define UINT64_C(value) value##uL -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif defined(BOOST_HAS_LONG_LONG) - // Usual macros not defined, work things out for ourselves: -# if(~0uLL == 18446744073709551615ULL) -# define INT64_C(value) value##LL -# define UINT64_C(value) value##uLL -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -# ifdef BOOST_NO_INT64_T -# define INTMAX_C(value) INT32_C(value) -# define UINTMAX_C(value) UINT32_C(value) -# else -# define INTMAX_C(value) INT64_C(value) -# define UINTMAX_C(value) UINT64_C(value) -# endif -#endif -# endif // Borland/Microsoft specific width suffixes - -#endif // INT#_C macros. - - - - diff --git a/SuperBuild/patches/BOOST/1.54.0/boost/date_time/local_time/custom_time_zone.hpp b/SuperBuild/patches/BOOST/1.54.0/boost/date_time/local_time/custom_time_zone.hpp deleted file mode 100644 index 7396c59421ca9c9a26d21d5e7f8da009b421839e..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/BOOST/1.54.0/boost/date_time/local_time/custom_time_zone.hpp +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ -#define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ - -/* Copyright (c) 2003-2005 CrystalClear Software, Inc. - * Subject to the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - * Author: Jeff Garland, Bart Garst - * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ - */ - -#include "boost/date_time/time_zone_base.hpp" -#include "boost/date_time/time_zone_names.hpp" -#include "boost/date_time/posix_time/posix_time.hpp" -#include "boost/date_time/local_time/dst_transition_day_rules.hpp" -#include "boost/date_time/string_convert.hpp" -//#include "boost/date_time/special_defs.hpp" -#include "boost/shared_ptr.hpp" - -namespace boost { -namespace local_time { - - //typedef boost::date_time::time_zone_names time_zone_names; - typedef boost::date_time::dst_adjustment_offsets<boost::posix_time::time_duration> dst_adjustment_offsets; - //typedef boost::date_time::time_zone_base<boost::posix_time::ptime> time_zone; - typedef boost::shared_ptr<dst_calc_rule> dst_calc_rule_ptr; - - //! A real time zone - template<class CharT> - class custom_time_zone_base : public date_time::time_zone_base<posix_time::ptime,CharT> { - public: - typedef boost::posix_time::time_duration time_duration_type; - typedef date_time::time_zone_base<posix_time::ptime,CharT> base_type; - typedef typename base_type::string_type string_type; - typedef typename base_type::stringstream_type stringstream_type; - typedef date_time::time_zone_names_base<CharT> time_zone_names; - typedef CharT char_type; - - custom_time_zone_base(const time_zone_names& zone_names, - const time_duration_type& utc_offset, - const dst_adjustment_offsets& dst_shift, - boost::shared_ptr<dst_calc_rule> calc_rule) : - zone_names_(zone_names), - base_utc_offset_(utc_offset), - dst_offsets_(dst_shift), - dst_calc_rules_(calc_rule) - {} - virtual ~custom_time_zone_base() {} - virtual string_type dst_zone_abbrev() const - { - return zone_names_.dst_zone_abbrev(); - } - virtual string_type std_zone_abbrev() const - { - return zone_names_.std_zone_abbrev(); - } - virtual string_type dst_zone_name() const - { - return zone_names_.dst_zone_name(); - } - virtual string_type std_zone_name() const - { - return zone_names_.std_zone_name(); - } - //! True if zone uses daylight savings adjustments - virtual bool has_dst() const - { - return (bool) dst_calc_rules_; //if calc_rule is set the tz has dst - } - //! Local time that DST starts -- NADT if has_dst is false - virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const - { - gregorian::date d(gregorian::not_a_date_time); - if (dst_calc_rules_) { - d = dst_calc_rules_->start_day(y); - } - return posix_time::ptime(d, dst_offsets_.dst_start_offset_); - } - //! Local time that DST ends -- NADT if has_dst is false - virtual posix_time::ptime dst_local_end_time(gregorian::greg_year y) const - { - gregorian::date d(gregorian::not_a_date_time); - if (dst_calc_rules_) { - d = dst_calc_rules_->end_day(y); - } - return posix_time::ptime(d, dst_offsets_.dst_end_offset_); - } - //! Base offset from UTC for zone (eg: -07:30:00) - virtual time_duration_type base_utc_offset() const - { - return base_utc_offset_; - } - //! Adjustment forward or back made while DST is in effect - virtual time_duration_type dst_offset() const - { - return dst_offsets_.dst_adjust_; - } - //! Returns a POSIX time_zone string for this object - virtual string_type to_posix_string() const - { - // std offset dst [offset],start[/time],end[/time] - w/o spaces - stringstream_type ss; - ss.fill('0'); - boost::shared_ptr<dst_calc_rule> no_rules; - // std - ss << std_zone_abbrev(); - // offset - if(base_utc_offset().is_negative()) { - // inverting the sign guarantees we get two digits - ss << '-' << std::setw(2) << base_utc_offset().invert_sign().hours(); - } - else { - ss << '+' << std::setw(2) << base_utc_offset().hours(); - } - if(base_utc_offset().minutes() != 0 || base_utc_offset().seconds() != 0) { - ss << ':' << std::setw(2) << base_utc_offset().minutes(); - if(base_utc_offset().seconds() != 0) { - ss << ':' << std::setw(2) << base_utc_offset().seconds(); - } - } - if(dst_calc_rules_ != no_rules) { - // dst - ss << dst_zone_abbrev(); - // dst offset - if(dst_offset().is_negative()) { - // inverting the sign guarantees we get two digits - ss << '-' << std::setw(2) << dst_offset().invert_sign().hours(); - } - else { - ss << '+' << std::setw(2) << dst_offset().hours(); - } - if(dst_offset().minutes() != 0 || dst_offset().seconds() != 0) { - ss << ':' << std::setw(2) << dst_offset().minutes(); - if(dst_offset().seconds() != 0) { - ss << ':' << std::setw(2) << dst_offset().seconds(); - } - } - // start/time - ss << ',' << date_time::convert_string_type<char, char_type>(dst_calc_rules_->start_rule_as_string()) << '/' - << std::setw(2) << dst_offsets_.dst_start_offset_.hours() << ':' - << std::setw(2) << dst_offsets_.dst_start_offset_.minutes(); - if(dst_offsets_.dst_start_offset_.seconds() != 0) { - ss << ':' << std::setw(2) << dst_offsets_.dst_start_offset_.seconds(); - } - // end/time - ss << ',' << date_time::convert_string_type<char, char_type>(dst_calc_rules_->end_rule_as_string()) << '/' - << std::setw(2) << dst_offsets_.dst_end_offset_.hours() << ':' - << std::setw(2) << dst_offsets_.dst_end_offset_.minutes(); - if(dst_offsets_.dst_end_offset_.seconds() != 0) { - ss << ':' << std::setw(2) << dst_offsets_.dst_end_offset_.seconds(); - } - } - - return ss.str(); - } - private: - time_zone_names zone_names_; - bool has_dst_; - time_duration_type base_utc_offset_; - dst_adjustment_offsets dst_offsets_; - boost::shared_ptr<dst_calc_rule> dst_calc_rules_; - }; - - typedef custom_time_zone_base<char> custom_time_zone; - -} }//namespace - - - -#endif diff --git a/SuperBuild/patches/BOOST/1.54.0/boost/log/utility/once_block.hpp b/SuperBuild/patches/BOOST/1.54.0/boost/log/utility/once_block.hpp deleted file mode 100644 index c8633aac9584794542030e07c08978b6e493165a..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/BOOST/1.54.0/boost/log/utility/once_block.hpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright Andrey Semashev 2007 - 2013. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -/*! - * \file once_block.hpp - * \author Andrey Semashev - * \date 23.06.2010 - * - * \brief The header defines classes and macros for once-blocks. - */ - -#ifndef BOOST_LOG_UTILITY_ONCE_BLOCK_HPP_INCLUDED_ -#define BOOST_LOG_UTILITY_ONCE_BLOCK_HPP_INCLUDED_ - -#include <boost/log/detail/config.hpp> -#include <boost/log/utility/unique_identifier_name.hpp> -#include <boost/log/detail/header.hpp> - -#ifdef BOOST_LOG_HAS_PRAGMA_ONCE -#pragma once -#endif - -#ifndef BOOST_LOG_NO_THREADS - -namespace boost { - -BOOST_LOG_OPEN_NAMESPACE - -/*! - * \brief A flag to detect if a code block has already been executed. - * - * This structure should be used in conjunction with the \c BOOST_LOG_ONCE_BLOCK_FLAG - * macro. Usage example: - * - * <code> - * void foo() - * { - * static once_block_flag flag = BOOST_LOG_ONCE_BLOCK_INIT; - * BOOST_LOG_ONCE_BLOCK_FLAG(flag) - * { - * puts("Hello, world once!"); - * } - * } - * </code> - */ -struct once_block_flag -{ -#ifndef BOOST_LOG_DOXYGEN_PASS - // Do not use, implementation detail - enum - { - uninitialized = 0, - being_initialized, - initialized - } - status; -#endif // BOOST_LOG_DOXYGEN_PASS -}; - -/*! - * \def BOOST_LOG_ONCE_BLOCK_INIT - * - * The static initializer for \c once_block_flag. - */ -#define BOOST_LOG_ONCE_BLOCK_INIT { boost::log::once_block_flag::uninitialized } - -namespace aux { - -class once_block_sentry -{ -private: - once_block_flag& m_Flag; - -public: - explicit once_block_sentry(once_block_flag& f) : m_Flag(f) - { - } - - ~once_block_sentry() - { - if (m_Flag.status != once_block_flag::initialized) - rollback(); - } - - bool executed() const - { - return (m_Flag.status == once_block_flag::initialized || enter_once_block()); - } - - BOOST_LOG_API void commit(); - -private: - // Non-copyable, non-assignable - once_block_sentry(once_block_sentry const&); - once_block_sentry& operator= (once_block_sentry const&); - - BOOST_LOG_API bool enter_once_block() const; - BOOST_LOG_API void rollback(); -}; - -} // namespace aux - -BOOST_LOG_CLOSE_NAMESPACE // namespace log - -} // namespace boost - -#else // BOOST_LOG_NO_THREADS - -namespace boost { - -BOOST_LOG_OPEN_NAMESPACE - -struct once_block_flag -{ - bool status; -}; - -#define BOOST_LOG_ONCE_BLOCK_INIT { false } - -namespace aux { - -class once_block_sentry -{ -private: - once_block_flag& m_Flag; - -public: - explicit once_block_sentry(once_block_flag& f) : m_Flag(f) - { - } - - bool executed() const - { - return m_Flag.status; - } - - void commit() - { - m_Flag.status = true; - } - -private: - // Non-copyable, non-assignable - once_block_sentry(once_block_sentry const&); - once_block_sentry& operator= (once_block_sentry const&); -}; - -} // namespace aux - -BOOST_LOG_CLOSE_NAMESPACE // namespace log - -} // namespace boost - -#endif // BOOST_LOG_NO_THREADS - -#ifndef BOOST_LOG_DOXYGEN_PASS - -#define BOOST_LOG_ONCE_BLOCK_FLAG_INTERNAL(flag_var, sentry_var)\ - for (boost::log::aux::once_block_sentry sentry_var((flag_var));\ - !sentry_var.executed(); sentry_var.commit()) - -#define BOOST_LOG_ONCE_BLOCK_INTERNAL(flag_var, sentry_var)\ - static boost::log::once_block_flag flag_var = BOOST_LOG_ONCE_BLOCK_INIT;\ - BOOST_LOG_ONCE_BLOCK_FLAG_INTERNAL(flag_var, sentry_var) - -#endif // BOOST_LOG_DOXYGEN_PASS - -/*! - * \def BOOST_LOG_ONCE_BLOCK_FLAG(flag_var) - * - * Begins a code block to be executed only once, with protection against thread concurrency. - * User has to provide the flag variable that controls whether the block has already - * been executed. - */ -#define BOOST_LOG_ONCE_BLOCK_FLAG(flag_var)\ - BOOST_LOG_ONCE_BLOCK_FLAG_INTERNAL(\ - flag_var,\ - BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_once_block_sentry_)) - -/*! - * \def BOOST_LOG_ONCE_BLOCK() - * - * Begins a code block to be executed only once, with protection against thread concurrency. - */ -#define BOOST_LOG_ONCE_BLOCK()\ - BOOST_LOG_ONCE_BLOCK_INTERNAL(\ - BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_once_block_flag_),\ - BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_once_block_sentry_)) - -#include <boost/log/detail/footer.hpp> - -#endif // BOOST_LOG_UTILITY_ONCE_BLOCK_HPP_INCLUDED_ diff --git a/SuperBuild/patches/BOOST/1.54.0/boost/thread/win32/thread_primitives.hpp b/SuperBuild/patches/BOOST/1.54.0/boost/thread/win32/thread_primitives.hpp deleted file mode 100644 index 7f05ca5a88b90cc8b34c1aecd56dbdaf0ea81959..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/BOOST/1.54.0/boost/thread/win32/thread_primitives.hpp +++ /dev/null @@ -1,471 +0,0 @@ -#ifndef BOOST_WIN32_THREAD_PRIMITIVES_HPP -#define BOOST_WIN32_THREAD_PRIMITIVES_HPP - -// win32_thread_primitives.hpp -// -// (C) Copyright 2005-7 Anthony Williams -// (C) Copyright 2007 David Deakins -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/thread/detail/config.hpp> -#include <boost/throw_exception.hpp> -#include <boost/assert.hpp> -#include <boost/thread/exceptions.hpp> -#include <boost/detail/interlocked.hpp> -#include <algorithm> - -#ifndef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 -#if _WIN32_WINNT >= 0x0600 -//#define BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 -#endif -#endif - -#if defined( BOOST_USE_WINDOWS_H ) -# include <windows.h> - -namespace boost -{ - namespace detail - { - namespace win32 - { -#ifdef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 - typedef unsigned long long ticks_type; -#else - typedef unsigned long ticks_type; -#endif - typedef ULONG_PTR ulong_ptr; - typedef HANDLE handle; - unsigned const infinite=INFINITE; - unsigned const timeout=WAIT_TIMEOUT; - handle const invalid_handle_value=INVALID_HANDLE_VALUE; - unsigned const event_modify_state=EVENT_MODIFY_STATE; - unsigned const synchronize=SYNCHRONIZE; - unsigned const wait_abandoned=WAIT_ABANDONED; - - -# ifdef BOOST_NO_ANSI_APIS - using ::CreateMutexW; - using ::CreateEventW; - using ::OpenEventW; - using ::CreateSemaphoreW; -# else - using ::CreateMutexA; - using ::CreateEventA; - using ::OpenEventA; - using ::CreateSemaphoreA; -# endif - using ::CloseHandle; - using ::ReleaseMutex; - using ::ReleaseSemaphore; - using ::SetEvent; - using ::ResetEvent; - using ::WaitForMultipleObjects; - using ::WaitForSingleObject; - using ::GetCurrentProcessId; - using ::GetCurrentThreadId; - using ::GetCurrentThread; - using ::GetCurrentProcess; - using ::DuplicateHandle; - using ::SleepEx; - using ::Sleep; - using ::QueueUserAPC; - using ::GetTickCount; -#ifdef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 - using ::GetTickCount64; -#else - inline ticks_type GetTickCount64() { return GetTickCount(); } -#endif - } - } -} -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) - -# ifdef UNDER_CE -# ifndef WINAPI -# ifndef _WIN32_WCE_EMULATION -# define WINAPI __cdecl // Note this doesn't match the desktop definition -# else -# define WINAPI __stdcall -# endif -# endif - -# ifdef __cplusplus -extern "C" { -# endif -typedef int BOOL; -typedef unsigned long DWORD; -typedef void* HANDLE; - -# include <kfuncs.h> -# ifdef __cplusplus -} -# endif -# endif - - -namespace boost -{ - namespace detail - { - namespace win32 - { -#ifdef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 - typedef unsigned long long ticks_type; -#else - typedef unsigned long ticks_type; -#endif -# ifdef _WIN64 - typedef unsigned __int64 ulong_ptr; -# else - typedef unsigned long ulong_ptr; -# endif - typedef void* handle; - unsigned const infinite=~0U; - unsigned const timeout=258U; - handle const invalid_handle_value=(handle)(-1); - unsigned const event_modify_state=2; - unsigned const synchronize=0x100000u; - unsigned const wait_abandoned=0x00000080u; - - extern "C" - { - struct _SECURITY_ATTRIBUTES; -# ifdef BOOST_NO_ANSI_APIS - __declspec(dllimport) void* __stdcall CreateMutexW(_SECURITY_ATTRIBUTES*,int,wchar_t const*); - __declspec(dllimport) void* __stdcall CreateSemaphoreW(_SECURITY_ATTRIBUTES*,long,long,wchar_t const*); - __declspec(dllimport) void* __stdcall CreateEventW(_SECURITY_ATTRIBUTES*,int,int,wchar_t const*); - __declspec(dllimport) void* __stdcall OpenEventW(unsigned long,int,wchar_t const*); -# else - __declspec(dllimport) void* __stdcall CreateMutexA(_SECURITY_ATTRIBUTES*,int,char const*); - __declspec(dllimport) void* __stdcall CreateSemaphoreA(_SECURITY_ATTRIBUTES*,long,long,char const*); - __declspec(dllimport) void* __stdcall CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*); - __declspec(dllimport) void* __stdcall OpenEventA(unsigned long,int,char const*); -# endif - __declspec(dllimport) int __stdcall CloseHandle(void*); - __declspec(dllimport) int __stdcall ReleaseMutex(void*); - __declspec(dllimport) unsigned long __stdcall WaitForSingleObject(void*,unsigned long); - __declspec(dllimport) unsigned long __stdcall WaitForMultipleObjects(unsigned long nCount,void* const * lpHandles,int bWaitAll,unsigned long dwMilliseconds); - __declspec(dllimport) int __stdcall ReleaseSemaphore(void*,long,long*); - __declspec(dllimport) int __stdcall DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long); - __declspec(dllimport) unsigned long __stdcall SleepEx(unsigned long,int); - __declspec(dllimport) void __stdcall Sleep(unsigned long); - typedef void (__stdcall *queue_user_apc_callback_function)(ulong_ptr); - __declspec(dllimport) unsigned long __stdcall QueueUserAPC(queue_user_apc_callback_function,void*,ulong_ptr); - - __declspec(dllimport) unsigned long __stdcall GetTickCount(); -# ifdef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 - __declspec(dllimport) ticks_type __stdcall GetTickCount64(); -# endif -# ifndef UNDER_CE - __declspec(dllimport) unsigned long __stdcall GetCurrentProcessId(); - __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(); - __declspec(dllimport) void* __stdcall GetCurrentThread(); - __declspec(dllimport) void* __stdcall GetCurrentProcess(); - __declspec(dllimport) int __stdcall SetEvent(void*); - __declspec(dllimport) int __stdcall ResetEvent(void*); -# else - using ::GetCurrentProcessId; - using ::GetCurrentThreadId; - using ::GetCurrentThread; - using ::GetCurrentProcess; - using ::SetEvent; - using ::ResetEvent; -# endif - } -# ifndef BOOST_THREAD_WIN32_HAS_GET_TICK_COUNT_64 - inline ticks_type GetTickCount64() { return GetTickCount(); } -# endif - } - } -} -#else -# error "Win32 functions not available" -#endif - -#include <boost/config/abi_prefix.hpp> - -namespace boost -{ - namespace detail - { - namespace win32 - { - enum event_type - { - auto_reset_event=false, - manual_reset_event=true - }; - - enum initial_event_state - { - event_initially_reset=false, - event_initially_set=true - }; - - inline handle create_anonymous_event(event_type type,initial_event_state state) - { -#if !defined(BOOST_NO_ANSI_APIS) - handle const res=win32::CreateEventA(0,type,state,0); -#else - handle const res=win32::CreateEventW(0,type,state,0); -#endif - if(!res) - { - boost::throw_exception(thread_resource_error()); - } - return res; - } - - inline handle create_anonymous_semaphore(long initial_count,long max_count) - { -#if !defined(BOOST_NO_ANSI_APIS) - handle const res=CreateSemaphoreA(0,initial_count,max_count,0); -#else - handle const res=CreateSemaphoreW(0,initial_count,max_count,0); -#endif - if(!res) - { - boost::throw_exception(thread_resource_error()); - } - return res; - } - inline handle create_anonymous_semaphore_nothrow(long initial_count,long max_count) - { -#if !defined(BOOST_NO_ANSI_APIS) - handle const res=CreateSemaphoreA(0,initial_count,max_count,0); -#else - handle const res=CreateSemaphoreW(0,initial_count,max_count,0); -#endif - return res; - } - - inline handle duplicate_handle(handle source) - { - handle const current_process=GetCurrentProcess(); - long const same_access_flag=2; - handle new_handle=0; - bool const success=DuplicateHandle(current_process,source,current_process,&new_handle,0,false,same_access_flag)!=0; - if(!success) - { - boost::throw_exception(thread_resource_error()); - } - return new_handle; - } - - inline void release_semaphore(handle semaphore,long count) - { - BOOST_VERIFY(ReleaseSemaphore(semaphore,count,0)!=0); - } - - class BOOST_THREAD_DECL handle_manager - { - private: - handle handle_to_manage; - handle_manager(handle_manager&); - handle_manager& operator=(handle_manager&); - - void cleanup() - { - if(handle_to_manage && handle_to_manage!=invalid_handle_value) - { - BOOST_VERIFY(CloseHandle(handle_to_manage)); - } - } - - public: - explicit handle_manager(handle handle_to_manage_): - handle_to_manage(handle_to_manage_) - {} - handle_manager(): - handle_to_manage(0) - {} - - handle_manager& operator=(handle new_handle) - { - cleanup(); - handle_to_manage=new_handle; - return *this; - } - - operator handle() const - { - return handle_to_manage; - } - - handle duplicate() const - { - return duplicate_handle(handle_to_manage); - } - - void swap(handle_manager& other) - { - std::swap(handle_to_manage,other.handle_to_manage); - } - - handle release() - { - handle const res=handle_to_manage; - handle_to_manage=0; - return res; - } - - bool operator!() const - { - return !handle_to_manage; - } - - ~handle_manager() - { - cleanup(); - } - }; - - } - } -} - -#if defined(BOOST_MSVC) && (_MSC_VER>=1400) && !defined(UNDER_CE) - -namespace boost -{ - namespace detail - { - namespace win32 - { -#if _MSC_VER==1400 - extern "C" unsigned char _interlockedbittestandset(long *a,long b); - extern "C" unsigned char _interlockedbittestandreset(long *a,long b); -#else - extern "C" unsigned char _interlockedbittestandset(volatile long *a,long b); - extern "C" unsigned char _interlockedbittestandreset(volatile long *a,long b); -#endif - -#pragma intrinsic(_interlockedbittestandset) -#pragma intrinsic(_interlockedbittestandreset) - - inline bool interlocked_bit_test_and_set(long* x,long bit) - { - return _interlockedbittestandset(x,bit)!=0; - } - - inline bool interlocked_bit_test_and_reset(long* x,long bit) - { - return _interlockedbittestandreset(x,bit)!=0; - } - - } - } -} -#define BOOST_THREAD_BTS_DEFINED -#elif (defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)) && defined(_M_IX86) -namespace boost -{ - namespace detail - { - namespace win32 - { - inline bool interlocked_bit_test_and_set(long* x,long bit) - { -#ifndef BOOST_INTEL_CXX_VERSION - __asm { - mov eax,bit; - mov edx,x; - lock bts [edx],eax; - setc al; - }; -#else - bool ret; - __asm { - mov eax,bit - mov edx,x - lock bts [edx],eax - setc al - mov ret, al - }; - return ret; - -#endif - } - - inline bool interlocked_bit_test_and_reset(long* x,long bit) - { -#ifndef BOOST_INTEL_CXX_VERSION - __asm { - mov eax,bit; - mov edx,x; - lock btr [edx],eax; - setc al; - }; -#else - bool ret; - __asm { - mov eax,bit - mov edx,x - lock btr [edx],eax - setc al - mov ret, al - }; - return ret; - -#endif - } - - } - } -} -#define BOOST_THREAD_BTS_DEFINED -#endif - -#ifndef BOOST_THREAD_BTS_DEFINED - -namespace boost -{ - namespace detail - { - namespace win32 - { - inline bool interlocked_bit_test_and_set(long* x,long bit) - { - long const value=1<<bit; - long old=*x; - do - { - long const current=BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,old|value,old); - if(current==old) - { - break; - } - old=current; - } - while(true); - return (old&value)!=0; - } - - inline bool interlocked_bit_test_and_reset(long* x,long bit) - { - long const value=1<<bit; - long old=*x; - do - { - long const current=BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,old&~value,old); - if(current==old) - { - break; - } - old=current; - } - while(true); - return (old&value)!=0; - } - } - } -} -#endif - -#include <boost/config/abi_suffix.hpp> - -#endif diff --git a/SuperBuild/patches/BOOST/1.54.0/libs/coroutine/build/Jamfile.v2 b/SuperBuild/patches/BOOST/1.54.0/libs/coroutine/build/Jamfile.v2 deleted file mode 100644 index 4954465650662cdb548f9a76aa030cfdfc3f0d74..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/BOOST/1.54.0/libs/coroutine/build/Jamfile.v2 +++ /dev/null @@ -1,53 +0,0 @@ - -# Copyright Oliver Kowalke 2009. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import feature ; -import modules ; -import toolset ; - -feature.feature segmented-stacks : on : optional propagated composite ; -feature.compose <segmented-stacks>on : <define>BOOST_USE_SEGMENTED_STACKS ; - -project boost/coroutine - : requirements - <library>/boost/context//boost_context - <toolset>gcc-4.7,<segmented-stacks>on:<cxxflags>-fsplit-stack - <toolset>gcc-4.7,<segmented-stacks>on:<linkflags>"-static-libgcc" - <toolset>gcc-4.8,<segmented-stacks>on:<cxxflags>-fsplit-stack - <toolset>gcc-4.8,<segmented-stacks>on:<linkflags>"-static-libgcc" - <link>static - <threading>multi - : source-location ../src - : usage-requirements - <link>shared:<define>BOOST_COROUTINES_DYN_LINK=1 - ; - -alias allocator_sources - : detail/standard_stack_allocator_windows.cpp - : <target-os>windows - ; - -alias allocator_sources - : detail/standard_stack_allocator_posix.cpp - detail/segmented_stack_allocator.cpp - : <segmented-stacks>on - ; - -alias allocator_sources - : detail/standard_stack_allocator_posix.cpp - ; - -explicit allocator_sources ; - -lib boost_coroutine - : allocator_sources - detail/coroutine_context.cpp - : <link>shared:<define>BOOST_COROUTINES_DYN_LINK=1 - : - : <link>shared:<library>../../context/build//boost_context - ; - -boost-install boost_coroutine ; diff --git a/SuperBuild/patches/BOOST/CMakeLists.txt b/SuperBuild/patches/BOOST/CMakeLists.txt index eec33836bd40952279eff3c045cc1e1e2111cf35..d5f069dadce0a6728b24d7dd63da4e25d5c0842d 100644 --- a/SuperBuild/patches/BOOST/CMakeLists.txt +++ b/SuperBuild/patches/BOOST/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 2.8.3) -project(boost) +project(OTB-SuperBuildBoost) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/boost DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp" PATTERN "*.h") - diff --git a/SuperBuild/patches/GDAL/CMakeLists.txt b/SuperBuild/patches/GDAL/CMakeLists.txt deleted file mode 100644 index bf48724a8bd284aff72803ccd84b1b5fc0fd3f13..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) - -project(gdal_install) - -file(GLOB GDAL_APPS "${GDAL_BUILD_DIR}/apps/*.exe") -foreach(GDAL_APP ${GDAL_APPS}) -install(FILES ${GDAL_APP} DESTINATION bin/gdal/apps COMPONENT Development) -endforeach() - -file(GLOB GDAL_DATAS "${GDAL_BUILD_DIR}/data/*.*") -message(STATUS ${GDAL_DATAS}) -foreach(GDAL_DATA ${GDAL_DATAS}) -install(FILES ${GDAL_DATA} DESTINATION bin/gdal-data COMPONENT Development) -endforeach() - - - # if exist $(OUTPUT_DIR)\bin\gdal\plugins del $(OUTPUT_DIR)\bin\gdal\plugins\*.dll - # if exist $(OUTPUT_DIR)\bin\gdal\plugins-optional del $(OUTPUT_DIR)\bin\gdal\plugins-optional\*.dll - # if exist $(OUTPUT_DIR)\bin\gdal\plugins-external del $(OUTPUT_DIR)\bin\gdal\plugins-external\*.dll - -file(GLOB ${PROJECT_NAME}_HEADERS -"${GDAL_BUILD_DIR}/port/*.h" -"${GDAL_BUILD_DIR}/gcore/*.h" -"${GDAL_BUILD_DIR}/alg/*.h" -"${GDAL_BUILD_DIR}/ogr/*.h" -"${GDAL_BUILD_DIR}/frmts/mem/memdataset.h" -"${GDAL_BUILD_DIR}/frmts/raw/rawdataset.h" -"${GDAL_BUILD_DIR}/frmts/vrt/*.h" -"${GDAL_BUILD_DIR}/ogr/ogrsf_frmts/*.h") - -file(GLOB ${PROJECT_NAME}_LIBS "${GDAL_BUILD_DIR}/*.lib" ) - -file(GLOB ${PROJECT_NAME}_DLLS "${GDAL_BUILD_DIR}/*.dll" ) - -foreach(${PROJECT_NAME}_HEADER ${${PROJECT_NAME}_HEADERS}) -install(FILES ${${PROJECT_NAME}_HEADER} - DESTINATION include - COMPONENT Development) -endforeach() - -foreach(${PROJECT_NAME}_LIB ${${PROJECT_NAME}_LIBS}) -install(FILES ${${PROJECT_NAME}_LIB} - DESTINATION lib - COMPONENT Development) -endforeach() - -foreach(${PROJECT_NAME}_DLL ${${PROJECT_NAME}_DLLS}) -install(FILES ${${PROJECT_NAME}_DLL} - DESTINATION bin - COMPONENT Development) -endforeach() \ No newline at end of file diff --git a/SuperBuild/patches/GDAL/GNUmakefile b/SuperBuild/patches/GDAL/GNUmakefile deleted file mode 100644 index 71f029d8726dbf9cda8644471ceee789f1e279cf..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/GNUmakefile +++ /dev/null @@ -1,95 +0,0 @@ - - -include ../../GDALmake.opt - -ifndef PYTHON - PYTHON=python -endif - -all: build - -BINDING = python -include ../SWIGmake.base - -PACKAGE_DIR=osgeo -SWIGOUTPUTDIR=extensions/ - -SCRIPTS = `ls ./scripts` -PY_COMMANDS = epsg_tr.py gdalchksum.py gdal2xyz.py gcps2wld.py \ - gdalimport.py gdal_merge.py pct2rgb.py rgb2pct.py \ - gcps2vec.py -PY_MODULES = ${PACKAGE_DIR}/gdal.py ${PACKAGE_DIR}/ogr.py ${PACKAGE_DIR}/osr.py ${PACKAGE_DIR}/gdalconst.py ${PACKAGE_DIR}/gdal_array.py - -clean: - -rm -f ${PACKAGE_DIR}/*.pyc - -rm -rf build - -rm -f *.pyc - -rm -rf *.egg-info - -rm -f *.so ./osgeo/*.so - -rm -rf dist - -SWIGARGS += -outdir "${PACKAGE_DIR}" - - -veryclean: clean - -rm -f ${WRAPPERS} ${PY_MODULES} - -rm -f ${SWIGOUTPUTDIR}/gdal_wrap.cpp - -rm -f ${SWIGOUTPUTDIR}/gdalconst_wrap.c - -rm -f ${SWIGOUTPUTDIR}/ogr_wrap.cpp - -rm -f ${SWIGOUTPUTDIR}/osr_wrap.cpp - -rm -f ${SWIGOUTPUTDIR}/gdal_array_wrap.cpp - -gdal_wrap.cpp: ../include/python/gdal_python.i - -ogr_wrap.cpp: ../include/python/ogr_python.i - -osr_wrap.cpp: ../include/python/osr_python.i - -gdal_array_wrap.cpp: ../include/gdal_array.i ../include/python/typemaps_python.i - $(SWIG) $(SWIGARGS) $(SWIGDEFINES) -I$(GDAL_ROOT) -c++ -$(BINDING) -o $(SWIGOUTPUTDIR)$@ gdal_array.i - -# A few hacks (cat, mv) : the first one for SWIG < 1.3.36 and the second one for SWIG <= 1.3.39 python 3.X on 64bit platforms -# The python3.2.patch is from https://sourceforge.net/tracker/?func=detail&aid=3057804&group_id=1645&atid=101645 -# and is no longer necessary with swig 2.0.4 -generate: ${WRAPPERS} gdal_array_wrap.cpp - for i in gdal_wrap.cpp gdalconst_wrap.c ogr_wrap.cpp osr_wrap.cpp gdal_array_wrap.cpp; do sed "s/PyErr_Format(PyExc_RuntimeError, mesg)/PyErr_SetString(PyExc_RuntimeError, mesg)/" ${SWIGOUTPUTDIR}/$$i | sed "s/int len;/Py_ssize_t len;/" > ${SWIGOUTPUTDIR}/$$i.tmp; mv -f ${SWIGOUTPUTDIR}/$$i.tmp ${SWIGOUTPUTDIR}/$$i; done - -grep "1\.3\.40" extensions/gdal_wrap.cpp >/dev/null && patch -p0 < python3.2.patch - -grep "1\.3\.40" extensions/gdal_wrap.cpp >/dev/null && cat python3.2.patch | sed "s/gdal_wrap/ogr_wrap/" | patch -p0 - -grep "1\.3\.40" extensions/gdal_wrap.cpp >/dev/null && cat python3.2.patch | sed "s/gdal_wrap/osr_wrap/" | patch -p0 - -grep "1\.3\.40" extensions/gdal_wrap.cpp >/dev/null && cat python3.2.patch | sed "s/gdal_wrap\.cpp/gdalconst_wrap\.c/" | patch -p0 - -grep "1\.3\.40" extensions/gdal_wrap.cpp >/dev/null && cat python3.2.patch | sed "s/gdal_wrap/gdal_array_wrap/" | patch -p0 - -build: - $(PYTHON) setup.py build - -egg: - $(PYTHON) setup.py bdist_egg - -install: - -ifeq ($(PY_HAVE_SETUPTOOLS),1) - $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) --install-purelib=$(prefix)/lib --install-scripts=$(prefix)/bin --install-platlib=$(prefix)/lib -else - $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) -endif - - for f in $(SCRIPTS) ; do $(INSTALL) ./scripts/$$f $(DESTDIR)$(INST_BIN) ; done - -docs: - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrlayer_8cpp.xml ../include/python/docs/ogr_layer_docs.i OGRLayerShadow OGR_L_ - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrgeometry_8cpp.xml ../include/python/docs/ogr_geometry_docs.i OGRGeometryShadow OGR_G_ - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrdatasource_8cpp.xml ../include/python/docs/ogr_datasource_docs.i OGRDataSourceShadow OGR_DS_ - - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrsfdriver_8cpp.xml ../include/python/docs/ogr_driver_docs.i OGRDriverShadow OGR_Dr_ - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrfeature_8cpp.xml ../include/python/docs/ogr_feature_docs.i OGRFeatureShadow OGR_F_ - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrfeaturedefn_8cpp.xml ../include/python/docs/ogr_featuredef_docs.i OGRFeatureDefnShadow OGR_FD_ - - $(PYTHON) ../include/python/docs/doxy2swig.py ../../ogr/xml/ogrfielddefn_8cpp.xml ../include/python/docs/ogr_fielddef_docs.i OGRFieldDefnShadow OGR_Fld_ - -epydoc: generate - epydoc --config epydoc.conf diff --git a/SuperBuild/patches/GDAL/S2_patch/GDALmake.opt.in b/SuperBuild/patches/GDAL/S2_patch/GDALmake.opt.in deleted file mode 100644 index 4c5e219200fcc72a18cb5485401718f0e0660230..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/GDALmake.opt.in +++ /dev/null @@ -1,579 +0,0 @@ -GDAL_ROOT = @abs_top_builddir@ -top_builddir = $(GDAL_ROOT) - -# -# the library can be built by the native build or with the help of libtool -# - -SHELL = @SHELL@ -HAVE_LIBTOOL = @HAVE_LIBTOOL@ -LIBTOOL = @LIBTOOL@ -ifeq ($(HAVE_LIBTOOL),yes) -LIBTOOL_COMPILE_CC = $(LIBTOOL) --mode=compile --tag=CC -LIBTOOL_COMPILE_CXX = $(LIBTOOL) --mode=compile --tag=CXX -LIBTOOL_LINK = $(LIBTOOL) --mode=link -LIBTOOL_INSTALL = $(LIBTOOL) --mode=install -LIBTOOL_FINISH = $(LIBTOOL) --mode=finish --silent -LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean -OBJ_EXT = lo -else -LIBTOOL_FINISH = @BINTRUE@ -OBJ_EXT = o -endif - -CC = $(LIBTOOL_COMPILE_CC) @CC@ -CXX = $(LIBTOOL_COMPILE_CXX) @CXX@ -LD = $(LIBTOOL_LINK) @CXX@ -RM = $(LIBTOOL_CLEAN) /bin/rm -f *.lo -INSTALL = $(LIBTOOL_INSTALL) $(GDAL_ROOT)/install-sh -c -INSTALL_LIB = $(LIBTOOL_INSTALL) $(GDAL_ROOT)/install-sh -c -INSTALL_DATA = $(GDAL_ROOT)/install-sh -c -m 0644 -INSTALL_DIR = $(GDAL_ROOT)/install-sh -d - -# SDE_LIB needs to be first because it embeds zlib. We need to use its symbols instead of -lz's - -LIBS = $(SDE_LIB) @LIBS@ $(KAK_LIBS) $(DWG_LIBS) $(CURL_LIB) \ - $(MRSID_LIBS) $(MRSID_LIDAR_LIBS) $(ECW_LIBS) $(INGRES_LIB) \ - $(PCIDSK_LIB) $(RASDAMAN_LIB) $(CHARLS_LIB) $(SOSI_LIB) \ - $(OPENCL_LIB) $(JVM_LIB) $(LIBICONV) $(FGDB_LIB) $(LIBXML2_LIB) - -AVXFLAGS = @AVXFLAGS@ -HAVE_AVX_AT_COMPILE_TIME = @HAVE_AVX_AT_COMPILE_TIME@ - -PYTHON = @PYTHON@ -PY_HAVE_SETUPTOOLS=@PY_HAVE_SETUPTOOLS@ - -# Next Generation SWIG bindings -BINDINGS = @BINDINGS@ - -HAVE_OGDI = @HAVE_OGDI@ -OGR_ENABLED = @OGR_ENABLED@ - -OSX_FRAMEWORK_PREFIX = /Library/Frameworks/GDAL.framework -OSX_VERSION_FRAMEWORK_PREFIX = ${OSX_FRAMEWORK_PREFIX}/Versions/@GDAL_VERSION_MAJOR@.@GDAL_VERSION_MINOR@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -INST_PREFIX = @exec_prefix@ -INST_INCLUDE = @includedir@ -INST_DATA = @datadir@ -INST_LIB = @libdir@ -INST_BIN = @bindir@ -INST_PYMOD = @pymoddir@ -INST_DOCS = @exec_prefix@/doc -INST_MAN = @mandir@ -INST_HTML = $(HOME)/www/gdal - -CPPFLAGS = @CPPFLAGS@ -I$(GDAL_ROOT)/port @EXTRA_INCLUDES@ -CFLAGS = @CFLAGS@ @C_WFLAGS@ $(USER_DEFS) -CXXFLAGS = @CXXFLAGS@ @CXX_WFLAGS@ $(USER_DEFS) -LDFLAGS = @LDFLAGS@ - -RANLIB = @RANLIB@ -SO_EXT = @SO_EXT@ -LD_SHARED = @LD_SHARED@ -EXE = @EXE_EXT@ - -ifeq ($(notdir $(LD_SHARED)),true) -HAVE_LD_SHARED = no -else -HAVE_LD_SHARED = yes -endif - -GDAL_INCLUDE = -I$(GDAL_ROOT)/port -I$(GDAL_ROOT)/gcore \ - -I$(GDAL_ROOT)/alg \ - -I$(GDAL_ROOT)/ogr -I$(GDAL_ROOT)/ogr/ogrsf_frmts - -# libtool targets and help variables -LIBGDAL := libgdal.la -LIBGDAL_CURRENT := 19 -LIBGDAL_REVISION := 2 -LIBGDAL_AGE := 18 - -# native build targets and variables -GDAL_VER = @GDAL_VER@ - -# version info -GDAL_VERSION_MAJOR = @GDAL_VERSION_MAJOR@ -GDAL_VERSION_MINOR = @GDAL_VERSION_MINOR@ -GDAL_VERSION_REV = @GDAL_VERSION_REV@ - -GDAL_LIB = $(GDAL_ROOT)/libgdal.a -GDAL_SLIB = $(GDAL_ROOT)/libgdal.$(SO_EXT) -GDAL_SLIB_LINK = -L$(GDAL_ROOT) -lgdal - -# Mac OS X Framework definition -MACOSX_FRAMEWORK = @MACOSX_FRAMEWORK@ - -# -# GDAL/OGR PostgreSQL support. -# -HAVE_OGR_PG = @HAVE_PG@ -HAVE_POSTGISRASTER = @HAVE_PG@ -PG_INC = @PG_INC@ - -# -# INGRES -# -II_SYSTEM = @II_SYSTEM@ -HAVE_INGRES = @HAVE_INGRES@ -INGRES_LIB = @INGRES_LIB@ -INGRES_INC = @INGRES_INC@ - -# -# MySQL support. -# -HAVE_MYSQL = @HAVE_MYSQL@ -MYSQL_LIB = @MYSQL_LIB@ -MYSQL_INC = @MYSQL_INC@ -LIBS += $(MYSQL_LIB) - -# -# HDF4 Support. -# -HAVE_HDF4 = @HAVE_HDF4@ -HDF4_INCLUDE = @HDF4_INCLUDE@ -I$(GDAL_ROOT)/ogr - -# -# HDF5 Support. -# -HAVE_HDF5 = @HAVE_HDF5@ -HDF5_INCLUDE = @HDF5_INCLUDE@ - -# -# NetCDF Support. -# -NETCDF_ROOT = @NETCDF_ROOT@ -NETCDF_HAS_NC4 = @NETCDF_HAS_NC4@ -NETCDF_HAS_HDF4 = @NETCDF_HAS_HDF4@ - -# -# DODS Include file location -# -DODS_INC = @DODS_INC@ -ifeq ($(DODS_INC),) -HAVE_DODS = no -else -HAVE_DODS = yes -endif - -# -# SQLite -# -SQLITE_INC = @SQLITE_INC@ -SQLITE_HAS_COLUMN_METADATA = @SQLITE_HAS_COLUMN_METADATA@ -HAVE_SQLITE = @HAVE_SQLITE@ -HAVE_SPATIALITE = @HAVE_SPATIALITE@ -SPATIALITE_INC = @SPATIALITE_INC@ -SPATIALITE_AMALGAMATION = @SPATIALITE_AMALGAMATION@ -SPATIALITE_412_OR_LATER = @SPATIALITE_412_OR_LATER@ -HAVE_PCRE = @HAVE_PCRE@ - -# -# JPEG2000 via Kakadu Support. -# -KAKDIR = @KAKDIR@ - -ifneq ($(KAKDIR),) -ifeq ($(HAVE_LIBTOOL),yes) -include $(GDAL_ROOT)/frmts/jp2kak/jp2kak.lst -KAK_LIBS = $(KAK_OBJ) -endif -endif - -# -# JPEG-2000 Support via JasPer library. -# -HAVE_JASPER = @HAVE_JASPER@ -JASPER_FLAGS = @JASPER_FLAGS@ - -# -# JPEG-2000 Support via OpenJPEG library. -# -HAVE_OPENJPEG = @HAVE_OPENJPEG@ -OPENJPEG_VERSION = @OPENJPEG_VERSION@ - -# -# MrSID support via LizardTech's DSDK -# -MRSID_FLAGS = @MRSID_FLAGS@ -MRSID_INCLUDE = @MRSID_INCLUDE@ -MRSID_LIBS = @MRSID_LIBS@ - -# -# -# MrSID/MG4 support via LizardTech LiDAR SDK -# -MRSID_LIDAR_INCLUDE = @MRSID_LIDAR_INCLUDE@ -MRSID_LIDAR_LIBS = @MRSID_LIDAR_LIBS@ - -# -# ECW Related -# -ECW_FLAGS = @ECW_FLAGS@ -ECW_INCLUDE = @ECW_INCLUDE@ -ECW_LIBS = @ECW_LIBS@ - -# Xerces C++ XML Parser for GML and ILI -# -HAVE_XERCES = @HAVE_XERCES@ -XERCES_INCLUDE = @XERCES_INCLUDE@ - -# -# Enable NAS format -# -HAVE_NAS = @HAVE_NAS@ - -# -# Expat XML Parser for KML, GPX, GeoRSS (and GML if no Xerces C++) -# -HAVE_EXPAT = @HAVE_EXPAT@ -EXPAT_INCLUDE = @EXPAT_INCLUDE@ - -# -# Google libkml for the new OGR KML driver written by Brian Case -# -HAVE_LIBKML = @HAVE_LIBKML@ -LIBKML_INCLUDE = @LIBKML_INCLUDE@ - -# -# Oracle Spatial Support -# -HAVE_OCI = @HAVE_OCI@ -OCI_INCLUDE = @OCI_INCLUDE@ - -# GEOS Support - -HAVE_GEOS = @HAVE_GEOS@ -GEOS_CFLAGS = @GEOS_CFLAGS@ - -# GRASS Support - -GRASS_SETTING = @GRASS_SETTING@ -GRASS_INCLUDE = @GRASS_INCLUDE@ -GRASS_GISBASE = @GRASS_GISBASE@ -HAVE_GRASS = @HAVE_GRASS@ - -# -# SDE -# -HAVE_SDE = @SDE_ENABLED@ -SDE_LIB = @SDE_LIB@ -SDE_INC = @SDE_INC@ - -# -# FileGDB -# -HAVE_FGDB = @FGDB_ENABLED@ -FGDB_LIB = @FGDB_LIB@ -FGDB_INC = @FGDB_INC@ - -# -# ArcObjects -# -HAVE_ARCOBJECTS = @ARCOBJECTS_ENABLED@ -ARCOBJECTS_LIB = @ARCOBJECTS_LIB@ -ARCOBJECTS_INC = @ARCOBJECTS_INC@ - -# -# Curl -# -CURL_SETTING = @CURL_SETTING@ -CURL_LIB = @CURL_LIB@ -CURL_INC = @CURL_INC@ - -# -# libjson-c -# -LIBJSONC_SETTING = @LIBJSONC_SETTING@ -JSON_INCLUDE = @JSON_INCLUDE@ - -# -# OpenCL support -# -OPENCL_LIB = @OPENCL_LIB@ -OPENCL_FLAGS = @OPENCL_FLAGS@ - -# -# SOSI support -# -SOSI_INC = @SOSI_INC@ -SOSI_LIB = @SOSI_LIB@ -HAVE_SOSI = @SOSI_ENABLED@ - - -# -# PCIDSK SDK -# -PCIDSK_SETTING = @PCIDSK_SETTING@ -PCIDSK_LIB = @PCIDSK_LIB@ -PCIDSK_INCLUDE = @PCIDSK_INCLUDE@ - -# -# Iconv -# -LIBICONV = @LIBICONV@ - -# -# LIBXML2 -# - -HAVE_LIBXML2 = @HAVE_LIBXML2@ -LIBXML2_INC = @LIBXML2_INC@ -LIBXML2_LIB = @LIBXML2_LIB@ - -# -# DWGdirect Library -# -DWGDIRECT = @DWGDIRECT@ -DWG_PLT = @DWG_PLT@ - -ifneq ($(DWGDIRECT),) -DWG_LIBDIR = $(DWGDIRECT)/lib/$(DWG_PLT) -DWG_LIBS = $(DWG_LIBDIR)/DD_$(DWG_PLT)_ModelerGeometry.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_AcisRenderer.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Br.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_AcisBuilder.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Db.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Gs.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_SpatialIndex.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Gi.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Ge.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Root.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_FT.a \ - $(DWG_LIBDIR)/DD_$(DWG_PLT)_Alloc.a -HAVE_DWGDIRECT = yes -else -DWG_LIBS = -HAVE_DWGDIRECT = no -endif - -# -# Informix DataBlade support -# -HAVE_IDB = @HAVE_IDB@ -IDB_INC = @IDB_INC@ -IDB_LIB = @IDB_LIB@ -ifeq ($(HAVE_IDB),yes) -LIBS += $(IDB_LIB) -endif - -# -# FMEObjects -# -ifeq (@X_FME_HOME@,) -HAVE_FME = no -FME_INCLUDE = -else -HAVE_FME = yes -FME_INCLUDE = -I@X_FME_HOME@/fmeobjects/cpp -endif - -# PCRaster support -PCRASTER_SETTING = @PCRASTER_SETTING@ - -OGDI_INCLUDE = @OGDI_INCLUDE@ - -PNG_SETTING = @PNG_SETTING@ -JPEG_SETTING = @JPEG_SETTING@ -JPEG12_ENABLED = @JPEG12_ENABLED@ -TIFF_JPEG12_ENABLED = @TIFF_JPEG12_ENABLED@ -TIFF_SETTING = @TIFF_SETTING@ -TIFF_OPTS = @TIFF_OPTS@ -RENAME_INTERNAL_LIBTIFF_SYMBOLS = @RENAME_INTERNAL_LIBTIFF_SYMBOLS@ -GEOTIFF_SETTING = @GEOTIFF_SETTING@ -GEOTIFF_INCLUDE = @GEOTIFF_INCLUDE@ -RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS = @RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS@ -GIF_SETTING = @GIF_SETTING@ -FITS_SETTING = @FITS_SETTING@ -OGDI_SETTING = @HAVE_OGDI@ -ODBC_SETTING = @ODBC_SETTING@ -# PGeo driver is built-in when ODBC is available -PGEO_SETTING = @ODBC_SETTING@ -MSSQLSPATIAL_SETTING = @ODBC_SETTING@ -GEOMEDIA_SETTING = @ODBC_SETTING@ -NETCDF_SETTING = @NETCDF_SETTING@ -LIBZ_SETTING = @LIBZ_SETTING@ -LIBLZMA_SETTING = @LIBLZMA_SETTING@ - -# -# DDS via Crunch Support. -# -CRUNCHDIR = @CRUNCHDIR@ - -# -# Rasdaman stuff -# -RASDAMAN_ENABLED = @RASDAMAN_ENABLED@ -RASDAMAN_INC = @RASDAMAN_INC@ -RASDAMAN_LIB = @RASDAMAN_LIB@ - -# -# Poppler stuff -# - -HAVE_POPPLER = @HAVE_POPPLER@ -POPPLER_HAS_OPTCONTENT = @POPPLER_HAS_OPTCONTENT@ -POPPLER_BASE_STREAM_HAS_TWO_ARGS = @POPPLER_BASE_STREAM_HAS_TWO_ARGS@ -POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@ -POPPLER_0_23_OR_LATER = @POPPLER_0_23_OR_LATER@ -POPPLER_INC = @POPPLER_INC@ - -# -# Podofo stuff -# - -HAVE_PODOFO = @HAVE_PODOFO@ -PODOFO_INC = @PODOFO_INC@ - -# -# CharLs stuff -# Uncomment and adapt paths to enable JPEGLS driver -# -#HAVE_CHARLS = yes -#CHARLS_INC = -I/path/to/charls_include -#CHARLS_LIB = -L/path/to/charls_lib -lCharLS - -# -# PROJ.4 stuff -# -PROJ_STATIC = @PROJ_STATIC@ -ifeq ($(PROJ_STATIC),yes) -PROJ_FLAGS = -DPROJ_STATIC -endif -PROJ_INCLUDE = @PROJ_INCLUDE@ - -PAM_SETTING = @PAM_SETTING@ - -ifeq ($(OGR_ENABLED),yes) -GDAL_LIBS := $(GDAL_LIB) $(OCI_LIB) $(GDAL_LIBS) -CPPFLAGS := -DOGR_ENABLED $(CPPFLAGS) -else -GDAL_LIBS = $(GDAL_LIB) -endif - -# -# Java stuff -# -JAVA_HOME = @JAVA_HOME@ -JAVA_INC = @JAVA_INC@ -JVM_LIB = @JVM_LIB@ - -MDB_ENABLED = @MDB_ENABLED@ - -HAVE_ARMADILLO = @HAVE_ARMADILLO@ - -# -# freexl stuff -# - -HAVE_FREEXL = @HAVE_FREEXL@ -FREEXL_INCLUDE = @FREEXL_INCLUDE@ - -# -# Note these codes have to exactly match the format directory names, -# and their uppercase form should be the format portion of the -# format registration entry point. eg. gdb -> GDALRegister_GDB(). -# -GDAL_FORMATS = gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm \ - sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b \ - nitf bmp pcidsk airsar rs2 ilwis rmf leveller sgi srtmhgt \ - idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg \ - coasp tsx terragen blx msgn til r northwood saga xyz hf2 \ - kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map\ - sentinel2 \ - @OPT_GDAL_FORMATS@ - - -ifneq ($(LIBZ_SETTING),no) -GDAL_FORMATS := $(GDAL_FORMATS) rik ozi pdf -endif - -ifeq ($(OGR_ENABLED),yes) -ifeq ($(HAVE_SQLITE),yes) -GDAL_FORMATS := $(GDAL_FORMATS) rasterlite mbtiles -endif -endif - -ifeq ($(HAVE_POSTGISRASTER),yes) -GDAL_FORMATS := $(GDAL_FORMATS) postgisraster -endif - -ifeq ($(HAVE_CHARLS),yes) -GDAL_FORMATS := $(GDAL_FORMATS) jpegls -endif - -ifeq ($(OGR_ENABLED),yes) -GDAL_FORMATS := $(GDAL_FORMATS) arg -endif - -# -# CONFIG_LIBS is what local program should link against, and CONFIG_LIBS_INS -# is what will be emitted into the gdal-config script that is installed -# globally. -# - -ifeq ($(HAVE_LIBTOOL), yes) - -CONFIG_LIBS = $(GDAL_ROOT)/$(LIBGDAL) -ifeq ($(MACOSX_FRAMEWORK),yes) -CONFIG_LIBS_INS = -L$(INST_LIB)/unix/lib -lgdal -else -CONFIG_LIBS_INS = -L$(INST_LIB) -lgdal -endif # MACOSX_FRAMEWORK - -EXE_DEP_LIBS = $(GDAL_ROOT)/$(LIBGDAL) -SO_EXT = la - -else # HAVE_LIBTOOL - -ifeq ($(HAVE_LD_SHARED),yes) -CONFIG_LIBS = $(GDAL_SLIB_LINK) $(LIBS) -ifeq ($(MACOSX_FRAMEWORK),yes) -CONFIG_LIBS_INS = -L$(INST_LIB)/unix/lib -lgdal -else -CONFIG_LIBS_INS = -L$(INST_LIB) -lgdal -endif -EXE_DEP_LIBS = $(GDAL_SLIB) -else -CONFIG_LIBS = $(GDAL_LIBS) $(LIBS) -CONFIG_LIBS_INS = $(foreach LF,$(GDAL_LIBS),$(INST_LIB)/$(notdir $(LF)))\ - $(LIBS) -EXE_DEP_LIBS = $(GDAL_LIB) -endif - -endif # HAVE_LIBTOOL - - -# -# generic library rules -# - -# -# gdal and ogr low level drivers use the following default rules in order to -# populate the ../o/ directory with all object and library object files -# - -O_OBJ = $(foreach file,$(OBJ),../o/$(file)) - -../o/%.$(OBJ_EXT): %.c - $(CC) $(GDAL_INCLUDE) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -../o/%.$(OBJ_EXT): %.cpp - $(CXX) $(GDAL_INCLUDE) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< - -%.$(OBJ_EXT): %.c - $(CC) $(GDAL_INCLUDE) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -%.$(OBJ_EXT): %.cpp - $(CXX) $(GDAL_INCLUDE) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< - -# -# default rules for handling subdirectories -# - -%-target: - $(MAKE) -C $* - -%-clean: - $(MAKE) -C $* clean diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/gdalallregister.cpp b/SuperBuild/patches/GDAL/S2_patch/frmts/gdalallregister.cpp deleted file mode 100644 index 72f069fa0d3841105dbdbbac5242ff48552a5ee9..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/gdalallregister.cpp +++ /dev/null @@ -1,543 +0,0 @@ -/****************************************************************************** - * $Id: gdalallregister.cpp 27196 2014-04-16 11:41:24Z rouault $ - * - * Project: GDAL Core - * Purpose: Implementation of GDALAllRegister(), primary format registration. - * Author: Frank Warmerdam, warmerdam@pobox.com - * - ****************************************************************************** - * Copyright (c) 1998, Frank Warmerdam - * Copyright (c) 2007-2014, Even Rouault <even dot rouault at mines-paris dot org> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - ****************************************************************************/ - -#include "gdal_priv.h" -#include "gdal_frmts.h" - -CPL_CVSID("$Id: gdalallregister.cpp 27196 2014-04-16 11:41:24Z rouault $"); - -#ifdef notdef -// we may have a use for this some day -static char *szConfiguredFormats = "GDAL_FORMATS"; -#endif - -/************************************************************************/ -/* GDALAllRegister() */ -/* */ -/* Register all identifiably supported formats. */ -/************************************************************************/ - -/** - * Register all known configured GDAL drivers. - * - * This function will drive any of the following that are configured into - * GDAL. Many others as well haven't been updated in this - * documentation (see <a href="http://gdal.org/formats_list.html">full list</a>): - * - * <ul> - * <li> GeoTIFF (GTiff) - * <li> Geosoft GXF (GXF) - * <li> Erdas Imagine (HFA) - * <li> CEOS (CEOS) - * <li> ELAS (ELAS) - * <li> Arc/Info Binary Grid (AIGrid) - * <li> SDTS Raster DEM (SDTS) - * <li> OGDI (OGDI) - * <li> ESRI Labelled BIL (EHdr) - * <li> PCI .aux Labelled Raw Raster (PAux) - * <li> HDF4 Hierachal Data Format Release 4 - * <li> HDF5 Hierachal Data Format Release 5 - * <li> GSAG Golden Software ASCII Grid - * <li> GSBG Golden Software Binary Grid - * </ul> - * - * This function should generally be called once at the beginning of the application. - */ - -void CPL_STDCALL GDALAllRegister() - -{ - GetGDALDriverManager()->AutoLoadDrivers(); - -#ifdef FRMT_vrt - GDALRegister_VRT(); -#endif - -#ifdef FRMT_gdb - GDALRegister_GDB(); -#endif - -#ifdef FRMT_gtiff - GDALRegister_GTiff(); -#endif - -#ifdef FRMT_nitf - GDALRegister_NITF(); - GDALRegister_RPFTOC(); - GDALRegister_ECRGTOC(); -#endif - -#ifdef FRMT_hfa - GDALRegister_HFA(); -#endif - -#ifdef FRMT_ceos2 - GDALRegister_SAR_CEOS(); -#endif - -#ifdef FRMT_ceos - GDALRegister_CEOS(); -#endif - -#ifdef FRMT_jaxapalsar - GDALRegister_PALSARJaxa(); -#endif - -#ifdef FRMT_gff - GDALRegister_GFF(); -#endif - -#ifdef FRMT_elas - GDALRegister_ELAS(); -#endif - -#ifdef FRMT_aigrid -// GDALRegister_AIGrid2(); - GDALRegister_AIGrid(); -#endif - -#ifdef FRMT_aaigrid - GDALRegister_AAIGrid(); - GDALRegister_GRASSASCIIGrid(); -#endif - -#ifdef FRMT_sdts - GDALRegister_SDTS(); -#endif - -#ifdef FRMT_ogdi - GDALRegister_OGDI(); -#endif - -#ifdef FRMT_dted - GDALRegister_DTED(); -#endif - -#ifdef FRMT_png - GDALRegister_PNG(); -#endif - -#ifdef FRMT_dds - GDALRegister_DDS(); -#endif - -#ifdef FRMT_gta - GDALRegister_GTA(); -#endif - -#ifdef FRMT_jpeg - GDALRegister_JPEG(); -#endif - -#ifdef FRMT_mem - GDALRegister_MEM(); -#endif - -#ifdef FRMT_jdem - GDALRegister_JDEM(); -#endif - -#ifdef FRMT_rasdaman - GDALRegister_RASDAMAN(); -#endif - -#ifdef FRMT_gif - GDALRegister_GIF(); - GDALRegister_BIGGIF(); -#endif - -#ifdef FRMT_envisat - GDALRegister_Envisat(); -#endif - -#ifdef FRMT_fits - GDALRegister_FITS(); -#endif - -#ifdef FRMT_bsb - GDALRegister_BSB(); -#endif - -#ifdef FRMT_xpm - GDALRegister_XPM(); -#endif - -#ifdef FRMT_bmp - GDALRegister_BMP(); -#endif - -#ifdef FRMT_dimap - GDALRegister_DIMAP(); -#endif - -#ifdef FRMT_airsar - GDALRegister_AirSAR(); -#endif - -#ifdef FRMT_rs2 - GDALRegister_RS2(); -#endif - -#ifdef FRMT_pcidsk - GDALRegister_PCIDSK(); -#endif - -#ifdef FRMT_pcraster - GDALRegister_PCRaster(); -#endif - -#ifdef FRMT_ilwis - GDALRegister_ILWIS(); -#endif - -#ifdef FRMT_sgi - GDALRegister_SGI(); -#endif - -#ifdef FRMT_srtmhgt - GDALRegister_SRTMHGT(); -#endif - -#ifdef FRMT_leveller - GDALRegister_Leveller(); -#endif - -#ifdef FRMT_terragen - GDALRegister_Terragen(); -#endif - -#ifdef FRMT_netcdf - GDALRegister_GMT(); - GDALRegister_netCDF(); -#endif - -#ifdef FRMT_hdf4 - GDALRegister_HDF4(); - GDALRegister_HDF4Image(); -#endif - -#ifdef FRMT_pds - GDALRegister_ISIS3(); - GDALRegister_ISIS2(); - GDALRegister_PDS(); -#endif - -#ifdef FRMT_til - GDALRegister_TIL(); -#endif - -#ifdef FRMT_ers - GDALRegister_ERS(); -#endif - -#ifdef FRMT_jp2kak -// JPEG2000 support using Kakadu toolkit - GDALRegister_JP2KAK(); -#endif - -#ifdef FRMT_jpipkak -// JPEG2000 support using Kakadu toolkit - GDALRegister_JPIPKAK(); -#endif - -#ifdef FRMT_ecw - GDALRegister_ECW(); - GDALRegister_JP2ECW(); -#endif - -#ifdef FRMT_openjpeg -// JPEG2000 support using OpenJPEG library - GDALRegister_JP2OpenJPEG(); -#endif - -#ifdef FRMT_l1b - GDALRegister_L1B(); -#endif - -#ifdef FRMT_fit - GDALRegister_FIT(); -#endif - -#ifdef FRMT_grib - GDALRegister_GRIB(); -#endif - -#ifdef FRMT_mrsid - GDALRegister_MrSID(); -#endif - -#ifdef FRMT_jpeg2000 -// JPEG2000 support using JasPer toolkit -// This one should always be placed after other JasPer supported formats, -// such as BMP or PNM. In other case we will get bad side effects. - GDALRegister_JPEG2000(); -#endif - -#ifdef FRMT_mrsid_lidar - GDALRegister_MG4Lidar(); -#endif - -#ifdef FRMT_rmf - GDALRegister_RMF(); -#endif - -#ifdef FRMT_wcs - GDALRegister_WCS(); -#endif - -#ifdef FRMT_wms - GDALRegister_WMS(); -#endif - -#ifdef FRMT_sde - GDALRegister_SDE(); -#endif - -#ifdef FRMT_msgn - GDALRegister_MSGN(); -#endif - -#ifdef FRMT_msg - GDALRegister_MSG(); -#endif - -#ifdef FRMT_idrisi - GDALRegister_IDRISI(); -#endif - -#ifdef FRMT_ingr - GDALRegister_INGR(); -#endif - -#ifdef FRMT_gsg - GDALRegister_GSAG(); - GDALRegister_GSBG(); - GDALRegister_GS7BG(); -#endif - -#ifdef FRMT_cosar - GDALRegister_COSAR(); -#endif - -#ifdef FRMT_tsx - GDALRegister_TSX(); -#endif - -#ifdef FRMT_coasp - GDALRegister_COASP(); -#endif - -#ifdef FRMT_tms - GDALRegister_TMS(); -#endif - -#ifdef FRMT_r - GDALRegister_R(); -#endif - -#ifdef FRMT_map - GDALRegister_MAP(); -#endif - -/* -------------------------------------------------------------------- */ -/* Put raw formats at the end of the list. These drivers support */ -/* various ASCII-header labeled formats, so the driver could be */ -/* confused if you have files in some of above formats and such */ -/* ASCII-header in the same directory. */ -/* -------------------------------------------------------------------- */ - -#ifdef FRMT_raw - GDALRegister_PNM(); - GDALRegister_DOQ1(); - GDALRegister_DOQ2(); - GDALRegister_ENVI(); - GDALRegister_EHdr(); - GDALRegister_GenBin(); - GDALRegister_PAux(); - GDALRegister_MFF(); - GDALRegister_HKV(); - GDALRegister_FujiBAS(); - GDALRegister_GSC(); - GDALRegister_FAST(); - GDALRegister_BT(); - GDALRegister_LAN(); - GDALRegister_CPG(); - GDALRegister_IDA(); - GDALRegister_NDF(); - GDALRegister_EIR(); - GDALRegister_DIPEx(); - GDALRegister_LCP(); - GDALRegister_GTX(); - GDALRegister_LOSLAS(); - GDALRegister_NTv2(); - GDALRegister_CTable2(); - GDALRegister_ACE2(); - GDALRegister_SNODAS(); - GDALRegister_KRO(); -#endif - -#ifdef FRMT_arg - GDALRegister_ARG(); -#endif - -/* -------------------------------------------------------------------- */ -/* Our test for the following is weak or expensive so we try */ -/* them last. */ -/* -------------------------------------------------------------------- */ - -#ifdef FRMT_rik - GDALRegister_RIK(); -#endif - -#ifdef FRMT_usgsdem - GDALRegister_USGSDEM(); -#endif - -#ifdef FRMT_gxf - GDALRegister_GXF(); -#endif - -#ifdef FRMT_grass - GDALRegister_GRASS(); -#endif - -#ifdef FRMT_dods - GDALRegister_DODS(); -#endif - -#ifdef FRMT_wcs - GDALRegister_HTTP(); -#endif - -#ifdef FRMT_hdf5 - GDALRegister_BAG(); - GDALRegister_HDF5(); - GDALRegister_HDF5Image(); -#endif - -#ifdef FRMT_northwood - GDALRegister_NWT_GRD(); - GDALRegister_NWT_GRC(); -#endif - -#ifdef FRMT_adrg - GDALRegister_ADRG(); - GDALRegister_SRP(); -#endif - -#ifdef FRMT_blx - GDALRegister_BLX(); -#endif - -#ifdef FRMT_pgchip - GDALRegister_PGCHIP(); -#endif - -#ifdef FRMT_georaster - GDALRegister_GEOR(); -#endif - -#ifdef FRMT_rasterlite - GDALRegister_Rasterlite(); -#endif - -#ifdef FRMT_epsilon - GDALRegister_EPSILON(); -#endif - -#ifdef FRMT_postgisraster - GDALRegister_PostGISRaster(); -#endif - -#ifdef FRMT_saga - GDALRegister_SAGA(); -#endif - -#ifdef FRMT_kmlsuperoverlay - GDALRegister_KMLSUPEROVERLAY(); -#endif - -#ifdef FRMT_xyz - GDALRegister_XYZ(); -#endif - -#ifdef FRMT_hf2 - GDALRegister_HF2(); -#endif - -#ifdef FRMT_pdf - GDALRegister_PDF(); -#endif - -#ifdef FRMT_jpegls - GDALRegister_JPEGLS(); -#endif - -#ifdef FRMT_ozi - GDALRegister_OZI(); -#endif - -#ifdef FRMT_ctg - GDALRegister_CTG(); -#endif - -#ifdef FRMT_e00grid - GDALRegister_E00GRID(); -#endif - -#ifdef FRMT_webp - GDALRegister_WEBP(); -#endif - -#ifdef FRMT_zmap - GDALRegister_ZMap(); -#endif - -#ifdef FRMT_ngsgeoid - GDALRegister_NGSGEOID(); -#endif - -#ifdef FRMT_mbtiles - GDALRegister_MBTiles(); -#endif - -#ifdef FRMT_iris - GDALRegister_IRIS(); -#endif - -#ifdef FRMT_sentinel2 - GDALRegister_SENTINEL2(); -#endif -/* -------------------------------------------------------------------- */ -/* Deregister any drivers explicitly marked as supressed by the */ -/* GDAL_SKIP environment variable. */ -/* -------------------------------------------------------------------- */ - GetGDALDriverManager()->AutoSkipDrivers(); -} diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/makefile.vc b/SuperBuild/patches/GDAL/S2_patch/frmts/makefile.vc deleted file mode 100644 index 94cfc96e14f84df98cd17920d360276a3823a1e1..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/makefile.vc +++ /dev/null @@ -1,217 +0,0 @@ - -GDAL_ROOT = .. - -EXTRAFLAGS = -DFRMT_ceos -DFRMT_aigrid -DFRMT_elas -DFRMT_hfa -DFRMT_gtiff\ - -DFRMT_sdts -DFRMT_raw -DFRMT_gxf -DFRMT_ceos2 -DFRMT_png \ - -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_gif \ - -DFRMT_envisat -DFRMT_aaigrid -DFRMT_usgsdem -DFRMT_l1b \ - -DFRMT_fit -DFRMT_vrt -DFRMT_xpm -DFRMT_bmp -DFRMT_rmf \ - -DFRMT_nitf -DFRMT_pcidsk -DFRMT_airsar -DFRMT_rs2 \ - -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik -DFRMT_pcraster \ - -DFRMT_leveller -DFRMT_sgi -DFRMT_srtmhgt -DFRMT_idrisi \ - -DFRMT_jaxapalsar -DFRMT_ers -DFRMT_ingr -DFRMT_dimap \ - -DFRMT_gff -DFRMT_terragen -DFRMT_gsg -DFRMT_cosar -DFRMT_pds \ - -DFRMT_adrg -DFRMT_coasp -DFRMT_tsx -DFRMT_blx -DFRMT_til \ - -DFRMT_r -DFRMT_northwood -DFRMT_saga -DFRMT_xyz -DFRMT_hf2 \ - -DFRMT_kmlsuperoverlay -DFRMT_ozi -DFRMT_ctg -DFRMT_e00grid \ - -DFRMT_zmap -DFRMT_ngsgeoid -DFRMT_pdf -DFRMT_iris -DFRMT_map \ - -DFRMT_sentinel2 - -MOREEXTRA = - -DIRLIST = $(EXTRAFLAGS:-DFRMT_=) - -PLUGINFLAGS = - -PLUGINDIRLIST = $(PLUGINFLAGS:-DFRMT_=) - -!INCLUDE $(GDAL_ROOT)/nmake.opt - -!IFDEF PG_INC_DIR -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_postgisraster -!ENDIF - -!IFDEF JPEG_SUPPORTED -EXTRAFLAGS = -DFRMT_jpeg $(EXTRAFLAGS) -!ENDIF - -!IFDEF BSB_SUPPORTED -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_bsb -!ENDIF - -!IFDEF OGDIDIR -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_ogdi -!ELSE -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_zlib -!ENDIF - -!IFDEF JASPER_DIR -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_jpeg2000 -!ENDIF - -!IFDEF OPENJPEG_ENABLED -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_openjpeg -!ENDIF - -!IFDEF KAKDIR -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_jp2kak -DFRMT_jpipkak -!ENDIF - -!IFDEF ECWDIR -!IF "$(ECW_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_ecw -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_ecw -!ENDIF -!ENDIF - -!IFDEF HDF4_DIR -!IF "$(HDF4_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_hdf4 -!ENDIF -!ENDIF - -!IFDEF HDF5_DIR -!IF "$(HDF5_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_hdf5 -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_hdf5 -!ENDIF -!ENDIF - -!IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR) -!INCLUDE mrsid\nmake.opt -!ENDIF - -!IFDEF MRSID_RASTER_DIR -!IF "$(MRSID_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_mrsid -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_mrsid -!ENDIF -!ENDIF - -!IFDEF MRSID_LIDAR_DIR -!IF "$(MRSID_LIDAR_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_mrsid_lidar -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_mrsid_lidar -!ENDIF -!ENDIF - -!IFDEF FITS_INC_DIR -!IF "$(FITS_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_fits -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_fits -!ENDIF -!ENDIF - -!IFDEF DODS_DIR -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_dods -!ENDIF - -!IFDEF NETCDF_SETTING -!IF "$(NETCDF_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_netcdf -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_netcdf -!ENDIF -!ENDIF - -!IFDEF GRIB_SETTING -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_grib -!ENDIF - -!IFDEF CURL_LIB -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_wcs -DFRMT_wms -!ENDIF - -!IFDEF SDE_ENABLED -!IF "$(SDE_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_sde -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_sde -!ENDIF -!ENDIF - -!IFDEF RASDAMAN_ENABLED -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_rasdaman -!ENDIF - -!IFDEF OCI_LIB -!IF "$(OCI_PLUGIN)" != "YES" -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_georaster -!ELSE -PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_georaster -!ENDIF -!ENDIF - -!IFDEF INCLUDE_OGR_FRMTS -!IFDEF SQLITE_LIB -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_rasterlite -DFRMT_mbtiles -!ENDIF -!ENDIF - -!IFDEF WEBP_ENABLED -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_webp -!ENDIF - -!IFDEF GTA_CFLAGS -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_gta -!ENDIF - -!IFDEF INCLUDE_OGR_FRMTS -EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_arg -!ENDIF - -default: o\gdalallregister.obj subdirs - -list: - echo $(DIRLIST) - echo $(PLUGINDIRLIST) - -subdirs: - for %d in ( $(DIRLIST) ) do \ - cd %d \ - && $(MAKE) /f makefile.vc \ - && cd .. \ - || exit 1 - -plugindirs: - -for %d in ( $(PLUGINDIRLIST) ) do \ - cd %d \ - && $(MAKE) /f makefile.vc plugin \ - && cd .. \ - || exit 1 - -o\gdalallregister.obj: gdalallregister.cpp ..\nmake.opt - $(CC) $(CFLAGS) $(MOREEXTRA) /c gdalallregister.cpp - copy gdalallregister.obj o - -clean: - -del o\*.obj *.obj - -for %d in ( $(DIRLIST) ) do \ - cd %d \ - && $(MAKE) /f makefile.vc clean \ - && cd .. \ - || exit 1 - -for %d in ( $(PLUGINDIRLIST) ) do \ - cd %d \ - && $(MAKE) /f makefile.vc clean \ - && cd .. \ - || exit 1 - cd iso8211 - $(MAKE) /f makefile.vc clean - -plugins-install: - -for %d in ( $(PLUGINDIRLIST) ) do \ - cd %d \ - && $(MAKE) /f makefile.vc plugin-install \ - && cd .. \ - || exit 1 - -html-install: - copy *.html $(HTMLDIR) - -for %d in ( $(DIRLIST) ) do \ - copy %d\frmt_*.html $(HTMLDIR) diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/GNUmakefile b/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/GNUmakefile deleted file mode 100644 index c5bf2e41389a97aba253f9578f2a225bf68af7b2..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/GNUmakefile +++ /dev/null @@ -1,11 +0,0 @@ - -include ../../GDALmake.opt - -OBJ = sentinel2dataset.o - -default: $(OBJ:.o=.$(OBJ_EXT)) - -clean: - rm -f *.o $(O_OBJ) - -install-obj: $(O_OBJ:.o=.$(OBJ_EXT)) diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/frmt_sentinel2.html b/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/frmt_sentinel2.html deleted file mode 100644 index 83d8cceb7d28d3f476b663f58d71d97890bd74b6..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/frmt_sentinel2.html +++ /dev/null @@ -1,458 +0,0 @@ -<html> -<head> -<title>SENTINEL2 -- Sentinel-2 Products</title> -</head> - -<body bgcolor="#ffffff"> - -<h1>SENTINEL2 -- Sentinel-2 Products</h1> - -<p>Driver for Sentinel-2 Level-1B, Level-1C and Level-2A products. (GDAL >= 2.1)</p> - -<p>The SENTINEL2 driver will be used if the main metadata .xml file at the -root of a SENTINEL2 data product is opened (whose name is typically -S2A_OPER_MTD_SAFL1C_....xml). It can also accept directly .zip files downloaded -from the <a href="https://scihub.esa.int/">Sentinels Scientific Data Hub</a></p> - -<p>To be able to read the imagery, GDAL must be configured with at least one of -the JPEG2000 capable drivers.</p> - -<p> -SENTINEL-2 data are acquired on 13 spectral bands in the -visible and near-infrared (VNIR) and Short-wavelength infrared (SWIR) spectrum, -as show in the below table: -</p> - -<p> -<table border=1"> -<tr><th>Band name</th><th>Resolution (m)</th><th>Central wavelength (nm)</th><th>Band width (nm)</th><th>Purpose</th></tr> -<tr><td>B01</td> <td>60</td> <td>443</td> <td>20</td> <td>Aerosol detection</td></tr> -<tr><td>B02</td> <td>10</td> <td>490</td> <td>65</td> <td>Blue</td></tr> -<tr><td>B03</td> <td>10</td> <td>560</td> <td>35</td> <td>Green</td></tr> -<tr><td>B04</td> <td>10</td> <td>665</td> <td>30</td> <td>Red</td></tr> -<tr><td>B05</td> <td>20</td> <td>705</td> <td>15</td> <td>Vegetation classification</td></tr> -<tr><td>B06</td> <td>20</td> <td>740</td> <td>15</td> <td>Vegetation classification</td></tr> -<tr><td>B07</td> <td>20</td> <td>783</td> <td>20</td> <td>Vegetation classification</td></tr> -<tr><td>B08</td> <td>10</td> <td>842</td> <td>115</td> <td>Near infrared</td></tr> -<tr><td>B08A</td> <td>20</td> <td>865</td> <td>20</td> <td>Vegetation classification</td></tr> -<tr><td>B09</td> <td>60</td> <td>945</td> <td>20</td> <td>Water vapour</td></tr> -<tr><td>B10</td> <td>60</td> <td>1375</td> <td>30</td> <td>Cirrus</td></tr> -<tr><td>B11</td> <td>20</td> <td>1610</td> <td>90</td> <td>Snow / ice / cloud discrimination</td></tr> -<tr><td>B12</td> <td>20</td> <td>2190</td> <td>180</td> <td>Snow / ice / cloud discrimination</td></tr> -</table> -</p> - -<h2>Level-1B</h2> - -<p>Level-1B products are composed of several "granules" of ~ 25 km across-track x -~ 23km along-track, in sensor geometry (i.e. non ortho-rectified). -Each granule correspond to the imagery captured -by one of the 12 detectors accros-track (for a total 290 km swath width). -The imagery of each band is put in a separate JPEG2000 file.</p> - -<p>Level-1B products are aimed at advanced users.</p> - -<p>When opening the main -metadata .xml file, the driver will typically expose N * 3 sub-datasets, where N -is the number of granules composing the user product, and 3 corresponds to the -number of spatial resolutions. There's one for the 4 -10m bands, one for the 6 20m bands and one for the 3 60m bands. Caution: the -number of such subdatasets can be typically of several hundreds or more.</p> - -<p>It is also possible to open the metadata .xml of a given granule, in which -case 3 subdatasets will be reported for each of the 3 spatial resolutions.</p> - -<p>When opening a subdataset, the georeferencing is made of 5 ground control points -for the 4 corner of the images and the center of image.</p> - -<h2>Level-1C</h2> - -<p>Level-1C products are organized in ortho-rectified tiles of 100 km x 100 km -in UTM WGS84 projections. The imagery of each band is put in a separate JPEG2000 file. -</p> - -<p>When opening the main -metadata .xml file, the driver will typically expose 4 sub-datasets: -<ul> -<li>one for the 4 10m bands,</li> -<li>one for the 6 20m bands, </li> -<li>one for the 3 60m bands and,</li> -<li> one for a preview of the R,G,B bands at a 320m resolution</li> -</ul> -</p> -<p> -All tiles of same resolution and projection are mosaiced together. -If a product spans over several UTM zones, -they will be exposed as separate subdatasets.</p> - -<p>It is also possible to open the metadata .xml file of each tile, in which case -the driver will typically expose the 4 above mentionned types of sub-datasets.</p> - -<h2>Level-2A</h2> - -<p>Similarly to Level-1C, Level-2A products are organized in ortho-rectified -tiles of 100 km x 100 km in UTM WGS84 projections. The imagery of each band is -put in a separate JPEG2000 file. -The values are Bottom-Of-Atmosphere (BOA) reflectances. L2A specific bands are -also computed: -<ul> -<li>AOT: Aerosol Optical Thickness map (at 550nm)</li> -<li>CLD: Raster mask values range from 0 for high confidence clear sky to 100 -for high confidence cloudy</li> -<li>SCL: Scene Classification. The meaning of the values is indicated in the -Category Names of the band.</li> -<li>SNW: Raster mask values range from 0 for high confidence NO snow/ice to 100 -for high confidence snow/ice</li> -<li>WVP: Scene-average Water Vapour map</li> -</ul></p> - -<p>When opening the main -metadata .xml file, the driver will typically expose 4 sub-datasets: -<ul> -<li>one for the 4 native 10m bands, and L2A specific bands (AOT and WVP)</li> -<li>one for the 6 native 20m bands, plus the 10m bands, except B8, resampled to -20m, and L2A specific bands (AOT, WVP, SCL, CLD and SNW), </li> -<li>one for the 3 native 60m bands, plus the 10m&20m bands, except B8, -resampled to 60m, and L2A specific bands (AOT, WVP, SCL, CLD and SNW),</li> -<li> one for a preview of the R,G,B bands at a 320m resolution</li> -</ul> -</p> -<p> -All tiles of same resolution and projection are mosaiced together. -If a product spans over several UTM zones, -they will be exposed as separate subdatasets.</p> - -<p>Note: at the time of writing (December 2015), the exact format of Level-2A -has not been yet decided by ESA. The driver is based on the output of the -<a href="https://github.com/umwilm/SEN2COR">sen2cor</a> v2.0.5 (Sentinel 2 Level 2A -Prototype Processor) software that processes Level-1C datasets into Level-2A.</p> - -<h2>Metadata</h2> - -<p>Metadata of the main metadata .xml file is available in the general metadata -domain. The whole XML file is also accessible through the xml:SENTINEL2 metadata -domain.</p> - -<p>Subdatasets are based on the VRT format, so the definition of this VRT can -be obtained by querying the xml:VRT metadata domain.</p> - -<h2>Performance issues for L1C and L2A</h2> - -<p>Due to the way Sentinel-2 products are structured, in particular because of -the number of JPEG2000 files involved, zoom-out operations can be very slow for -products made of many tiles. For interactive -display, it can be useful to generate overviews (can be a slow operation by -itself). This can be done with the gdaladdo utility on the subdataset name. -The overview file is created next to the main metadata .xml file, with the same -name, but prefixed with _XX_EPSG_YYYYY.tif.ovr where XX=10m,20m,60m or PREVIEW -and YYYYY is the EPSG code. -</p> -<p>Trick: if the content of the zoom-out preview is not important for the use case, -blank overviews can be created instantaneously -by using the NONE resampling method ('-r none' as gdaladdo switch).</p> - -<p>When converting a subdataset to another format like tiled GeoTIFF, if using -the JP2OpenJPEG driver, the recommended minimum value for the GDAL_CACHEMAX -configuration option is (subdataset_width * 2048 * 2 ) / 10000000 if generating a -INTERLEAVE=BAND GeoTIFF, or that value multiplied by the number of bands for -the default INTERLEAVE=PIXEL configuration. -The current versions of the OpenJPEG libraries can also consume a lot of memory -to decode a JPEG2000 tile (up to 600MB), so you might want to specify the -GDAL_NUM_THREADS configuration option to a reasonable number of threads if you -are short of memory (the default value is the total number of virtual CPUs). -</p> - -<h2>Open options</h2> - -The driver can be passed the following open options: -<ul> -<li><b>ALPHA</b>=YES/NO: whether to expose an alpha band. Defaults to NO. If set, -an extra band is added after the Sentinel2 bands with an alpha channel. Its value -are: -<ul> -<li>0 on areas with no tiles, or when the tile data is set to the NODATA or SATURATED -special values,</li> -<li>4095 on areas with valid data.</li> -</ul> -</ul> - -<p> -Note: above open options can also be specified as configuration options, by -prefixing the open option name with SENTINEL2_ (e.g. SENTINEL2_ALPHA). -</p> - -<h2>Examples</h2> - -<ul> - -<li>Opening the main metadata file of a Sentinel2 product: - -<pre> -$ gdalinfo S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml -</pre> - -<pre> -Driver: SENTINEL2/Sentinel 2 -Files: S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml -Size is 512, 512 -Coordinate System is `' -Metadata: - CLOUD_COVERAGE_ASSESSMENT=0.0 - DATATAKE_1_DATATAKE_SENSING_START=2015-08-13T10:10:26.027Z - DATATAKE_1_DATATAKE_TYPE=INS-NOBS - DATATAKE_1_ID=GS2A_20150813T101026_000734_N01.03 - DATATAKE_1_SENSING_ORBIT_DIRECTION=DESCENDING - DATATAKE_1_SENSING_ORBIT_NUMBER=22 - DATATAKE_1_SPACECRAFT_NAME=Sentinel-2A - DEGRADED_ANC_DATA_PERCENTAGE=0 - DEGRADED_MSI_DATA_PERCENTAGE=0 - FOOTPRINT=POLYGON((11.583573986577191 46.02490454425771, 11.538730738326866 45.03757398414644, 12.93007028286133 44.99812645604949, 12.999359413660665 45.98408391203724, 11.583573986577191 46.02490454425771, 11.583573986577191 46.02490454425771)) - FORMAT_CORRECTNESS_FLAG=PASSED - GENERAL_QUALITY_FLAG=PASSED - GENERATION_TIME=2015-08-18T10:14:40.000283Z - GEOMETRIC_QUALITY_FLAG=PASSED - PREVIEW_GEO_INFO=BrowseImageFootprint - PREVIEW_IMAGE_URL=https://pdmcdam2.sentinel2.eo.esa.int/s2pdgs_geoserver/geo_service.php?service=WMS&version=1.1.0&request=GetMap&layers=S2A_A000022_N0103:S2A_A000022_N0103&styles=&bbox=11.538730738326866,44.99812645604949,12.999359413660665,46.02490454425771&width=1579&height=330&srs=EPSG:4326&format=image/png&time=2015-08-13T10:24:06.0Z/2015-08-13T10:24:06.0Z - PROCESSING_BASELINE=01.03 - PROCESSING_LEVEL=Level-1C - PRODUCT_START_TIME=2015-08-13T10:24:06.637Z - PRODUCT_STOP_TIME=2015-08-13T10:24:06.637Z - PRODUCT_TYPE=S2MSI1C - QUANTIFICATION_VALUE=1000 - RADIOMETRIC_QUALITY_FLAG=PASSED - REFERENCE_BAND=B1 - REFLECTANCE_CONVERSION_U=0.973195961910065 - SENSOR_QUALITY_FLAG=PASSED - SPECIAL_VALUE_NODATA=1 - SPECIAL_VALUE_SATURATED=0 -Subdatasets: - SUBDATASET_1_NAME=SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:10m:EPSG_32632 - SUBDATASET_1_DESC=Bands B2, B3, B4, B8 with 10m resolution, UTM 32N - SUBDATASET_2_NAME=SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:20m:EPSG_32632 - SUBDATASET_2_DESC=Bands B5, B6, B7, B8A, B11, B12 with 20m resolution, UTM 32N - SUBDATASET_3_NAME=SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:60m:EPSG_32632 - SUBDATASET_3_DESC=Bands B1, B9, B10 with 60m resolution, UTM 32N - SUBDATASET_4_NAME=SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:PREVIEW:EPSG_32632 - SUBDATASET_4_DESC=RGB preview, UTM 32N -Corner Coordinates: -Upper Left ( 0.0, 0.0) -Lower Left ( 0.0, 512.0) -Upper Right ( 512.0, 0.0) -Lower Right ( 512.0, 512.0) -Center ( 256.0, 256.0) -</pre> -</li> - -<li>Opening the .zip file directly: - -<pre> -$ gdalinfo S2A_OPER_PRD_MSIL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.zip -</pre> - -<li>Opening the 10 meters resolution bands of a L1C subdataset: - -<pre> -$ gdalinfo SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:10m:EPSG_32632 -</pre> - -<pre> -Driver: SENTINEL2/Sentinel 2 -Files: S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml - ./GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_N01.03/S2A_OPER_MTD_L1C_TL_MTI__20150813T201603_A000734_T32TQR.xml - ./GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_N01.03/IMG_DATA/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_B04.jp2 - ./GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_N01.03/IMG_DATA/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_B03.jp2 - ./GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_N01.03/IMG_DATA/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_B02.jp2 - ./GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_N01.03/IMG_DATA/S2A_OPER_MSI_L1C_TL_MTI__20150813T201603_A000734_T32TQR_B08.jp2 -Size is 10980, 10980 -Coordinate System is: -PROJCS["WGS 84 / UTM zone 32N", - GEOGCS["WGS 84", - DATUM["WGS_1984", - SPHEROID["WGS 84",6378137,298.257223563, - AUTHORITY["EPSG","7030"]], - AUTHORITY["EPSG","6326"]], - PRIMEM["Greenwich",0, - AUTHORITY["EPSG","8901"]], - UNIT["degree",0.0174532925199433, - AUTHORITY["EPSG","9122"]], - AUTHORITY["EPSG","4326"]], - PROJECTION["Transverse_Mercator"], - PARAMETER["latitude_of_origin",0], - PARAMETER["central_meridian",9], - PARAMETER["scale_factor",0.9996], - PARAMETER["false_easting",500000], - PARAMETER["false_northing",0], - UNIT["metre",1, - AUTHORITY["EPSG","9001"]], - AXIS["Easting",EAST], - AXIS["Northing",NORTH], - AUTHORITY["EPSG","32632"]] -Origin = (699960.000000000000000,5100060.000000000000000) -Pixel Size = (10.000000000000000,-10.000000000000000) -Metadata: -[... same as above ...] -Image Structure Metadata: - COMPRESSION=JPEG2000 -Corner Coordinates: -Upper Left ( 699960.000, 5100060.000) ( 11d35' 0.87"E, 46d 1'29.66"N) -Lower Left ( 699960.000, 4990260.000) ( 11d32'19.43"E, 45d 2'15.27"N) -Upper Right ( 809760.000, 5100060.000) ( 12d59'57.69"E, 45d59' 2.70"N) -Lower Right ( 809760.000, 4990260.000) ( 12d55'48.25"E, 44d59'53.26"N) -Center ( 754860.000, 5045160.000) ( 12d15'46.56"E, 45d30'48.07"N) -Band 1 Block=128x128 Type=UInt16, ColorInterp=Red - Description = B4, central wavelength 665 nm - Overviews: 5490x5490, 2745x2745, 1373x1373, 687x687, 344x344 - Metadata: - BANDNAME=B4 - BANDWIDTH=30 - BANDWIDTH_UNIT=nm - SOLAR_IRRADIANCE=1512.79 - SOLAR_IRRADIANCE_UNIT=W/m2/um - WAVELENGTH=665 - WAVELENGTH_UNIT=nm - Image Structure Metadata: - NBITS=12 -Band 2 Block=128x128 Type=UInt16, ColorInterp=Green - Description = B3, central wavelength 560 nm -[...] -Band 3 Block=128x128 Type=UInt16, ColorInterp=Blue - Description = B2, central wavelength 490 nm -[...] -Band 4 Block=128x128 Type=UInt16, ColorInterp=Undefined - Description = B8, central wavelength 842 nm -[...] -</pre> -</li> - -<li>Conversion of a L1C subdataset to tiled GeoTIFF -<pre> -$ gdal_translate SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:10m:EPSG_32632 \ - 10m.tif \ - -co TILED=YES --config GDAL_CACHEMAX 1000 --config GDAL_NUM_THREADS 2 -</pre> - -<li>Generating blank overviews for a L1C subdataset: -<pre> -$ gdaladdo -r NONE SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:10m:EPSG_32632 4 -</pre> - -<li>Creating a VRT file from the subdataset (can be convenient to have the subdatasets as files): -<pre> -$ python -c "import sys; from osgeo import gdal; ds = gdal.Open(sys.argv[1]); open(sys.argv[2], 'wb').write(ds.GetMetadata('xml:VRT')[0].encode('utf-8'))" \ - SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20150818T101440_R022_V20150813T102406_20150813T102406.xml:10m:EPSG_32632 10m.vrt -</pre> - -<li>Opening the 10 meters resolution bands of a L1B subdataset: -<pre> -$ gdalinfo SENTINEL2_L1B:S2A_OPER_MTD_L1B_GR_SGS__20151024T023555_S20151024T011315_D02.xml:10m -</pre> - -<pre> -Driver: SENTINEL2/Sentinel 2 -Files: S2A_OPER_MTD_L1B_GR_SGS__20151024T023555_S20151024T011315_D02.xml - IMG_DATA/S2A_OPER_MSI_L1B_GR_SGS__20151024T023555_S20151024T011315_D02_B04.jp2 - IMG_DATA/S2A_OPER_MSI_L1B_GR_SGS__20151024T023555_S20151024T011315_D02_B03.jp2 - IMG_DATA/S2A_OPER_MSI_L1B_GR_SGS__20151024T023555_S20151024T011315_D02_B02.jp2 - IMG_DATA/S2A_OPER_MSI_L1B_GR_SGS__20151024T023555_S20151024T011315_D02_B08.jp2 -Size is 2552, 2304 -Coordinate System is `' -GCP Projection = -GEOGCS["WGS 84", - DATUM["WGS_1984", - SPHEROID["WGS 84",6378137,298.257223563, - AUTHORITY["EPSG","7030"]], - AUTHORITY["EPSG","6326"]], - PRIMEM["Greenwich",0, - AUTHORITY["EPSG","8901"]], - UNIT["degree",0.0174532925199433, - AUTHORITY["EPSG","9122"]], - AUTHORITY["EPSG","4326"]] -GCP[ 0]: Id=, Info= - (0,0) -> (134.635194391036,-21.4282083310724,0) -GCP[ 1]: Id=, Info= - (0,2304) -> (134.581480136827,-21.6408640426055,0) -GCP[ 2]: Id=, Info= - (2552,2304) -> (134.833308274251,-21.686125031254,0) -GCP[ 3]: Id=, Info= - (2552,0) -> (134.886750925145,-21.4734274382519,0) -GCP[ 4]: Id=, Info= - (1276,1152) -> (134.734115530986,-21.5571457404287,0) -Metadata: - CLOUDY_PIXEL_PERCENTAGE=0 - DATASTRIP_ID=S2A_OPER_MSI_L1B_DS_SGS__20151024T023555_S20151024T011312_N01.04 - DATATAKE_1_DATATAKE_SENSING_START=2015-10-24T01:13:12.027Z - DATATAKE_1_DATATAKE_TYPE=INS-NOBS - DATATAKE_1_ID=GS2A_20151024T011312_001758_N01.04 - DATATAKE_1_SENSING_ORBIT_DIRECTION=DESCENDING - DATATAKE_1_SENSING_ORBIT_NUMBER=45 - DATATAKE_1_SPACECRAFT_NAME=Sentinel-2A - DEGRADED_ANC_DATA_PERCENTAGE=0 - DEGRADED_MSI_DATA_PERCENTAGE=0 - DETECTOR_ID=02 - DOWNLINK_PRIORITY=NOMINAL - FOOTPRINT=POLYGON((134.635194391036 -21.4282083310724, 134.581480136827 -21.6408640426055, 134.833308274251 -21.686125031254, 134.886750925145 -21.4734274382519, 134.635194391036 -21.4282083310724)) - FORMAT_CORRECTNESS_FLAG=PASSED - GENERAL_QUALITY_FLAG=PASSED - GENERATION_TIME=2015-11-12T10:55:12.000947Z - GEOMETRIC_QUALITY_FLAG=PASSED - GRANULE_ID=S2A_OPER_MSI_L1B_GR_SGS__20151024T023555_S20151024T011315_D02_N01.04 - PREVIEW_GEO_INFO=BrowseImageFootprint - PREVIEW_IMAGE_URL=https://pdmcdam2.sentinel2.eo.esa.int/s2pdgs_geoserver/geo_service.php?service=WMS&version=1.1.0&request=GetMap&layers=S2A_A000045_N0104:S2A_A000045_N0104&styles=&bbox=133.512786023161,-25.3930035889714,137.184847290108,-21.385906922696&width=1579&height=330&srs=EPSG:4326&format=image/png&time=2015-10-24T01:13:15.0Z/2015-10-24T01:14:13.0Z - PROCESSING_BASELINE=01.04 - PROCESSING_LEVEL=Level-1B - PRODUCT_START_TIME=2015-10-24T01:13:15.497656Z - PRODUCT_STOP_TIME=2015-10-24T01:14:13.70431Z - PRODUCT_TYPE=S2MSI1B - RADIOMETRIC_QUALITY_FLAG=PASSED - SENSING_TIME=2015-10-24T01:13:15.497656Z - SENSOR_QUALITY_FLAG=PASSED - SPECIAL_VALUE_NODATA=1 - SPECIAL_VALUE_SATURATED=0 -Corner Coordinates: -Upper Left ( 0.0, 0.0) -Lower Left ( 0.0, 2304.0) -Upper Right ( 2552.0, 0.0) -Lower Right ( 2552.0, 2304.0) -Center ( 1276.0, 1152.0) -Band 1 Block=128x128 Type=UInt16, ColorInterp=Red - Description = B4, central wavelength 665 nm - Overviews: 1276x1152, 638x576, 319x288, 160x144 - Metadata: - BANDNAME=B4 - BANDWIDTH=30 - BANDWIDTH_UNIT=nm - WAVELENGTH=665 - WAVELENGTH_UNIT=nm - Image Structure Metadata: - NBITS=12 -Band 2 Block=128x128 Type=UInt16, ColorInterp=Green - Description = B3, central wavelength 560 nm -[...] -Band 3 Block=128x128 Type=UInt16, ColorInterp=Blue - Description = B2, central wavelength 490 nm -[...] -Band 4 Block=128x128 Type=UInt16, ColorInterp=Undefined - Description = B8, central wavelength 842 nm -[...] -</pre> - -</li> - -</ul> - - -<h2>See Also:</h2> - -<ul> - <li><a href="https://scihub.esa.int/">Sentinels Scientific Data Hub</a></li> - <li><a href="https://sentinels.copernicus.eu/web/sentinel/user-guides/sentinel-2-msi">Sentinel 2 User guide</a></li> - <li><a href="https://sentinels.copernicus.eu/web/sentinel/user-guides/document-library/-/asset_publisher/xlslt4309D5h/content/sentinel-2-user-handbook">Sentinel 2 User Handbook</a></li> -</ul> - -<h2>Credits</h2> - -This driver has been developed by <a href="http://spatialys.com">Spatialys</a> with funding from -<a href="https://cnes.fr">Centre National d'Etudes Spatiales (CNES)</a> - -</body> -</html> diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/makefile.vc b/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/makefile.vc deleted file mode 100644 index 3daceba1e105514d3e94e2cdac6bb5827a2ffd28..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/makefile.vc +++ /dev/null @@ -1,13 +0,0 @@ - -OBJ = sentinel2dataset.obj - -GDAL_ROOT = ..\.. - -!INCLUDE $(GDAL_ROOT)\nmake.opt - -default: $(OBJ) - xcopy /D /Y *.obj ..\o - -clean: - -del *.obj - diff --git a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/sentinel2dataset.cpp b/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/sentinel2dataset.cpp deleted file mode 100644 index 2aa7d269917a79c4ed33d58043c7cc354dfd5b5d..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/frmts/sentinel2/sentinel2dataset.cpp +++ /dev/null @@ -1,3229 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Project: GDAL - * Purpose: Sentinel2 products - * Author: Even Rouault, <even.rouault at spatialys.com> - * Funded by: Centre National d'Etudes Spatiales (CNES) - * - ****************************************************************************** - * Copyright (c) 2015, Even Rouault, <even.rouault at spatialys.com> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - ****************************************************************************/ - -#include "cpl_minixml.h" -#include "cpl_string.h" -#include "gdal_pam.h" -#include "gdal_proxy.h" -#include "ogr_spatialref.h" -#include "ogr_geometry.h" -#include "gdaljp2metadata.h" -#include "../vrt/vrtdataset.h" -#include <set> -#include <map> -#include <vector> - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifndef STARTS_WITH_CI -#define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b)) -#endif - -CPL_CVSID("$Id$"); - -CPL_C_START -void GDALRegister_SENTINEL2(void); -CPL_C_END - -typedef enum -{ - SENTINEL2_L1B, - SENTINEL2_L1C, - SENTINEL2_L2A -} SENTINEL2Level; - -typedef struct -{ - const char* pszBandName; - int nResolution; /* meters */ - int nWaveLength; /* nanometers */ - int nBandWidth; /* nanometers */ - GDALColorInterp eColorInterp; -} SENTINEL2BandDescription; - -static const SENTINEL2BandDescription asBandDesc[] = -{ - { "B1", 60, 443, 20, GCI_Undefined }, - { "B2", 10, 490, 65, GCI_BlueBand }, - { "B3", 10, 560, 35, GCI_GreenBand }, - { "B4", 10, 665, 30, GCI_RedBand }, - { "B5", 20, 705, 15, GCI_Undefined }, - { "B6", 20, 740, 15, GCI_Undefined }, - { "B7", 20, 783, 20, GCI_Undefined }, - { "B8", 10, 842, 115, GCI_Undefined }, - { "B8A", 20, 865, 20, GCI_Undefined }, - { "B9", 60, 945, 20, GCI_Undefined }, - { "B10", 60, 1375, 30, GCI_Undefined }, - { "B11", 20, 1610, 90, GCI_Undefined }, - { "B12", 20, 2190, 180, GCI_Undefined }, -}; - -#define NB_BANDS (sizeof(asBandDesc)/sizeof(asBandDesc[0])) - -typedef enum -{ - TL_IMG_DATA, /* Tile is located in IMG_DATA/ */ - TL_IMG_DATA_Rxxm, /* Tile is located in IMG_DATA/Rxxm/ */ - TL_QI_DATA /* Tile is located in QI_DATA/ */ -} SENTINEL2_L2A_Tilelocation; - -typedef struct -{ - const char* pszBandName; - const char* pszBandDescription; - SENTINEL2_L2A_Tilelocation eLocation; -} SENTINEL2_L2A_BandDescription; - -static const SENTINEL2_L2A_BandDescription asL2ABandDesc[] = -{ - { "AOT", "Aerosol Optical Thickness map (at 550nm)", TL_IMG_DATA_Rxxm }, - { "WVP", "Scene-average Water Vapour map", TL_IMG_DATA_Rxxm }, - { "SCL", "Scene Classification", TL_IMG_DATA }, - { "CLD", "Raster mask values range from 0 for high confidence clear sky to 100 for high confidence cloudy", TL_QI_DATA }, - { "SNW", "Raster mask values range from 0 for high confidence NO snow/ice to 100 for high confidence snow/ice", TL_QI_DATA }, -}; - -#define NB_L2A_BANDS (sizeof(asL2ABandDesc)/sizeof(asL2ABandDesc[0])) - -static -const char* SENTINEL2GetOption( GDALOpenInfo* poOpenInfo, - const char* pszName, - const char* pszDefaultVal = NULL ); -static bool SENTINEL2GetTileInfo(const char* pszFilename, - int* pnWidth, int* pnHeight, int *pnBits); - -/************************************************************************/ -/* SENTINEL2GranuleInfo */ -/************************************************************************/ - -class SENTINEL2GranuleInfo -{ - public: - CPLString osPath; - double dfMinX, dfMinY, dfMaxX, dfMaxY; - int nWidth, nHeight; -}; - -/************************************************************************/ -/* ==================================================================== */ -/* SENTINEL2Dataset */ -/* ==================================================================== */ -/************************************************************************/ - -class SENTINEL2DatasetContainer: public GDALPamDataset -{ - public: - SENTINEL2DatasetContainer() {} -}; - -class SENTINEL2Dataset : public VRTDataset -{ - std::vector<CPLString> aosNonJP2Files; - - void AddL1CL2ABandMetadata(SENTINEL2Level eLevel, - CPLXMLNode* psRoot, - const std::vector<CPLString>& aosBands); - - static SENTINEL2Dataset *CreateL1CL2ADataset( - SENTINEL2Level eLevel, - const std::vector<CPLString>& aosGranuleList, - std::vector<CPLString>& aosNonJP2Files, - int nSubDSPrecision, - bool bIsPreview, - int nSubDSEPSGCode, - bool bAlpha, - const std::vector<CPLString>& aosBands, - int nSaturatedVal, - int nNodataVal); - - public: - SENTINEL2Dataset(int nXSize, int nYSize); - ~SENTINEL2Dataset(); - - virtual char** GetFileList(); - - static GDALDataset *Open( GDALOpenInfo * ); - static GDALDataset *OpenL1BUserProduct( GDALOpenInfo * ); - static GDALDataset *OpenL1BGranule( const char* pszFilename, - CPLXMLNode** ppsRoot = NULL, - int nResolutionOfInterest = 0, - std::set<CPLString> *poBandSet = NULL); - static GDALDataset *OpenL1BSubdataset( GDALOpenInfo * ); - static GDALDataset *OpenL1C_L2A( const char* pszFilename, - SENTINEL2Level eLevel ); - static GDALDataset *OpenL1CTile( const char* pszFilename, - CPLXMLNode** ppsRootMainMTD = NULL, - int nResolutionOfInterest = 0, - std::set<CPLString>* poBandSet = NULL); - static GDALDataset *OpenL1CTileSubdataset( GDALOpenInfo * ); - static GDALDataset *OpenL1C_L2ASubdataset( GDALOpenInfo *, - SENTINEL2Level eLevel ); - - static int Identify( GDALOpenInfo * ); -}; - -/************************************************************************/ -/* ==================================================================== */ -/* SENTINEL2AlphaBand */ -/* ==================================================================== */ -/************************************************************************/ - -class SENTINEL2AlphaBand: public VRTSourcedRasterBand -{ - int m_nSaturatedVal; - int m_nNodataVal; - - public: - SENTINEL2AlphaBand( GDALDataset *poDS, int nBand, - GDALDataType eType, - int nXSize, int nYSize, - int nSaturatedVal, int nNodataVal ); - - virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int, - void *, int, int, GDALDataType, -#ifdef GDAL_DCAP_RASTER - GSpacing nPixelSpace, GSpacing nLineSpace, - GDALRasterIOExtraArg* psExtraArg -#else - int nPixelSpace, int nLineSpace -#endif - ); - -}; - -/************************************************************************/ -/* SENTINEL2AlphaBand() */ -/************************************************************************/ - -SENTINEL2AlphaBand::SENTINEL2AlphaBand( GDALDataset *poDSIn, int nBandIn, - GDALDataType eType, - int nXSize, int nYSize, - int nSaturatedVal, int nNodataVal ) : - VRTSourcedRasterBand(poDSIn, nBandIn, eType, - nXSize, nYSize), - m_nSaturatedVal(nSaturatedVal), - m_nNodataVal(nNodataVal) -{ -} - -/************************************************************************/ -/* IRasterIO() */ -/************************************************************************/ - -CPLErr SENTINEL2AlphaBand::IRasterIO( GDALRWFlag eRWFlag, - int nXOff, int nYOff, int nXSize, int nYSize, - void * pData, int nBufXSize, int nBufYSize, - GDALDataType eBufType, -#ifdef GDAL_DCAP_RASTER - GSpacing nPixelSpace, GSpacing nLineSpace, - GDALRasterIOExtraArg* psExtraArg -#else - int nPixelSpace, int nLineSpace -#endif - ) -{ - // Query the first band. Quite arbitrary, but hopefully all bands have - // the same nodata/saturated pixels. - CPLErr eErr = poDS->GetRasterBand(1)->RasterIO(eRWFlag, nXOff, nYOff, nXSize, nYSize, - pData, nBufXSize, nBufYSize, - eBufType, nPixelSpace, nLineSpace -#ifdef GDAL_DCAP_RASTER - ,psExtraArg -#endif - ); - if( eErr == CE_None ) - { - const char* pszNBITS = GetMetadataItem("NBITS", "IMAGE_STRUCTURE"); - const int nBits = (pszNBITS) ? atoi(pszNBITS) : 16; - const GUInt16 nMaxVal = (GUInt16)((1 << nBits) - 1); - - // Replace pixels matching m_nSaturatedVal and m_nNodataVal by 0 - // and others by the maxVal. - for(int iY = 0; iY < nBufYSize; iY ++) - { - for(int iX = 0; iX < nBufXSize; iX ++) - { - // Optimized path for likely most common case - if( eBufType == GDT_UInt16 ) - { - GUInt16* panPtr = (GUInt16*) - ((GByte*)pData + iY * nLineSpace + iX * nPixelSpace); - if( *panPtr == 0 || - *panPtr == m_nSaturatedVal || *panPtr == m_nNodataVal ) - { - *panPtr = 0; - } - else - *panPtr = nMaxVal; - } - // Generic path for other datatypes - else - { - double dfVal; - GDALCopyWords((GByte*)pData + iY * nLineSpace + iX * nPixelSpace, - eBufType, 0, - &dfVal, GDT_Float64, 0, - 1); - if( dfVal == 0.0 || dfVal == m_nSaturatedVal || - dfVal == m_nNodataVal ) - { - dfVal = 0; - } - else - dfVal = nMaxVal; - GDALCopyWords(&dfVal, GDT_Float64, 0, - (GByte*)pData + iY * nLineSpace + iX * nPixelSpace, - eBufType, 0, - 1); - } - } - } - } - - return eErr; -} - -/************************************************************************/ -/* SENTINEL2Dataset() */ -/************************************************************************/ - -SENTINEL2Dataset::SENTINEL2Dataset(int nXSize, int nYSize) : VRTDataset(nXSize,nYSize) -{ - poDriver = NULL; - SetWritable(FALSE); -} - -/************************************************************************/ -/* ~SENTINEL2Dataset() */ -/************************************************************************/ - -SENTINEL2Dataset::~SENTINEL2Dataset() -{ -} - -/************************************************************************/ -/* GetFileList() */ -/************************************************************************/ - -char** SENTINEL2Dataset::GetFileList() -{ - CPLStringList aosList; - for(size_t i=0;i<aosNonJP2Files.size();i++) - aosList.AddString(aosNonJP2Files[i]); - char** papszFileList = VRTDataset::GetFileList(); - for(char** papszIter = papszFileList; papszIter && *papszIter; ++papszIter) - aosList.AddString(*papszIter); - CSLDestroy(papszFileList); - return aosList.StealList(); -} - -/************************************************************************/ -/* Identify() */ -/************************************************************************/ - -int SENTINEL2Dataset::Identify( GDALOpenInfo *poOpenInfo ) -{ - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1B:") ) - return TRUE; - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1C:") ) - return TRUE; - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1C_TILE:") ) - return TRUE; - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L2A:") ) - return TRUE; - - /* Accept directly .zip as provided by https://scihub.esa.int/ */ - const char* pszJustFilename = CPLGetFilename(poOpenInfo->pszFilename); - if( (STARTS_WITH_CI(pszJustFilename, "S2A_OPER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2B_OPER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2A_USER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2B_USER_PRD_MSI") ) && - EQUAL(CPLGetExtension(pszJustFilename), "zip") ) - { - return TRUE; - } - - if( poOpenInfo->nHeaderBytes < 100 ) - return FALSE; - - const char* pszHeader = reinterpret_cast<const char*>(poOpenInfo->pabyHeader); - - if( strstr(pszHeader, "<n1:Level-1B_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-1B.xsd" ) != NULL ) - return TRUE; - - if( strstr(pszHeader, "<n1:Level-1B_Granule_ID" ) != NULL && - strstr(pszHeader, "S2_PDI_Level-1B_Granule_Metadata.xsd" ) != NULL ) - return TRUE; - - if( strstr(pszHeader, "<n1:Level-1C_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-1C.xsd" ) != NULL ) - return TRUE; - - if( strstr(pszHeader, "<n1:Level-1C_Tile_ID" ) != NULL && - strstr(pszHeader, "S2_PDI_Level-1C_Tile_Metadata.xsd" ) != NULL ) - return TRUE; - - if( strstr(pszHeader, "<n1:Level-2A_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-2A_Metadata" ) != NULL ) - return TRUE; - - return FALSE; -} - -/************************************************************************/ -/* SENTINEL2_CPLXMLNodeHolder */ -/************************************************************************/ - -class SENTINEL2_CPLXMLNodeHolder -{ - CPLXMLNode* m_psNode; - public: - SENTINEL2_CPLXMLNodeHolder(CPLXMLNode* psNode) : m_psNode(psNode) {} - ~SENTINEL2_CPLXMLNodeHolder() { if(m_psNode) CPLDestroyXMLNode(m_psNode); } - - CPLXMLNode* Release() { CPLXMLNode* psRet = m_psNode; m_psNode = NULL; return psRet; } -}; - -/************************************************************************/ -/* Open() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::Open( GDALOpenInfo * poOpenInfo ) -{ - if ( !Identify( poOpenInfo ) ) - { - return NULL; - } - - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1B:") ) - return OpenL1BSubdataset(poOpenInfo); - - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1C:") ) - return OpenL1C_L2ASubdataset(poOpenInfo, SENTINEL2_L1C); - - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1C_TILE:") ) - return OpenL1CTileSubdataset(poOpenInfo); - - if( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L2A:") ) - return OpenL1C_L2ASubdataset(poOpenInfo, SENTINEL2_L2A); - - const char* pszJustFilename = CPLGetFilename(poOpenInfo->pszFilename); - if( (STARTS_WITH_CI(pszJustFilename, "S2A_OPER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2B_OPER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2A_USER_PRD_MSI") || - STARTS_WITH_CI(pszJustFilename, "S2B_USER_PRD_MSI") ) && - EQUAL(CPLGetExtension(pszJustFilename), "zip") ) - { - CPLString osBasename(CPLGetBasename(pszJustFilename)); - CPLString osFilename(poOpenInfo->pszFilename); - CPLString osMTD(osBasename); - osMTD[9] = 'M'; - osMTD[10] = 'T'; - osMTD[11] = 'D'; - osMTD[13] = 'S'; - osMTD[14] = 'A'; - osMTD[15] = 'F'; - CPLString osSAFE(CPLString(osBasename) + ".SAFE"); - osFilename = osFilename + "/" + osSAFE +"/" + osMTD + ".xml"; - if( strncmp(osFilename, "/vsizip/", strlen("/vsizip/")) != 0 ) - osFilename = "/vsizip/" + osFilename; - CPLDebug("SENTINEL2", "Trying %s", osFilename.c_str()); - GDALOpenInfo oOpenInfo(osFilename, GA_ReadOnly); - return Open(&oOpenInfo); - } - - const char* pszHeader = reinterpret_cast<const char*>(poOpenInfo->pabyHeader); - - if( strstr(pszHeader, "<n1:Level-1B_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-1B.xsd" ) != NULL ) - { - return OpenL1BUserProduct(poOpenInfo); - } - - if( strstr(pszHeader, "<n1:Level-1B_Granule_ID" ) != NULL && - strstr(pszHeader, "S2_PDI_Level-1B_Granule_Metadata.xsd" ) != NULL ) - { - return OpenL1BGranule(poOpenInfo->pszFilename); - } - - if( strstr(pszHeader, "<n1:Level-1C_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-1C.xsd" ) != NULL ) - { - return OpenL1C_L2A(poOpenInfo->pszFilename, SENTINEL2_L1C); - } - - if( strstr(pszHeader, "<n1:Level-1C_Tile_ID" ) != NULL && - strstr(pszHeader, "S2_PDI_Level-1C_Tile_Metadata.xsd" ) != NULL ) - return OpenL1CTile(poOpenInfo->pszFilename); - - if( strstr(pszHeader, "<n1:Level-2A_User_Product" ) != NULL && - strstr(pszHeader, "User_Product_Level-2A_Metadata" ) != NULL ) - return OpenL1C_L2A(poOpenInfo->pszFilename, SENTINEL2_L2A); - - return NULL; -} - -/************************************************************************/ -/* SENTINEL2GetBandDesc() */ -/************************************************************************/ - -static const SENTINEL2BandDescription* SENTINEL2GetBandDesc(const char* pszBandName) -{ - for(size_t i=0; i < NB_BANDS; i++) - { - if( EQUAL(asBandDesc[i].pszBandName, pszBandName) ) - return &(asBandDesc[i]); - } - return NULL; -} - -/************************************************************************/ -/* SENTINEL2GetL2ABandDesc() */ -/************************************************************************/ - -static const SENTINEL2_L2A_BandDescription* SENTINEL2GetL2ABandDesc(const char* pszBandName) -{ - for(size_t i=0; i < NB_L2A_BANDS; i++) - { - if( EQUAL(asL2ABandDesc[i].pszBandName, pszBandName) ) - return &(asL2ABandDesc[i]); - } - return NULL; -} - -/************************************************************************/ -/* SENTINEL2GetGranuleInfo() */ -/************************************************************************/ - -static bool SENTINEL2GetGranuleInfo(SENTINEL2Level eLevel, - const CPLString& osGranuleMTDPath, - int nDesiredResolution, - int* pnEPSGCode = NULL, - double* pdfULX = NULL, - double* pdfULY = NULL, - int* pnResolution = NULL, - int* pnWidth = NULL, - int* pnHeight = NULL) -{ - static bool bTryOptimization = true; - CPLXMLNode *psRoot = NULL; - - if( bTryOptimization ) - { - /* Small optimization: in practice the interesting info are in the */ - /* first bytes of the Granule MTD, which can be very long sometimes */ - /* so only read them, and hack the buffer a bit to form a valid XML */ - char szBuffer[3072]; - VSILFILE* fp = VSIFOpenL( osGranuleMTDPath, "rb" ); - size_t nRead = 0; - if( fp == NULL || - (nRead = VSIFReadL( szBuffer, 1, sizeof(szBuffer)-1, fp )) == 0 ) - { - if( fp ) - VSIFCloseL(fp); - CPLError(CE_Failure, CPLE_AppDefined, "Cannot read %s", - osGranuleMTDPath.c_str()); - return false; - } - szBuffer[nRead] = 0; - VSIFCloseL(fp); - char* pszTileGeocoding = strstr(szBuffer, "</Tile_Geocoding>"); - if( eLevel == SENTINEL2_L1C && - pszTileGeocoding != NULL && - strstr(szBuffer, "<n1:Level-1C_Tile_ID") != NULL && - strstr(szBuffer, "<n1:Geometric_Info") != NULL && - static_cast<size_t>(pszTileGeocoding - szBuffer) < - sizeof(szBuffer) - strlen("</Tile_Geocoding></n1:Geometric_Info></n1:Level-1C_Tile_ID>") - 1 ) - { - strcpy(pszTileGeocoding, - "</Tile_Geocoding></n1:Geometric_Info></n1:Level-1C_Tile_ID>"); - psRoot = CPLParseXMLString( szBuffer ); - } - else if( eLevel == SENTINEL2_L2A && - pszTileGeocoding != NULL && - strstr(szBuffer, "<n1:Level-2A_Tile_ID") != NULL && - strstr(szBuffer, "<n1:Geometric_Info") != NULL && - static_cast<size_t>(pszTileGeocoding - szBuffer) < - sizeof(szBuffer) - strlen("</Tile_Geocoding></n1:Geometric_Info></n1:Level-2A_Tile_ID>") - 1 ) - { - strcpy(pszTileGeocoding, - "</Tile_Geocoding></n1:Geometric_Info></n1:Level-2A_Tile_ID>"); - psRoot = CPLParseXMLString( szBuffer ); - } - else - bTryOptimization = false; - } - - // If the above doesn't work, then read the whole file... - if( psRoot == NULL ) - psRoot = CPLParseXMLFile( osGranuleMTDPath ); - if( psRoot == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot XML parse %s", - osGranuleMTDPath.c_str()); - return false; - } - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - const char* pszNodePath = - (eLevel == SENTINEL2_L1C ) ? - "=Level-1C_Tile_ID.Geometric_Info.Tile_Geocoding" : - "=Level-2A_Tile_ID.Geometric_Info.Tile_Geocoding"; - CPLXMLNode* psTileGeocoding = CPLGetXMLNode(psRoot, pszNodePath); - if( psTileGeocoding == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - pszNodePath, - osGranuleMTDPath.c_str()); - return false; - } - - const char* pszCSCode = CPLGetXMLValue(psTileGeocoding, "HORIZONTAL_CS_CODE", NULL); - if( pszCSCode == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - "HORIZONTAL_CS_CODE", - osGranuleMTDPath.c_str()); - return false; - } - if( !STARTS_WITH_CI(pszCSCode, "EPSG:") ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Invalid CS code (%s) for %s", - pszCSCode, - osGranuleMTDPath.c_str()); - return false; - } - int nEPSGCode = atoi(pszCSCode + strlen("EPSG:")); - if( pnEPSGCode != NULL ) - *pnEPSGCode = nEPSGCode; - - for(CPLXMLNode* psIter = psTileGeocoding->psChild; psIter != NULL; - psIter = psIter->psNext) - { - if( psIter->eType != CXT_Element ) - continue; - if( EQUAL(psIter->pszValue, "Size") && - (nDesiredResolution == 0 || - atoi(CPLGetXMLValue(psIter, "resolution", "")) == nDesiredResolution) ) - { - nDesiredResolution = atoi(CPLGetXMLValue(psIter, "resolution", "")); - const char* pszRows = CPLGetXMLValue(psIter, "NROWS", NULL); - if( pszRows == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - "NROWS", - osGranuleMTDPath.c_str()); - return false; - } - const char* pszCols = CPLGetXMLValue(psIter, "NCOLS", NULL); - if( pszCols == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - "NCOLS", - osGranuleMTDPath.c_str()); - return false; - } - if( pnResolution ) - *pnResolution = nDesiredResolution; - if( pnWidth ) - *pnWidth = atoi(pszCols); - if( pnHeight ) - *pnHeight = atoi(pszRows); - } - else if( EQUAL(psIter->pszValue, "Geoposition") && - (nDesiredResolution == 0 || - atoi(CPLGetXMLValue(psIter, "resolution", "")) == nDesiredResolution) ) - { - nDesiredResolution = atoi(CPLGetXMLValue(psIter, "resolution", "")); - const char* pszULX = CPLGetXMLValue(psIter, "ULX", NULL); - if( pszULX == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - "ULX", - osGranuleMTDPath.c_str()); - return false; - } - const char* pszULY = CPLGetXMLValue(psIter, "ULY", NULL); - if( pszULY == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s in %s", - "ULY", - osGranuleMTDPath.c_str()); - return false; - } - if( pnResolution ) - *pnResolution = nDesiredResolution; - if( pdfULX ) - *pdfULX = CPLAtof(pszULX); - if( pdfULY ) - *pdfULY = CPLAtof(pszULY); - } - } - - return true; -} - -/************************************************************************/ -/* SENTINEL2GetPathSeparator() */ -/************************************************************************/ - -// For the sake of simplifying our unit tests, we limit the use of \\ to when -// it is strictly necessary. Otherwise we could use CPLFormFilename()... -static char SENTINEL2GetPathSeparator(const char* pszBasename) -{ - if( STARTS_WITH_CI(pszBasename, "\\\\?\\") ) - return '\\'; - else - return '/'; -} - -/************************************************************************/ -/* SENTINEL2GetGranuleList() */ -/************************************************************************/ - -static bool SENTINEL2GetGranuleList(CPLXMLNode* psMainMTD, - SENTINEL2Level eLevel, - const char* pszFilename, - std::vector<CPLString>& osList, - std::set<int>* poSetResolutions = NULL, - std::map<int, std::set<CPLString> >* - poMapResolutionsToBands = NULL) -{ - const char* pszNodePath = - (eLevel == SENTINEL2_L1B ) ? "Level-1B_User_Product" : - (eLevel == SENTINEL2_L1C ) ? "Level-1C_User_Product" : - "Level-2A_User_Product"; - - CPLXMLNode* psRoot = CPLGetXMLNode(psMainMTD, - CPLSPrintf("=%s", pszNodePath)); - if( psRoot == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find =%s", pszNodePath); - return false; - } - pszNodePath = (eLevel == SENTINEL2_L2A) ? - "General_Info.L2A_Product_Info" : "General_Info.Product_Info"; - CPLXMLNode* psProductInfo = CPLGetXMLNode(psRoot, pszNodePath); - if( psProductInfo == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", pszNodePath); - return false; - } - - pszNodePath = (eLevel == SENTINEL2_L2A) ? - "L2A_Product_Organisation" : "Product_Organisation"; - CPLXMLNode* psProductOrganisation = - CPLGetXMLNode(psProductInfo, pszNodePath); - if( psProductOrganisation == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", pszNodePath); - return false; - } - - CPLString osDirname( CPLGetDirname(pszFilename) ); -#ifdef HAVE_READLINK - char szPointerFilename[2048]; - int nBytes = static_cast<int>(readlink(pszFilename, szPointerFilename, - sizeof(szPointerFilename))); - if (nBytes != -1) - { - szPointerFilename[MIN(nBytes, - static_cast<int>(sizeof(szPointerFilename)-1))] = 0; - osDirname = CPLGetDirname(szPointerFilename); - } -#endif - - std::set<CPLString> aoSetGranuleId; - for(CPLXMLNode* psIter = psProductOrganisation->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "Granule_List") ) - { - continue; - } - for(CPLXMLNode* psIter2 = psIter->psChild; psIter2 != NULL; - psIter2 = psIter2->psNext ) - { - if( psIter2->eType != CXT_Element || - !EQUAL(psIter2->pszValue, "Granules") ) - { - continue; - } - const char* pszGranuleId = CPLGetXMLValue(psIter2, "granuleIdentifier", NULL); - if( pszGranuleId == NULL ) - { - CPLDebug("SENTINEL2", "Missing granuleIdentifier attribute"); - continue; - } - - if( eLevel == SENTINEL2_L2A ) - { - for(CPLXMLNode* psIter3 = psIter2->psChild; psIter3 != NULL; - psIter3 = psIter3->psNext ) - { - if( psIter3->eType != CXT_Element || - !EQUAL(psIter3->pszValue, "IMAGE_ID_2A") ) - { - continue; - } - const char* pszTileName = CPLGetXMLValue(psIter3, NULL, ""); - size_t nLen = strlen(pszTileName); - if( nLen > 4 && pszTileName[nLen-4] == '_' && - pszTileName[nLen-1] == 'm' ) - { - int nResolution = atoi(pszTileName + nLen - 3); - if( poSetResolutions != NULL ) - (*poSetResolutions).insert(nResolution); - if( poMapResolutionsToBands != NULL ) - { - nLen -= 4; - if( nLen > 4 && pszTileName[nLen-4] == '_' && - pszTileName[nLen-3] == 'B' ) - { - (*poMapResolutionsToBands)[nResolution]. - insert(CPLString(pszTileName).substr(nLen-2,2)); - } - else if ( nLen > strlen("S2A_USER_MSI_") && - pszTileName[8] == '_' && - pszTileName[12] == '_' && - !EQUALN(pszTileName+9, "MSI", 3) ) - { - (*poMapResolutionsToBands)[nResolution]. - insert(CPLString(pszTileName).substr(9,3)); - } - } - } - } - } - - // For L2A we can have several time the same granuleIdentifier - // for the different resolutions - if( aoSetGranuleId.find(pszGranuleId) != aoSetGranuleId.end() ) - continue; - aoSetGranuleId.insert(pszGranuleId); - - /* S2A_OPER_MSI_L1C_TL_SGS__20151024T023555_A001758_T53JLJ_N01.04 --> */ - /* S2A_OPER_MTD_L1C_TL_SGS__20151024T023555_A001758_T53JLJ */ - CPLString osGranuleMTD = pszGranuleId; - if( osGranuleMTD.size() > strlen("S2A_OPER_MSI_") && - osGranuleMTD[8] == '_' && osGranuleMTD[12] == '_' && - osGranuleMTD[osGranuleMTD.size()-7] == '_' && - osGranuleMTD[osGranuleMTD.size()-6] == 'N' ) - { - osGranuleMTD[9] = 'M'; - osGranuleMTD[10] = 'T'; - osGranuleMTD[11] = 'D'; - osGranuleMTD.resize(osGranuleMTD.size()-7); - } - else - { - CPLDebug("SENTINEL2", "Invalid granule ID: %s", pszGranuleId); - continue; - } - osGranuleMTD += ".xml"; - - const char chSeparator = SENTINEL2GetPathSeparator(osDirname); - CPLString osGranuleMTDPath = osDirname; - osGranuleMTDPath += chSeparator; - osGranuleMTDPath += "GRANULE"; - osGranuleMTDPath += chSeparator; - osGranuleMTDPath += pszGranuleId; - osGranuleMTDPath += chSeparator; - osGranuleMTDPath += osGranuleMTD; - osList.push_back(osGranuleMTDPath); - } - } - - return true; -} - -/************************************************************************/ -/* SENTINEL2GetUserProductMetadata() */ -/************************************************************************/ - -static -char** SENTINEL2GetUserProductMetadata( CPLXMLNode* psMainMTD, - const char* pszRootNode ) -{ - CPLStringList aosList; - - CPLXMLNode* psRoot = CPLGetXMLNode(psMainMTD, - CPLSPrintf("=%s", pszRootNode)); - if( psRoot == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find =%s", pszRootNode); - return NULL; - } - CPLXMLNode* psProductInfo = CPLGetXMLNode(psRoot, - EQUAL(pszRootNode, "Level-2A_User_Product") ? - "General_Info.L2A_Product_Info" : "General_Info.Product_Info"); - int nDataTakeCounter = 1; - for( CPLXMLNode* psIter = (psProductInfo ? psProductInfo->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - if( psIter->psChild != NULL && psIter->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( psIter->pszValue, - psIter->psChild->pszValue ); - } - else if( EQUAL(psIter->pszValue, "Datatake") ) - { - CPLString osPrefix(CPLSPrintf("DATATAKE_%d_", nDataTakeCounter)); - nDataTakeCounter ++; - const char* pszId = CPLGetXMLValue(psIter, "datatakeIdentifier", NULL); - if( pszId ) - aosList.AddNameValue( (osPrefix + "ID").c_str(), pszId ); - for( CPLXMLNode* psIter2 = psIter->psChild; - psIter2 != NULL; - psIter2 = psIter2->psNext ) - { - if( psIter2->eType != CXT_Element ) - continue; - if( psIter2->psChild != NULL && psIter2->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( (osPrefix + psIter2->pszValue).c_str(), - psIter2->psChild->pszValue ); - } - } - } - } - - CPLXMLNode* psIC = CPLGetXMLNode(psRoot, - EQUAL(pszRootNode, "Level-2A_User_Product") ? - "General_Info.L2A_Product_Image_Characteristics" : - "General_Info.Product_Image_Characteristics"); - if( psIC != NULL ) - { - for( CPLXMLNode* psIter = psIC->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "Special_Values") ) - { - continue; - } - const char* pszText = CPLGetXMLValue(psIter, "SPECIAL_VALUE_TEXT", NULL); - const char* pszIndex = CPLGetXMLValue(psIter, "SPECIAL_VALUE_INDEX", NULL); - if( pszText && pszIndex ) - { - aosList.AddNameValue( (CPLString("SPECIAL_VALUE_") + pszText).c_str(), - pszIndex ); - } - } - - const char* pszQuantValue = - CPLGetXMLValue(psIC, "QUANTIFICATION_VALUE", NULL); - if( pszQuantValue != NULL ) - aosList.AddNameValue("QUANTIFICATION_VALUE", pszQuantValue); - - const char* pszRCU = - CPLGetXMLValue(psIC, "Reflectance_Conversion.U", NULL); - if( pszRCU != NULL ) - aosList.AddNameValue("REFLECTANCE_CONVERSION_U", pszRCU); - - // L2A specific - CPLXMLNode* psQVL = CPLGetXMLNode(psIC, "L1C_L2A_Quantification_Values_List"); - for( CPLXMLNode* psIter = psQVL ? psQVL->psChild : NULL; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - { - continue; - } - aosList.AddNameValue( psIter->pszValue, - CPLGetXMLValue(psIter, NULL, NULL)); - const char* pszUnit = CPLGetXMLValue(psIter, "unit", NULL); - if( pszUnit ) - aosList.AddNameValue( CPLSPrintf("%s_UNIT", psIter->pszValue), pszUnit); - } - - const char* pszRefBand = - CPLGetXMLValue(psIC, "REFERENCE_BAND", NULL); - if( pszRefBand != NULL ) - { - int nIdx = atoi(pszRefBand); - if( nIdx >= 0 && nIdx < (int)NB_BANDS ) - aosList.AddNameValue("REFERENCE_BAND", asBandDesc[nIdx].pszBandName ); - } - } - - CPLXMLNode* psQII = CPLGetXMLNode(psRoot, "Quality_Indicators_Info"); - if( psQII != NULL ) - { - const char* pszCC = CPLGetXMLValue(psQII, "Cloud_Coverage_Assessment", NULL); - if( pszCC ) - aosList.AddNameValue("CLOUD_COVERAGE_ASSESSMENT", - pszCC); - - const char* pszDegradedAnc = CPLGetXMLValue(psQII, - "Technical_Quality_Assessment.DEGRADED_ANC_DATA_PERCENTAGE", NULL); - if( pszDegradedAnc ) - aosList.AddNameValue("DEGRADED_ANC_DATA_PERCENTAGE", pszDegradedAnc); - - const char* pszDegradedMSI = CPLGetXMLValue(psQII, - "Technical_Quality_Assessment.DEGRADED_MSI_DATA_PERCENTAGE", NULL); - if( pszDegradedMSI ) - aosList.AddNameValue("DEGRADED_MSI_DATA_PERCENTAGE", pszDegradedMSI); - - CPLXMLNode* psQualInspect = CPLGetXMLNode(psQII, - "Quality_Control_Checks.Quality_Inspections"); - for( CPLXMLNode* psIter = (psQualInspect ? psQualInspect->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - if( psIter->psChild != NULL && psIter->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( psIter->pszValue, - psIter->psChild->pszValue ); - } - } - } - - CPLXMLNode* psL2A_QII = CPLGetXMLNode(psRoot, "L2A_Quality_Indicators_Info"); - if( psL2A_QII != NULL ) - { - CPLXMLNode* psICCQI = CPLGetXMLNode(psL2A_QII, "Image_Content_QI"); - for( CPLXMLNode* psIter = (psICCQI ? psICCQI->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - if( psIter->psChild != NULL && psIter->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( psIter->pszValue, - psIter->psChild->pszValue ); - } - } - } - - return aosList.StealList(); -} - -/************************************************************************/ -/* SENTINEL2GetResolutionSet() */ -/************************************************************************/ - -static bool SENTINEL2GetResolutionSet(CPLXMLNode* psProductInfo, - std::set<int>& oSetResolutions, - std::map<int, std::set<CPLString> >& - oMapResolutionsToBands) -{ - - CPLXMLNode* psBandList = CPLGetXMLNode(psProductInfo, - "Query_Options.Band_List"); - if( psBandList == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", - "Query_Options.Band_List"); - return false; - } - - for(CPLXMLNode* psIter = psBandList->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "BAND_NAME") ) - { - continue; - } - const char* pszBandName = CPLGetXMLValue(psIter, NULL, ""); - const SENTINEL2BandDescription* psBandDesc = - SENTINEL2GetBandDesc(pszBandName); - if( psBandDesc == NULL ) - { - CPLDebug("SENTINEL2", "Unknown band name %s", pszBandName); - continue; - } - oSetResolutions.insert( psBandDesc->nResolution ); - CPLString osName = psBandDesc->pszBandName + 1; /* skip B character */ - if( atoi(osName) < 10 ) - osName = "0" + osName; - oMapResolutionsToBands[psBandDesc->nResolution].insert(osName); - } - if( oSetResolutions.size() == 0 ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find any band"); - return false; - } - return true; -} - -/************************************************************************/ -/* SENTINEL2GetPolygonWKTFromPosList() */ -/************************************************************************/ - -static CPLString SENTINEL2GetPolygonWKTFromPosList(const char* pszPosList) -{ - CPLString osPolygon; - char** papszTokens = CSLTokenizeString(pszPosList); - int nTokens = CSLCount(papszTokens); - int nDim = 2; - if( (nTokens % 3) == 0 && nTokens >= 3 * 4 && - EQUAL(papszTokens[0], papszTokens[nTokens-3]) && - EQUAL(papszTokens[1], papszTokens[nTokens-2]) && - EQUAL(papszTokens[2], papszTokens[nTokens-1]) ) - { - nDim = 3; - } - if( (nTokens % nDim) == 0 ) - { - osPolygon = "POLYGON(("; - for(char** papszIter = papszTokens; *papszIter; papszIter += nDim ) - { - if( papszIter != papszTokens ) - osPolygon += ", "; - osPolygon += papszIter[1]; - osPolygon += " "; - osPolygon += papszIter[0]; - if( nDim == 3 ) - { - osPolygon += " "; - osPolygon += papszIter[2]; - } - } - osPolygon += "))"; - } - CSLDestroy(papszTokens); - return osPolygon; -} - -/************************************************************************/ -/* SENTINEL2GetBandListForResolution() */ -/************************************************************************/ - -static CPLString SENTINEL2GetBandListForResolution( - const std::set<CPLString>& oBandnames) -{ - CPLString osBandNames; - for(std::set<CPLString>::const_iterator oIterBandnames = oBandnames.begin(); - oIterBandnames != oBandnames.end(); - ++oIterBandnames) - { - if( osBandNames.size() ) - osBandNames += ", "; - const char* pszName = *oIterBandnames; - if( *pszName == '0' ) - pszName ++; - if( atoi(pszName) > 0 ) - osBandNames += "B" + CPLString(pszName); - else - osBandNames += pszName; - } - return osBandNames; -} - -/************************************************************************/ -/* OpenL1BUserProduct() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1BUserProduct( GDALOpenInfo * poOpenInfo ) -{ - CPLXMLNode *psRoot = CPLParseXMLFile( poOpenInfo->pszFilename ); - if( psRoot == NULL ) - return NULL; - - char* pszOriginalXML = CPLSerializeXMLTree(psRoot); - CPLString osOriginalXML; - if( pszOriginalXML ) - osOriginalXML = pszOriginalXML; - CPLFree(pszOriginalXML); - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - CPLXMLNode* psProductInfo = CPLGetXMLNode(psRoot, - "=Level-1B_User_Product.General_Info.Product_Info"); - if( psProductInfo == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", - "=Level-1B_User_Product.General_Info.Product_Info"); - return NULL; - } - - std::set<int> oSetResolutions; - std::map<int, std::set<CPLString> > oMapResolutionsToBands; - if( !SENTINEL2GetResolutionSet(psProductInfo, - oSetResolutions, - oMapResolutionsToBands) ) - { - return NULL; - } - - std::vector<CPLString> aosGranuleList; - if( !SENTINEL2GetGranuleList(psRoot, - SENTINEL2_L1B, - poOpenInfo->pszFilename, - aosGranuleList) ) - { - return NULL; - } - - SENTINEL2DatasetContainer* poDS = new SENTINEL2DatasetContainer(); - char** papszMD = SENTINEL2GetUserProductMetadata(psRoot, - "Level-1B_User_Product"); - poDS->GDALDataset::SetMetadata(papszMD); - CSLDestroy(papszMD); - - if( osOriginalXML.size() ) - { - char* apszXMLMD[2]; - apszXMLMD[0] = const_cast<char*>(osOriginalXML.c_str()); - apszXMLMD[1] = NULL; - poDS->GDALDataset::SetMetadata(apszXMLMD, "xml:SENTINEL2"); - } - - /* Create subdatsets per granules and resolution (10, 20, 60m) */ - int iSubDSNum = 1; - for(size_t i = 0; i < aosGranuleList.size(); i++ ) - { - for(std::set<int>::const_iterator oIterRes = oSetResolutions.begin(); - oIterRes != oSetResolutions.end(); - ++oIterRes ) - { - const int nResolution = *oIterRes; - - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("SENTINEL2_L1B:%s:%dm", - aosGranuleList[i].c_str(), - nResolution), - "SUBDATASETS"); - - CPLString osBandNames = SENTINEL2GetBandListForResolution( - oMapResolutionsToBands[nResolution]); - - CPLString osDesc(CPLSPrintf("Bands %s of granule %s with %dm resolution", - osBandNames.c_str(), - CPLGetFilename(aosGranuleList[i]), - nResolution)); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - iSubDSNum ++; - } - } - - const char* pszPosList = CPLGetXMLValue(psRoot, - "=Level-1B_User_Product.Geometric_Info.Product_Footprint." - "Product_Footprint.Global_Footprint.EXT_POS_LIST", NULL); - if( pszPosList != NULL ) - { - CPLString osPolygon = SENTINEL2GetPolygonWKTFromPosList(pszPosList); - if( osPolygon.size() ) - poDS->GDALDataset::SetMetadataItem("FOOTPRINT", osPolygon.c_str()); - } - - return poDS; -} - -/************************************************************************/ -/* SENTINEL2GetL1BGranuleMetadata() */ -/************************************************************************/ - -static -char** SENTINEL2GetL1BGranuleMetadata( CPLXMLNode* psMainMTD ) -{ - CPLStringList aosList; - - CPLXMLNode* psRoot = CPLGetXMLNode(psMainMTD, - "=Level-1B_Granule_ID"); - if( psRoot == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "Cannot find =Level-1B_Granule_ID"); - return NULL; - } - CPLXMLNode* psGeneralInfo = CPLGetXMLNode(psRoot, - "General_Info"); - for( CPLXMLNode* psIter = (psGeneralInfo ? psGeneralInfo->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - const char* pszValue = CPLGetXMLValue(psIter, NULL, NULL); - if( pszValue != NULL ) - { - aosList.AddNameValue( psIter->pszValue, pszValue ); - } - } - - CPLXMLNode* psGeometryHeader = CPLGetXMLNode(psRoot, - "Geometric_Info.Granule_Position.Geometric_Header"); - if( psGeometryHeader != NULL ) - { - const char* pszVal = CPLGetXMLValue(psGeometryHeader, - "Incidence_Angles.ZENITH_ANGLE", NULL); - if( pszVal ) - aosList.AddNameValue( "INCIDENCE_ZENITH_ANGLE", pszVal ); - - pszVal = CPLGetXMLValue(psGeometryHeader, - "Incidence_Angles.AZIMUTH_ANGLE", NULL); - if( pszVal ) - aosList.AddNameValue( "INCIDENCE_AZIMUTH_ANGLE", pszVal ); - - pszVal = CPLGetXMLValue(psGeometryHeader, - "Solar_Angles.ZENITH_ANGLE", NULL); - if( pszVal ) - aosList.AddNameValue( "SOLAR_ZENITH_ANGLE", pszVal ); - - pszVal = CPLGetXMLValue(psGeometryHeader, - "Solar_Angles.AZIMUTH_ANGLE", NULL); - if( pszVal ) - aosList.AddNameValue( "SOLAR_AZIMUTH_ANGLE", pszVal ); - } - - CPLXMLNode* psQII = CPLGetXMLNode(psRoot, "Quality_Indicators_Info"); - if( psQII != NULL ) - { - CPLXMLNode* psICCQI = CPLGetXMLNode(psQII, "Image_Content_QI"); - for( CPLXMLNode* psIter = (psICCQI ? psICCQI->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - if( psIter->psChild != NULL && psIter->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( psIter->pszValue, - psIter->psChild->pszValue ); - } - } - } - - return aosList.StealList(); -} - -/************************************************************************/ -/* SENTINEL2GetTilename() */ -/************************************************************************/ - -static CPLString SENTINEL2GetTilename(const CPLString& osGranulePath, - const CPLString& osGranuleName, - const CPLString& osBandName, - bool bIsPreview = false, - int nPrecisionL2A = 0) -{ - CPLString osJPEG2000Name(osGranuleName); - if( osJPEG2000Name.size() > 7 && - osJPEG2000Name[osJPEG2000Name.size()-7] == '_' && - osJPEG2000Name[osJPEG2000Name.size()-6] == 'N' ) - { - osJPEG2000Name.resize(osJPEG2000Name.size()-7); - } - - const SENTINEL2_L2A_BandDescription* psL2ABandDesc = - (nPrecisionL2A) ? SENTINEL2GetL2ABandDesc(osBandName): NULL; - - CPLString osTile(osGranulePath); - const char chSeparator = SENTINEL2GetPathSeparator(osTile); - if( osTile.size() ) - osTile += chSeparator; - if( bIsPreview || - (psL2ABandDesc != NULL && psL2ABandDesc->eLocation == TL_QI_DATA ) ) - { - osTile += "QI_DATA"; - osTile += chSeparator; - if( osJPEG2000Name.size() > 12 && - osJPEG2000Name[8] == '_' && osJPEG2000Name[12] == '_' ) - { - if( atoi(osBandName) > 0 ) - { - osJPEG2000Name[9] = 'P'; - osJPEG2000Name[10] = 'V'; - osJPEG2000Name[11] = 'I'; - } - else if( nPrecisionL2A && osBandName.size() == 3 ) - { - osJPEG2000Name[9] = osBandName[0]; - osJPEG2000Name[10] = osBandName[1]; - osJPEG2000Name[11] = osBandName[2]; - } - } - else - { - CPLDebug("SENTINEL2", "Invalid granule path: %s", - osGranulePath.c_str()); - } - osTile += osJPEG2000Name; - if( nPrecisionL2A && !bIsPreview ) - osTile += CPLSPrintf("_%02dm", nPrecisionL2A); - } - else - { - osTile += "IMG_DATA"; - osTile += chSeparator; - if( (psL2ABandDesc != NULL && psL2ABandDesc->eLocation == TL_IMG_DATA_Rxxm) || - (psL2ABandDesc == NULL && nPrecisionL2A != 0) ) - { - osTile += CPLSPrintf("R%02dm", nPrecisionL2A); - osTile += chSeparator; - } - if( osJPEG2000Name.size() > 12 && - osJPEG2000Name[8] == '_' && osJPEG2000Name[12] == '_' ) - { - if( atoi(osBandName) > 0 ) - { - osJPEG2000Name[9] = 'M'; - osJPEG2000Name[10] = 'S'; - osJPEG2000Name[11] = 'I'; - } - else if( nPrecisionL2A && osBandName.size() == 3 ) - { - osJPEG2000Name[9] = osBandName[0]; - osJPEG2000Name[10] = osBandName[1]; - osJPEG2000Name[11] = osBandName[2]; - } - } - else - { - CPLDebug("SENTINEL2", "Invalid granule path: %s", - osGranulePath.c_str()); - } - osTile += osJPEG2000Name; - if( atoi(osBandName) > 0 ) - { - osTile += "_B"; - if( osBandName.size() == 3 && osBandName[0] == '0' ) - osTile += osBandName.substr(1); - else - osTile += osBandName; - } - if( nPrecisionL2A ) - osTile += CPLSPrintf("_%02dm", nPrecisionL2A); - } - osTile += ".jp2"; - return osTile; -} - -/************************************************************************/ -/* SENTINEL2GetMainMTDFilenameFromGranuleMTD() */ -/************************************************************************/ - -static CPLString SENTINEL2GetMainMTDFilenameFromGranuleMTD(const char* pszFilename) -{ - // Look for product MTD file - CPLString osTopDir(CPLFormFilename( - CPLFormFilename( CPLGetDirname(pszFilename), "..", NULL ), - "..", NULL )); - - // Workaround to avoid long filenames on Windows - if( CPLIsFilenameRelative(pszFilename) ) - { - // GRANULE/bla/bla.xml - const char* pszPath = CPLGetPath(pszFilename); - if( strchr(pszPath, '/') || strchr(pszPath, '\\') ) - { - osTopDir = CPLGetPath(CPLGetPath(pszPath)); - if( osTopDir == "" ) - osTopDir = "."; - } - } - - char** papszContents = VSIReadDir(osTopDir); - CPLString osMainMTD; - for(char** papszIter = papszContents; papszIter && *papszIter; ++papszIter) - { - if( strlen(*papszIter) >= strlen("S2A_XXXX_MTD") && - (STARTS_WITH_CI(*papszIter, "S2A_") || - STARTS_WITH_CI(*papszIter, "S2B_")) && - EQUALN(*papszIter + strlen("S2A_XXXX"), "_MTD", 4) ) - { - osMainMTD = CPLFormFilename(osTopDir, *papszIter, NULL); - break; - } - } - CSLDestroy(papszContents); - return osMainMTD; -} - -/************************************************************************/ -/* SENTINEL2GetResolutionSetAndMainMDFromGranule() */ -/************************************************************************/ - -static void SENTINEL2GetResolutionSetAndMainMDFromGranule( - const char* pszFilename, - const char* pszRootPathWithoutEqual, - int nResolutionOfInterest, - std::set<int>& oSetResolutions, - std::map<int, std::set<CPLString> >& oMapResolutionsToBands, - char**& papszMD, - CPLXMLNode** ppsRootMainMTD) -{ - CPLString osMainMTD(SENTINEL2GetMainMTDFilenameFromGranuleMTD(pszFilename)); - - // Parse product MTD if available - papszMD = NULL; - if( osMainMTD.size() != 0 && - /* env var for debug only */ - CSLTestBoolean(CPLGetConfigOption("SENTINEL2_USE_MAIN_MTD", "YES")) ) - { - CPLXMLNode *psRootMainMTD = CPLParseXMLFile( osMainMTD ); - if( psRootMainMTD != NULL ) - { - CPLStripXMLNamespace(psRootMainMTD, NULL, TRUE); - - CPLXMLNode* psProductInfo = CPLGetXMLNode(psRootMainMTD, - CPLSPrintf("=%s.General_Info.Product_Info", pszRootPathWithoutEqual)); - if( psProductInfo != NULL ) - { - SENTINEL2GetResolutionSet(psProductInfo, - oSetResolutions, - oMapResolutionsToBands); - } - - papszMD = SENTINEL2GetUserProductMetadata(psRootMainMTD, - pszRootPathWithoutEqual); - if( ppsRootMainMTD != NULL ) - *ppsRootMainMTD = psRootMainMTD; - else - CPLDestroyXMLNode(psRootMainMTD); - } - } - else - { - // If no main MTD file found, then probe all bands for resolution (of - // interest if there's one, or all resolutions otherwise) - for(size_t i=0;i<NB_BANDS;i++) - { - if( nResolutionOfInterest != 0 && - asBandDesc[i].nResolution != nResolutionOfInterest ) - { - continue; - } - CPLString osBandName = asBandDesc[i].pszBandName + 1; /* skip B character */ - if( atoi(osBandName) < 10 ) - osBandName = "0" + osBandName; - - CPLString osTile(SENTINEL2GetTilename(CPLGetPath(pszFilename), - CPLGetBasename(pszFilename), - osBandName)); - VSIStatBufL sStat; - if( VSIStatExL(osTile, &sStat, VSI_STAT_EXISTS_FLAG) == 0 ) - { - oMapResolutionsToBands[asBandDesc[i].nResolution].insert(osBandName); - oSetResolutions.insert(asBandDesc[i].nResolution); - } - } - } -} - -/************************************************************************/ -/* OpenL1BGranule() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1BGranule( const char* pszFilename, - CPLXMLNode** ppsRoot, - int nResolutionOfInterest, - std::set<CPLString> *poBandSet ) -{ - CPLXMLNode *psRoot = CPLParseXMLFile( pszFilename ); - if( psRoot == NULL ) - return NULL; - - char* pszOriginalXML = CPLSerializeXMLTree(psRoot); - CPLString osOriginalXML; - if( pszOriginalXML ) - osOriginalXML = pszOriginalXML; - CPLFree(pszOriginalXML); - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - CPLString osMainMTD(SENTINEL2GetMainMTDFilenameFromGranuleMTD(pszFilename)); - - SENTINEL2DatasetContainer* poDS = new SENTINEL2DatasetContainer(); - - if( osOriginalXML.size() ) - { - char* apszXMLMD[2]; - apszXMLMD[0] = const_cast<char*>(osOriginalXML.c_str()); - apszXMLMD[1] = NULL; - poDS->GDALDataset::SetMetadata(apszXMLMD, "xml:SENTINEL2"); - } - - std::set<int> oSetResolutions; - std::map<int, std::set<CPLString> > oMapResolutionsToBands; - char** papszMD = NULL; - SENTINEL2GetResolutionSetAndMainMDFromGranule(pszFilename, - "Level-1B_User_Product", - nResolutionOfInterest, - oSetResolutions, - oMapResolutionsToBands, - papszMD, - NULL); - if( poBandSet != NULL ) - *poBandSet = oMapResolutionsToBands[nResolutionOfInterest]; - - char** papszGranuleMD = SENTINEL2GetL1BGranuleMetadata(psRoot); - papszMD = CSLMerge(papszMD, papszGranuleMD); - CSLDestroy(papszGranuleMD); - - // Remove CLOUD_COVERAGE_ASSESSMENT that comes from main metadata, if granule - // CLOUDY_PIXEL_PERCENTAGE is present. - if( CSLFetchNameValue(papszMD, "CLOUDY_PIXEL_PERCENTAGE") != NULL && - CSLFetchNameValue(papszMD, "CLOUD_COVERAGE_ASSESSMENT") != NULL ) - { - papszMD = CSLSetNameValue(papszMD, "CLOUD_COVERAGE_ASSESSMENT", NULL); - } - - poDS->GDALDataset::SetMetadata(papszMD); - CSLDestroy(papszMD); - - // Get the footprint - const char* pszPosList = CPLGetXMLValue(psRoot, - "=Level-1B_Granule_ID.Geometric_Info.Granule_Footprint." - "Granule_Footprint.Footprint.EXT_POS_LIST", NULL); - if( pszPosList != NULL ) - { - CPLString osPolygon = SENTINEL2GetPolygonWKTFromPosList(pszPosList); - if( osPolygon.size() ) - poDS->GDALDataset::SetMetadataItem("FOOTPRINT", osPolygon.c_str()); - } - - /* Create subdatsets per resolution (10, 20, 60m) */ - int iSubDSNum = 1; - for(std::set<int>::const_iterator oIterRes = oSetResolutions.begin(); - oIterRes != oSetResolutions.end(); - ++oIterRes ) - { - const int nResolution = *oIterRes; - - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("SENTINEL2_L1B:%s:%dm", - pszFilename, - nResolution), - "SUBDATASETS"); - - CPLString osBandNames = SENTINEL2GetBandListForResolution( - oMapResolutionsToBands[nResolution]); - - CPLString osDesc(CPLSPrintf("Bands %s with %dm resolution", - osBandNames.c_str(), - nResolution)); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - iSubDSNum ++; - } - - if( ppsRoot != NULL ) - { - *ppsRoot = oXMLHolder.Release(); - } - - return poDS; -} - -/************************************************************************/ -/* SENTINEL2SetBandMetadata() */ -/************************************************************************/ - -static void SENTINEL2SetBandMetadata(GDALRasterBand* poBand, - const CPLString& osBandName) -{ - CPLString osLookupBandName(osBandName); - if( osLookupBandName[0] == '0' ) - osLookupBandName = osLookupBandName.substr(1); - if( atoi(osLookupBandName) > 0 ) - osLookupBandName = "B" + osLookupBandName; - - CPLString osBandDesc(osLookupBandName); - const SENTINEL2BandDescription* psBandDesc = - SENTINEL2GetBandDesc(osLookupBandName); - if( psBandDesc != NULL ) - { - osBandDesc += CPLSPrintf(", central wavelength %d nm", - psBandDesc->nWaveLength); - poBand->SetColorInterpretation(psBandDesc->eColorInterp); - poBand->SetMetadataItem("BANDNAME", psBandDesc->pszBandName); - poBand->SetMetadataItem("BANDWIDTH", CPLSPrintf("%d", - psBandDesc->nBandWidth)); - poBand->SetMetadataItem("BANDWIDTH_UNIT", "nm"); - poBand->SetMetadataItem("WAVELENGTH", CPLSPrintf("%d", - psBandDesc->nWaveLength)); - poBand->SetMetadataItem("WAVELENGTH_UNIT", "nm"); - } - else - { - const SENTINEL2_L2A_BandDescription* psL2ABandDesc = - SENTINEL2GetL2ABandDesc(osBandName); - if(psL2ABandDesc != NULL ) - { - osBandDesc += ", "; - osBandDesc += psL2ABandDesc->pszBandDescription; - } - - poBand->SetMetadataItem("BANDNAME", osBandName); - } - poBand->SetDescription(osBandDesc); -} - -/************************************************************************/ -/* OpenL1BSubdataset() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1BSubdataset( GDALOpenInfo * poOpenInfo ) -{ - CPLString osFilename; - CPLAssert( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1B:") ); - osFilename = poOpenInfo->pszFilename + strlen("SENTINEL2_L1B:"); - const char* pszPrecision = strrchr(osFilename.c_str(), ':'); - if( pszPrecision == NULL || pszPrecision == osFilename.c_str() ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Invalid syntax for SENTINEL2_L1B:"); - return NULL; - } - const int nSubDSPrecision = atoi(pszPrecision + 1); - if( nSubDSPrecision != 10 && nSubDSPrecision != 20 && nSubDSPrecision != 60 ) - { - CPLError(CE_Failure, CPLE_NotSupported, "Unsupported precision: %d", - nSubDSPrecision); - return NULL; - } - osFilename.resize( pszPrecision - osFilename.c_str() ); - - CPLXMLNode* psRoot = NULL; - std::set<CPLString> oSetBands; - GDALDataset* poTmpDS = OpenL1BGranule( osFilename, &psRoot, - nSubDSPrecision, &oSetBands); - if( poTmpDS == NULL ) - return NULL; - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - - std::vector<CPLString> aosBands; - for(std::set<CPLString>::const_iterator oIterBandnames = oSetBands.begin(); - oIterBandnames != oSetBands.end(); - ++oIterBandnames) - { - aosBands.push_back(*oIterBandnames); - } - /* Put 2=Blue, 3=Green, 4=Band bands in RGB order for conveniency */ - if( aosBands.size() >= 3 && - aosBands[0] == "02" && - aosBands[1] == "03" && - aosBands[2] == "04" ) - { - aosBands[0] = "04"; - aosBands[2] = "02"; - } - - int nBits = 0; /* 0 = unknown yet*/ - int nValMax = 0; /* 0 = unknown yet*/ - int nRows = 0, nCols = 0; - CPLXMLNode* psGranuleDimensions = - CPLGetXMLNode(psRoot, "=Level-1B_Granule_ID.Geometric_Info.Granule_Dimensions"); - if( psGranuleDimensions == NULL ) - { - for( size_t i=0; i<aosBands.size(); i++ ) - { - CPLString osTile(SENTINEL2GetTilename(CPLGetPath(osFilename), - CPLGetBasename(osFilename), - aosBands[i])); - if( SENTINEL2GetTileInfo(osTile, &nCols, &nRows, &nBits) ) - { - if( nBits <= 16 ) - nValMax = (1 << nBits) - 1; - else - { - CPLDebug("SENTINEL2", "Unexpected bit depth %d", nBits); - nValMax = 65535; - } - break; - } - } - } - else - { - for(CPLXMLNode* psIter = psGranuleDimensions->psChild; psIter != NULL; - psIter = psIter->psNext) - { - if( psIter->eType != CXT_Element ) - continue; - if( EQUAL(psIter->pszValue, "Size") && - atoi(CPLGetXMLValue(psIter, "resolution", "")) == nSubDSPrecision ) - { - const char* pszRows = CPLGetXMLValue(psIter, "NROWS", NULL); - if( pszRows == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", - "NROWS"); - delete poTmpDS; - return NULL; - } - const char* pszCols = CPLGetXMLValue(psIter, "NCOLS", NULL); - if( pszCols == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", - "NCOLS"); - delete poTmpDS; - return NULL; - } - nRows = atoi(pszRows); - nCols = atoi(pszCols); - break; - } - } - } - if( nRows <= 0 || nCols <= 0 ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find granule dimension"); - delete poTmpDS; - return NULL; - } - - SENTINEL2Dataset* poDS = new SENTINEL2Dataset(nCols, nRows); - poDS->aosNonJP2Files.push_back(osFilename); - - // Transfer metadata - poDS->GDALDataset::SetMetadata( poTmpDS->GetMetadata() ); - poDS->GDALDataset::SetMetadata( poTmpDS->GetMetadata("xml:SENTINEL2"), "xml:SENTINEL2" ); - - delete poTmpDS; - -/* -------------------------------------------------------------------- */ -/* Initialize bands. */ -/* -------------------------------------------------------------------- */ - - int nSaturatedVal = atoi(CSLFetchNameValueDef(poDS->GetMetadata(), "SPECIAL_VALUE_SATURATED", "-1")); - int nNodataVal = atoi(CSLFetchNameValueDef(poDS->GetMetadata(), "SPECIAL_VALUE_NODATA", "-1")); - - const bool bAlpha = - CSLTestBoolean(SENTINEL2GetOption(poOpenInfo, "ALPHA", "FALSE")) != FALSE; - const int nBands = ((bAlpha) ? 1 : 0) + static_cast<int>(aosBands.size()); - const int nAlphaBand = (!bAlpha) ? 0 : nBands; - const GDALDataType eDT = GDT_UInt16; - - for(int nBand=1;nBand<=nBands;nBand++) - { - VRTSourcedRasterBand* poBand; - - if( nBand != nAlphaBand ) - { - poBand = new VRTSourcedRasterBand( poDS, nBand, eDT, - poDS->nRasterXSize, - poDS->nRasterYSize ); - } - else - { - poBand = new SENTINEL2AlphaBand ( poDS, nBand, eDT, - poDS->nRasterXSize, - poDS->nRasterYSize, - nSaturatedVal, - nNodataVal ); - } - - poDS->SetBand(nBand, poBand); - if( nBand == nAlphaBand ) - poBand->SetColorInterpretation(GCI_AlphaBand); - - CPLString osBandName; - if( nBand != nAlphaBand ) - { - osBandName = aosBands[nBand-1]; - SENTINEL2SetBandMetadata( poBand, osBandName); - } - else - osBandName = aosBands[0]; - - CPLString osTile(SENTINEL2GetTilename(CPLGetPath(osFilename), - CPLGetBasename(osFilename), - osBandName)); - - bool bTileFound = false; - if( nValMax == 0 ) - { - /* It is supposed to be 12 bits, but some products have 15 bits */ - if( SENTINEL2GetTileInfo(osTile, NULL, NULL, &nBits) ) - { - bTileFound = true; - if( nBits <= 16 ) - nValMax = (1 << nBits) - 1; - else - { - CPLDebug("SENTINEL2", "Unexpected bit depth %d", nBits); - nValMax = 65535; - } - } - } - else - { - VSIStatBufL sStat; - if( VSIStatExL(osTile, &sStat, VSI_STAT_EXISTS_FLAG) == 0 ) - bTileFound = true; - } - if( !bTileFound ) - { - CPLError(CE_Warning, CPLE_AppDefined, - "Tile %s not found on filesystem. Skipping it", - osTile.c_str()); - continue; - } - - GDALProxyPoolDataset* proxyDS; - proxyDS = new GDALProxyPoolDataset( osTile, - poDS->nRasterXSize, - poDS->nRasterYSize, - GA_ReadOnly, - TRUE); - proxyDS->AddSrcBandDescription(eDT, 128, 128); - - if( nBand != nAlphaBand ) - { - poBand->AddSimpleSource( proxyDS->GetRasterBand(1), - 0, 0, - poDS->nRasterXSize, - poDS->nRasterYSize, - 0, - 0, - poDS->nRasterXSize, - poDS->nRasterYSize); - } - else - { - poBand->AddComplexSource( proxyDS->GetRasterBand(1), - 0, 0, - poDS->nRasterXSize, - poDS->nRasterYSize, - 0, - 0, - poDS->nRasterXSize, - poDS->nRasterYSize, - nValMax /* offset */, - 0 /* scale */); - } - - proxyDS->Dereference(); - - if( (nBits % 8) != 0 ) - { - poBand->SetMetadataItem("NBITS", - CPLSPrintf("%d", nBits), "IMAGE_STRUCTURE"); - } - } - -/* -------------------------------------------------------------------- */ -/* Add georeferencing. */ -/* -------------------------------------------------------------------- */ - //const char* pszDirection = poDS->GetMetadataItem("DATATAKE_1_SENSING_ORBIT_DIRECTION"); - const char* pszFootprint = poDS->GetMetadataItem("FOOTPRINT"); - if( pszFootprint != NULL ) - { - // For descending orbits, we have observed that the order of points in - // the polygon is UL, LL, LR, UR. That might not be true for ascending orbits - // but let's assume it... - char* pszFootprintC = const_cast<char*>(pszFootprint); - OGRGeometry* poGeom = NULL; - if( OGRGeometryFactory::createFromWkt( &pszFootprintC, NULL, &poGeom) - == OGRERR_NONE && - poGeom != NULL && - wkbFlatten(poGeom->getGeometryType()) == wkbPolygon ) - { - OGRLinearRing* poRing = - reinterpret_cast<OGRPolygon*>(poGeom)->getExteriorRing(); - if( poRing != NULL && poRing->getNumPoints() == 5 ) - { - GDAL_GCP asGCPList[5]; - memset( asGCPList, 0, sizeof(asGCPList) ); - for(int i=0;i<4;i++) - { - asGCPList[i].dfGCPX = poRing->getX(i); - asGCPList[i].dfGCPY = poRing->getY(i); - asGCPList[i].dfGCPZ = poRing->getZ(i); - } - asGCPList[0].dfGCPPixel = 0; - asGCPList[0].dfGCPLine = 0; - asGCPList[1].dfGCPPixel = 0; - asGCPList[1].dfGCPLine = poDS->nRasterYSize; - asGCPList[2].dfGCPPixel = poDS->nRasterXSize; - asGCPList[2].dfGCPLine = poDS->nRasterYSize; - asGCPList[3].dfGCPPixel = poDS->nRasterXSize; - asGCPList[3].dfGCPLine = 0; - - int nGCPCount = 4; - CPLXMLNode* psGeometryHeader = - CPLGetXMLNode(psRoot, - "=Level-1B_Granule_ID.Geometric_Info." - "Granule_Position.Geometric_Header"); - if( psGeometryHeader != NULL ) - { - const char* pszGC = - CPLGetXMLValue(psGeometryHeader, "GROUND_CENTER", NULL); - const char* pszQLCenter = - CPLGetXMLValue(psGeometryHeader, "QL_CENTER", NULL); - if( pszGC != NULL && pszQLCenter != NULL && EQUAL(pszQLCenter, "0 0") ) - { - char** papszTokens = CSLTokenizeString(pszGC); - if( CSLCount(papszTokens) >= 2 ) - { - nGCPCount = 5; - asGCPList[4].dfGCPX = CPLAtof(papszTokens[1]); - asGCPList[4].dfGCPY = CPLAtof(papszTokens[0]); - if( CSLCount(papszTokens) >= 3 ) - asGCPList[4].dfGCPZ = CPLAtof(papszTokens[2]); - asGCPList[4].dfGCPLine = poDS->nRasterYSize / 2.0; - asGCPList[4].dfGCPPixel = poDS->nRasterXSize / 2.0; - } - CSLDestroy(papszTokens); - } - } - - poDS->SetGCPs( nGCPCount, asGCPList, SRS_WKT_WGS84 ); - GDALDeinitGCPs( nGCPCount, asGCPList ); - } - } - delete poGeom; - } - -/* -------------------------------------------------------------------- */ -/* Initialize overview information. */ -/* -------------------------------------------------------------------- */ - poDS->SetDescription( poOpenInfo->pszFilename ); - CPLString osOverviewFile; - osOverviewFile = CPLSPrintf("%s_%dm.tif.ovr", - osFilename.c_str(), nSubDSPrecision); - poDS->SetMetadataItem( "OVERVIEW_FILE", osOverviewFile, "OVERVIEWS" ); - poDS->oOvManager.Initialize( poDS, ":::VIRTUAL:::" ); - - return poDS; -} - -/************************************************************************/ -/* OpenL1C_L2A() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1C_L2A( const char* pszFilename, - SENTINEL2Level eLevel ) -{ - CPLXMLNode *psRoot = CPLParseXMLFile( pszFilename ); - if( psRoot == NULL ) - return NULL; - - char* pszOriginalXML = CPLSerializeXMLTree(psRoot); - CPLString osOriginalXML; - if( pszOriginalXML ) - osOriginalXML = pszOriginalXML; - CPLFree(pszOriginalXML); - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - const char* pszNodePath = (eLevel == SENTINEL2_L1C ) ? - "=Level-1C_User_Product.General_Info.Product_Info" : - "=Level-2A_User_Product.General_Info.L2A_Product_Info"; - CPLXMLNode* psProductInfo = CPLGetXMLNode(psRoot, pszNodePath); - if( psProductInfo == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", pszNodePath); - return NULL; - } - - std::set<int> oSetResolutions; - std::map<int, std::set<CPLString> > oMapResolutionsToBands; - if( eLevel == SENTINEL2_L1C && - !SENTINEL2GetResolutionSet(psProductInfo, - oSetResolutions, - oMapResolutionsToBands) ) - { - return NULL; - } - - std::vector<CPLString> aosGranuleList; - if( !SENTINEL2GetGranuleList(psRoot, - eLevel, - pszFilename, - aosGranuleList, - (eLevel == SENTINEL2_L1C) ? NULL : - &oSetResolutions, - (eLevel == SENTINEL2_L1C) ? NULL : - &oMapResolutionsToBands) ) - { - return NULL; - } - - std::set<int> oSetEPSGCodes; - for(size_t i=0;i<aosGranuleList.size();i++) - { - int nEPSGCode = 0; - if( SENTINEL2GetGranuleInfo(eLevel, - aosGranuleList[i], - *(oSetResolutions.begin()), &nEPSGCode) ) - { - oSetEPSGCodes.insert(nEPSGCode); - } - } - - SENTINEL2DatasetContainer* poDS = new SENTINEL2DatasetContainer(); - char** papszMD = SENTINEL2GetUserProductMetadata(psRoot, - (eLevel == SENTINEL2_L1C ) ? "Level-1C_User_Product" : - "Level-2A_User_Product"); - poDS->GDALDataset::SetMetadata(papszMD); - CSLDestroy(papszMD); - - if( osOriginalXML.size() ) - { - char* apszXMLMD[2]; - apszXMLMD[0] = const_cast<char*>(osOriginalXML.c_str()); - apszXMLMD[1] = NULL; - poDS->GDALDataset::SetMetadata(apszXMLMD, "xml:SENTINEL2"); - } - - const char* pszPrefix = (eLevel == SENTINEL2_L1C) ? "SENTINEL2_L1C" : - "SENTINEL2_L2A"; - - /* Create subdatsets per resolution (10, 20, 60m) and EPSG codes */ - int iSubDSNum = 1; - for(std::set<int>::const_iterator oIterRes = oSetResolutions.begin(); - oIterRes != oSetResolutions.end(); - ++oIterRes ) - { - const int nResolution = *oIterRes; - - for(std::set<int>::const_iterator oIterEPSG = oSetEPSGCodes.begin(); - oIterEPSG != oSetEPSGCodes.end(); - ++oIterEPSG ) - { - const int nEPSGCode = *oIterEPSG; - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("%s:%s:%dm:EPSG_%d", - pszPrefix, pszFilename, nResolution, nEPSGCode), - "SUBDATASETS"); - - CPLString osBandNames = SENTINEL2GetBandListForResolution( - oMapResolutionsToBands[nResolution]); - - CPLString osDesc(CPLSPrintf("Bands %s with %dm resolution", - osBandNames.c_str(), nResolution)); - if( nEPSGCode >= 32601 && nEPSGCode <= 32660 ) - osDesc += CPLSPrintf(", UTM %dN", nEPSGCode - 32600); - else if( nEPSGCode >= 32701 && nEPSGCode <= 32760 ) - osDesc += CPLSPrintf(", UTM %dS", nEPSGCode - 32700); - else - osDesc += CPLSPrintf(", EPSG:%d", nEPSGCode); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - iSubDSNum ++; - } - } - - /* Expose PREVIEW subdatasets */ - for(std::set<int>::const_iterator oIterEPSG = oSetEPSGCodes.begin(); - oIterEPSG != oSetEPSGCodes.end(); - ++oIterEPSG ) - { - const int nEPSGCode = *oIterEPSG; - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("%s:%s:PREVIEW:EPSG_%d", - pszPrefix, pszFilename, nEPSGCode), - "SUBDATASETS"); - - CPLString osDesc("RGB preview"); - if( nEPSGCode >= 32601 && nEPSGCode <= 32660 ) - osDesc += CPLSPrintf(", UTM %dN", nEPSGCode - 32600); - else if( nEPSGCode >= 32701 && nEPSGCode <= 32760 ) - osDesc += CPLSPrintf(", UTM %dS", nEPSGCode - 32700); - else - osDesc += CPLSPrintf(", EPSG:%d", nEPSGCode); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - iSubDSNum ++; - } - - pszNodePath = (eLevel == SENTINEL2_L1C ) ? - "=Level-1C_User_Product.Geometric_Info.Product_Footprint." - "Product_Footprint.Global_Footprint.EXT_POS_LIST" : - "=Level-2A_User_Product.Geometric_Info.Product_Footprint." - "Product_Footprint.Global_Footprint.EXT_POS_LIST"; - const char* pszPosList = CPLGetXMLValue(psRoot, pszNodePath, NULL); - if( pszPosList != NULL ) - { - CPLString osPolygon = SENTINEL2GetPolygonWKTFromPosList(pszPosList); - if( osPolygon.size() ) - poDS->GDALDataset::SetMetadataItem("FOOTPRINT", osPolygon.c_str()); - } - - return poDS; -} - -/************************************************************************/ -/* SENTINEL2GetL1BCTileMetadata() */ -/************************************************************************/ - -static -char** SENTINEL2GetL1BCTileMetadata( CPLXMLNode* psMainMTD ) -{ - CPLStringList aosList; - - CPLXMLNode* psRoot = CPLGetXMLNode(psMainMTD, - "=Level-1C_Tile_ID"); - if( psRoot == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "Cannot find =Level-1C_Tile_ID"); - return NULL; - } - CPLXMLNode* psGeneralInfo = CPLGetXMLNode(psRoot, - "General_Info"); - for( CPLXMLNode* psIter = (psGeneralInfo ? psGeneralInfo->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - const char* pszValue = CPLGetXMLValue(psIter, NULL, NULL); - if( pszValue != NULL ) - { - aosList.AddNameValue( psIter->pszValue, pszValue ); - } - } - - CPLXMLNode* psQII = CPLGetXMLNode(psRoot, "Quality_Indicators_Info"); - if( psQII != NULL ) - { - CPLXMLNode* psICCQI = CPLGetXMLNode(psQII, "Image_Content_QI"); - for( CPLXMLNode* psIter = (psICCQI ? psICCQI->psChild : NULL); - psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element ) - continue; - if( psIter->psChild != NULL && psIter->psChild->eType == CXT_Text ) - { - aosList.AddNameValue( psIter->pszValue, - psIter->psChild->pszValue ); - } - } - } - - return aosList.StealList(); -} - -/************************************************************************/ -/* OpenL1CTile() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1CTile( const char* pszFilename, - CPLXMLNode** ppsRootMainMTD, - int nResolutionOfInterest, - std::set<CPLString>* poBandSet ) -{ - CPLXMLNode *psRoot = CPLParseXMLFile( pszFilename ); - if( psRoot == NULL ) - return NULL; - - char* pszOriginalXML = CPLSerializeXMLTree(psRoot); - CPLString osOriginalXML; - if( pszOriginalXML ) - osOriginalXML = pszOriginalXML; - CPLFree(pszOriginalXML); - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - std::set<int> oSetResolutions; - std::map<int, std::set<CPLString> > oMapResolutionsToBands; - char** papszMD = NULL; - SENTINEL2GetResolutionSetAndMainMDFromGranule(pszFilename, - "Level-1C_User_Product", - nResolutionOfInterest, - oSetResolutions, - oMapResolutionsToBands, - papszMD, - ppsRootMainMTD); - if( poBandSet != NULL ) - *poBandSet = oMapResolutionsToBands[nResolutionOfInterest]; - - SENTINEL2DatasetContainer* poDS = new SENTINEL2DatasetContainer(); - - char** papszGranuleMD = SENTINEL2GetL1BCTileMetadata(psRoot); - papszMD = CSLMerge(papszMD, papszGranuleMD); - CSLDestroy(papszGranuleMD); - - // Remove CLOUD_COVERAGE_ASSESSMENT that comes from main metadata, if granule - // CLOUDY_PIXEL_PERCENTAGE is present. - if( CSLFetchNameValue(papszMD, "CLOUDY_PIXEL_PERCENTAGE") != NULL && - CSLFetchNameValue(papszMD, "CLOUD_COVERAGE_ASSESSMENT") != NULL ) - { - papszMD = CSLSetNameValue(papszMD, "CLOUD_COVERAGE_ASSESSMENT", NULL); - } - - poDS->GDALDataset::SetMetadata(papszMD); - CSLDestroy(papszMD); - - if( osOriginalXML.size() ) - { - char* apszXMLMD[2]; - apszXMLMD[0] = const_cast<char*>(osOriginalXML.c_str()); - apszXMLMD[1] = NULL; - poDS->GDALDataset::SetMetadata(apszXMLMD, "xml:SENTINEL2"); - } - - /* Create subdatsets per resolution (10, 20, 60m) */ - int iSubDSNum = 1; - for(std::set<int>::const_iterator oIterRes = oSetResolutions.begin(); - oIterRes != oSetResolutions.end(); - ++oIterRes ) - { - const int nResolution = *oIterRes; - - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("%s:%s:%dm", - "SENTINEL2_L1C_TILE", pszFilename, nResolution), - "SUBDATASETS"); - - CPLString osBandNames = SENTINEL2GetBandListForResolution( - oMapResolutionsToBands[nResolution]); - - CPLString osDesc(CPLSPrintf("Bands %s with %dm resolution", - osBandNames.c_str(), nResolution)); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - iSubDSNum ++; - } - - /* Expose PREVIEW subdataset */ - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_NAME", iSubDSNum), - CPLSPrintf("%s:%s:PREVIEW", - "SENTINEL2_L1C_TILE", pszFilename), - "SUBDATASETS"); - - CPLString osDesc("RGB preview"); - poDS->GDALDataset::SetMetadataItem( - CPLSPrintf("SUBDATASET_%d_DESC", iSubDSNum), - osDesc.c_str(), - "SUBDATASETS"); - - return poDS; -} - -/************************************************************************/ -/* SENTINEL2GetOption() */ -/************************************************************************/ - -static -const char* SENTINEL2GetOption( GDALOpenInfo* poOpenInfo, - const char* pszName, - const char* pszDefaultVal ) -{ -#ifdef GDAL_DMD_OPENOPTIONLIST - const char* pszVal = CSLFetchNameValue(poOpenInfo->papszOpenOptions, pszName); - if( pszVal != NULL ) - return pszVal; -#else - (void) poOpenInfo; -#endif - return CPLGetConfigOption( CPLSPrintf("SENTINEL2_%s", pszName), pszDefaultVal ); -} - -/************************************************************************/ -/* LaunderUnit() */ -/************************************************************************/ - -static CPLString LaunderUnit(const char* pszUnit) -{ - CPLString osUnit; - for(int i=0; pszUnit[i] != '\0'; ) - { - if( strncmp(pszUnit + i, "\xC2" "\xB2", 2) == 0 ) /* square / 2 */ - { - i += 2; - osUnit += "2"; - } - else if( strncmp(pszUnit + i, "\xC2" "\xB5", 2) == 0 ) /* micro */ - { - i += 2; - osUnit += "u"; - } - else - { - osUnit += pszUnit[i]; - i ++; - } - } - return osUnit; -} - -/************************************************************************/ -/* SENTINEL2GetTileInfo() */ -/************************************************************************/ - -static bool SENTINEL2GetTileInfo(const char* pszFilename, - int* pnWidth, int* pnHeight, int *pnBits) -{ - static const unsigned char jp2_box_jp[] = {0x6a,0x50,0x20,0x20}; /* 'jP ' */ - VSILFILE* fp = VSIFOpenL(pszFilename, "rb"); - if( fp == NULL ) - return false; - GByte abyHeader[8]; - if( VSIFReadL(abyHeader, 8, 1, fp) != 1 ) - { - VSIFCloseL(fp); - return false; - } - if( memcmp(abyHeader + 4, jp2_box_jp, 4) == 0 ) - { - bool bRet = false; - /* Just parse the ihdr box instead of doing a full dataset opening */ - GDALJP2Box oBox( fp ); - if( oBox.ReadFirst() ) - { - while( strlen(oBox.GetType()) > 0 ) - { - if( EQUAL(oBox.GetType(),"jp2h") ) - { - GDALJP2Box oChildBox( fp ); - if( !oChildBox.ReadFirstChild( &oBox ) ) - break; - - while( strlen(oChildBox.GetType()) > 0 ) - { - if( EQUAL(oChildBox.GetType(),"ihdr") ) - { - GByte* pabyData = oChildBox.ReadBoxData(); - GIntBig nLength = oChildBox.GetDataLength(); - if( pabyData != NULL && nLength >= 4 + 4 + 2 + 1 ) - { - bRet = true; - if( pnHeight ) - { - memcpy(pnHeight, pabyData, 4); - CPL_MSBPTR32(pnHeight); - } - if( pnWidth ) - { - memcpy(pnWidth, pabyData+4, 4); - CPL_MSBPTR32(pnWidth); - } - if( pnBits ) - { - GByte byPBC = pabyData[4+4+2]; - if( byPBC != 255 ) - { - *pnBits = 1 + (byPBC & 0x7f); - } - else - *pnBits = 0; - } - } - CPLFree(pabyData); - break; - } - if( !oChildBox.ReadNextChild( &oBox ) ) - break; - } - break; - } - - if (!oBox.ReadNext()) - break; - } - } - VSIFCloseL(fp); - return bRet; - } - else /* for unit tests, we use TIFF */ - { - VSIFCloseL(fp); - GDALDataset* poDS = (GDALDataset*)GDALOpen(pszFilename, GA_ReadOnly); - bool bRet = false; - if( poDS != NULL ) - { - if( poDS->GetRasterCount() != 0 ) - { - bRet = true; - if( pnWidth ) - *pnWidth = poDS->GetRasterXSize(); - if( pnHeight ) - *pnHeight = poDS->GetRasterYSize(); - if( pnBits ) - { - const char* pszNBits = poDS->GetRasterBand(1)->GetMetadataItem( - "NBITS", "IMAGE_STRUCTURE"); - if( pszNBits == NULL ) - { - GDALDataType eDT = poDS->GetRasterBand(1)->GetRasterDataType(); - pszNBits = CPLSPrintf( "%d", GDALGetDataTypeSize(eDT) ); - } - *pnBits = atoi(pszNBits); - } - } - GDALClose(poDS); - } - return bRet; - } -} - -/************************************************************************/ -/* OpenL1C_L2ASubdataset() */ -/************************************************************************/ - -GDALDataset *SENTINEL2Dataset::OpenL1C_L2ASubdataset( GDALOpenInfo * poOpenInfo, - SENTINEL2Level eLevel ) -{ - CPLString osFilename; - const char* pszPrefix = (eLevel == SENTINEL2_L1C) ? "SENTINEL2_L1C" : - "SENTINEL2_L2A"; - CPLAssert( STARTS_WITH_CI(poOpenInfo->pszFilename, pszPrefix) ); - osFilename = poOpenInfo->pszFilename + strlen(pszPrefix) + 1; - const char* pszEPSGCode = strrchr(osFilename.c_str(), ':'); - if( pszEPSGCode == NULL || pszEPSGCode == osFilename.c_str() ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "Invalid syntax for %s:", pszPrefix); - return NULL; - } - osFilename[ (size_t)(pszEPSGCode - osFilename.c_str()) ] = '\0'; - const char* pszPrecision = strrchr(osFilename.c_str(), ':'); - if( pszPrecision == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "Invalid syntax for %s:", pszPrefix); - return NULL; - } - - if( !STARTS_WITH_CI(pszEPSGCode+1, "EPSG_") ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "Invalid syntax for %s:", pszPrefix); - return NULL; - } - - const int nSubDSEPSGCode = atoi(pszEPSGCode + 1 + strlen("EPSG_")); - const bool bIsPreview = STARTS_WITH_CI(pszPrecision + 1, "PREVIEW"); - const int nSubDSPrecision = (bIsPreview) ? 320 : atoi(pszPrecision + 1); - if( !bIsPreview && - nSubDSPrecision != 10 && nSubDSPrecision != 20 && nSubDSPrecision != 60 ) - { - CPLError(CE_Failure, CPLE_NotSupported, "Unsupported precision: %d", - nSubDSPrecision); - return NULL; - } - - osFilename.resize( pszPrecision - osFilename.c_str() ); - std::vector<CPLString> aosNonJP2Files; - aosNonJP2Files.push_back(osFilename); - - CPLXMLNode *psRoot = CPLParseXMLFile( osFilename ); - if( psRoot == NULL ) - return NULL; - - char* pszOriginalXML = CPLSerializeXMLTree(psRoot); - CPLString osOriginalXML; - if( pszOriginalXML ) - osOriginalXML = pszOriginalXML; - CPLFree(pszOriginalXML); - - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRoot); - CPLStripXMLNamespace(psRoot, NULL, TRUE); - - std::vector<CPLString> aosGranuleList; - std::set<int> oSetResolutions; - std::map<int, std::set<CPLString> > oMapResolutionsToBands; - if( !SENTINEL2GetGranuleList(psRoot, - eLevel, - osFilename, - aosGranuleList, - NULL, - (eLevel == SENTINEL2_L1C) ? NULL : - &oMapResolutionsToBands) ) - { - return NULL; - } - - std::vector<CPLString> aosBands; - std::set<CPLString> oSetBands; - if( bIsPreview ) - { - aosBands.push_back("04"); - aosBands.push_back("03"); - aosBands.push_back("02"); - } - else if( eLevel == SENTINEL2_L1C ) - { - CPLXMLNode* psBandList = CPLGetXMLNode(psRoot, - "=Level-1C_User_Product.General_Info.Product_Info.Query_Options.Band_List"); - if( psBandList == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Cannot find %s", - "Query_Options.Band_List"); - return NULL; - } - - for(CPLXMLNode* psIter = psBandList->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "BAND_NAME") ) - continue; - const char* pszBandName = CPLGetXMLValue(psIter, NULL, ""); - const SENTINEL2BandDescription* psBandDesc = - SENTINEL2GetBandDesc(pszBandName); - if( psBandDesc == NULL ) - { - CPLDebug("SENTINEL2", "Unknown band name %s", pszBandName); - continue; - } - if( psBandDesc->nResolution != nSubDSPrecision ) - continue; - CPLString osName = psBandDesc->pszBandName + 1; /* skip B character */ - if( atoi(osName) < 10 ) - osName = "0" + osName; - oSetBands.insert(osName); - } - if( oSetBands.size() == 0 ) - return NULL; - } - else - { - oSetBands = oMapResolutionsToBands[nSubDSPrecision]; - } - - if( aosBands.size() == 0 ) - { - for(std::set<CPLString>::const_iterator oIterBandnames = oSetBands.begin(); - oIterBandnames != oSetBands.end(); - ++oIterBandnames) - { - aosBands.push_back(*oIterBandnames); - } - /* Put 2=Blue, 3=Green, 4=Band bands in RGB order for conveniency */ - if( aosBands.size() >= 3 && - aosBands[0] == "02" && - aosBands[1] == "03" && - aosBands[2] == "04" ) - { - aosBands[0] = "04"; - aosBands[2] = "02"; - } - } - -/* -------------------------------------------------------------------- */ -/* Create dataset. */ -/* -------------------------------------------------------------------- */ - - char** papszMD = SENTINEL2GetUserProductMetadata(psRoot, - (eLevel == SENTINEL2_L1C ) ? "Level-1C_User_Product" : "Level-2A_User_Product"); - - const int nSaturatedVal = atoi(CSLFetchNameValueDef(papszMD, - "SPECIAL_VALUE_SATURATED", "-1")); - const int nNodataVal = atoi(CSLFetchNameValueDef(papszMD, - "SPECIAL_VALUE_NODATA", "-1")); - - const bool bAlpha = - CSLTestBoolean(SENTINEL2GetOption(poOpenInfo, "ALPHA", "FALSE")) != FALSE; - - SENTINEL2Dataset* poDS = CreateL1CL2ADataset(eLevel, - aosGranuleList, - aosNonJP2Files, - nSubDSPrecision, - bIsPreview, - nSubDSEPSGCode, - bAlpha, - aosBands, - nSaturatedVal, - nNodataVal); - if( poDS == NULL ) - { - CSLDestroy(papszMD); - return NULL; - } - - if( osOriginalXML.size() ) - { - char* apszXMLMD[2]; - apszXMLMD[0] = const_cast<char*>(osOriginalXML.c_str()); - apszXMLMD[1] = NULL; - poDS->GDALDataset::SetMetadata(apszXMLMD, "xml:SENTINEL2"); - } - - poDS->GDALDataset::SetMetadata(papszMD); - CSLDestroy(papszMD); - -/* -------------------------------------------------------------------- */ -/* Add extra band metadata. */ -/* -------------------------------------------------------------------- */ - poDS->AddL1CL2ABandMetadata(eLevel, psRoot, aosBands); - -/* -------------------------------------------------------------------- */ -/* Initialize overview information. */ -/* -------------------------------------------------------------------- */ - poDS->SetDescription( poOpenInfo->pszFilename ); - CPLString osOverviewFile; - if( bIsPreview ) - osOverviewFile = CPLSPrintf("%s_PREVIEW_EPSG_%d.tif.ovr", - osFilename.c_str(), nSubDSEPSGCode); - else - osOverviewFile = CPLSPrintf("%s_%dm_EPSG_%d.tif.ovr", - osFilename.c_str(), nSubDSPrecision, - nSubDSEPSGCode); - poDS->SetMetadataItem( "OVERVIEW_FILE", osOverviewFile, "OVERVIEWS" ); - poDS->oOvManager.Initialize( poDS, ":::VIRTUAL:::" ); - - return poDS; -} - -/************************************************************************/ -/* AddL1CL2ABandMetadata() */ -/************************************************************************/ - -void SENTINEL2Dataset::AddL1CL2ABandMetadata(SENTINEL2Level eLevel, - CPLXMLNode* psRoot, - const std::vector<CPLString>& aosBands) -{ - CPLXMLNode* psIC = CPLGetXMLNode(psRoot, - (eLevel == SENTINEL2_L1C) ? - "=Level-1C_User_Product.General_Info.Product_Image_Characteristics" : - "=Level-2A_User_Product.General_Info.L2A_Product_Image_Characteristics"); - if( psIC != NULL ) - { - CPLXMLNode* psSIL = CPLGetXMLNode(psIC, - "Reflectance_Conversion.Solar_Irradiance_List"); - if( psSIL != NULL ) - { - for(CPLXMLNode* psIter = psSIL->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "SOLAR_IRRADIANCE") ) - { - continue; - } - const char* pszBandId = CPLGetXMLValue(psIter, "bandId", NULL); - const char* pszUnit = CPLGetXMLValue(psIter, "unit", NULL); - const char* pszValue = CPLGetXMLValue(psIter, NULL, NULL); - if( pszBandId != NULL && pszUnit != NULL && pszValue != NULL ) - { - int nIdx = atoi(pszBandId); - if( nIdx >= 0 && nIdx < (int)NB_BANDS ) - { - for(int i=0;i<nBands;i++) - { - GDALRasterBand* poBand = GetRasterBand(i+1); - const char* pszBandName = - poBand->GetMetadataItem("BANDNAME"); - if( pszBandName != NULL && - EQUAL(asBandDesc[nIdx].pszBandName, pszBandName) ) - { - poBand->GDALRasterBand::SetMetadataItem( - "SOLAR_IRRADIANCE", pszValue); - poBand->GDALRasterBand::SetMetadataItem( - "SOLAR_IRRADIANCE_UNIT", - LaunderUnit(pszUnit)); - break; - } - } - } - } - } - } - } - -/* -------------------------------------------------------------------- */ -/* Add Scene Classification category values (L2A) */ -/* -------------------------------------------------------------------- */ - CPLXMLNode* psSCL = CPLGetXMLNode(psRoot, - "=Level-2A_User_Product.General_Info." - "L2A_Product_Image_Characteristics.L2A_Scene_Classification_List"); - int nSCLBand = 0; - for(int nBand=1;nBand<=static_cast<int>(aosBands.size());nBand++) - { - if( EQUAL(aosBands[nBand-1], "SCL") ) - { - nSCLBand = nBand; - break; - } - } - if( psSCL != NULL && nSCLBand > 0 ) - { - std::vector<CPLString> osCategories; - for(CPLXMLNode* psIter = psSCL->psChild; psIter != NULL; - psIter = psIter->psNext ) - { - if( psIter->eType != CXT_Element || - !EQUAL(psIter->pszValue, "L2A_Scene_Classification_ID") ) - { - continue; - } - const char* pszText = CPLGetXMLValue(psIter, - "L2A_SCENE_CLASSIFICATION_TEXT", NULL); - const char* pszIdx = CPLGetXMLValue(psIter, - "L2A_SCENE_CLASSIFICATION_INDEX", NULL); - if( pszText && pszIdx && atoi(pszIdx) >= 0 && atoi(pszIdx) < 100 ) - { - int nIdx = atoi(pszIdx); - if( nIdx >= (int)osCategories.size() ) - osCategories.resize(nIdx + 1); - if( STARTS_WITH_CI(pszText, "SC_") ) - osCategories[nIdx] = pszText + 3; - else - osCategories[nIdx] = pszText; - } - } - char** papszCategories = - (char**)CPLCalloc(osCategories.size()+1,sizeof(char*)); - for(size_t i=0;i<osCategories.size();i++) - papszCategories[i] = CPLStrdup(osCategories[i]); - GetRasterBand(nSCLBand)->SetCategoryNames(papszCategories); - CSLDestroy(papszCategories); - } -} - -/************************************************************************/ -/* CreateL1CL2ADataset() */ -/************************************************************************/ - -SENTINEL2Dataset* SENTINEL2Dataset::CreateL1CL2ADataset( - SENTINEL2Level eLevel, - const std::vector<CPLString>& aosGranuleList, - std::vector<CPLString>& aosNonJP2Files, - int nSubDSPrecision, - bool bIsPreview, - int nSubDSEPSGCode, /* or -1 if not known at this point */ - bool bAlpha, - const std::vector<CPLString>& aosBands, - int nSaturatedVal, - int nNodataVal) -{ - - /* Iterate over granule metadata to know the layer extent */ - /* and the location of each granule */ - double dfMinX = 1e20, dfMinY = 1e20, dfMaxX = -1e20, dfMaxY = -1e20; - std::vector<SENTINEL2GranuleInfo> aosGranuleInfoList; - const int nDesiredResolution = (bIsPreview) ? 0 : nSubDSPrecision; - for(size_t i=0;i<aosGranuleList.size();i++) - { - int nEPSGCode = 0; - double dfULX = 0.0, dfULY = 0.0; - int nResolution = 0; - int nWidth = 0, nHeight = 0; - if( SENTINEL2GetGranuleInfo(eLevel, - aosGranuleList[i], - nDesiredResolution, - &nEPSGCode, - &dfULX, &dfULY, - &nResolution, - &nWidth, &nHeight) && - (nSubDSEPSGCode == nEPSGCode || nSubDSEPSGCode < 0) && - nResolution != 0 ) - { - nSubDSEPSGCode = nEPSGCode; - aosNonJP2Files.push_back(aosGranuleList[i]); - - if( dfULX < dfMinX ) dfMinX = dfULX; - if( dfULY > dfMaxY ) dfMaxY = dfULY; - const double dfLRX = dfULX + nResolution * nWidth; - const double dfLRY = dfULY - nResolution * nHeight; - if( dfLRX > dfMaxX ) dfMaxX = dfLRX; - if( dfLRY < dfMinY ) dfMinY = dfLRY; - - SENTINEL2GranuleInfo oGranuleInfo; - oGranuleInfo.osPath = CPLGetPath(aosGranuleList[i]); - oGranuleInfo.dfMinX = dfULX; - oGranuleInfo.dfMinY = dfLRY; - oGranuleInfo.dfMaxX = dfLRX; - oGranuleInfo.dfMaxY = dfULY; - oGranuleInfo.nWidth = nWidth / (nSubDSPrecision / nResolution); - oGranuleInfo.nHeight = nHeight / (nSubDSPrecision / nResolution); - aosGranuleInfoList.push_back(oGranuleInfo); - } - } - if( dfMinX > dfMaxX ) - { - CPLError(CE_Failure, CPLE_NotSupported, - "No granule found for EPSG code %d", - nSubDSEPSGCode); - return NULL; - } - - const int nRasterXSize = static_cast<int> - ((dfMaxX - dfMinX) / nSubDSPrecision + 0.5); - const int nRasterYSize = static_cast<int> - ((dfMaxY - dfMinY) / nSubDSPrecision + 0.5); - SENTINEL2Dataset* poDS = new SENTINEL2Dataset(nRasterXSize, nRasterYSize); - - poDS->aosNonJP2Files = aosNonJP2Files; - - OGRSpatialReference oSRS; - char* pszProjection = NULL; - if( oSRS.importFromEPSG(nSubDSEPSGCode) == OGRERR_NONE && - oSRS.exportToWkt(&pszProjection) == OGRERR_NONE ) - { - poDS->SetProjection(pszProjection); - CPLFree(pszProjection); - } - else - { - CPLDebug("SENTINEL2", "Invalid EPSG code %d", nSubDSEPSGCode); - } - - double adfGeoTransform[6]; - adfGeoTransform[0] = dfMinX; - adfGeoTransform[1] = nSubDSPrecision; - adfGeoTransform[2] = 0; - adfGeoTransform[3] = dfMaxY; - adfGeoTransform[4] = 0; - adfGeoTransform[5] = -nSubDSPrecision; - poDS->SetGeoTransform(adfGeoTransform); - poDS->GDALDataset::SetMetadataItem("COMPRESSION", "JPEG2000", "IMAGE_STRUCTURE"); - if( bIsPreview ) - poDS->GDALDataset::SetMetadataItem("INTERLEAVE", "PIXEL", "IMAGE_STRUCTURE"); - - int nBits = (bIsPreview) ? 8 : 0 /* 0 = unknown yet*/; - int nValMax = (bIsPreview) ? 255 : 0 /* 0 = unknown yet*/; - const int nBands = (bIsPreview) ? 3 : ((bAlpha) ? 1 : 0) + static_cast<int>(aosBands.size()); - const int nAlphaBand = (bIsPreview || !bAlpha) ? 0 : nBands; - const GDALDataType eDT = (bIsPreview) ? GDT_Byte: GDT_UInt16; - - std::map<CPLString, GDALProxyPoolDataset*> oMapPVITile; - - for(int nBand=1;nBand<=nBands;nBand++) - { - VRTSourcedRasterBand* poBand; - - if( nBand != nAlphaBand ) - { - poBand = new VRTSourcedRasterBand( poDS, nBand, eDT, - poDS->nRasterXSize, - poDS->nRasterYSize ); - } - else - { - poBand = new SENTINEL2AlphaBand ( poDS, nBand, eDT, - poDS->nRasterXSize, - poDS->nRasterYSize, - nSaturatedVal, - nNodataVal ); - } - - poDS->SetBand(nBand, poBand); - if( nBand == nAlphaBand ) - poBand->SetColorInterpretation(GCI_AlphaBand); - - CPLString osBandName; - if( nBand != nAlphaBand ) - { - osBandName = aosBands[nBand-1]; - SENTINEL2SetBandMetadata( poBand, osBandName); - } - else - osBandName = aosBands[0]; - - for(size_t iSrc=0;iSrc<aosGranuleInfoList.size();iSrc++) - { - const SENTINEL2GranuleInfo& oGranuleInfo = aosGranuleInfoList[iSrc]; - CPLString osTile(SENTINEL2GetTilename( - oGranuleInfo.osPath, - CPLGetFilename(oGranuleInfo.osPath), - osBandName, - bIsPreview, - (eLevel == SENTINEL2_L1C) ? 0 : nSubDSPrecision)); - - bool bTileFound = false; - if( nValMax == 0 ) - { - /* It is supposed to be 12 bits, but some products have 15 bits */ - if( SENTINEL2GetTileInfo(osTile, NULL, NULL, &nBits) ) - { - bTileFound = true; - if( nBits <= 16 ) - nValMax = (1 << nBits) - 1; - else - { - CPLDebug("SENTINEL2", "Unexpected bit depth %d", nBits); - nValMax = 65535; - } - } - } - else - { - VSIStatBufL sStat; - if( VSIStatExL(osTile, &sStat, VSI_STAT_EXISTS_FLAG) == 0 ) - bTileFound = true; - } - if( !bTileFound ) - { - CPLError(CE_Warning, CPLE_AppDefined, - "Tile %s not found on filesystem. Skipping it", - osTile.c_str()); - continue; - } - - GDALProxyPoolDataset* proxyDS; - if( bIsPreview ) - { - proxyDS = oMapPVITile[osTile]; - if( proxyDS == NULL ) - { - proxyDS = new GDALProxyPoolDataset( osTile, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight, - GA_ReadOnly, - TRUE); - for(int j=0;j<nBands;j++) - proxyDS->AddSrcBandDescription(eDT, 128, 128); - oMapPVITile[osTile] = proxyDS; - } - else - proxyDS->Reference(); - } - else - { - proxyDS = new GDALProxyPoolDataset( osTile, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight, - GA_ReadOnly, - TRUE); - proxyDS->AddSrcBandDescription(eDT, 128, 128); - } - - const int nDstXOff = static_cast<int>( - (oGranuleInfo.dfMinX - dfMinX) / nSubDSPrecision + 0.5); - const int nDstYOff = static_cast<int>( - (dfMaxY - oGranuleInfo.dfMaxY) / nSubDSPrecision + 0.5); - - if( nBand != nAlphaBand ) - { - poBand->AddSimpleSource( proxyDS->GetRasterBand((bIsPreview) ? nBand : 1), - 0, 0, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight, - nDstXOff, - nDstYOff, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight); - } - else - { - poBand->AddComplexSource( proxyDS->GetRasterBand(1), - 0, 0, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight, - nDstXOff, - nDstYOff, - oGranuleInfo.nWidth, - oGranuleInfo.nHeight, - nValMax /* offset */, - 0 /* scale */); - } - - proxyDS->Dereference(); - } - - if( (nBits % 8) != 0 ) - { - poBand->SetMetadataItem("NBITS", - CPLSPrintf("%d", nBits), "IMAGE_STRUCTURE"); - } - } - - return poDS; -} - -/************************************************************************/ -/* OpenL1CTileSubdataset() */ -/************************************************************************/ - -GDALDataset* SENTINEL2Dataset::OpenL1CTileSubdataset( GDALOpenInfo * poOpenInfo ) -{ - CPLString osFilename; - CPLAssert( STARTS_WITH_CI(poOpenInfo->pszFilename, "SENTINEL2_L1C_TILE:") ); - osFilename = poOpenInfo->pszFilename + strlen("SENTINEL2_L1C_TILE:"); - const char* pszPrecision = strrchr(osFilename.c_str(), ':'); - if( pszPrecision == NULL || pszPrecision == osFilename.c_str() ) - { - CPLError(CE_Failure, CPLE_AppDefined, "Invalid syntax for SENTINEL2_L1C_TILE:"); - return NULL; - } - const bool bIsPreview = STARTS_WITH_CI(pszPrecision + 1, "PREVIEW"); - const int nSubDSPrecision = (bIsPreview) ? 320 : atoi(pszPrecision + 1); - if( !bIsPreview && nSubDSPrecision != 10 && nSubDSPrecision != 20 && nSubDSPrecision != 60 ) - { - CPLError(CE_Failure, CPLE_NotSupported, "Unsupported precision: %d", - nSubDSPrecision); - return NULL; - } - osFilename.resize( pszPrecision - osFilename.c_str() ); - - std::set<CPLString> oSetBands; - CPLXMLNode* psRootMainMTD = NULL; - GDALDataset* poTmpDS = OpenL1CTile( osFilename, &psRootMainMTD, nSubDSPrecision, &oSetBands); - SENTINEL2_CPLXMLNodeHolder oXMLHolder(psRootMainMTD); - if( poTmpDS == NULL ) - return NULL; - - std::vector<CPLString> aosBands; - if( bIsPreview ) - { - aosBands.push_back("04"); - aosBands.push_back("03"); - aosBands.push_back("02"); - } - else - { - for(std::set<CPLString>::const_iterator oIterBandnames = oSetBands.begin(); - oIterBandnames != oSetBands.end(); - ++oIterBandnames) - { - aosBands.push_back(*oIterBandnames); - } - /* Put 2=Blue, 3=Green, 4=Band bands in RGB order for conveniency */ - if( aosBands.size() >= 3 && - aosBands[0] == "02" && - aosBands[1] == "03" && - aosBands[2] == "04" ) - { - aosBands[0] = "04"; - aosBands[2] = "02"; - } - } - -/* -------------------------------------------------------------------- */ -/* Create dataset. */ -/* -------------------------------------------------------------------- */ - - std::vector<CPLString> aosGranuleList; - aosGranuleList.push_back(osFilename); - - const int nSaturatedVal = atoi(CSLFetchNameValueDef(poTmpDS->GetMetadata(), - "SPECIAL_VALUE_SATURATED", "-1")); - const int nNodataVal = atoi(CSLFetchNameValueDef(poTmpDS->GetMetadata(), - "SPECIAL_VALUE_NODATA", "-1")); - - const bool bAlpha = - CSLTestBoolean(SENTINEL2GetOption(poOpenInfo, "ALPHA", "FALSE")) != FALSE; - - std::vector<CPLString> aosNonJP2Files; - SENTINEL2Dataset* poDS = CreateL1CL2ADataset(SENTINEL2_L1C, - aosGranuleList, - aosNonJP2Files, - nSubDSPrecision, - bIsPreview, - -1 /*nSubDSEPSGCode*/, - bAlpha, - aosBands, - nSaturatedVal, - nNodataVal); - if( poDS == NULL ) - { - delete poTmpDS; - return NULL; - } - - // Transfer metadata - poDS->GDALDataset::SetMetadata( poTmpDS->GetMetadata() ); - poDS->GDALDataset::SetMetadata( poTmpDS->GetMetadata("xml:SENTINEL2"), "xml:SENTINEL2" ); - - delete poTmpDS; - -/* -------------------------------------------------------------------- */ -/* Add extra band metadata. */ -/* -------------------------------------------------------------------- */ - if( psRootMainMTD != NULL ) - poDS->AddL1CL2ABandMetadata(SENTINEL2_L1C, psRootMainMTD, aosBands); - -/* -------------------------------------------------------------------- */ -/* Initialize overview information. */ -/* -------------------------------------------------------------------- */ - poDS->SetDescription( poOpenInfo->pszFilename ); - CPLString osOverviewFile; - if( bIsPreview ) - osOverviewFile = CPLSPrintf("%s_PREVIEW.tif.ovr", - osFilename.c_str()); - else - osOverviewFile = CPLSPrintf("%s_%dm.tif.ovr", - osFilename.c_str(), nSubDSPrecision); - poDS->SetMetadataItem( "OVERVIEW_FILE", osOverviewFile, "OVERVIEWS" ); - poDS->oOvManager.Initialize( poDS, ":::VIRTUAL:::" ); - - return poDS; -} - -/************************************************************************/ -/* GDALRegister_SENTINEL2() */ -/************************************************************************/ - -void GDALRegister_SENTINEL2() -{ - if( GDALGetDriverByName( "SENTINEL2" ) != NULL ) - return; - - GDALDriver *poDriver = new GDALDriver(); - - poDriver->SetDescription( "SENTINEL2" ); -#ifdef GDAL_DCAP_RASTER - poDriver->SetMetadataItem( GDAL_DCAP_RASTER, "YES" ); -#endif - poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" ); - poDriver->SetMetadataItem( GDAL_DMD_LONGNAME, "Sentinel 2" ); - poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC, "frmt_sentinel2.html" ); - poDriver->SetMetadataItem( GDAL_DMD_SUBDATASETS, "YES" ); - -#ifdef GDAL_DMD_OPENOPTIONLIST - poDriver->SetMetadataItem( GDAL_DMD_OPENOPTIONLIST, -"<OpenOptionList>" -" <Option name='ALPHA' type='boolean' description='Whether to expose an alpha band' default='NO'/>" -"</OpenOptionList>" ); -#endif - - poDriver->pfnOpen = SENTINEL2Dataset::Open; - poDriver->pfnIdentify = SENTINEL2Dataset::Identify; - - GetGDALDriverManager()->RegisterDriver( poDriver ); -} diff --git a/SuperBuild/patches/GDAL/S2_patch/gcore/gdal_frmts.h b/SuperBuild/patches/GDAL/S2_patch/gcore/gdal_frmts.h deleted file mode 100644 index e3a14ddfc88bcf9585866567793135ba8a28cb3d..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/S2_patch/gcore/gdal_frmts.h +++ /dev/null @@ -1,184 +0,0 @@ -/****************************************************************************** - * $Id: gdal_frmts.h 27044 2014-03-16 23:41:27Z rouault $ - * - * Project: GDAL - * Purpose: Prototypes for all format specific driver initializations. - * Author: Frank Warmerdam, warmerdam@pobox.com - * - ****************************************************************************** - * Copyright (c) 2001, Frank Warmerdam - * Copyright (c) 2007-2014, Even Rouault <even dot rouault at mines-paris dot org> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - ****************************************************************************/ - -#ifndef GDAL_FRMTS_H_INCLUDED -#define GDAL_FRMTS_H_INCLUDED - -#include "cpl_port.h" - -CPL_C_START -void CPL_DLL GDALRegister_GDB(void); -void CPL_DLL GDALRegister_GTiff(void); -void CPL_DLL GDALRegister_GXF(void); -void CPL_DLL GDALRegister_OGDI(void); -void CPL_DLL GDALRegister_HFA(void); -void CPL_DLL GDALRegister_AAIGrid(void); -void CPL_DLL GDALRegister_GRASSASCIIGrid(void); -void CPL_DLL GDALRegister_AIGrid(void); -void CPL_DLL GDALRegister_AIGrid2(void); -void CPL_DLL GDALRegister_CEOS(void); -void CPL_DLL GDALRegister_SAR_CEOS(void); -void CPL_DLL GDALRegister_SDTS(void); -void CPL_DLL GDALRegister_ELAS(void); -void CPL_DLL GDALRegister_EHdr(void); -void CPL_DLL GDALRegister_GenBin(void); -void CPL_DLL GDALRegister_PAux(void); -void CPL_DLL GDALRegister_ENVI(void); -void CPL_DLL GDALRegister_DOQ1(void); -void CPL_DLL GDALRegister_DOQ2(void); -void CPL_DLL GDALRegister_DTED(void); -void CPL_DLL GDALRegister_MFF(void); -void CPL_DLL GDALRegister_HKV(void); -void CPL_DLL GDALRegister_PNG(void); -void CPL_DLL GDALRegister_DDS(void); -void CPL_DLL GDALRegister_GTA(void); -void CPL_DLL GDALRegister_JPEG(void); -void CPL_DLL GDALRegister_JPEG2000(void); -void CPL_DLL GDALRegister_JP2KAK(void); -void CPL_DLL GDALRegister_JPIPKAK(void); -void CPL_DLL GDALRegister_MEM(void); -void CPL_DLL GDALRegister_JDEM(void); -void CPL_DLL GDALRegister_RASDAMAN(void); -void CPL_DLL GDALRegister_GRASS(void); -void CPL_DLL GDALRegister_PNM(void); -void CPL_DLL GDALRegister_GIF(void); -void CPL_DLL GDALRegister_BIGGIF(void); -void CPL_DLL GDALRegister_Envisat(void); -void CPL_DLL GDALRegister_FITS(void); -void CPL_DLL GDALRegister_ECW(void); -void CPL_DLL GDALRegister_JP2ECW(void); -void CPL_DLL GDALRegister_ECW_JP2ECW(); -void CPL_DLL GDALRegister_FujiBAS(void); -void CPL_DLL GDALRegister_FIT(void); -void CPL_DLL GDALRegister_VRT(void); -void CPL_DLL GDALRegister_USGSDEM(void); -void CPL_DLL GDALRegister_FAST(void); -void CPL_DLL GDALRegister_HDF4(void); -void CPL_DLL GDALRegister_HDF4Image(void); -void CPL_DLL GDALRegister_L1B(void); -void CPL_DLL GDALRegister_LDF(void); -void CPL_DLL GDALRegister_BSB(void); -void CPL_DLL GDALRegister_XPM(void); -void CPL_DLL GDALRegister_BMP(void); -void CPL_DLL GDALRegister_GSC(void); -void CPL_DLL GDALRegister_NITF(void); -void CPL_DLL GDALRegister_RPFTOC(void); -void CPL_DLL GDALRegister_ECRGTOC(void); -void CPL_DLL GDALRegister_MrSID(void); -void CPL_DLL GDALRegister_MG4Lidar(void); -void CPL_DLL GDALRegister_PCIDSK(void); -void CPL_DLL GDALRegister_BT(void); -void CPL_DLL GDALRegister_DODS(void); -void CPL_DLL GDALRegister_GMT(void); -void CPL_DLL GDALRegister_netCDF(void); -void CPL_DLL GDALRegister_LAN(void); -void CPL_DLL GDALRegister_CPG(void); -void CPL_DLL GDALRegister_AirSAR(void); -void CPL_DLL GDALRegister_RS2(void); -void CPL_DLL GDALRegister_ILWIS(void); -void CPL_DLL GDALRegister_PCRaster(void); -void CPL_DLL GDALRegister_IDA(void); -void CPL_DLL GDALRegister_NDF(void); -void CPL_DLL GDALRegister_RMF(void); -void CPL_DLL GDALRegister_BAG(void); -void CPL_DLL GDALRegister_HDF5(void); -void CPL_DLL GDALRegister_HDF5Image(void); -void CPL_DLL GDALRegister_MSGN(void); -void CPL_DLL GDALRegister_MSG(void); -void CPL_DLL GDALRegister_RIK(void); -void CPL_DLL GDALRegister_Leveller(void); -void CPL_DLL GDALRegister_SGI(void); -void CPL_DLL GDALRegister_SRTMHGT(void); -void CPL_DLL GDALRegister_DIPEx(void); -void CPL_DLL GDALRegister_ISIS3(void); -void CPL_DLL GDALRegister_ISIS2(void); -void CPL_DLL GDALRegister_PDS(void); -void CPL_DLL GDALRegister_IDRISI(void); -void CPL_DLL GDALRegister_Terragen(void); -void CPL_DLL GDALRegister_WCS(void); -void CPL_DLL GDALRegister_WMS(void); -void CPL_DLL GDALRegister_HTTP(void); -void CPL_DLL GDALRegister_SDE(void); -void CPL_DLL GDALRegister_GSAG(void); -void CPL_DLL GDALRegister_GSBG(void); -void CPL_DLL GDALRegister_GS7BG(void); -void CPL_DLL GDALRegister_GRIB(void); -void CPL_DLL GDALRegister_INGR(void); -void CPL_DLL GDALRegister_ERS(void); -void CPL_DLL GDALRegister_PALSARJaxa(void); -void CPL_DLL GDALRegister_DIMAP(); -void CPL_DLL GDALRegister_GFF(void); -void CPL_DLL GDALRegister_COSAR(void); -void CPL_DLL GDALRegister_TSX(void); -void CPL_DLL GDALRegister_ADRG(void); -void CPL_DLL GDALRegister_SRP(void); -void CPL_DLL GDALRegister_COASP(void); -void CPL_DLL GDALRegister_BLX(void); -void CPL_DLL GDALRegister_LCP(void); -void CPL_DLL GDALRegister_PGCHIP(void); -void CPL_DLL GDALRegister_TMS(void); -void CPL_DLL GDALRegister_EIR(void); -void CPL_DLL GDALRegister_GEOR(void); -void CPL_DLL GDALRegister_TIL(void); -void CPL_DLL GDALRegister_R(void); -void CPL_DLL GDALRegister_Rasterlite(void); -void CPL_DLL GDALRegister_EPSILON(void); -void CPL_DLL GDALRegister_PostGISRaster(void); -void CPL_DLL GDALRegister_NWT_GRD(void); -void CPL_DLL GDALRegister_NWT_GRC(void); -void CPL_DLL GDALRegister_SAGA(void); -void CPL_DLL GDALRegister_KMLSUPEROVERLAY(void); -void CPL_DLL GDALRegister_GTX(void); -void CPL_DLL GDALRegister_LOSLAS(void); -void CPL_DLL GDALRegister_Istar(void); -void CPL_DLL GDALRegister_NTv2(void); -void CPL_DLL GDALRegister_CTable2(void); -void CPL_DLL GDALRegister_JP2OpenJPEG(void); -void CPL_DLL GDALRegister_XYZ(void); -void CPL_DLL GDALRegister_HF2(void); -void CPL_DLL GDALRegister_PDF(void); -void CPL_DLL GDALRegister_JPEGLS(void); -void CPL_DLL GDALRegister_MAP(void); -void CPL_DLL GDALRegister_OZI(void); -void CPL_DLL GDALRegister_ACE2(void); -void CPL_DLL GDALRegister_CTG(void); -void CPL_DLL GDALRegister_E00GRID(void); -void CPL_DLL GDALRegister_SNODAS(void); -void CPL_DLL GDALRegister_WEBP(void); -void CPL_DLL GDALRegister_ZMap(void); -void CPL_DLL GDALRegister_NGSGEOID(void); -void CPL_DLL GDALRegister_MBTiles(void); -void CPL_DLL GDALRegister_ARG(void); -void CPL_DLL GDALRegister_IRIS(void); -void CPL_DLL GDALRegister_KRO(void); -void CPL_DLL GDALRegister_SENTINEL2(void); -CPL_C_END - -#endif /* ndef GDAL_FRMTS_H_INCLUDED */ diff --git a/SuperBuild/patches/GDAL/gdal-1-nmake-win.diff b/SuperBuild/patches/GDAL/gdal-1-nmake-win.diff new file mode 100644 index 0000000000000000000000000000000000000000..c2cadc7efb5e47940ac5d62d9fe770d3a7e52e04 --- /dev/null +++ b/SuperBuild/patches/GDAL/gdal-1-nmake-win.diff @@ -0,0 +1,12 @@ +diff -burN gdal-2.1.0.orig/nmake.opt gdal-2.1.0/nmake.opt +--- gdal-2.1.0.orig/nmake.opt 2016-06-14 11:39:22.911630802 +0200 ++++ gdal-2.1.0/nmake.opt 2016-06-14 11:39:39.827630670 +0200 +@@ -247,7 +247,7 @@ + JPEG_SUPPORTED = 1 + + # This will enable 12bit libjpeg - use only with internal jpeg builds. +-JPEG12_SUPPORTED = 1 ++#JPEG12_SUPPORTED = 1 + + #if using an external jpeg library uncomment the following lines + #JPEG_EXTERNAL_LIB = 1 diff --git a/SuperBuild/patches/GDAL/ogrsqlitevirtualogr.cpp b/SuperBuild/patches/GDAL/ogrsqlitevirtualogr.cpp deleted file mode 100644 index 08bef44581b84b9628da5278de886b0f78a919ea..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GDAL/ogrsqlitevirtualogr.cpp +++ /dev/null @@ -1,2464 +0,0 @@ -/****************************************************************************** - * $Id: ogrsqlitevirtualogr.cpp 27044 2014-03-16 23:41:27Z rouault $ - * - * Project: OpenGIS Simple Features Reference Implementation - * Purpose: SQLite Virtual Table module using OGR layers - * Author: Even Rouault, even dot rouault at mines dash paris dot org - * - ****************************************************************************** - * Copyright (c) 2012-2013, Even Rouault <even dot rouault at mines-paris dot org> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - ****************************************************************************/ - -#include "ogrsqlitevirtualogr.h" -#include "ogr_api.h" -#include "swq.h" -#include <map> -#include <vector> - -#ifdef HAVE_SQLITE_VFS -/************************************************************************/ -/* OGR2SQLITE_Register() */ -/************************************************************************/ - -CPL_C_START -int CPL_DLL OGR2SQLITE_static_register (sqlite3* hDB, char **pzErrMsg, void* pApi); -CPL_C_END - -/* We call this function so that each time a db is created, */ -/* OGR2SQLITE_static_register is called, to initialize the sqlite3_api */ -/* structure with the right pointers. */ -/* We need to declare this function before including sqlite3ext.h, since */ -/* sqlite 3.8.7, sqlite3_auto_extension can be a macro (#5725) */ - -void OGR2SQLITE_Register() -{ - sqlite3_auto_extension ((void (*)(void)) OGR2SQLITE_static_register); -} - -/************************************************************************/ -#define VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED -//#define DEBUG_OGR2SQLITE - -#if defined(SPATIALITE_AMALGAMATION) -#include "ogrsqlite3ext.h" -#else -#include "sqlite3ext.h" -#endif - -/* Declaration of sqlite3_api structure */ -static SQLITE_EXTENSION_INIT1 - -/* The layout of fields is : - 0 : RegularField0 - ... - n-1 : RegularField(n-1) - n : OGR_STYLE (may be HIDDEN) - n+1 : GEOMETRY -*/ - -#define COMPILATION_ALLOWED -#include "ogrsqlitesqlfunctions.cpp" /* yes the .cpp file, to make it work on Windows with load_extension('gdalXX.dll') */ -#undef COMPILATION_ALLOWED - -/************************************************************************/ -/* OGR2SQLITEModule */ -/************************************************************************/ - -class OGR2SQLITEModule -{ -#ifdef DEBUG - void* pDummy; /* to track memory leaks */ -#endif - sqlite3* hDB; /* *NOT* to be freed */ - - OGRDataSource* poDS; /* *NOT* to be freed */ - std::vector<OGRDataSource*> apoExtraDS; /* each datasource to be freed */ - - OGRSQLiteDataSource* poSQLiteDS; /* *NOT* to be freed, might be NULL */ - - std::map< CPLString, OGRLayer* > oMapVTableToOGRLayer; - - void* hHandleSQLFunctions; - - public: - OGR2SQLITEModule(); - ~OGR2SQLITEModule(); - - int Setup(OGRDataSource* poDS, - OGRSQLiteDataSource* poSQLiteDS); - int Setup(sqlite3* hDB); - - OGRDataSource* GetDS() { return poDS; } - - int AddExtraDS(OGRDataSource* poDS); - OGRDataSource *GetExtraDS(int nIndex); - - int FetchSRSId(OGRSpatialReference* poSRS); - - void RegisterVTable(const char* pszVTableName, OGRLayer* poLayer); - void UnregisterVTable(const char* pszVTableName); - OGRLayer* GetLayerForVTable(const char* pszVTableName); - - void SetHandleSQLFunctions(void* hHandleSQLFunctionsIn); -}; - -/************************************************************************/ -/* OGR2SQLITEModule() */ -/************************************************************************/ - -OGR2SQLITEModule::OGR2SQLITEModule() : - hDB(NULL), poDS(NULL), poSQLiteDS(NULL), hHandleSQLFunctions(NULL) -{ -#ifdef DEBUG - pDummy = CPLMalloc(1); -#endif -} - -/************************************************************************/ -/* ~OGR2SQLITEModule */ -/************************************************************************/ - -OGR2SQLITEModule::~OGR2SQLITEModule() -{ -#ifdef DEBUG - CPLFree(pDummy); -#endif - - for(int i=0;i<(int)apoExtraDS.size();i++) - delete apoExtraDS[i]; - - OGRSQLiteUnregisterSQLFunctions(hHandleSQLFunctions); -} - -/************************************************************************/ -/* SetHandleSQLFunctions() */ -/************************************************************************/ - -void OGR2SQLITEModule::SetHandleSQLFunctions(void* hHandleSQLFunctionsIn) -{ - CPLAssert(hHandleSQLFunctions == NULL); - hHandleSQLFunctions = hHandleSQLFunctionsIn; -} - -/************************************************************************/ -/* AddExtraDS() */ -/************************************************************************/ - -int OGR2SQLITEModule::AddExtraDS(OGRDataSource* poDS) -{ - int nRet = (int)apoExtraDS.size(); - apoExtraDS.push_back(poDS); - return nRet; -} - -/************************************************************************/ -/* GetExtraDS() */ -/************************************************************************/ - -OGRDataSource* OGR2SQLITEModule::GetExtraDS(int nIndex) -{ - if( nIndex < 0 || nIndex >= (int)apoExtraDS.size() ) - return NULL; - return apoExtraDS[nIndex]; -} - -/************************************************************************/ -/* Setup() */ -/************************************************************************/ - -int OGR2SQLITEModule::Setup(OGRDataSource* poDSIn, - OGRSQLiteDataSource* poSQLiteDSIn) -{ - CPLAssert(poDS == NULL); - CPLAssert(poSQLiteDS == NULL); - poDS = poDSIn; - poSQLiteDS = poSQLiteDSIn; - return Setup(poSQLiteDS->GetDB()); -} - -/************************************************************************/ -/* FetchSRSId() */ -/************************************************************************/ - -int OGR2SQLITEModule::FetchSRSId(OGRSpatialReference* poSRS) -{ - int nSRSId; - - if( poSQLiteDS != NULL ) - { - nSRSId = poSQLiteDS->GetUndefinedSRID(); - if( poSRS != NULL ) - nSRSId = poSQLiteDS->FetchSRSId(poSRS); - } - else - { - nSRSId = -1; - if( poSRS != NULL ) - { - const char* pszAuthorityName = poSRS->GetAuthorityName(NULL); - if (pszAuthorityName != NULL && EQUAL(pszAuthorityName, "EPSG")) - { - const char* pszAuthorityCode = poSRS->GetAuthorityCode(NULL); - if ( pszAuthorityCode != NULL && strlen(pszAuthorityCode) > 0 ) - { - nSRSId = atoi(pszAuthorityCode); - } - } - } - } - - return nSRSId; -} - -/************************************************************************/ -/* RegisterVTable() */ -/************************************************************************/ - -void OGR2SQLITEModule::RegisterVTable(const char* pszVTableName, - OGRLayer* poLayer) -{ - oMapVTableToOGRLayer[pszVTableName] = poLayer; -} - -/************************************************************************/ -/* UnregisterVTable() */ -/************************************************************************/ - -void OGR2SQLITEModule::UnregisterVTable(const char* pszVTableName) -{ - oMapVTableToOGRLayer[pszVTableName] = NULL; -} - -/************************************************************************/ -/* GetLayerForVTable() */ -/************************************************************************/ - -OGRLayer* OGR2SQLITEModule::GetLayerForVTable(const char* pszVTableName) -{ - std::map<CPLString, OGRLayer*>::iterator oIter = - oMapVTableToOGRLayer.find(pszVTableName); - if( oIter == oMapVTableToOGRLayer.end() ) - return NULL; - - OGRLayer* poLayer = oIter->second; - if( poLayer == NULL ) - { - /* If the associate layer is null, then try to "ping" the virtual */ - /* table since we know that we have managed to create it before */ - if( sqlite3_exec(hDB, - CPLSPrintf("PRAGMA table_info(\"%s\")", - OGRSQLiteEscapeName(pszVTableName).c_str()), - NULL, NULL, NULL) == SQLITE_OK ) - { - poLayer = oMapVTableToOGRLayer[pszVTableName]; - } - } - - return poLayer; -} - -/* See http://www.sqlite.org/vtab.html for the documentation on how to - implement a new module for the Virtual Table mechanism. */ - -/************************************************************************/ -/* OGR2SQLITE_vtab */ -/************************************************************************/ - -typedef struct -{ - /* Mandatory fields by sqlite3: don't change or reorder them ! */ - const sqlite3_module *pModule; - int nRef; - char *zErrMsg; - - /* Extension fields */ - char *pszVTableName; - OGR2SQLITEModule *poModule; - OGRDataSource *poDS; - int bCloseDS; - OGRLayer *poLayer; - int nMyRef; -} OGR2SQLITE_vtab; - -/************************************************************************/ -/* OGR2SQLITE_vtab_cursor */ -/************************************************************************/ - -typedef struct -{ - /* Mandatory fields by sqlite3: don't change or reorder them ! */ - OGR2SQLITE_vtab *pVTab; - - /* Extension fields */ - OGRDataSource *poDupDataSource; - OGRLayer *poLayer; - OGRFeature *poFeature; - - /* nFeatureCount >= 0 if the layer has a feast feature count capability. */ - /* In which case nNextWishedIndex and nCurFeatureIndex */ - /* will be used to avoid useless GetNextFeature() */ - /* Helps in SELECT COUNT(*) FROM xxxx scenarios */ - int nFeatureCount; - int nNextWishedIndex; - int nCurFeatureIndex; - - GByte *pabyGeomBLOB; - int nGeomBLOBLen; -} OGR2SQLITE_vtab_cursor; - - -/************************************************************************/ -/* OGR2SQLITE_GetNameForGeometryColumn() */ -/************************************************************************/ - -CPLString OGR2SQLITE_GetNameForGeometryColumn(OGRLayer* poLayer) -{ - if( poLayer->GetGeometryColumn() != NULL && - !EQUAL(poLayer->GetGeometryColumn(), "") ) - { - return poLayer->GetGeometryColumn(); - } - else - { - CPLString osGeomCol("GEOMETRY"); - int bTry = 2; - while( poLayer->GetLayerDefn()->GetFieldIndex(osGeomCol) >= 0 ) - { - osGeomCol.Printf("GEOMETRY%d", bTry++); - } - return osGeomCol; - } -} - -#ifdef VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED - -/************************************************************************/ -/* OGR2SQLITEDetectSuspiciousUsage() */ -/************************************************************************/ - -static int OGR2SQLITEDetectSuspiciousUsage(sqlite3* hDB, - const char* pszVirtualTableName, - char**pzErr) -{ - char **papszResult = NULL; - int nRowCount = 0, nColCount = 0; - int i; - - std::vector<CPLString> aosDatabaseNames; - - /* Collect database names */ - sqlite3_get_table( hDB, "PRAGMA database_list", - &papszResult, &nRowCount, &nColCount, NULL ); - - for(i = 1; i <= nRowCount; i++) - { - const char* pszUnescapedName = papszResult[i * nColCount + 1]; - aosDatabaseNames.push_back( - CPLSPrintf("\"%s\".sqlite_master", - OGRSQLiteEscapeName(pszUnescapedName).c_str())); - } - - /* Add special database (just in case, not sure it is really needed) */ - aosDatabaseNames.push_back("sqlite_temp_master"); - - sqlite3_free_table(papszResult); - papszResult = NULL; - - /* Check the triggers of each database */ - for(i = 0; i < (int)aosDatabaseNames.size(); i++ ) - { - nRowCount = 0; nColCount = 0; - - const char* pszSQL; - - pszSQL = CPLSPrintf("SELECT name, sql FROM %s " - "WHERE (type = 'trigger' OR type = 'view') AND (" - "sql LIKE '%%%s%%' OR " - "sql LIKE '%%\"%s\"%%' OR " - "sql LIKE '%%ogr_layer_%%' )", - aosDatabaseNames[i].c_str(), - pszVirtualTableName, - OGRSQLiteEscapeName(pszVirtualTableName).c_str()); - - sqlite3_get_table( hDB, pszSQL, &papszResult, &nRowCount, &nColCount, - NULL ); - - sqlite3_free_table(papszResult); - papszResult = NULL; - - if( nRowCount > 0 ) - { - if( !CSLTestBoolean(CPLGetConfigOption("ALLOW_VIRTUAL_OGR_FROM_TRIGGER_AND_VIEW", "NO")) ) - { - *pzErr = sqlite3_mprintf( - "A trigger and/or view might reference VirtualOGR table '%s'.\n" - "This is suspicious practice that could be used to steal data without your consent.\n" - "Disabling access to it unless you define the ALLOW_VIRTUAL_OGR_FROM_TRIGGER_AND_VIEW " - "configuration option to YES.", - pszVirtualTableName); - return TRUE; - } - } - } - - return FALSE; -} - -#endif // VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED - -/************************************************************************/ -/* OGR2SQLITE_ConnectCreate() */ -/************************************************************************/ - -static -int OGR2SQLITE_DisconnectDestroy(sqlite3_vtab *pVTab); - -static -int OGR2SQLITE_ConnectCreate(sqlite3* hDB, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**pzErr) -{ - OGR2SQLITEModule* poModule = (OGR2SQLITEModule*) pAux; - OGRLayer* poLayer = NULL; - OGRDataSource* poDS = NULL; - int bExposeOGR_STYLE = FALSE; - int bCloseDS = FALSE; - int bInternalUse = FALSE; - int i; - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "ConnectCreate(%s)", argv[2]); -#endif - - /*for(i=0;i<argc;i++) - printf("[%d] %s\n", i, argv[i]);*/ - -/* -------------------------------------------------------------------- */ -/* If called from ogrexecutesql.cpp */ -/* -------------------------------------------------------------------- */ - poDS = poModule->GetDS(); - if( poDS != NULL && argc == 6 && - CPLGetValueType(argv[3]) == CPL_VALUE_INTEGER ) - { - bInternalUse = TRUE; - if( argc != 6 ) - { - *pzErr = sqlite3_mprintf( - "Expected syntax: CREATE VIRTUAL TABLE xxx USING " - "VirtualOGR(ds_idx, layer_name, expose_ogr_style)"); - return SQLITE_ERROR; - } - - int nDSIndex = atoi(argv[3]); - if( nDSIndex >= 0 ) - { - poDS = poModule->GetExtraDS(nDSIndex); - if( poDS == NULL ) - { - *pzErr = sqlite3_mprintf("Invalid dataset index : %d", nDSIndex); - return SQLITE_ERROR; - } - } - CPLString osLayerName(OGRSQLiteParamsUnquote(argv[4])); - - poLayer = poDS->GetLayerByName(osLayerName); - if( poLayer == NULL ) - { - *pzErr = sqlite3_mprintf( "Cannot find layer '%s' in '%s'", - osLayerName.c_str(), poDS->GetName() ); - return SQLITE_ERROR; - } - - bExposeOGR_STYLE = atoi(OGRSQLiteParamsUnquote(argv[5])); - } -#ifdef VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED -/* -------------------------------------------------------------------- */ -/* If called from outside (OGR loaded as a sqlite3 extension) */ -/* -------------------------------------------------------------------- */ - else - { - if( argc < 4 || argc > 7 ) - { - *pzErr = sqlite3_mprintf( - "Expected syntax: CREATE VIRTUAL TABLE xxx USING " - "VirtualOGR(datasource_name[, update_mode, [layer_name[, expose_ogr_style]]])"); - return SQLITE_ERROR; - } - - if( OGR2SQLITEDetectSuspiciousUsage(hDB, argv[2], pzErr) ) - { - return SQLITE_ERROR; - } - - CPLString osDSName(OGRSQLiteParamsUnquote(argv[3])); - CPLString osUpdate(OGRSQLiteParamsUnquote((argc >= 5) ? argv[4] : "0")); - - if( !EQUAL(osUpdate, "1") && !EQUAL(osUpdate, "0") ) - { - *pzErr = sqlite3_mprintf( - "update_mode parameter should be 0 or 1"); - return SQLITE_ERROR; - } - - int bUpdate = atoi(osUpdate); - - poDS = (OGRDataSource* )OGROpenShared(osDSName, bUpdate, NULL); - if( poDS == NULL ) - { - *pzErr = sqlite3_mprintf( "Cannot open datasource '%s'", osDSName.c_str() ); - return SQLITE_ERROR; - } - - CPLString osLayerName; - if( argc >= 6 ) - { - osLayerName = OGRSQLiteParamsUnquote(argv[5]); - poLayer = poDS->GetLayerByName(osLayerName); - } - else - { - if( poDS->GetLayerCount() == 0 ) - { - *pzErr = sqlite3_mprintf( "Datasource '%s' has no layers", - osDSName.c_str() ); - poDS->Release(); - return SQLITE_ERROR; - } - - if( poDS->GetLayerCount() > 1 ) - { - *pzErr = sqlite3_mprintf( "Datasource '%s' has more than one layers, and none was explicitely selected.", - osDSName.c_str() ); - poDS->Release(); - return SQLITE_ERROR; - } - - poLayer = poDS->GetLayer(0); - } - - if( poLayer == NULL ) - { - *pzErr = sqlite3_mprintf( "Cannot find layer '%s' in '%s'", osLayerName.c_str(), osDSName.c_str() ); - poDS->Release(); - return SQLITE_ERROR; - } - - if( argc == 7 ) - { - bExposeOGR_STYLE = atoi(OGRSQLiteParamsUnquote(argv[6])); - } - - bCloseDS = TRUE; - } -#endif // VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED - OGR2SQLITE_vtab* vtab = - (OGR2SQLITE_vtab*) CPLCalloc(1, sizeof(OGR2SQLITE_vtab)); - /* We dont need to fill the non-extended fields */ - vtab->pszVTableName = CPLStrdup(OGRSQLiteEscapeName(argv[2])); - vtab->poModule = poModule; - vtab->poDS = poDS; - vtab->bCloseDS = bCloseDS; - vtab->poLayer = poLayer; - vtab->nMyRef = 0; - - poModule->RegisterVTable(vtab->pszVTableName, poLayer); - - *ppVTab = (sqlite3_vtab*) vtab; - - CPLString osSQL; - osSQL = "CREATE TABLE "; - osSQL += "\""; - osSQL += OGRSQLiteEscapeName(argv[2]); - osSQL += "\""; - osSQL += "("; - - int bAddComma = FALSE; - - OGRFeatureDefn* poFDefn = poLayer->GetLayerDefn(); - for(i=0;i<poFDefn->GetFieldCount();i++) - { - if( bAddComma ) - osSQL += ","; - bAddComma = TRUE; - - OGRFieldDefn* poFieldDefn = poFDefn->GetFieldDefn(i); - - osSQL += "\""; - osSQL += OGRSQLiteEscapeName(poFieldDefn->GetNameRef()); - osSQL += "\""; - osSQL += " "; - osSQL += OGRSQLiteFieldDefnToSQliteFieldDefn(poFieldDefn); - } - - if( bAddComma ) - osSQL += ","; - bAddComma = TRUE; - osSQL += "OGR_STYLE VARCHAR"; - if( !bExposeOGR_STYLE ) - osSQL += " HIDDEN"; - - for(i=0;i<poFDefn->GetGeomFieldCount();i++) - { - if( bAddComma ) - osSQL += ","; - bAddComma = TRUE; - - OGRGeomFieldDefn* poFieldDefn = poFDefn->GetGeomFieldDefn(i); - - osSQL += "\""; - if( i == 0 ) - osSQL += OGRSQLiteEscapeName(OGR2SQLITE_GetNameForGeometryColumn(poLayer)); - else - osSQL += OGRSQLiteEscapeName(poFieldDefn->GetNameRef()); - osSQL += "\""; - osSQL += " BLOB"; - - /* We use a special column type, e.g. BLOB_POINT_25D_4326 */ - /* when the virtual table is created by OGRSQLiteExecuteSQL() */ - /* and thus for interal use only. */ - if( bInternalUse ) - { - osSQL += "_"; - osSQL += OGRToOGCGeomType(poFieldDefn->GetType()); - osSQL += "_"; - osSQL += (poFieldDefn->GetType() & wkb25DBit) ? "25D" : "2D"; - OGRSpatialReference* poSRS = poFieldDefn->GetSpatialRef(); - if( poSRS == NULL && i == 0 ) - poSRS = poLayer->GetSpatialRef(); - int nSRID = poModule->FetchSRSId(poSRS); - if( nSRID >= 0 ) - { - osSQL += "_"; - osSQL += CPLSPrintf("%d", nSRID); - } - } - } - - osSQL += ")"; - - CPLDebug("OGR2SQLITE", "sqlite3_declare_vtab(%s)", osSQL.c_str()); - if (sqlite3_declare_vtab (hDB, osSQL.c_str()) != SQLITE_OK) - { - *pzErr = sqlite3_mprintf("CREATE VIRTUAL: invalid SQL statement : %s", - osSQL.c_str()); - OGR2SQLITE_DisconnectDestroy((sqlite3_vtab*) vtab); - return SQLITE_ERROR; - } - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_BestIndex() */ -/************************************************************************/ - -static -int OGR2SQLITE_BestIndex(sqlite3_vtab *pVTab, sqlite3_index_info* pIndex) -{ - int i; - OGR2SQLITE_vtab* pMyVTab = (OGR2SQLITE_vtab*) pVTab; - OGRFeatureDefn* poFDefn = pMyVTab->poLayer->GetLayerDefn(); - -#ifdef DEBUG_OGR2SQLITE - CPLString osQueryPatternUsable, osQueryPatternNotUsable; - for (i = 0; i < pIndex->nConstraint; i++) - { - int iCol = pIndex->aConstraint[i].iColumn; - const char* pszFieldName; - if( iCol == -1 ) - pszFieldName = "FID"; - else if( iCol >= 0 && iCol < poFDefn->GetFieldCount() ) - pszFieldName = poFDefn->GetFieldDefn(iCol)->GetNameRef(); - else - pszFieldName = "unknown_field"; - - const char* pszOp; - switch(pIndex->aConstraint[i].op) - { - case SQLITE_INDEX_CONSTRAINT_EQ: pszOp = " = "; break; - case SQLITE_INDEX_CONSTRAINT_GT: pszOp = " > "; break; - case SQLITE_INDEX_CONSTRAINT_LE: pszOp = " <= "; break; - case SQLITE_INDEX_CONSTRAINT_LT: pszOp = " < "; break; - case SQLITE_INDEX_CONSTRAINT_GE: pszOp = " >= "; break; - case SQLITE_INDEX_CONSTRAINT_MATCH: pszOp = " MATCH "; break; - default: pszOp = " (unknown op) "; break; - } - - if (pIndex->aConstraint[i].usable) - { - if (osQueryPatternUsable.size()) osQueryPatternUsable += " AND "; - osQueryPatternUsable += pszFieldName; - osQueryPatternUsable += pszOp; - osQueryPatternUsable += "?"; - } - else - { - if (osQueryPatternNotUsable.size()) osQueryPatternNotUsable += " AND "; - osQueryPatternNotUsable += pszFieldName; - osQueryPatternNotUsable += pszOp; - osQueryPatternNotUsable += "?"; - } - } - CPLDebug("OGR2SQLITE", "BestIndex, usable ( %s ), not usable ( %s )", - osQueryPatternUsable.c_str(), osQueryPatternNotUsable.c_str()); -#endif - - int nConstraints = 0; - for (i = 0; i < pIndex->nConstraint; i++) - { - int iCol = pIndex->aConstraint[i].iColumn; - if (pIndex->aConstraint[i].usable && - pIndex->aConstraint[i].op != SQLITE_INDEX_CONSTRAINT_MATCH && - iCol < poFDefn->GetFieldCount() && - (iCol < 0 || poFDefn->GetFieldDefn(iCol)->GetType() != OFTBinary)) - { - pIndex->aConstraintUsage[i].argvIndex = nConstraints + 1; - pIndex->aConstraintUsage[i].omit = TRUE; - - nConstraints ++; - } - else - { - pIndex->aConstraintUsage[i].argvIndex = 0; - pIndex->aConstraintUsage[i].omit = FALSE; - } - } - - int* panConstraints = NULL; - - if( nConstraints ) - { - panConstraints = (int*) - sqlite3_malloc( sizeof(int) * (1 + 2 * nConstraints) ); - panConstraints[0] = nConstraints; - - nConstraints = 0; - - for (i = 0; i < pIndex->nConstraint; i++) - { - if (pIndex->aConstraintUsage[i].omit) - { - panConstraints[2 * nConstraints + 1] = - pIndex->aConstraint[i].iColumn; - panConstraints[2 * nConstraints + 2] = - pIndex->aConstraint[i].op; - - nConstraints ++; - } - } - } - - pIndex->orderByConsumed = FALSE; - pIndex->idxNum = 0; - - if (nConstraints != 0) - { - pIndex->idxStr = (char *) panConstraints; - pIndex->needToFreeIdxStr = TRUE; - } - else - { - pIndex->idxStr = NULL; - pIndex->needToFreeIdxStr = FALSE; - } - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_DisconnectDestroy() */ -/************************************************************************/ - -static -int OGR2SQLITE_DisconnectDestroy(sqlite3_vtab *pVTab) -{ - OGR2SQLITE_vtab* pMyVTab = (OGR2SQLITE_vtab*) pVTab; - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "DisconnectDestroy(%s)",pMyVTab->pszVTableName); -#endif - - sqlite3_free(pMyVTab->zErrMsg); - if( pMyVTab->bCloseDS ) - pMyVTab->poDS->Release(); - pMyVTab->poModule->UnregisterVTable(pMyVTab->pszVTableName); - CPLFree(pMyVTab->pszVTableName); - CPLFree(pMyVTab); - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Open() */ -/************************************************************************/ - -static -int OGR2SQLITE_Open(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor) -{ - OGR2SQLITE_vtab* pMyVTab = (OGR2SQLITE_vtab*) pVTab; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Open(%s, %s)", - pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName()); -#endif - - OGRDataSource* poDupDataSource = NULL; - OGRLayer* poLayer = NULL; - - if( pMyVTab->nMyRef == 0 ) - { - poLayer = pMyVTab->poLayer; - } - else - { - poDupDataSource = - (OGRDataSource*) OGROpen(pMyVTab->poDS->GetName(), FALSE, NULL); - if( poDupDataSource == NULL ) - return SQLITE_ERROR; - poLayer = poDupDataSource->GetLayerByName( - pMyVTab->poLayer->GetName()); - if( poLayer == NULL ) - { - delete poDupDataSource; - return SQLITE_ERROR; - } - if( !poLayer->GetLayerDefn()-> - IsSame(pMyVTab->poLayer->GetLayerDefn()) ) - { - delete poDupDataSource; - return SQLITE_ERROR; - } - } - pMyVTab->nMyRef ++; - - OGR2SQLITE_vtab_cursor* pCursor = (OGR2SQLITE_vtab_cursor*) - CPLCalloc(1, sizeof(OGR2SQLITE_vtab_cursor)); - /* We dont need to fill the non-extended fields */ - *ppCursor = (sqlite3_vtab_cursor *)pCursor; - - pCursor->poDupDataSource = poDupDataSource; - pCursor->poLayer = poLayer; - pCursor->poLayer->ResetReading(); - pCursor->poFeature = NULL; - pCursor->nNextWishedIndex = 0; - pCursor->nCurFeatureIndex = -1; - pCursor->nFeatureCount = -1; - - pCursor->pabyGeomBLOB = NULL; - pCursor->nGeomBLOBLen = -1; - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Close() */ -/************************************************************************/ - -static -int OGR2SQLITE_Close(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; - OGR2SQLITE_vtab* pMyVTab = pMyCursor->pVTab; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Close(%s, %s)", - pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName()); -#endif - pMyVTab->nMyRef --; - - delete pMyCursor->poFeature; - delete pMyCursor->poDupDataSource; - - CPLFree(pMyCursor->pabyGeomBLOB); - - CPLFree(pCursor); - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Filter() */ -/************************************************************************/ - -static -int OGR2SQLITE_Filter(sqlite3_vtab_cursor* pCursor, - int idxNum, const char *idxStr, - int argc, sqlite3_value **argv) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Filter"); -#endif - - int* panConstraints = (int*) idxStr; - int nConstraints = panConstraints ? panConstraints[0] : 0; - - if( nConstraints != argc ) - return SQLITE_ERROR; - - CPLString osAttributeFilter; - - OGRFeatureDefn* poFDefn = pMyCursor->poLayer->GetLayerDefn(); - - int i; - for (i = 0; i < argc; i++) - { - int nCol = panConstraints[2 * i + 1]; - OGRFieldDefn* poFieldDefn = NULL; - if( nCol >= 0 ) - { - poFieldDefn = poFDefn->GetFieldDefn(nCol); - if( poFieldDefn == NULL ) - return SQLITE_ERROR; - } - - if( i != 0 ) - osAttributeFilter += " AND "; - - if( poFieldDefn != NULL ) - { - const char* pszFieldName = poFieldDefn->GetNameRef(); - char ch; - int bNeedsQuoting = swq_is_reserved_keyword(pszFieldName); - for(int j = 0; !bNeedsQuoting && - (ch = pszFieldName[j]) != '\0'; j++ ) - { - if (!(isalnum((int)ch) || ch == '_')) - bNeedsQuoting = FALSE; - } - - if( bNeedsQuoting ) - { - /* FIXME: we would need some virtual method */ - OGRSFDriver* poDriver = pMyCursor->pVTab->poDS->GetDriver(); - char chQuote; - - if (poDriver && ( - EQUAL(poDriver->GetName(), "PostgreSQL") || - EQUAL(poDriver->GetName(), "SQLite") || - EQUAL(poDriver->GetName(), "FileGDB" )) ) - chQuote = '"'; - else - chQuote = '\''; - - osAttributeFilter += chQuote; - if( chQuote == '"' ) - osAttributeFilter += OGRSQLiteEscapeName(pszFieldName); - else - osAttributeFilter += OGRSQLiteEscape(pszFieldName); - osAttributeFilter += chQuote; - } - else - { - osAttributeFilter += pszFieldName; - } - } - else - osAttributeFilter += "FID"; - - switch(panConstraints[2 * i + 2]) - { - case SQLITE_INDEX_CONSTRAINT_EQ: osAttributeFilter += " = "; break; - case SQLITE_INDEX_CONSTRAINT_GT: osAttributeFilter += " > "; break; - case SQLITE_INDEX_CONSTRAINT_LE: osAttributeFilter += " <= "; break; - case SQLITE_INDEX_CONSTRAINT_LT: osAttributeFilter += " < "; break; - case SQLITE_INDEX_CONSTRAINT_GE: osAttributeFilter += " >= "; break; - default: - { - sqlite3_free(pMyCursor->pVTab->zErrMsg); - pMyCursor->pVTab->zErrMsg = sqlite3_mprintf( - "Unhandled constraint operator : %d", - panConstraints[2 * i + 2]); - return SQLITE_ERROR; - } - } - - if (sqlite3_value_type (argv[i]) == SQLITE_INTEGER) - { - osAttributeFilter += - CPLSPrintf(CPL_FRMT_GIB, sqlite3_value_int64 (argv[i])); - } - else if (sqlite3_value_type (argv[i]) == SQLITE_FLOAT) - { - osAttributeFilter += - CPLSPrintf("%.18g", sqlite3_value_double (argv[i])); - } - else if (sqlite3_value_type (argv[i]) == SQLITE_TEXT) - { - osAttributeFilter += "'"; - osAttributeFilter += OGRSQLiteEscape((const char*) sqlite3_value_text (argv[i])); - osAttributeFilter += "'"; - } - else - { - sqlite3_free(pMyCursor->pVTab->zErrMsg); - pMyCursor->pVTab->zErrMsg = sqlite3_mprintf( - "Unhandled constraint data type : %d", - sqlite3_value_type (argv[i])); - return SQLITE_ERROR; - } - } - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Attribute filter : %s", - osAttributeFilter.c_str()); -#endif - - if( pMyCursor->poLayer->SetAttributeFilter( osAttributeFilter.size() ? - osAttributeFilter.c_str() : NULL) != OGRERR_NONE ) - { - sqlite3_free(pMyCursor->pVTab->zErrMsg); - pMyCursor->pVTab->zErrMsg = sqlite3_mprintf( - "Cannot apply attribute filter : %s", - osAttributeFilter.c_str()); - return SQLITE_ERROR; - } - - if( pMyCursor->poLayer->TestCapability(OLCFastFeatureCount) ) - { - pMyCursor->nFeatureCount = pMyCursor->poLayer->GetFeatureCount(); - pMyCursor->poLayer->ResetReading(); - } - else - pMyCursor->nFeatureCount = -1; - - if( pMyCursor->nFeatureCount < 0 ) - { - pMyCursor->poFeature = pMyCursor->poLayer->GetNextFeature(); -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "GetNextFeature() --> %d", - pMyCursor->poFeature ? (int)pMyCursor->poFeature->GetFID() : -1); -#endif - } - - pMyCursor->nNextWishedIndex = 0; - pMyCursor->nCurFeatureIndex = -1; - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Next() */ -/************************************************************************/ - -static -int OGR2SQLITE_Next(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Next"); -#endif - - pMyCursor->nNextWishedIndex ++; - if( pMyCursor->nFeatureCount < 0 ) - { - delete pMyCursor->poFeature; - pMyCursor->poFeature = pMyCursor->poLayer->GetNextFeature(); - - CPLFree(pMyCursor->pabyGeomBLOB); - pMyCursor->pabyGeomBLOB = NULL; - pMyCursor->nGeomBLOBLen = -1; - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "GetNextFeature() --> %d", - pMyCursor->poFeature ? (int)pMyCursor->poFeature->GetFID() : -1); -#endif - } - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Eof() */ -/************************************************************************/ - -static -int OGR2SQLITE_Eof(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Eof"); -#endif - - if( pMyCursor->nFeatureCount < 0 ) - { - return (pMyCursor->poFeature == NULL); - } - else - { - return ( pMyCursor->nNextWishedIndex >= pMyCursor->nFeatureCount ); - } -} - -/************************************************************************/ -/* OGR2SQLITE_GoToWishedIndex() */ -/************************************************************************/ - -static void OGR2SQLITE_GoToWishedIndex(OGR2SQLITE_vtab_cursor* pMyCursor) -{ - if( pMyCursor->nFeatureCount >= 0 ) - { - if( pMyCursor->nCurFeatureIndex < pMyCursor->nNextWishedIndex ) - { - do - { - pMyCursor->nCurFeatureIndex ++; - - delete pMyCursor->poFeature; - pMyCursor->poFeature = pMyCursor->poLayer->GetNextFeature(); -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "GetNextFeature() --> %d", - pMyCursor->poFeature ? (int)pMyCursor->poFeature->GetFID() : -1); -#endif - } - while( pMyCursor->nCurFeatureIndex < pMyCursor->nNextWishedIndex ); - - CPLFree(pMyCursor->pabyGeomBLOB); - pMyCursor->pabyGeomBLOB = NULL; - pMyCursor->nGeomBLOBLen = -1; - } - } -} - -/************************************************************************/ -/* OGR2SQLITE_Column() */ -/************************************************************************/ - -static -int OGR2SQLITE_Column(sqlite3_vtab_cursor* pCursor, - sqlite3_context* pContext, int nCol) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; - OGRFeature* poFeature; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Column %d", nCol); -#endif - - OGR2SQLITE_GoToWishedIndex(pMyCursor); - - poFeature = pMyCursor->poFeature; - if( poFeature == NULL) - return SQLITE_ERROR; - - OGRFeatureDefn* poFDefn = pMyCursor->poLayer->GetLayerDefn(); - int nFieldCount = poFDefn->GetFieldCount(); - - if( nCol == nFieldCount ) - { - sqlite3_result_text(pContext, - poFeature->GetStyleString(), - -1, SQLITE_TRANSIENT); - return SQLITE_OK; - } - else if( nCol == (nFieldCount + 1) && - poFDefn->GetGeomType() != wkbNone ) - { - if( pMyCursor->nGeomBLOBLen < 0 ) - { - OGRGeometry* poGeom = poFeature->GetGeometryRef(); - if( poGeom == NULL ) - { - pMyCursor->nGeomBLOBLen = 0; - } - else - { - CPLAssert(pMyCursor->pabyGeomBLOB == NULL); - - OGRSpatialReference* poSRS = poGeom->getSpatialReference(); - int nSRSId = pMyCursor->pVTab->poModule->FetchSRSId(poSRS); - - if( OGRSQLiteLayer::ExportSpatiaLiteGeometry( - poGeom, nSRSId, wkbNDR, FALSE, FALSE, FALSE, - &pMyCursor->pabyGeomBLOB, - &pMyCursor->nGeomBLOBLen ) != CE_None ) - { - pMyCursor->nGeomBLOBLen = 0; - } - } - } - - if( pMyCursor->nGeomBLOBLen == 0 ) - { - sqlite3_result_null(pContext); - } - else - { - GByte *pabyGeomBLOBDup = (GByte*) - CPLMalloc(pMyCursor->nGeomBLOBLen); - memcpy(pabyGeomBLOBDup, - pMyCursor->pabyGeomBLOB, pMyCursor->nGeomBLOBLen); - sqlite3_result_blob(pContext, pabyGeomBLOBDup, - pMyCursor->nGeomBLOBLen, CPLFree); - } - - return SQLITE_OK; - } - else if( nCol > (nFieldCount + 1) && - nCol - (nFieldCount + 1) < poFDefn->GetGeomFieldCount() ) - { - OGRGeometry* poGeom = poFeature->GetGeomFieldRef(nCol - (nFieldCount + 1)); - if( poGeom == NULL ) - { - sqlite3_result_null(pContext); - } - else - { - OGRSpatialReference* poSRS = poGeom->getSpatialReference(); - int nSRSId = pMyCursor->pVTab->poModule->FetchSRSId(poSRS); - - GByte* pabyGeomBLOB = NULL; - int nGeomBLOBLen = 0; - if( OGRSQLiteLayer::ExportSpatiaLiteGeometry( - poGeom, nSRSId, wkbNDR, FALSE, FALSE, FALSE, - &pabyGeomBLOB, &nGeomBLOBLen ) != CE_None ) - { - nGeomBLOBLen = 0; - } - - if( nGeomBLOBLen == 0 ) - { - sqlite3_result_null(pContext); - } - else - { - sqlite3_result_blob(pContext, pabyGeomBLOB, - nGeomBLOBLen, CPLFree); - } - } - return SQLITE_OK; - } - else if( nCol < 0 || nCol >= nFieldCount ) - { - return SQLITE_ERROR; - } - else if( !poFeature->IsFieldSet(nCol) ) - { - sqlite3_result_null(pContext); - return SQLITE_OK; - } - - switch( poFDefn->GetFieldDefn(nCol)->GetType() ) - { - case OFTInteger: - sqlite3_result_int(pContext, - poFeature->GetFieldAsInteger(nCol)); - break; - - case OFTReal: - sqlite3_result_double(pContext, - poFeature->GetFieldAsDouble(nCol)); - break; - - case OFTBinary: - { - int nSize; - GByte* pBlob = poFeature->GetFieldAsBinary(nCol, &nSize); - sqlite3_result_blob(pContext, pBlob, nSize, SQLITE_TRANSIENT); - break; - } - - case OFTDateTime: - { - int nYear, nMonth, nDay, nHour, nMinute, nSecond, nTZ; - poFeature->GetFieldAsDateTime(nCol, &nYear, &nMonth, &nDay, - &nHour, &nMinute, &nSecond, &nTZ); - char szBuffer[64]; - sprintf(szBuffer, "%04d-%02d-%02dT%02d:%02d:%02d", - nYear, nMonth, nDay, nHour, nMinute, nSecond); - sqlite3_result_text(pContext, - szBuffer, - -1, SQLITE_TRANSIENT); - break; - } - - case OFTDate: - { - int nYear, nMonth, nDay, nHour, nMinute, nSecond, nTZ; - poFeature->GetFieldAsDateTime(nCol, &nYear, &nMonth, &nDay, - &nHour, &nMinute, &nSecond, &nTZ); - char szBuffer[64]; - sprintf(szBuffer, "%04d-%02d-%02dT", nYear, nMonth, nDay); - sqlite3_result_text(pContext, - szBuffer, - -1, SQLITE_TRANSIENT); - break; - } - - case OFTTime: - { - int nYear, nMonth, nDay, nHour, nMinute, nSecond, nTZ; - poFeature->GetFieldAsDateTime(nCol, &nYear, &nMonth, &nDay, - &nHour, &nMinute, &nSecond, &nTZ); - char szBuffer[64]; - sprintf(szBuffer, "%02d:%02d:%02d", nHour, nMinute, nSecond); - sqlite3_result_text(pContext, - szBuffer, - -1, SQLITE_TRANSIENT); - break; - } - - default: - sqlite3_result_text(pContext, - poFeature->GetFieldAsString(nCol), - -1, SQLITE_TRANSIENT); - break; - } - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Rowid() */ -/************************************************************************/ - -static -int OGR2SQLITE_Rowid(sqlite3_vtab_cursor* pCursor, sqlite3_int64 *pRowid) -{ - OGR2SQLITE_vtab_cursor* pMyCursor = (OGR2SQLITE_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Rowid"); -#endif - - OGR2SQLITE_GoToWishedIndex(pMyCursor); - - if( pMyCursor->poFeature == NULL) - return SQLITE_ERROR; - - *pRowid = pMyCursor->poFeature->GetFID(); - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITE_Rename() */ -/************************************************************************/ - -static -int OGR2SQLITE_Rename(sqlite3_vtab *pVtab, const char *zNew) -{ - //CPLDebug("OGR2SQLITE", "Rename"); - return SQLITE_ERROR; -} - -#if 0 -/************************************************************************/ -/* OGR2SQLITE_FindFunction() */ -/************************************************************************/ - -static -int OGR2SQLITE_FindFunction(sqlite3_vtab *pVtab, - int nArg, - const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), - void **ppArg) -{ - CPLDebug("OGR2SQLITE", "FindFunction %s", zName); - - return 0; -} -#endif - -/************************************************************************/ -/* OGR2SQLITE_FeatureFromArgs() */ -/************************************************************************/ - -static OGRFeature* OGR2SQLITE_FeatureFromArgs(OGRLayer* poLayer, - int argc, - sqlite3_value **argv) -{ - OGRFeatureDefn* poLayerDefn = poLayer->GetLayerDefn(); - int nFieldCount = poLayerDefn->GetFieldCount(); - int nGeomFieldCount = poLayerDefn->GetGeomFieldCount(); - if( argc != 2 + nFieldCount + 1 + nGeomFieldCount) - { - CPLDebug("OGR2SQLITE", "Did not get expect argument count : %d, %d", argc, - 2 + nFieldCount + 1 + nGeomFieldCount); - return NULL; - } - - OGRFeature* poFeature = new OGRFeature(poLayerDefn); - int i; - for(i = 0; i < nFieldCount; i++) - { - switch( sqlite3_value_type(argv[2 + i]) ) - { - case SQLITE_INTEGER: - //FIXME use int64 when OGR has 64bit integer support - poFeature->SetField(i, sqlite3_value_int(argv[2 + i])); - break; - case SQLITE_FLOAT: - poFeature->SetField(i, sqlite3_value_double(argv[2 + i])); - break; - case SQLITE_TEXT: - { - const char* pszValue = (const char*) sqlite3_value_text(argv[2 + i]); - switch( poLayerDefn->GetFieldDefn(i)->GetType() ) - { - case OFTDate: - case OFTTime: - case OFTDateTime: - { - if( !OGRSQLITEStringToDateTimeField( poFeature, i, pszValue ) ) - poFeature->SetField(i, pszValue); - break; - } - - default: - poFeature->SetField(i, pszValue); - break; - } - break; - } - case SQLITE_BLOB: - { - GByte* paby = (GByte *) sqlite3_value_blob (argv[2 + i]); - int nLen = sqlite3_value_bytes (argv[2 + i]); - poFeature->SetField(i, nLen, paby); - break; - } - default: - break; - } - } - - int nStyleIdx = 2 + nFieldCount; - if( sqlite3_value_type(argv[nStyleIdx]) == SQLITE_TEXT ) - { - poFeature->SetStyleString((const char*) sqlite3_value_text(argv[nStyleIdx])); - } - - for(i = 0; i < nGeomFieldCount; i++) - { - int nGeomFieldIdx = 2 + nFieldCount + 1 + i; - if( sqlite3_value_type(argv[nGeomFieldIdx]) == SQLITE_BLOB ) - { - GByte* pabyBlob = (GByte *) sqlite3_value_blob (argv[nGeomFieldIdx]); - int nLen = sqlite3_value_bytes (argv[nGeomFieldIdx]); - OGRGeometry* poGeom = NULL; - if( OGRSQLiteLayer::ImportSpatiaLiteGeometry( - pabyBlob, nLen, &poGeom ) == CE_None ) - { - poFeature->SetGeomFieldDirectly(i, poGeom); - } - } - } - - if( sqlite3_value_type(argv[1]) == SQLITE_INTEGER ) - poFeature->SetFID( sqlite3_value_int64(argv[1]) ); - - return poFeature; -} - -/************************************************************************/ -/* OGR2SQLITE_Update() */ -/************************************************************************/ - -static -int OGR2SQLITE_Update(sqlite3_vtab *pVTab, - int argc, - sqlite3_value **argv, - sqlite_int64 *pRowid) -{ - CPLDebug("OGR2SQLITE", "OGR2SQLITE_Update"); - - OGR2SQLITE_vtab* pMyVTab = (OGR2SQLITE_vtab*) pVTab; - OGRLayer* poLayer = pMyVTab->poLayer; - - if( argc == 1 ) - { - /* DELETE */ - - OGRErr eErr = poLayer->DeleteFeature(sqlite3_value_int64(argv[0])); - - return ( eErr == OGRERR_NONE ) ? SQLITE_OK : SQLITE_ERROR; - } - else if( argc > 1 && sqlite3_value_type(argv[0]) == SQLITE_NULL ) - { - /* INSERT */ - - OGRFeature* poFeature = OGR2SQLITE_FeatureFromArgs(poLayer, argc, argv); - if( poFeature == NULL ) - return SQLITE_ERROR; - - OGRErr eErr = poLayer->CreateFeature(poFeature); - if( eErr == OGRERR_NONE ) - *pRowid = poFeature->GetFID(); - - delete poFeature; - - return ( eErr == OGRERR_NONE ) ? SQLITE_OK : SQLITE_ERROR; - } - else if( argc > 1 && sqlite3_value_type(argv[0]) == SQLITE_INTEGER && - sqlite3_value_type(argv[1]) == SQLITE_INTEGER && - sqlite3_value_int64(argv[0]) == sqlite3_value_int64(argv[1]) ) - { - /* UPDATE */ - - OGRFeature* poFeature = OGR2SQLITE_FeatureFromArgs(poLayer, argc, argv); - if( poFeature == NULL ) - return SQLITE_ERROR; - - OGRErr eErr = poLayer->SetFeature(poFeature); - - delete poFeature; - - return ( eErr == OGRERR_NONE ) ? SQLITE_OK : SQLITE_ERROR; - } - - // UPDATE table SET rowid=rowid+1 WHERE ... unsupported - - return SQLITE_ERROR; -} - -/************************************************************************/ -/* sOGR2SQLITEModule */ -/************************************************************************/ - -static const struct sqlite3_module sOGR2SQLITEModule = -{ - 1, /* iVersion */ - OGR2SQLITE_ConnectCreate, /* xCreate */ - OGR2SQLITE_ConnectCreate, /* xConnect */ - OGR2SQLITE_BestIndex, - OGR2SQLITE_DisconnectDestroy, /* xDisconnect */ - OGR2SQLITE_DisconnectDestroy, /* xDestroy */ - OGR2SQLITE_Open, - OGR2SQLITE_Close, - OGR2SQLITE_Filter, - OGR2SQLITE_Next, - OGR2SQLITE_Eof, - OGR2SQLITE_Column, - OGR2SQLITE_Rowid, - OGR2SQLITE_Update, - NULL, /* xBegin */ - NULL, /* xSync */ - NULL, /* xCommit */ - NULL, /* xFindFunctionRollback */ - NULL, /* xFindFunction */ // OGR2SQLITE_FindFunction; - OGR2SQLITE_Rename -}; - -/************************************************************************/ -/* OGR2SQLITE_GetLayer() */ -/************************************************************************/ - -static -OGRLayer* OGR2SQLITE_GetLayer(const char* pszFuncName, - sqlite3_context* pContext, - int argc, sqlite3_value** argv) -{ - if( argc != 1 ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "%s: %s(): %s", - "VirtualOGR", - pszFuncName, - "Invalid number of arguments"); - sqlite3_result_null (pContext); - return NULL; - } - - if( sqlite3_value_type (argv[0]) != SQLITE_TEXT ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "%s: %s(): %s", - "VirtualOGR", - pszFuncName, - "Invalid argument type"); - sqlite3_result_null (pContext); - return NULL; - } - - const char* pszVTableName = (const char*)sqlite3_value_text(argv[0]); - - OGR2SQLITEModule* poModule = - (OGR2SQLITEModule*) sqlite3_user_data(pContext); - - OGRLayer* poLayer = poModule->GetLayerForVTable(OGRSQLiteParamsUnquote(pszVTableName)); - if( poLayer == NULL ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "%s: %s(): %s", - "VirtualOGR", - pszFuncName, - "Unknown virtual table"); - sqlite3_result_null (pContext); - return NULL; - } - - return poLayer; -} - -/************************************************************************/ -/* OGR2SQLITE_ogr_layer_Extent() */ -/************************************************************************/ - -static -void OGR2SQLITE_ogr_layer_Extent(sqlite3_context* pContext, - int argc, sqlite3_value** argv) -{ - OGRLayer* poLayer = OGR2SQLITE_GetLayer("ogr_layer_Extent", - pContext, argc, argv); - if( poLayer == NULL ) - return; - - OGR2SQLITEModule* poModule = - (OGR2SQLITEModule*) sqlite3_user_data(pContext); - - if( poLayer->GetGeomType() == wkbNone ) - { - sqlite3_result_null (pContext); - return; - } - - OGREnvelope sExtent; - if( poLayer->GetExtent(&sExtent) != OGRERR_NONE ) - { - CPLError(CE_Failure, CPLE_AppDefined, - "%s: %s(): %s", - "VirtualOGR", - "ogr_layer_Extent", - "Cannot fetch layer extent"); - sqlite3_result_null (pContext); - return; - } - - OGRPolygon oPoly; - OGRLinearRing* poRing = new OGRLinearRing(); - oPoly.addRingDirectly(poRing); - poRing->addPoint(sExtent.MinX, sExtent.MinY); - poRing->addPoint(sExtent.MaxX, sExtent.MinY); - poRing->addPoint(sExtent.MaxX, sExtent.MaxY); - poRing->addPoint(sExtent.MinX, sExtent.MaxY); - poRing->addPoint(sExtent.MinX, sExtent.MinY); - - GByte* pabySLBLOB = NULL; - int nBLOBLen = 0; - int nSRID = poModule->FetchSRSId(poLayer->GetSpatialRef()); - if( OGRSQLiteLayer::ExportSpatiaLiteGeometry( - &oPoly, nSRID, wkbNDR, FALSE, - FALSE, FALSE, &pabySLBLOB, &nBLOBLen ) == CE_None ) - { - sqlite3_result_blob(pContext, pabySLBLOB, nBLOBLen, CPLFree); - } - else - { - sqlite3_result_null (pContext); - } -} - -/************************************************************************/ -/* OGR2SQLITE_ogr_layer_SRID() */ -/************************************************************************/ - -static -void OGR2SQLITE_ogr_layer_SRID(sqlite3_context* pContext, - int argc, sqlite3_value** argv) -{ - OGRLayer* poLayer = OGR2SQLITE_GetLayer("OGR2SQLITE_ogr_layer_SRID", - pContext, argc, argv); - if( poLayer == NULL ) - return; - - OGR2SQLITEModule* poModule = - (OGR2SQLITEModule*) sqlite3_user_data(pContext); - - if( poLayer->GetGeomType() == wkbNone ) - { - sqlite3_result_null (pContext); - return; - } - - int nSRID = poModule->FetchSRSId(poLayer->GetSpatialRef()); - sqlite3_result_int(pContext, nSRID); -} - -/************************************************************************/ -/* OGR2SQLITE_ogr_layer_GeometryType() */ -/************************************************************************/ - -static -void OGR2SQLITE_ogr_layer_GeometryType(sqlite3_context* pContext, - int argc, sqlite3_value** argv) -{ - OGRLayer* poLayer = OGR2SQLITE_GetLayer("OGR2SQLITE_ogr_layer_GeometryType", - pContext, argc, argv); - if( poLayer == NULL ) - return; - - OGRwkbGeometryType eType = poLayer->GetGeomType(); - - if( eType == wkbNone ) - { - sqlite3_result_null (pContext); - return; - } - - const char* psz2DName = OGRToOGCGeomType(eType); - if( eType & wkb25DBit ) - sqlite3_result_text( pContext, CPLSPrintf("%s Z", psz2DName), -1, SQLITE_TRANSIENT ); - else - sqlite3_result_text( pContext, psz2DName, -1, SQLITE_TRANSIENT ); -} - -/************************************************************************/ -/* OGR2SQLITE_ogr_layer_FeatureCount() */ -/************************************************************************/ - -static -void OGR2SQLITE_ogr_layer_FeatureCount(sqlite3_context* pContext, - int argc, sqlite3_value** argv) -{ - OGRLayer* poLayer = OGR2SQLITE_GetLayer("OGR2SQLITE_ogr_layer_FeatureCount", - pContext, argc, argv); - if( poLayer == NULL ) - return; - - sqlite3_result_int64( pContext, poLayer->GetFeatureCount() ); -} - -/************************************************************************/ -/* OGR2SQLITEDestroyModule() */ -/************************************************************************/ - -static void OGR2SQLITEDestroyModule(void* pData) -{ - CPLDebug("OGR", "Unloading VirtualOGR module"); - delete (OGR2SQLITEModule*) pData; -} - -/* ENABLE_VIRTUAL_OGR_SPATIAL_INDEX is not defined */ -#ifdef ENABLE_VIRTUAL_OGR_SPATIAL_INDEX - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_vtab */ -/************************************************************************/ - -typedef struct -{ - /* Mandatory fields by sqlite3: don't change or reorder them ! */ - const sqlite3_module *pModule; - int nRef; - char *zErrMsg; - - /* Extension fields */ - char *pszVTableName; - OGR2SQLITEModule *poModule; - OGRDataSource *poDS; - int bCloseDS; - OGRLayer *poLayer; - int nMyRef; -} OGR2SQLITESpatialIndex_vtab; - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_vtab_cursor */ -/************************************************************************/ - -typedef struct -{ - /* Mandatory fields by sqlite3: don't change or reorder them ! */ - OGR2SQLITESpatialIndex_vtab *pVTab; - - /* Extension fields */ - OGRDataSource *poDupDataSource; - OGRLayer *poLayer; - OGRFeature *poFeature; - int bHasSetBounds; - double dfMinX, dfMinY, dfMaxX, dfMaxY; -} OGR2SQLITESpatialIndex_vtab_cursor; - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_ConnectCreate() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_ConnectCreate(sqlite3* hDB, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**pzErr) -{ - OGR2SQLITEModule* poModule = (OGR2SQLITEModule*) pAux; - OGRLayer* poLayer = NULL; - OGRDataSource* poDS = NULL; - int bCloseDS = FALSE; - int i; - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "ConnectCreate(%s)", argv[2]); -#endif - - /*for(i=0;i<argc;i++) - printf("[%d] %s\n", i, argv[i]);*/ - -/* -------------------------------------------------------------------- */ -/* If called from ogrexecutesql.cpp */ -/* -------------------------------------------------------------------- */ - poDS = poModule->GetDS(); - if( poDS == NULL ) - return SQLITE_ERROR; - - if( argc != 10 ) - { - *pzErr = sqlite3_mprintf( - "Expected syntax: CREATE VIRTUAL TABLE xxx USING " - "VirtualOGRSpatialIndex(ds_idx, layer_name, pkid, xmin, xmax, ymin, ymax)"); - return SQLITE_ERROR; - } - - int nDSIndex = atoi(argv[3]); - if( nDSIndex >= 0 ) - { - poDS = poModule->GetExtraDS(nDSIndex); - if( poDS == NULL ) - { - *pzErr = sqlite3_mprintf("Invalid dataset index : %d", nDSIndex); - return SQLITE_ERROR; - } - } - - poDS = (OGRDataSource*) OGROpen( poDS->GetName(), FALSE, NULL); - if( poDS == NULL ) - { - return SQLITE_ERROR; - } - bCloseDS = TRUE; - - CPLString osLayerName(OGRSQLiteParamsUnquote(argv[4])); - - poLayer = poDS->GetLayerByName(osLayerName); - if( poLayer == NULL ) - { - *pzErr = sqlite3_mprintf( "Cannot find layer '%s' in '%s'", - osLayerName.c_str(), poDS->GetName() ); - return SQLITE_ERROR; - } - - OGR2SQLITESpatialIndex_vtab* vtab = - (OGR2SQLITESpatialIndex_vtab*) CPLCalloc(1, sizeof(OGR2SQLITESpatialIndex_vtab)); - /* We dont need to fill the non-extended fields */ - vtab->pszVTableName = CPLStrdup(OGRSQLiteEscapeName(argv[2])); - vtab->poModule = poModule; - vtab->poDS = poDS; - vtab->bCloseDS = bCloseDS; - vtab->poLayer = poLayer; - vtab->nMyRef = 0; - - *ppVTab = (sqlite3_vtab*) vtab; - - CPLString osSQL; - osSQL = "CREATE TABLE "; - osSQL += "\""; - osSQL += OGRSQLiteEscapeName(argv[2]); - osSQL += "\""; - osSQL += "("; - - int bAddComma = FALSE; - - for(i=0;i<5;i++) - { - if( bAddComma ) - osSQL += ","; - bAddComma = TRUE; - - osSQL += "\""; - osSQL += OGRSQLiteEscapeName(OGRSQLiteParamsUnquote(argv[5+i])); - osSQL += "\""; - osSQL += " "; - osSQL += (i == 0) ? "INTEGER" : "FLOAT"; - } - - osSQL += ")"; - - CPLDebug("OGR2SQLITE", "sqlite3_declare_vtab(%s)", osSQL.c_str()); - if (sqlite3_declare_vtab (hDB, osSQL.c_str()) != SQLITE_OK) - { - *pzErr = sqlite3_mprintf("CREATE VIRTUAL: invalid SQL statement : %s", - osSQL.c_str()); - return SQLITE_ERROR; - } - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_BestIndex() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_BestIndex(sqlite3_vtab *pVTab, sqlite3_index_info* pIndex) -{ -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "BestIndex"); -#endif - - int i; - - int bMinX = FALSE, bMinY = FALSE, bMaxX = FALSE, bMaxY = FALSE; - - for (i = 0; i < pIndex->nConstraint; i++) - { - int iCol = pIndex->aConstraint[i].iColumn; - /* MinX */ - if( !bMinX && iCol == 1 && pIndex->aConstraint[i].usable && - (pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_LE || - pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_LT) ) - bMinX = TRUE; - /* MaxX */ - else if( !bMaxX && iCol == 2 && pIndex->aConstraint[i].usable && - (pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_GE || - pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_GT) ) - bMaxX = TRUE; - /* MinY */ - else if( !bMinY && iCol == 3 && pIndex->aConstraint[i].usable && - (pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_LE || - pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_LT) ) - bMinY = TRUE; - /* MaxY */ - else if( !bMaxY && iCol == 4 && pIndex->aConstraint[i].usable && - (pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_GE || - pIndex->aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_GT) ) - bMaxY = TRUE; - else - break; - } - - if( bMinX && bMinY && bMaxX && bMaxY ) - { - CPLAssert( pIndex->nConstraint == 4 ); - - int nConstraints = 0; - for (i = 0; i < pIndex->nConstraint; i++) - { - pIndex->aConstraintUsage[i].argvIndex = nConstraints + 1; - pIndex->aConstraintUsage[i].omit = TRUE; - - nConstraints ++; - } - - int* panConstraints = (int*) - sqlite3_malloc( sizeof(int) * (1 + 2 * nConstraints) ); - panConstraints[0] = nConstraints; - - nConstraints = 0; - - for (i = 0; i < pIndex->nConstraint; i++) - { - if (pIndex->aConstraintUsage[i].omit) - { - panConstraints[2 * nConstraints + 1] = - pIndex->aConstraint[i].iColumn; - panConstraints[2 * nConstraints + 2] = - pIndex->aConstraint[i].op; - - nConstraints ++; - } - } - - pIndex->idxStr = (char *) panConstraints; - pIndex->needToFreeIdxStr = TRUE; - - pIndex->orderByConsumed = FALSE; - pIndex->idxNum = 0; - - return SQLITE_OK; - } - else - { - CPLDebug("OGR2SQLITE", "OGR2SQLITESpatialIndex_BestIndex: unhandled request"); - return SQLITE_ERROR; -/* - for (i = 0; i < pIndex->nConstraint; i++) - { - pIndex->aConstraintUsage[i].argvIndex = 0; - pIndex->aConstraintUsage[i].omit = FALSE; - } - - pIndex->idxStr = NULL; - pIndex->needToFreeIdxStr = FALSE; -*/ - } -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_DisconnectDestroy() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_DisconnectDestroy(sqlite3_vtab *pVTab) -{ - OGR2SQLITESpatialIndex_vtab* pMyVTab = (OGR2SQLITESpatialIndex_vtab*) pVTab; - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "DisconnectDestroy(%s)",pMyVTab->pszVTableName); -#endif - - sqlite3_free(pMyVTab->zErrMsg); - if( pMyVTab->bCloseDS ) - delete pMyVTab->poDS; - CPLFree(pMyVTab->pszVTableName); - CPLFree(pMyVTab); - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Open() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Open(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor) -{ - OGR2SQLITESpatialIndex_vtab* pMyVTab = (OGR2SQLITESpatialIndex_vtab*) pVTab; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Open(%s, %s)", - pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName()); -#endif - - OGRDataSource* poDupDataSource = NULL; - OGRLayer* poLayer = NULL; - - if( pMyVTab->nMyRef == 0 ) - { - poLayer = pMyVTab->poLayer; - } - else - { - poDupDataSource = - (OGRDataSource*) OGROpen(pMyVTab->poDS->GetName(), FALSE, NULL); - if( poDupDataSource == NULL ) - return SQLITE_ERROR; - poLayer = poDupDataSource->GetLayerByName( - pMyVTab->poLayer->GetName()); - if( poLayer == NULL ) - { - delete poDupDataSource; - return SQLITE_ERROR; - } - if( !poLayer->GetLayerDefn()-> - IsSame(pMyVTab->poLayer->GetLayerDefn()) ) - { - delete poDupDataSource; - return SQLITE_ERROR; - } - } - pMyVTab->nMyRef ++; - - OGR2SQLITESpatialIndex_vtab_cursor* pCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) - CPLCalloc(1, sizeof(OGR2SQLITESpatialIndex_vtab_cursor)); - /* We dont need to fill the non-extended fields */ - *ppCursor = (sqlite3_vtab_cursor *)pCursor; - - pCursor->poDupDataSource = poDupDataSource; - pCursor->poLayer = poLayer; - pCursor->poLayer->ResetReading(); - pCursor->poFeature = NULL; - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Close() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Close(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITESpatialIndex_vtab_cursor* pMyCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) pCursor; - OGR2SQLITESpatialIndex_vtab* pMyVTab = pMyCursor->pVTab; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Close(%s, %s)", - pMyVTab->poDS->GetName(), pMyVTab->poLayer->GetName()); -#endif - pMyVTab->nMyRef --; - - delete pMyCursor->poFeature; - delete pMyCursor->poDupDataSource; - - CPLFree(pCursor); - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Filter() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Filter(sqlite3_vtab_cursor* pCursor, - int idxNum, const char *idxStr, - int argc, sqlite3_value **argv) -{ - OGR2SQLITESpatialIndex_vtab_cursor* pMyCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Filter"); -#endif - - int* panConstraints = (int*) idxStr; - int nConstraints = panConstraints ? panConstraints[0] : 0; - - if( nConstraints != argc ) - return SQLITE_ERROR; - - int i; - double dfMinX = 0, dfMaxX = 0, dfMinY = 0, dfMaxY = 0; - for (i = 0; i < argc; i++) - { - int nCol = panConstraints[2 * i + 1]; - if( nCol < 0 ) - return SQLITE_ERROR; - - double dfVal; - if (sqlite3_value_type (argv[i]) == SQLITE_INTEGER) - dfVal = sqlite3_value_int64 (argv[i]); - else if (sqlite3_value_type (argv[i]) == SQLITE_FLOAT) - dfVal = sqlite3_value_double (argv[i]); - else - return SQLITE_ERROR; - - if( nCol == 1 ) - dfMaxX = dfVal; - else if( nCol == 2 ) - dfMinX = dfVal; - else if( nCol == 3 ) - dfMaxY = dfVal; - else if( nCol == 4 ) - dfMinY = dfVal; - else - return SQLITE_ERROR; - } - -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Spatial filter : %.18g, %.18g, %.18g, %.18g", - dfMinX, dfMinY, dfMaxX, dfMaxY); -#endif - - pMyCursor->poLayer->SetSpatialFilterRect(dfMinX, dfMinY, dfMaxX, dfMaxY); - pMyCursor->poLayer->ResetReading(); - - pMyCursor->poFeature = pMyCursor->poLayer->GetNextFeature(); - pMyCursor->bHasSetBounds = FALSE; - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Next() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Next(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITESpatialIndex_vtab_cursor* pMyCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Next"); -#endif - - delete pMyCursor->poFeature; - pMyCursor->poFeature = pMyCursor->poLayer->GetNextFeature(); - pMyCursor->bHasSetBounds = FALSE; - - return SQLITE_OK; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Eof() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Eof(sqlite3_vtab_cursor* pCursor) -{ - OGR2SQLITESpatialIndex_vtab_cursor* pMyCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) pCursor; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Eof"); -#endif - - return (pMyCursor->poFeature == NULL); -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Column() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Column(sqlite3_vtab_cursor* pCursor, - sqlite3_context* pContext, int nCol) -{ - OGR2SQLITESpatialIndex_vtab_cursor* pMyCursor = (OGR2SQLITESpatialIndex_vtab_cursor*) pCursor; - OGRFeature* poFeature; -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Column %d", nCol); -#endif - - poFeature = pMyCursor->poFeature; - if( poFeature == NULL) - return SQLITE_ERROR; - - if( nCol == 0 ) - { - CPLDebug("OGR2SQLITE", "--> FID = %ld", poFeature->GetFID()); - sqlite3_result_int64(pContext, poFeature->GetFID()); - return SQLITE_OK; - } - - if( !pMyCursor->bHasSetBounds ) - { - OGRGeometry* poGeom = poFeature->GetGeometryRef(); - if( poGeom != NULL && !poGeom->IsEmpty() ) - { - OGREnvelope sEnvelope; - poGeom->getEnvelope(&sEnvelope); - pMyCursor->bHasSetBounds = TRUE; - pMyCursor->dfMinX = sEnvelope.MinX; - pMyCursor->dfMinY = sEnvelope.MinY; - pMyCursor->dfMaxX = sEnvelope.MaxX; - pMyCursor->dfMaxY = sEnvelope.MaxY; - } - } - if( !pMyCursor->bHasSetBounds ) - { - sqlite3_result_null(pContext); - return SQLITE_OK; - } - - if( nCol == 1 ) - { - sqlite3_result_double(pContext, pMyCursor->dfMinX); - return SQLITE_OK; - } - if( nCol == 2 ) - { - sqlite3_result_double(pContext, pMyCursor->dfMaxX); - return SQLITE_OK; - } - if( nCol == 3 ) - { - sqlite3_result_double(pContext, pMyCursor->dfMinY); - return SQLITE_OK; - } - if( nCol == 4 ) - { - sqlite3_result_double(pContext, pMyCursor->dfMaxY); - return SQLITE_OK; - } - - return SQLITE_ERROR; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Rowid() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Rowid(sqlite3_vtab_cursor* pCursor, sqlite3_int64 *pRowid) -{ -#ifdef DEBUG_OGR2SQLITE - CPLDebug("OGR2SQLITE", "Rowid"); -#endif - - return SQLITE_ERROR; -} - -/************************************************************************/ -/* OGR2SQLITESpatialIndex_Rename() */ -/************************************************************************/ - -static -int OGR2SQLITESpatialIndex_Rename(sqlite3_vtab *pVtab, const char *zNew) -{ - //CPLDebug("OGR2SQLITE", "Rename"); - return SQLITE_ERROR; -} - -/************************************************************************/ -/* sOGR2SQLITESpatialIndex */ -/************************************************************************/ - -static const struct sqlite3_module sOGR2SQLITESpatialIndex = -{ - 1, /* iVersion */ - OGR2SQLITESpatialIndex_ConnectCreate, /* xCreate */ - OGR2SQLITESpatialIndex_ConnectCreate, /* xConnect */ - OGR2SQLITESpatialIndex_BestIndex, - OGR2SQLITESpatialIndex_DisconnectDestroy, /* xDisconnect */ - OGR2SQLITESpatialIndex_DisconnectDestroy, /* xDestroy */ - OGR2SQLITESpatialIndex_Open, - OGR2SQLITESpatialIndex_Close, - OGR2SQLITESpatialIndex_Filter, - OGR2SQLITESpatialIndex_Next, - OGR2SQLITESpatialIndex_Eof, - OGR2SQLITESpatialIndex_Column, - OGR2SQLITESpatialIndex_Rowid, - NULL, /* xUpdate */ - NULL, /* xBegin */ - NULL, /* xSync */ - NULL, /* xCommit */ - NULL, /* xFindFunctionRollback */ - NULL, /* xFindFunction */ - OGR2SQLITESpatialIndex_Rename -}; -#endif // ENABLE_VIRTUAL_OGR_SPATIAL_INDEX - -/************************************************************************/ -/* Setup() */ -/************************************************************************/ - -int OGR2SQLITEModule::Setup(sqlite3* hDB) -{ - int rc; - - this->hDB = hDB; - - rc = sqlite3_create_module_v2(hDB, "VirtualOGR", &sOGR2SQLITEModule, this, - OGR2SQLITEDestroyModule); - if( rc != SQLITE_OK ) - return FALSE; - -#ifdef ENABLE_VIRTUAL_OGR_SPATIAL_INDEX - rc = sqlite3_create_module(hDB, "VirtualOGRSpatialIndex", - &sOGR2SQLITESpatialIndex, this); - if( rc != SQLITE_OK ) - return FALSE; -#endif // ENABLE_VIRTUAL_OGR_SPATIAL_INDEX - - rc= sqlite3_create_function(hDB, "ogr_layer_Extent", 1, SQLITE_ANY, this, - OGR2SQLITE_ogr_layer_Extent, NULL, NULL); - if( rc != SQLITE_OK ) - return FALSE; - - rc= sqlite3_create_function(hDB, "ogr_layer_SRID", 1, SQLITE_ANY, this, - OGR2SQLITE_ogr_layer_SRID, NULL, NULL); - if( rc != SQLITE_OK ) - return FALSE; - - rc= sqlite3_create_function(hDB, "ogr_layer_GeometryType", 1, SQLITE_ANY, this, - OGR2SQLITE_ogr_layer_GeometryType, NULL, NULL); - if( rc != SQLITE_OK ) - return FALSE; - - rc= sqlite3_create_function(hDB, "ogr_layer_FeatureCount", 1, SQLITE_ANY, this, - OGR2SQLITE_ogr_layer_FeatureCount, NULL, NULL); - if( rc != SQLITE_OK ) - return FALSE; - - SetHandleSQLFunctions(OGRSQLiteRegisterSQLFunctions(hDB)); - - return TRUE; -} - -/************************************************************************/ -/* OGR2SQLITE_Setup() */ -/************************************************************************/ - -OGR2SQLITEModule* OGR2SQLITE_Setup(OGRDataSource* poDS, - OGRSQLiteDataSource* poSQLiteDS) -{ - OGR2SQLITEModule* poModule = new OGR2SQLITEModule(); - poModule->Setup(poDS, poSQLiteDS); - return poModule; -} - -/************************************************************************/ -/* OGR2SQLITE_AddExtraDS() */ -/************************************************************************/ - -int OGR2SQLITE_AddExtraDS(OGR2SQLITEModule* poModule, OGRDataSource* poDS) -{ - return poModule->AddExtraDS(poDS); -} - -#ifdef VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED - -/************************************************************************/ -/* sqlite3_extension_init() */ -/************************************************************************/ - -CPL_C_START -int CPL_DLL sqlite3_extension_init (sqlite3 * hDB, char **pzErrMsg, - const sqlite3_api_routines * pApi); -CPL_C_END - -/* Entry point for dynamically loaded extension (typically called by load_extension()) */ -int sqlite3_extension_init (sqlite3 * hDB, char **pzErrMsg, - const sqlite3_api_routines * pApi) -{ - CPLDebug("OGR", "OGR SQLite extension loading..."); - - SQLITE_EXTENSION_INIT2(pApi); - - *pzErrMsg = NULL; - - OGRRegisterAll(); - - OGR2SQLITEModule* poModule = new OGR2SQLITEModule(); - if( poModule->Setup(hDB) ) - { - CPLDebug("OGR", "OGR SQLite extension loaded"); - return SQLITE_OK; - } - else - return SQLITE_ERROR; -} - -#endif // VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED - -/************************************************************************/ -/* OGR2SQLITE_static_register() */ -/************************************************************************/ - - -#ifndef WIN32 -extern const struct sqlite3_api_routines OGRSQLITE_static_routines; -#endif - -int OGR2SQLITE_static_register (sqlite3 * hDB, char **pzErrMsg, void * _pApi) -{ - const sqlite3_api_routines * pApi = (const sqlite3_api_routines * )_pApi; -#ifndef WIN32 - if( pApi->create_module == NULL ) - { - pApi = &OGRSQLITE_static_routines; - } -#endif - SQLITE_EXTENSION_INIT2 (pApi); - - *pzErrMsg = NULL; - - /* The config option is turned off by ogrsqliteexecutesql.cpp that needs */ - /* to create a custom module */ - if( CSLTestBoolean(CPLGetConfigOption("OGR_SQLITE_STATIC_VIRTUAL_OGR", "YES")) ) - { - /* Can happen if sqlite is compiled with SQLITE_OMIT_LOAD_EXTENSION (with sqlite 3.6.10 for example) */ - /* We return here OK since it is not vital for regular SQLite dababases */ - /* to load the OGR SQL functions */ - if( pApi->create_module == NULL ) - return SQLITE_OK; - - OGR2SQLITEModule* poModule = new OGR2SQLITEModule(); - return poModule->Setup(hDB) ? SQLITE_OK : SQLITE_ERROR; - } - else - { - /* Can happen if sqlite is compiled with SQLITE_OMIT_LOAD_EXTENSION (with sqlite 3.6.10 for example) */ - /* We return fail since Setup() will later be called, and crash */ - /* if create_module isn't available */ - if( pApi->create_module == NULL ) - return SQLITE_ERROR; - } - - return SQLITE_OK; -} -#endif // HAVE_SQLITE_VFS diff --git a/SuperBuild/patches/GEOS/geos-1-fixes-linux.diff b/SuperBuild/patches/GEOS/geos-1-fixes-linux.diff new file mode 100755 index 0000000000000000000000000000000000000000..db9f9e47ae009dd46502a97d9f872e2a72b72549 --- /dev/null +++ b/SuperBuild/patches/GEOS/geos-1-fixes-linux.diff @@ -0,0 +1,38 @@ +diff -burN geos-3.4.2.orig/src/CMakeLists.txt geos-3.4.2/src/CMakeLists.txt +--- geos-3.4.2.orig/src/CMakeLists.txt 2016-07-01 14:07:05.000000000 +0200 ++++ geos-3.4.2/src/CMakeLists.txt 2016-07-01 14:07:39.000000000 +0200 +@@ -62,7 +62,7 @@ + else() + + add_library(geos SHARED ${geos_SOURCES} ${geos_ALL_HEADERS}) +- add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) ++# add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) + + set_target_properties(geos + PROPERTIES +@@ -70,11 +70,11 @@ + VERSION ${VERSION} + CLEAN_DIRECT_OUTPUT 1) + +- set_target_properties(geos-static +- PROPERTIES +- OUTPUT_NAME "geos" +- PREFIX "lib" +- CLEAN_DIRECT_OUTPUT 1) ++# set_target_properties(geos-static ++# PROPERTIES ++# OUTPUT_NAME "geos" ++# PREFIX "lib" ++# CLEAN_DIRECT_OUTPUT 1) + + endif() + +@@ -90,7 +90,7 @@ + ################################################################################# + + if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK) +- install(TARGETS geos geos-static ++ install(TARGETS geos + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/SuperBuild/patches/GEOS/geos-1-fixes-macx.diff b/SuperBuild/patches/GEOS/geos-1-fixes-macx.diff new file mode 100755 index 0000000000000000000000000000000000000000..db9f9e47ae009dd46502a97d9f872e2a72b72549 --- /dev/null +++ b/SuperBuild/patches/GEOS/geos-1-fixes-macx.diff @@ -0,0 +1,38 @@ +diff -burN geos-3.4.2.orig/src/CMakeLists.txt geos-3.4.2/src/CMakeLists.txt +--- geos-3.4.2.orig/src/CMakeLists.txt 2016-07-01 14:07:05.000000000 +0200 ++++ geos-3.4.2/src/CMakeLists.txt 2016-07-01 14:07:39.000000000 +0200 +@@ -62,7 +62,7 @@ + else() + + add_library(geos SHARED ${geos_SOURCES} ${geos_ALL_HEADERS}) +- add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) ++# add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) + + set_target_properties(geos + PROPERTIES +@@ -70,11 +70,11 @@ + VERSION ${VERSION} + CLEAN_DIRECT_OUTPUT 1) + +- set_target_properties(geos-static +- PROPERTIES +- OUTPUT_NAME "geos" +- PREFIX "lib" +- CLEAN_DIRECT_OUTPUT 1) ++# set_target_properties(geos-static ++# PROPERTIES ++# OUTPUT_NAME "geos" ++# PREFIX "lib" ++# CLEAN_DIRECT_OUTPUT 1) + + endif() + +@@ -90,7 +90,7 @@ + ################################################################################# + + if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK) +- install(TARGETS geos geos-static ++ install(TARGETS geos + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/SuperBuild/patches/GEOS/geos-1-fixes-win.diff b/SuperBuild/patches/GEOS/geos-1-fixes-win.diff new file mode 100755 index 0000000000000000000000000000000000000000..8421b8cd1b97a80ff7521f6a25ea4ef72bfebe48 --- /dev/null +++ b/SuperBuild/patches/GEOS/geos-1-fixes-win.diff @@ -0,0 +1,50 @@ +diff -burN libgeos-714127ef49087634e7f6687424fdf041d18c3d0f.orig/CMakeLists.txt libgeos-714127ef49087634e7f6687424fdf041d18c3d0f/CMakeLists.txt +--- libgeos-714127ef49087634e7f6687424fdf041d18c3d0f.orig/CMakeLists.txt 2016-07-01 14:03:31.000000000 +0200 ++++ libgeos-714127ef49087634e7f6687424fdf041d18c3d0f/CMakeLists.txt 2016-07-01 14:05:21.000000000 +0200 +@@ -254,7 +254,7 @@ + ENDMACRO(GET_SVN_REVISION) + + # Determine SVN/Git revision +-set(GEOS_BUILD_PACKAGED TRUE) ++#set(GEOS_BUILD_PACKAGED TRUE) + if(EXISTS "${PROJECT_SOURCE_DIR}/.svn") + set(GEOS_BUILD_PACKAGED FALSE) + GET_SVN_REVISION() +diff -burN libgeos-714127ef49087634e7f6687424fdf041d18c3d0f.orig/src/CMakeLists.txt libgeos-714127ef49087634e7f6687424fdf041d18c3d0f/src/CMakeLists.txt +--- libgeos-714127ef49087634e7f6687424fdf041d18c3d0f.orig/src/CMakeLists.txt 2016-07-01 14:03:30.000000000 +0200 ++++ libgeos-714127ef49087634e7f6687424fdf041d18c3d0f/src/CMakeLists.txt 2016-07-01 14:05:56.000000000 +0200 +@@ -62,7 +62,7 @@ + else() + + add_library(geos SHARED ${geos_SOURCES} ${geos_ALL_HEADERS}) +- add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) ++ # add_library(geos-static STATIC ${geos_SOURCES} ${geos_ALL_HEADERS}) + + set_target_properties(geos + PROPERTIES +@@ -70,11 +70,11 @@ + VERSION ${VERSION} + CLEAN_DIRECT_OUTPUT 1) + +- set_target_properties(geos-static +- PROPERTIES +- OUTPUT_NAME "geos" +- PREFIX "lib" +- CLEAN_DIRECT_OUTPUT 1) ++# set_target_properties(geos-static ++# PROPERTIES ++# OUTPUT_NAME "geos" ++# PREFIX "lib" ++# CLEAN_DIRECT_OUTPUT 1) + + endif() + +@@ -90,7 +90,7 @@ + ################################################################################# + + if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK) +- install(TARGETS geos geos-static ++ install(TARGETS geos + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/SuperBuild/patches/GLEW/CMakeLists.txt b/SuperBuild/patches/GLEW/CMakeLists.txt deleted file mode 100755 index c54661c97022cdbea0cfe6d8cf56abcaca8647a3..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/GLEW/CMakeLists.txt +++ /dev/null @@ -1,168 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) - -project(glew) - -#NOTE: Below is output from "make" on osx. This was used to make up this cmakelists.txt -# cc -DGLEW_NO_GLU -DGLEW_BUILD -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o tmp/darwin/default/shared/glew.o -c src/glew.c -# cc -dynamiclib -install_name /usr/lib/libGLEW.1.13.0.dylib -current_version 1.13.0 -compatibility_version 1.13 -o lib/libGLEW.1.13.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -# ln -sf libGLEW.1.13.0.dylib lib/libGLEW.1.13.dylib -# ln -sf libGLEW.1.13.0.dylib lib/libGLEW.dylib -# strip -x lib/libGLEW.1.13.0.dylib -# cc -DGLEW_NO_GLU -DGLEW_MX -DGLEW_BUILD -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o tmp/darwin/mx/shared/glew.o -c src/glew.c -# cc -dynamiclib -install_name /usr/lib/libGLEWmx.1.13.0.dylib -current_version 1.13.0 -compatibility_version 1.13 -o lib/libGLEWmx.1.13.0.dylib tmp/darwin/mx/shared/glew.o -framework OpenGL -# ln -sf libGLEWmx.1.13.0.dylib lib/libGLEWmx.1.13.dylib -# ln -sf libGLEWmx.1.13.0.dylib lib/libGLEWmx.dylib -# strip -x lib/libGLEWmx.1.13.0.dylib -# cc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o tmp/darwin/default/shared/glewinfo.o -c src/glewinfo.c -# cc -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o bin/glewinfo tmp/darwin/default/shared/glewinfo.o -Llib -lGLEW -framework OpenGL -# clang: warning: argument unused during compilation: '-ansi' -# strip -x bin/glewinfo -# cc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o tmp/darwin/default/shared/visualinfo.o -c src/visualinfo.c -# cc -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o bin/visualinfo tmp/darwin/default/shared/visualinfo.o -Llib -lGLEW -framework -# OpenGL -# clang: warning: argument unused during compilation: '-ansi' - -if(APPLE) - if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) - endif() - set(CMAKE_MACOSX_RPATH TRUE) - # use, i.e. don't skip the full RPATH for the build tree - set(CMAKE_SKIP_BUILD_RPATH FALSE) - # when building, don't use the install RPATH already - # (but later on when installing) - set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - # add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - # the RPATH to be used when installing, but only if it's not a system directory - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) - if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - endif("${isSystemDir}" STREQUAL "-1") -endif() - - -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() - -set(BUILD_SHARED_LIBS ON) -if(MSVC) - set(BUILD_SHARED_LIBS OFF) #force off -endif() - -if(BUILD_SHARED_LIBS) - add_definitions("-DGLEW_BUILD") -else() - add_definitions("-DGLEW_STATIC") -endif() - -if(UNIX) - if(CMAKE_C_FLAGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pedantic") - else() - set(CMAKE_C_FLAGS "-Wall") - endif() -else() - #TODO: MSVC - -endif() - -#-ansi -if(APPLE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -dynamic -fno-common") -endif() - -option(GLEW_NO_GLU "define GLEW_NO_GLU" TRUE) - -if(NOT GLEW_NO_GLU) - #need for pkgconfig file - set(LIBGLU glu) -else() - add_definitions("-DGLEW_NO_GLU") -endif() - -find_package(OpenGL REQUIRED) - -mark_as_advanced(OPENGL_INCLUDE_DIR) -mark_as_advanced(OPENGL_LIBRARY) - -include_directories(${OPENGL_INCLUDE_DIR}) - -include_directories(include) - -if(NOT OPENGL_FOUND) - message(FATAL_ERROR "Cannot find OpenGL. Set OPENGL_INCLUDE_DIR and OPENGL_LIBRARY") -endif() - -set(VERSION_MAJOR "1") -set(VERSION_MINOR "13") -set(VERSION_PATCH "0") -set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") - -set(GLEW_SRCS - src/glew.c ) - -set(GLEW_HEADERS - include/GL/glew.h - include/GL/wglew.h - include/GL/glxew.h) - -add_library(libGLEW ${GLEW_SRCS}) - -target_link_libraries(libGLEW ${OPENGL_LIBRARY}) - -set_target_properties(libGLEW - PROPERTIES - PREFIX "" - VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" - SOVERSION "${VERSION_MAJOR}") - -install(TARGETS libGLEW - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - - -add_library(libGLEWmx ${GLEW_SRCS}) - -target_link_libraries(libGLEWmx ${OPENGL_LIBRARY}) - -set_target_properties(libGLEWmx - PROPERTIES - PREFIX "" - VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" - SOVERSION "${VERSION_MAJOR}") - -set_target_properties(libGLEWmx - PROPERTIES - COMPILE_DEFINITIONS GLEW_MX - ) - -install(TARGETS libGLEWmx - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -#make executables glewinfo and visualinfo - -foreach(executable glew visual) - add_executable(${executable}info src/${executable}info.c) - add_dependencies(${executable}info libGLEW) - target_link_libraries(${executable}info libGLEW) - #install - install(TARGETS ${executable}info - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -endforeach() - -#install include headers -install(FILES ${GLEW_HEADERS} DESTINATION include/GL/) diff --git a/SuperBuild/patches/ITK/itk-1-fftw-all.diff b/SuperBuild/patches/ITK/itk-1-fftw-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..8b7769bfb6b18cbf27e48130ad452927d394a8f2 --- /dev/null +++ b/SuperBuild/patches/ITK/itk-1-fftw-all.diff @@ -0,0 +1,31 @@ +diff -burN InsightToolkit-4.10.0.orig/CMake/FindFFTW.cmake InsightToolkit-4.10.0/CMake/FindFFTW.cmake +--- InsightToolkit-4.10.0.orig/CMake/FindFFTW.cmake 2016-06-16 14:21:15.226203872 +0200 ++++ InsightToolkit-4.10.0/CMake/FindFFTW.cmake 2016-06-16 14:23:48.966202670 +0200 +@@ -35,14 +35,12 @@ + set(FFTW_LIB_SEARCHPATH + ${FFTW_INSTALL_BASE_PATH}/lib + ${FFTW_INSTALL_BASE_PATH}/lib64 +- /usr/lib/fftw +- /usr/local/lib/fftw + ) + + if(ITK_USE_FFTWD) + mark_as_advanced(FFTWD_LIB) +- find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib +- find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib only if compiled with threads support ++ find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Double Precision Lib ++ find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Double Precision Lib only if compiled with threads support + + if(FFTWD_LIB) + set(FFTWD_FOUND 1) +@@ -55,8 +53,8 @@ + + if(ITK_USE_FFTWF) + mark_as_advanced(FFTWF_LIB) +- find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib +- find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib only if compiled with threads support ++ find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Single Precision Lib ++ find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Single Precision Lib only if compiled with threads support + + if(FFTWF_LIB) + set(FFTWF_FOUND 1) diff --git a/SuperBuild/patches/ITK/itk-2-dlopen_gcc41-linux.diff b/SuperBuild/patches/ITK/itk-2-dlopen_gcc41-linux.diff new file mode 100644 index 0000000000000000000000000000000000000000..ef2f1f0ed27176848187e5a56eecbca98040715c --- /dev/null +++ b/SuperBuild/patches/ITK/itk-2-dlopen_gcc41-linux.diff @@ -0,0 +1,14 @@ +#Purpose: loading application via python fails This was due to exporting symbols from shared library +#GCC FAQ says to add RTLD_GLOBAL flag when using dlopen apart from -Wl,-E linker flags +diff -burN InsightToolkit-4.10.0.orig/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx InsightToolkit-4.10.0/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx +--- InsightToolkit-4.10.0.orig/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx 2016-08-17 11:32:27.000000000 +0200 ++++ InsightToolkit-4.10.0/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx 2016-08-17 11:33:16.000000000 +0200 +@@ -491,7 +491,7 @@ + //---------------------------------------------------------------------------- + DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname ) + { +- return dlopen(libname.c_str(), RTLD_LAZY); ++ return dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL ); + } + + //---------------------------------------------------------------------------- diff --git a/SuperBuild/patches/JPEG/jconfigint.h.in b/SuperBuild/patches/JPEG/jconfigint.h.in old mode 100755 new mode 100644 diff --git a/SuperBuild/patches/LIBKML/CMakeLists.txt b/SuperBuild/patches/LIBKML/CMakeLists.txt index d76e30f4a998f7a4f84d173da8d105d84296ec21..d4e096c80f9dc35cd9581fed9c497a5ead554eeb 100644 --- a/SuperBuild/patches/LIBKML/CMakeLists.txt +++ b/SuperBuild/patches/LIBKML/CMakeLists.txt @@ -6,15 +6,12 @@ set(libkml_VERSION_MAJOR "1") set(libkml_VERSION_MINOR "3") set(libkml_VERSION_PATCH "0") +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) + # Version string should not include patch level. The major.minor is # enough to distinguish available features of the library. set(libkml_VERSION_STRING "${libkml_VERSION_MAJOR}.${libkml_VERSION_MINOR}.${libkml_VERSION_PATCH}") -set(BUILD_SHARED_LIBS ON) -if(MSVC) -set(BUILD_SHARED_LIBS OFF) #force off -endif() - # Allow sources in subdirectories to see the include files. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) #include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party) diff --git a/SuperBuild/patches/LIBSVM/CMakeLists.txt b/SuperBuild/patches/LIBSVM/CMakeLists.txt index aa70d5263d3902171aa0a919eb5c2fbd6b43b06e..5c062347ff4b914c2720960ffb7652234d849e0c 100644 --- a/SuperBuild/patches/LIBSVM/CMakeLists.txt +++ b/SuperBuild/patches/LIBSVM/CMakeLists.txt @@ -2,17 +2,10 @@ cmake_minimum_required(VERSION 2.8.3) project(libsvm) -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) -set(BUILD_SHARED_LIBS ON) -if(MSVC) -set(BUILD_SHARED_LIBS OFF) #force off +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() set(LIBSVM_SRCS "svm.cpp" ) diff --git a/SuperBuild/patches/MUPARSER/CMakeLists.txt b/SuperBuild/patches/MUPARSER/CMakeLists.txt index 77d6e1dfaaafe008c21827c8bbb4e42f2b1b0708..5cfc94c65e999d34d5a71d42fc471ddc1f7d7e36 100644 --- a/SuperBuild/patches/MUPARSER/CMakeLists.txt +++ b/SuperBuild/patches/MUPARSER/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 2.8.3) project(muparser) -set(BUILD_SHARED_LIBS ON) -if(MSVC) -set(BUILD_SHARED_LIBS OFF) #force off +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() file(GLOB MUPARSER_SRCS "src/*.cpp" ) diff --git a/SuperBuild/patches/MUPARSERX/CMakeLists.txt b/SuperBuild/patches/MUPARSERX/CMakeLists.txt index 06556dd8050b25eb69f4b28910e2f7eb7f21752e..70ee71d29c7fddf6c64c1ba1c906fe8a39c98b75 100644 --- a/SuperBuild/patches/MUPARSERX/CMakeLists.txt +++ b/SuperBuild/patches/MUPARSERX/CMakeLists.txt @@ -10,9 +10,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() -set(BUILD_SHARED_LIBS ON) -if(MSVC) -set(BUILD_SHARED_LIBS OFF) #force off +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) + +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() file(GLOB MUPARSERX_SRCS "parser/*.cpp" ) diff --git a/SuperBuild/patches/OPENCV/opencv-fix-rpath-for-macx.diff b/SuperBuild/patches/OPENCV/opencv-fix-rpath-for-macx.diff old mode 100755 new mode 100644 diff --git a/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff b/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..960f888dbbfa43227fd29c499d868934d9c4b431 --- /dev/null +++ b/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff @@ -0,0 +1,4448 @@ +diff --git a/.travis.yml b/.travis.yml +index 0618f26..3d73f75 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -10,6 +10,9 @@ matrix: + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 + - os: linux + compiler: gcc ++ env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2 ++ - os: linux ++ compiler: gcc + env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + addons: + apt: +diff --git a/src/bin/jp2/CMakeLists.txt b/src/bin/jp2/CMakeLists.txt +index dc013c2..ad7bce7 100644 +--- a/src/bin/jp2/CMakeLists.txt ++++ b/src/bin/jp2/CMakeLists.txt +@@ -57,6 +57,9 @@ foreach(exe opj_decompress opj_compress opj_dump) + # On unix you need to link to the math library: + if(UNIX) + target_link_libraries(${exe} m) ++ IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") ++ target_link_libraries(${exe} rt) ++ endif() + endif() + # Install exe + install(TARGETS ${exe} +diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c +index ab7ff04..57fe554 100644 +--- a/src/bin/jp2/opj_decompress.c ++++ b/src/bin/jp2/opj_decompress.c +@@ -43,6 +43,7 @@ + #include <string.h> + #include <stdlib.h> + #include <math.h> ++#include <time.h> + + #ifdef _WIN32 + #include "windirent.h" +@@ -150,6 +151,8 @@ typedef struct opj_decompress_params + int upsample; + /* split output components to different files */ + int split_pnm; ++ /** number of threads */ ++ int num_threads; + }opj_decompress_parameters; + + /* -------------------------------------------------------------------------- */ +@@ -224,8 +227,11 @@ static void decode_help_display(void) { + " -upsample\n" + " Downsampled components will be upsampled to image size\n" + " -split-pnm\n" +- " Split output components to different files when writing to PNM\n" +- "\n"); ++ " Split output components to different files when writing to PNM\n"); ++ if( opj_has_thread_support() ) { ++ fprintf(stdout," -threads <num_threads>\n" ++ " Number of threads to use for decoding.\n"); ++ } + /* UniPG>> */ + #ifdef USE_JPWL + fprintf(stdout," -W <options>\n" +@@ -520,7 +526,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_decompress_parameters *para + {"OutFor", REQ_ARG, NULL,'O'}, + {"force-rgb", NO_ARG, NULL, 1}, + {"upsample", NO_ARG, NULL, 1}, +- {"split-pnm", NO_ARG, NULL, 1} ++ {"split-pnm", NO_ARG, NULL, 1}, ++ {"threads", REQ_ARG, NULL, 'T'} + }; + + const char optlist[] = "i:o:r:l:x:d:t:p:" +@@ -808,6 +815,22 @@ int parse_cmdline_decoder(int argc, char **argv, opj_decompress_parameters *para + break; + #endif /* USE_JPWL */ + /* <<UniPG */ ++ ++ /* ----------------------------------------------------- */ ++ case 'T': /* Number of threads */ ++ { ++ if( strcmp(opj_optarg, "ALL_CPUS") == 0 ) ++ { ++ parameters->num_threads = opj_get_num_cpus(); ++ if( parameters->num_threads == 1 ) ++ parameters->num_threads = 0; ++ } ++ else ++ { ++ sscanf(opj_optarg, "%d", ¶meters->num_threads); ++ } ++ } ++ break; + + /* ----------------------------------------------------- */ + +@@ -885,17 +908,22 @@ OPJ_FLOAT64 opj_clock(void) { + /* t is the high resolution performance counter (see MSDN) */ + QueryPerformanceCounter ( & t ) ; + return freq.QuadPart ? (t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) : 0; ++#elif defined(__linux) ++ struct timespec ts; ++ clock_gettime(CLOCK_REALTIME, &ts); ++ return( ts.tv_sec + ts.tv_nsec * 1e-9 ); + #else +- /* Unix or Linux: use resource usage */ +- struct rusage t; +- OPJ_FLOAT64 procTime; +- /* (1) Get the rusage data structure at this moment (man getrusage) */ +- getrusage(0,&t); +- /* (2) What is the elapsed time ? - CPU time = User time + System time */ ++ /* Unix : use resource usage */ ++ /* FIXME: this counts the total CPU time, instead of the user perceived time */ ++ struct rusage t; ++ OPJ_FLOAT64 procTime; ++ /* (1) Get the rusage data structure at this moment (man getrusage) */ ++ getrusage(0,&t); ++ /* (2) What is the elapsed time ? - CPU time = User time + System time */ + /* (2a) Get the seconds */ +- procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); +- /* (2b) More precisely! Get the microseconds part ! */ +- return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; ++ procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); ++ /* (2b) More precisely! Get the microseconds part ! */ ++ return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; + #endif + } + +@@ -1306,7 +1334,13 @@ int main(int argc, char **argv) + opj_destroy_codec(l_codec); + failed = 1; goto fin; + } +- ++ ++ if( parameters.num_threads >= 1 && !opj_codec_set_threads(l_codec, parameters.num_threads) ) { ++ fprintf(stderr, "ERROR -> opj_decompress: failed to set number of threads\n"); ++ opj_stream_destroy(l_stream); ++ opj_destroy_codec(l_codec); ++ failed = 1; goto fin; ++ } + + /* Read the main header of the codestream and if necessary the JP2 boxes*/ + if(! opj_read_header(l_stream, l_codec, &image)){ +diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt +index 367a7a8..f45ceb3 100644 +--- a/src/lib/openjp2/CMakeLists.txt ++++ b/src/lib/openjp2/CMakeLists.txt +@@ -9,6 +9,8 @@ include_directories( + ) + # Defines the source code for the library + set(OPENJPEG_SRCS ++ ${CMAKE_CURRENT_SOURCE_DIR}/thread.c ++ ${CMAKE_CURRENT_SOURCE_DIR}/thread.h + ${CMAKE_CURRENT_SOURCE_DIR}/bio.c + ${CMAKE_CURRENT_SOURCE_DIR}/bio.h + ${CMAKE_CURRENT_SOURCE_DIR}/cio.c +@@ -29,6 +31,7 @@ set(OPENJPEG_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/mct.h + ${CMAKE_CURRENT_SOURCE_DIR}/mqc.c + ${CMAKE_CURRENT_SOURCE_DIR}/mqc.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/mqc_inl.h + ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c + ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.h + ${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c +@@ -73,6 +76,11 @@ if(OPJ_DISABLE_TPSOT_FIX) + add_definitions(-DOPJ_DISABLE_TPSOT_FIX) + endif() + ++# Special case for old i586-mingw32msvc-gcc cross compiler ++if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER MATCHES ".*mingw32msvc.*" ) ++ set(WIN32 YES) ++endif() ++ + # Build the library + if(WIN32) + if(BUILD_SHARED_LIBS) +@@ -142,3 +150,36 @@ if(OPJ_USE_DSYMUTIL) + DEPENDS ${OPENJPEG_LIBRARY_NAME}) + endif() + endif() ++ ++################################################################################# ++# threading configuration ++################################################################################# ++set(CMAKE_THREAD_PREFER_PTHREAD TRUE) ++ ++option(USE_THREAD "Build with thread/mutex support " ON) ++if(NOT USE_THREAD) ++ add_definitions( -DMUTEX_stub) ++endif(NOT USE_THREAD) ++ ++find_package(Threads QUIET) ++ ++if(USE_THREAD AND WIN32 AND NOT Threads_FOUND ) ++ add_definitions( -DMUTEX_win32) ++ set(Threads_FOUND YES) ++endif() ++ ++if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT ) ++ add_definitions( -DMUTEX_win32) ++endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT ) ++ ++if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT ) ++ add_definitions( -DMUTEX_pthread) ++endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT ) ++ ++if(USE_THREAD AND NOT Threads_FOUND) ++ message(FATAL_ERROR "No thread library found and thread/mutex support is required by USE_THREAD option") ++endif(USE_THREAD AND NOT Threads_FOUND) ++ ++if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) ++ TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} ${CMAKE_THREAD_LIBS_INIT}) ++endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) +diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c +index a4ff01b..18f8d9c 100644 +--- a/src/lib/openjp2/dwt.c ++++ b/src/lib/openjp2/dwt.c +@@ -124,7 +124,7 @@ static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_st + /** + Inverse wavelet transform in 2-D. + */ +-static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); ++static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); + + static OPJ_BOOL opj_dwt_encode_procedure( opj_tcd_tilecomp_t * tilec, + void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) ); +@@ -473,8 +473,8 @@ OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec) + /* <summary> */ + /* Inverse 5-3 wavelet transform in 2-D. */ + /* </summary> */ +-OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) { +- return opj_dwt_decode_tile(tilec, numres, &opj_dwt_decode_1); ++OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) { ++ return opj_dwt_decode_tile(tp, tilec, numres, &opj_dwt_decode_1); + } + + +@@ -556,10 +556,72 @@ static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_U + return mr ; + } + ++typedef struct ++{ ++ opj_dwt_t h; ++ DWT1DFN dwt_1D; ++ OPJ_UINT32 rw; ++ OPJ_UINT32 w; ++ OPJ_INT32 * restrict tiledp; ++ int min_j; ++ int max_j; ++} opj_dwd_decode_h_job_t; ++ ++static void opj_dwt_decode_h_func(void* user_data, opj_tls_t* tls) ++{ ++ int j; ++ opj_dwd_decode_h_job_t* job; ++ (void)tls; ++ ++ job = (opj_dwd_decode_h_job_t*)user_data; ++ for( j = job->min_j; j < job->max_j; j++ ) ++ { ++ opj_dwt_interleave_h(&job->h, &job->tiledp[j*job->w]); ++ (job->dwt_1D)(&job->h); ++ memcpy(&job->tiledp[j*job->w], job->h.mem, job->rw * sizeof(OPJ_INT32)); ++ } ++ ++ opj_aligned_free(job->h.mem); ++ opj_free(job); ++} ++ ++typedef struct ++{ ++ opj_dwt_t v; ++ DWT1DFN dwt_1D; ++ OPJ_UINT32 rh; ++ OPJ_UINT32 w; ++ OPJ_INT32 * restrict tiledp; ++ int min_j; ++ int max_j; ++} opj_dwd_decode_v_job_t; ++ ++static void opj_dwt_decode_v_func(void* user_data, opj_tls_t* tls) ++{ ++ int j; ++ opj_dwd_decode_v_job_t* job; ++ (void)tls; ++ ++ job = (opj_dwd_decode_v_job_t*)user_data; ++ for( j = job->min_j; j < job->max_j; j++ ) ++ { ++ OPJ_UINT32 k; ++ opj_dwt_interleave_v(&job->v, &job->tiledp[j], (OPJ_INT32)job->w); ++ (job->dwt_1D)(&job->v); ++ for(k = 0; k < job->rh; ++k) { ++ job->tiledp[k * job->w + j] = job->v.mem[k]; ++ } ++ } ++ ++ opj_aligned_free(job->v.mem); ++ opj_free(job); ++} ++ ++ + /* <summary> */ + /* Inverse wavelet transform in 2-D. */ + /* </summary> */ +-static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { ++static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { + opj_dwt_t h; + opj_dwt_t v; + +@@ -569,11 +631,15 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres + OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0); /* height of the resolution level computed */ + + OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0); ++ size_t h_mem_size; ++ int num_threads; + + if (numres == 1U) { + return OPJ_TRUE; + } +- h.mem = (OPJ_INT32*)opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32)); ++ num_threads = opj_thread_pool_get_thread_count(tp); ++ h_mem_size = opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32); ++ h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); + if (! h.mem){ + /* FIXME event manager error callback */ + return OPJ_FALSE; +@@ -595,23 +661,113 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres + h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn); + h.cas = tr->x0 % 2; + +- for(j = 0; j < rh; ++j) { +- opj_dwt_interleave_h(&h, &tiledp[j*w]); +- (dwt_1D)(&h); +- memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32)); +- } ++ if( num_threads <= 1 || rh == 1 ) ++ { ++ for(j = 0; j < rh; ++j) { ++ opj_dwt_interleave_h(&h, &tiledp[j*w]); ++ (dwt_1D)(&h); ++ memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32)); ++ } ++ } ++ else ++ { ++ int num_jobs = num_threads; ++ if( rh < num_jobs ) ++ num_jobs = rh; ++ for( j = 0; j < num_jobs; j++ ) ++ { ++ opj_dwd_decode_h_job_t* job; ++ ++ job = (opj_dwd_decode_h_job_t*) opj_malloc(sizeof(opj_dwd_decode_h_job_t)); ++ if( !job ) ++ { ++ /* It would be nice to fallback to single thread case, but */ ++ /* unfortunately some jobs may be launched and have modified */ ++ /* tiledp, so it is not practical to recover from that error */ ++ /* FIXME event manager error callback */ ++ opj_thread_pool_wait_completion(tp, 0); ++ opj_aligned_free(h.mem); ++ return OPJ_FALSE; ++ } ++ job->h = h; ++ job->dwt_1D = dwt_1D; ++ job->rw = rw; ++ job->w = w; ++ job->tiledp = tiledp; ++ job->min_j = j * (rh / num_jobs); ++ job->max_j = (j+1) * (rh / num_jobs); ++ if( job->max_j > rh || j == num_jobs - 1 ) ++ job->max_j = rh; ++ job->h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); ++ if (!job->h.mem) ++ { ++ /* FIXME event manager error callback */ ++ opj_thread_pool_wait_completion(tp, 0); ++ opj_free(job); ++ opj_aligned_free(h.mem); ++ return OPJ_FALSE; ++ } ++ opj_thread_pool_submit_job( tp, opj_dwt_decode_h_func, job ); ++ } ++ opj_thread_pool_wait_completion(tp, 0); ++ } + + v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn); + v.cas = tr->y0 % 2; + +- for(j = 0; j < rw; ++j){ +- OPJ_UINT32 k; +- opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w); +- (dwt_1D)(&v); +- for(k = 0; k < rh; ++k) { +- tiledp[k * w + j] = v.mem[k]; +- } +- } ++ if( num_threads <= 1 || rw == 1 ) ++ { ++ for(j = 0; j < rw; ++j){ ++ OPJ_UINT32 k; ++ opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w); ++ (dwt_1D)(&v); ++ for(k = 0; k < rh; ++k) { ++ tiledp[k * w + j] = v.mem[k]; ++ } ++ } ++ } ++ else ++ { ++ int num_jobs = num_threads; ++ if( rw < num_jobs ) ++ num_jobs = rw; ++ for( j = 0; j < num_jobs; j++ ) ++ { ++ opj_dwd_decode_v_job_t* job; ++ ++ job = (opj_dwd_decode_v_job_t*) opj_malloc(sizeof(opj_dwd_decode_v_job_t)); ++ if( !job ) ++ { ++ /* It would be nice to fallback to single thread case, but */ ++ /* unfortunately some jobs may be launched and have modified */ ++ /* tiledp, so it is not practical to recover from that error */ ++ /* FIXME event manager error callback */ ++ opj_thread_pool_wait_completion(tp, 0); ++ opj_aligned_free(v.mem); ++ return OPJ_FALSE; ++ } ++ job->v = v; ++ job->dwt_1D = dwt_1D; ++ job->rh = rh; ++ job->w = w; ++ job->tiledp = tiledp; ++ job->min_j = j * (rw / num_jobs); ++ job->max_j = (j+1) * (rw / num_jobs); ++ if( job->max_j > rw || j == num_jobs - 1 ) ++ job->max_j = rw; ++ job->v.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); ++ if (!job->v.mem) ++ { ++ /* FIXME event manager error callback */ ++ opj_thread_pool_wait_completion(tp, 0); ++ opj_free(job); ++ opj_aligned_free(v.mem); ++ return OPJ_FALSE; ++ } ++ opj_thread_pool_submit_job( tp, opj_dwt_decode_v_func, job ); ++ } ++ opj_thread_pool_wait_completion(tp, 0); ++ } + } + opj_aligned_free(h.mem); + return OPJ_TRUE; +diff --git a/src/lib/openjp2/dwt.h b/src/lib/openjp2/dwt.h +index 21fe942..9385002 100644 +--- a/src/lib/openjp2/dwt.h ++++ b/src/lib/openjp2/dwt.h +@@ -63,10 +63,11 @@ OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec); + /** + Inverse 5-3 wavelet transform in 2-D. + Apply a reversible inverse DWT transform to a component of an image. ++@param tp Thread pool + @param tilec Tile component information (current tile) + @param numres Number of resolution levels to decode + */ +-OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres); ++OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres); + + /** + Get the gain of a subband for the reversible 5-3 DWT. +diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c +index 9eaa155..68b2f82 100644 +--- a/src/lib/openjp2/j2k.c ++++ b/src/lib/openjp2/j2k.c +@@ -5944,6 +5944,32 @@ void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters) + } + } + ++OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads) ++{ ++ if( opj_has_thread_support() ) ++ { ++ opj_thread_pool_destroy(j2k->m_tp); ++ j2k->m_tp = opj_thread_pool_create((int)num_threads); ++ if( j2k->m_tp == 0 ) ++ { ++ j2k->m_tp = opj_thread_pool_create(0); ++ return OPJ_FALSE; ++ } ++ return OPJ_TRUE; ++ } ++ return OPJ_FALSE; ++} ++ ++static int opj_j2k_get_default_thread_count() ++{ ++ const char* num_threads = getenv("OPJ_NUM_THREADS"); ++ if( num_threads == NULL || !opj_has_thread_support() ) ++ return 0; ++ if( strcmp(num_threads, "ALL_CPUS") == 0 ) ++ return opj_get_num_cpus(); ++ return atoi(num_threads); ++} ++ + /* ----------------------------------------------------------------------- */ + /* J2K encoder interface */ + /* ----------------------------------------------------------------------- */ +@@ -5981,6 +6007,17 @@ opj_j2k_t* opj_j2k_create_compress(void) + return NULL; + } + ++ l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count()); ++ if( !l_j2k->m_tp ) ++ { ++ l_j2k->m_tp = opj_thread_pool_create(0); ++ } ++ if( !l_j2k->m_tp ) ++ { ++ opj_j2k_destroy(l_j2k); ++ return NULL; ++ } ++ + return l_j2k; + } + +@@ -7486,7 +7523,7 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2 + return OPJ_FALSE; + } + +- if ( !opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp)) ) { ++ if ( !opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp), p_j2k->m_tp) ) { + opj_tcd_destroy(p_j2k->m_tcd); + p_j2k->m_tcd = 00; + opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n"); +@@ -7567,6 +7604,9 @@ void opj_j2k_destroy (opj_j2k_t *p_j2k) + opj_image_destroy(p_j2k->m_output_image); + p_j2k->m_output_image = NULL; + ++ opj_thread_pool_destroy(p_j2k->m_tp); ++ p_j2k->m_tp = NULL; ++ + opj_free(p_j2k); + } + +@@ -8658,6 +8698,17 @@ opj_j2k_t* opj_j2k_create_decompress(void) + return 00; + } + ++ l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count()); ++ if( !l_j2k->m_tp ) ++ { ++ l_j2k->m_tp = opj_thread_pool_create(0); ++ } ++ if( !l_j2k->m_tp ) ++ { ++ opj_j2k_destroy(l_j2k); ++ return NULL; ++ } ++ + return l_j2k; + } + +@@ -10934,7 +10985,7 @@ static OPJ_BOOL opj_j2k_create_tcd( opj_j2k_t *p_j2k, + return OPJ_FALSE; + } + +- if (!opj_tcd_init(p_j2k->m_tcd,p_j2k->m_private_image,&p_j2k->m_cp)) { ++ if (!opj_tcd_init(p_j2k->m_tcd,p_j2k->m_private_image,&p_j2k->m_cp, p_j2k->m_tp)) { + opj_tcd_destroy(p_j2k->m_tcd); + p_j2k->m_tcd = 00; + return OPJ_FALSE; +diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h +index 358e073..be85d5d 100644 +--- a/src/lib/openjp2/j2k.h ++++ b/src/lib/openjp2/j2k.h +@@ -589,6 +589,12 @@ typedef struct opj_j2k + + /** the current tile coder/decoder **/ + struct opj_tcd * m_tcd; ++ ++ /** Number of threads to use */ ++ int m_num_threads; ++ ++ /** Thread pool */ ++ opj_thread_pool_t* m_tp; + } + opj_j2k_t; + +@@ -607,6 +613,8 @@ Decoding parameters are returned in j2k->cp. + */ + void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters); + ++OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads); ++ + /** + * Creates a J2K compression structure + * +diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c +index a607c8a..e156ebf 100644 +--- a/src/lib/openjp2/jp2.c ++++ b/src/lib/openjp2/jp2.c +@@ -1767,6 +1767,11 @@ void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters) + jp2->ignore_pclr_cmap_cdef = parameters->flags & OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG; + } + ++OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads) ++{ ++ return opj_j2k_set_threads(jp2->j2k, num_threads); ++} ++ + /* ----------------------------------------------------------------------- */ + /* JP2 encoder interface */ + /* ----------------------------------------------------------------------- */ +diff --git a/src/lib/openjp2/jp2.h b/src/lib/openjp2/jp2.h +index 9413883..b54d0bf 100644 +--- a/src/lib/openjp2/jp2.h ++++ b/src/lib/openjp2/jp2.h +@@ -243,6 +243,8 @@ Decoding parameters are returned in jp2->j2k->cp. + */ + void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters); + ++OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads); ++ + /** + * Decode an image from a JPEG-2000 file stream + * @param jp2 JP2 decompressor handle +diff --git a/src/lib/openjp2/mqc.c b/src/lib/openjp2/mqc.c +index 4e409a7..7119c3a 100644 +--- a/src/lib/openjp2/mqc.c ++++ b/src/lib/openjp2/mqc.c +@@ -70,28 +70,6 @@ Fill mqc->c with 1's for flushing + @param mqc MQC handle + */ + static void opj_mqc_setbits(opj_mqc_t *mqc); +-/** +-FIXME DOC +-@param mqc MQC handle +-@return +-*/ +-static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc); +-/** +-FIXME DOC +-@param mqc MQC handle +-@return +-*/ +-static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc); +-/** +-Input a byte +-@param mqc MQC handle +-*/ +-static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc); +-/** +-Renormalize mqc->a and mqc->c while decoding +-@param mqc MQC handle +-*/ +-static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc); + /*@}*/ + + /*@}*/ +@@ -284,82 +262,6 @@ static void opj_mqc_setbits(opj_mqc_t *mqc) { + } + } + +-static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) { +- OPJ_INT32 d; +- if (mqc->a < (*mqc->curctx)->qeval) { +- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); +- *mqc->curctx = (*mqc->curctx)->nlps; +- } else { +- d = (OPJ_INT32)(*mqc->curctx)->mps; +- *mqc->curctx = (*mqc->curctx)->nmps; +- } +- +- return d; +-} +- +-static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) { +- OPJ_INT32 d; +- if (mqc->a < (*mqc->curctx)->qeval) { +- mqc->a = (*mqc->curctx)->qeval; +- d = (OPJ_INT32)(*mqc->curctx)->mps; +- *mqc->curctx = (*mqc->curctx)->nmps; +- } else { +- mqc->a = (*mqc->curctx)->qeval; +- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); +- *mqc->curctx = (*mqc->curctx)->nlps; +- } +- +- return d; +-} +- +-#ifdef MQC_PERF_OPT +-static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { +- unsigned int i = *((unsigned int *) mqc->bp); +- mqc->c += i & 0xffff00; +- mqc->ct = i & 0x0f; +- mqc->bp += (i >> 2) & 0x04; +-} +-#else +-static void opj_mqc_bytein(opj_mqc_t *const mqc) { +- if (mqc->bp != mqc->end) { +- OPJ_UINT32 c; +- if (mqc->bp + 1 != mqc->end) { +- c = *(mqc->bp + 1); +- } else { +- c = 0xff; +- } +- if (*mqc->bp == 0xff) { +- if (c > 0x8f) { +- mqc->c += 0xff00; +- mqc->ct = 8; +- } else { +- mqc->bp++; +- mqc->c += c << 9; +- mqc->ct = 7; +- } +- } else { +- mqc->bp++; +- mqc->c += c << 8; +- mqc->ct = 8; +- } +- } else { +- mqc->c += 0xff00; +- mqc->ct = 8; +- } +-} +-#endif +- +-static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) { +- do { +- if (mqc->ct == 0) { +- opj_mqc_bytein(mqc); +- } +- mqc->a <<= 1; +- mqc->c <<= 1; +- mqc->ct--; +- } while (mqc->a < 0x8000); +-} +- + /* + ========================================================== + MQ-Coder interface +@@ -585,25 +487,6 @@ OPJ_BOOL opj_mqc_init_dec(opj_mqc_t *mqc, OPJ_BYTE *bp, OPJ_UINT32 len) { + return OPJ_TRUE; + } + +-OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) { +- OPJ_INT32 d; +- mqc->a -= (*mqc->curctx)->qeval; +- if ((mqc->c >> 16) < (*mqc->curctx)->qeval) { +- d = opj_mqc_lpsexchange(mqc); +- opj_mqc_renormd(mqc); +- } else { +- mqc->c -= (*mqc->curctx)->qeval << 16; +- if ((mqc->a & 0x8000) == 0) { +- d = opj_mqc_mpsexchange(mqc); +- opj_mqc_renormd(mqc); +- } else { +- d = (OPJ_INT32)(*mqc->curctx)->mps; +- } +- } +- +- return d; +-} +- + void opj_mqc_resetstates(opj_mqc_t *mqc) { + OPJ_UINT32 i; + for (i = 0; i < MQC_NUMCTXS; i++) { +diff --git a/src/lib/openjp2/mqc.h b/src/lib/openjp2/mqc.h +index 69a2d46..491ee50 100644 +--- a/src/lib/openjp2/mqc.h ++++ b/src/lib/openjp2/mqc.h +@@ -77,11 +77,14 @@ typedef struct opj_mqc { + OPJ_BYTE *end; + opj_mqc_state_t *ctxs[MQC_NUMCTXS]; + opj_mqc_state_t **curctx; ++ const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */ + #ifdef MQC_PERF_OPT + unsigned char *buffer; + #endif + } opj_mqc_t; + ++#include "mqc_inl.h" ++ + /** @name Exported functions */ + /*@{*/ + /* ----------------------------------------------------------------------- */ +@@ -198,7 +201,7 @@ Decode a symbol + @param mqc MQC handle + @return Returns the decoded symbol (0 or 1) + */ +-OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc); ++static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc); + /* ----------------------------------------------------------------------- */ + /*@}*/ + +diff --git a/src/lib/openjp2/mqc_inl.h b/src/lib/openjp2/mqc_inl.h +new file mode 100644 +index 0000000..882b59f +--- /dev/null ++++ b/src/lib/openjp2/mqc_inl.h +@@ -0,0 +1,159 @@ ++/* ++ * The copyright in this software is being made available under the 2-clauses ++ * BSD License, included below. This software may be subject to other third ++ * party and contributor rights, including patent rights, and no such rights ++ * are granted under this license. ++ * ++ * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium ++ * Copyright (c) 2002-2014, Professor Benoit Macq ++ * Copyright (c) 2001-2003, David Janssens ++ * Copyright (c) 2002-2003, Yannick Verschueren ++ * Copyright (c) 2003-2007, Francois-Olivier Devaux ++ * Copyright (c) 2003-2014, Antonin Descampe ++ * Copyright (c) 2005, Herve Drolon, FreeImage Team ++ * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef __MQC_INL_H ++#define __MQC_INL_H ++/** ++FIXME DOC ++@param mqc MQC handle ++@return ++*/ ++static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) { ++ OPJ_INT32 d; ++ if (mqc->a < (*mqc->curctx)->qeval) { ++ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); ++ *mqc->curctx = (*mqc->curctx)->nlps; ++ } else { ++ d = (OPJ_INT32)(*mqc->curctx)->mps; ++ *mqc->curctx = (*mqc->curctx)->nmps; ++ } ++ ++ return d; ++} ++ ++/** ++FIXME DOC ++@param mqc MQC handle ++@return ++*/ ++static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) { ++ OPJ_INT32 d; ++ if (mqc->a < (*mqc->curctx)->qeval) { ++ mqc->a = (*mqc->curctx)->qeval; ++ d = (OPJ_INT32)(*mqc->curctx)->mps; ++ *mqc->curctx = (*mqc->curctx)->nmps; ++ } else { ++ mqc->a = (*mqc->curctx)->qeval; ++ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); ++ *mqc->curctx = (*mqc->curctx)->nlps; ++ } ++ ++ return d; ++} ++ ++/** ++Input a byte ++@param mqc MQC handle ++*/ ++#ifdef MQC_PERF_OPT ++static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { ++ unsigned int i = *((unsigned int *) mqc->bp); ++ mqc->c += i & 0xffff00; ++ mqc->ct = i & 0x0f; ++ mqc->bp += (i >> 2) & 0x04; ++} ++#else ++static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { ++ if (mqc->bp != mqc->end) { ++ OPJ_UINT32 c; ++ if (mqc->bp + 1 != mqc->end) { ++ c = *(mqc->bp + 1); ++ } else { ++ c = 0xff; ++ } ++ if (*mqc->bp == 0xff) { ++ if (c > 0x8f) { ++ mqc->c += 0xff00; ++ mqc->ct = 8; ++ } else { ++ mqc->bp++; ++ mqc->c += c << 9; ++ mqc->ct = 7; ++ } ++ } else { ++ mqc->bp++; ++ mqc->c += c << 8; ++ mqc->ct = 8; ++ } ++ } else { ++ mqc->c += 0xff00; ++ mqc->ct = 8; ++ } ++} ++#endif ++ ++/** ++Renormalize mqc->a and mqc->c while decoding ++@param mqc MQC handle ++*/ ++static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) { ++ do { ++ if (mqc->ct == 0) { ++ opj_mqc_bytein(mqc); ++ } ++ mqc->a <<= 1; ++ mqc->c <<= 1; ++ mqc->ct--; ++ } while (mqc->a < 0x8000); ++} ++ ++/** ++Decode a symbol ++@param mqc MQC handle ++@return Returns the decoded symbol (0 or 1) ++*/ ++static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) { ++ OPJ_INT32 d; ++ mqc->a -= (*mqc->curctx)->qeval; ++ if ((mqc->c >> 16) < (*mqc->curctx)->qeval) { ++ d = opj_mqc_lpsexchange(mqc); ++ opj_mqc_renormd(mqc); ++ } else { ++ mqc->c -= (*mqc->curctx)->qeval << 16; ++ if ((mqc->a & 0x8000) == 0) { ++ d = opj_mqc_mpsexchange(mqc); ++ opj_mqc_renormd(mqc); ++ } else { ++ d = (OPJ_INT32)(*mqc->curctx)->mps; ++ } ++ } ++ ++ return d; ++} ++ ++#endif /* __MQC_INL_H */ +diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c +index 5114cc1..ee3e14b 100644 +--- a/src/lib/openjp2/openjpeg.c ++++ b/src/lib/openjp2/openjpeg.c +@@ -239,6 +239,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) + OPJ_UINT32 res_factor, + struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor; + ++ l_codec->opj_set_threads = ++ (OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_j2k_set_threads; ++ + l_codec->m_codec = opj_j2k_create_decompress(); + + if (! l_codec->m_codec) { +@@ -315,6 +318,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor; + ++ l_codec->opj_set_threads = ++ (OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_jp2_set_threads; ++ + l_codec->m_codec = opj_jp2_create(OPJ_TRUE); + + if (! l_codec->m_codec) { +@@ -354,6 +360,18 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete + } + } + ++ ++OPJ_API OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, ++ int num_threads) ++{ ++ if (p_codec ) { ++ opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec; ++ ++ return l_codec->opj_set_threads(l_codec->m_codec, num_threads); ++ } ++ return OPJ_FALSE; ++} ++ + OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, + opj_dparameters_t *parameters + ) +diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h +index c07e9c8..7912c23 100644 +--- a/src/lib/openjp2/openjpeg.h ++++ b/src/lib/openjp2/openjpeg.h +@@ -1263,6 +1263,25 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, + opj_dparameters_t *parameters ); + + /** ++ * Allocates worker threads for the compressor/decompressor. ++ * ++ * By default, only the main thread is used. If this function is not used, ++ * but the OPJ_NUM_THREADS environment variable is set, its value will be ++ * used to initialize the number of threads. The value can be either an integer ++ * number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called, ++ * this function will override the behaviour of the environment variable. ++ * ++ * Note: currently only has effect on the decompressor. ++ * ++ * @param p_codec decompressor handler ++ * @param num_threads number of threads. ++ * ++ * @return OPJ_TRUE if the decoder is correctly set ++ */ ++OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, ++ int num_threads); ++ ++/** + * Decodes an image header. + * + * @param p_stream the jpeg2000 stream. +@@ -1554,6 +1573,19 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT( opj_cparameters_t *parameters, + OPJ_INT32 * p_dc_shift, + OPJ_UINT32 pNbComp); + ++/* ++========================================================== ++ Thread functions ++========================================================== ++*/ ++ ++/** Returns if the library is built with thread support. ++ * OPJ_TRUE if mutex, condition, thread, thread pool are available. ++ */ ++OPJ_API OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void); ++ ++/** Return the number of virtual CPUs */ ++OPJ_API int OPJ_CALLCONV opj_get_num_cpus(void); + + + #ifdef __cplusplus +diff --git a/src/lib/openjp2/opj_codec.h b/src/lib/openjp2/opj_codec.h +index 6bd791f..c88005d 100644 +--- a/src/lib/openjp2/opj_codec.h ++++ b/src/lib/openjp2/opj_codec.h +@@ -113,6 +113,7 @@ typedef struct opj_codec_private + OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager); ++ + } m_decompression; + + /** +@@ -157,6 +158,9 @@ typedef struct opj_codec_private + void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream); + opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec); + opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec); ++ ++ /** Set number of threads */ ++ OPJ_BOOL (*opj_set_threads) ( void * p_codec, OPJ_UINT32 num_threads ); + } + opj_codec_private_t; + +diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h +index 58a5a9a..e835fae 100644 +--- a/src/lib/openjp2/opj_includes.h ++++ b/src/lib/openjp2/opj_includes.h +@@ -182,6 +182,9 @@ static INLINE long opj_lrintf(float f) { + #include "bio.h" + #include "cio.h" + ++#include "thread.h" ++#include "tls_keys.h" ++ + #include "image.h" + #include "invert.h" + #include "j2k.h" +diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c +index 1bf7205..b1c6128 100644 +--- a/src/lib/openjp2/t1.c ++++ b/src/lib/openjp2/t1.c +@@ -39,26 +39,27 @@ + #include "opj_includes.h" + #include "t1_luts.h" + ++/* #define CONSISTENCY_CHECK */ ++ + /** @defgroup T1 T1 - Implementation of the tier-1 coding */ + /*@{*/ + + /** @name Local static functions */ + /*@{*/ + +-static INLINE OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient); ++static INLINE OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f); + static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f); + static INLINE OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f); + static OPJ_BYTE opj_t1_getspb(OPJ_UINT32 f); + static OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos); + static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos); +-static void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride); ++static INLINE void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride); + /** + Encode significant pass + */ + static void opj_t1_enc_sigpass_step(opj_t1_t *t1, + opj_flag_t *flagsp, + OPJ_INT32 *datap, +- OPJ_UINT32 orient, + OPJ_INT32 bpno, + OPJ_INT32 one, + OPJ_INT32 *nmsedec, +@@ -81,23 +82,27 @@ static void opj_t1_dec_sigpass_step(opj_t1_t *t1, + static INLINE void opj_t1_dec_sigpass_step_raw( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, +- OPJ_INT32 vsc); ++ OPJ_INT32 vsc, ++ OPJ_INT32 row); + static INLINE void opj_t1_dec_sigpass_step_mqc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf); ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row, ++ OPJ_INT32 flags_stride); + static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, +- OPJ_INT32 vsc); ++ OPJ_INT32 vsc, ++ OPJ_INT32 row); + + + /** +@@ -105,7 +110,6 @@ Encode significant pass + */ + static void opj_t1_enc_sigpass( opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_UINT32 orient, + OPJ_INT32 *nmsedec, + OPJ_BYTE type, + OPJ_UINT32 cblksty); +@@ -116,16 +120,10 @@ Decode significant pass + static void opj_t1_dec_sigpass_raw( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_INT32 orient, + OPJ_INT32 cblksty); +-static void opj_t1_dec_sigpass_mqc( +- opj_t1_t *t1, +- OPJ_INT32 bpno, +- OPJ_INT32 orient); + static void opj_t1_dec_sigpass_mqc_vsc( + opj_t1_t *t1, +- OPJ_INT32 bpno, +- OPJ_INT32 orient); ++ OPJ_INT32 bpno); + + + +@@ -158,9 +156,6 @@ static void opj_t1_dec_refpass_raw( + opj_t1_t *t1, + OPJ_INT32 bpno, + OPJ_INT32 cblksty); +-static void opj_t1_dec_refpass_mqc( +- opj_t1_t *t1, +- OPJ_INT32 bpno); + static void opj_t1_dec_refpass_mqc_vsc( + opj_t1_t *t1, + OPJ_INT32 bpno); +@@ -182,23 +177,28 @@ static void opj_t1_dec_refpass_step(opj_t1_t *t1, + static INLINE void opj_t1_dec_refpass_step_raw( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, + OPJ_INT32 neghalf, +- OPJ_INT32 vsc); ++ OPJ_INT32 row); + static INLINE void opj_t1_dec_refpass_step_mqc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, +- OPJ_INT32 neghalf); ++ OPJ_INT32 neghalf, ++ OPJ_INT32 row); + static INLINE void opj_t1_dec_refpass_step_mqc_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, + OPJ_INT32 neghalf, +- OPJ_INT32 vsc); ++ OPJ_INT32 vsc, ++ OPJ_INT32 row); + + + +@@ -209,7 +209,6 @@ static void opj_t1_enc_clnpass_step( + opj_t1_t *t1, + opj_flag_t *flagsp, + OPJ_INT32 *datap, +- OPJ_UINT32 orient, + OPJ_INT32 bpno, + OPJ_INT32 one, + OPJ_INT32 *nmsedec, +@@ -221,30 +220,32 @@ Decode clean-up pass + static void opj_t1_dec_clnpass_step_partial( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf); ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row); + static void opj_t1_dec_clnpass_step( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf); ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row); + static void opj_t1_dec_clnpass_step_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, + OPJ_INT32 partial, +- OPJ_INT32 vsc); ++ OPJ_INT32 vsc, ++ OPJ_INT32 row); + /** + Encode clean-up pass + */ + static void opj_t1_enc_clnpass( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_UINT32 orient, + OPJ_INT32 *nmsedec, + OPJ_UINT32 cblksty); + /** +@@ -253,7 +254,6 @@ Decode clean-up pass + static void opj_t1_dec_clnpass( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_INT32 orient, + OPJ_INT32 cblksty); + + static OPJ_FLOAT64 opj_t1_getwmsedec( +@@ -305,8 +305,8 @@ static OPJ_BOOL opj_t1_allocate_buffers( opj_t1_t *t1, + + /* ----------------------------------------------------------------------- */ + +-static OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient) { +- return lut_ctxno_zc[(orient << 8) | (f & T1_SIG_OTH)]; ++static OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f) { ++ return mqc->lut_ctxno_zc_orient[(f & T1_SIG_OTH)]; + } + + static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f) { +@@ -339,34 +339,73 @@ static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos) { + return lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)]; + } + +-static void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) { ++static INLINE void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) { + opj_flag_t *np = flagsp - stride; + opj_flag_t *sp = flagsp + stride; + +- static const opj_flag_t mod[] = { +- T1_SIG_S, T1_SIG_S|T1_SGN_S, +- T1_SIG_E, T1_SIG_E|T1_SGN_E, +- T1_SIG_W, T1_SIG_W|T1_SGN_W, +- T1_SIG_N, T1_SIG_N|T1_SGN_N +- }; ++ /* We strongly rely on (T1_SGN_N == 0x0100) == (T1_SIG_N == 0x0010) << 4 */ ++ /* and T1_SIG_E == T1_SIG_N << 1, T1_SIG_W == T1_SIG_N << 2 and T1_SIG_S == T1_SIG_N << 2 */ ++ /* and T1_SGN_E == T1_SGN_N << 1, T1_SGN_W == T1_SGN_N << 2 and T1_SGN_S == T1_SGN_N << 2 */ ++ ++ opj_flag_t flag_N = T1_SIG_N | (T1_SIG_N << (4 * s)); + + np[-1] |= T1_SIG_SE; +- np[0] |= mod[s]; ++ np[0] |= flag_N << 2; + np[1] |= T1_SIG_SW; + +- flagsp[-1] |= mod[s+2]; ++ flagsp[-1] |= flag_N << 1; + flagsp[0] |= T1_SIG; +- flagsp[1] |= mod[s+4]; ++ flagsp[1] |= flag_N << 3; + + sp[-1] |= T1_SIG_NE; +- sp[0] |= mod[s+6]; ++ sp[0] |= flag_N; + sp[1] |= T1_SIG_NW; + } + ++static INLINE void opj_t1_updateflagscolflags(opj_flag_t *flagsp, opj_colflag_t *colflagsp, OPJ_UINT32 s, OPJ_UINT32 stride, OPJ_INT32 row) ++{ ++ opj_t1_updateflags(flagsp, s, stride); ++ if( row == 0 ) ++ { ++ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ *(colflagsp - stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3); ++ *(colflagsp - stride) |= (T1_COLFLAG_SIG_OTHER_ROW_3); ++ *(colflagsp - stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3); ++ } ++ else if( row == 3 ) ++ { ++ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))); ++ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))); ++ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS* (row-1))); ++ *(colflagsp + stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0); ++ *(colflagsp + stride) |= (T1_COLFLAG_SIG_OTHER_ROW_0); ++ *(colflagsp + stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0); ++ } ++ else ++ { ++ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); ++ } ++} ++ + static void opj_t1_enc_sigpass_step( opj_t1_t *t1, + opj_flag_t *flagsp, + OPJ_INT32 *datap, +- OPJ_UINT32 orient, + OPJ_INT32 bpno, + OPJ_INT32 one, + OPJ_INT32 *nmsedec, +@@ -382,7 +421,7 @@ static void opj_t1_enc_sigpass_step( opj_t1_t *t1, + flag = vsc ? (OPJ_UINT32)((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (OPJ_UINT32)(*flagsp); + if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { + v = (opj_int_abs(*datap) & one) ? 1 : 0; +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient)); /* ESSAI */ ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag)); /* ESSAI */ + if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */ + opj_mqc_bypass_enc(mqc, (OPJ_UINT32)v); + } else { +@@ -407,72 +446,89 @@ static void opj_t1_enc_sigpass_step( opj_t1_t *t1, + static INLINE void opj_t1_dec_sigpass_step_raw( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, +- OPJ_INT32 vsc) ++ OPJ_INT32 vsc, ++ OPJ_INT32 row) + { + OPJ_INT32 v, flag; + opj_raw_t *raw = t1->raw; /* RAW component */ +- OPJ_ARG_NOT_USED(orient); +- ++ + flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); +- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { ++ if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { + if (opj_raw_decode(raw)) { + v = (OPJ_INT32)opj_raw_decode(raw); /* ESSAI */ + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); + } ++#ifdef CONSISTENCY_CHECK + *flagsp |= T1_VISIT; ++#endif ++ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } + + static INLINE void opj_t1_dec_sigpass_step_mqc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf) ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row, ++ OPJ_INT32 flags_stride) + { + OPJ_INT32 v, flag; + + opj_mqc_t *mqc = t1->mqc; /* MQC component */ +- +- flag = *flagsp; +- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); ++#ifdef CONSISTENCY_CHECK ++ assert( ((*flagsp & T1_SIG_OTH) && !(*flagsp & (T1_SIG | T1_VISIT))) == ++ ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0) << (T1_COLFLAG_RBS * row))) == ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row))) ); ++#endif ++ if( (*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0) << (T1_COLFLAG_RBS * row))) == ++ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) ) { ++ flag = *flagsp; ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); + if (opj_mqc_decode(mqc)) { + opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); + v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, flags_stride, row); + } ++#ifdef CONSISTENCY_CHECK + *flagsp |= T1_VISIT; ++#endif ++ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } /* VSC and BYPASS by Antonin */ + + static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t* colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, +- OPJ_INT32 vsc) ++ OPJ_INT32 vsc, ++ OPJ_INT32 row) + { + OPJ_INT32 v, flag; + + opj_mqc_t *mqc = t1->mqc; /* MQC component */ + + flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); +- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); ++ if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); + if (opj_mqc_decode(mqc)) { + opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); + v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); + } ++#ifdef CONSISTENCY_CHECK + *flagsp |= T1_VISIT; ++#endif ++ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } /* VSC and BYPASS by Antonin */ + +@@ -480,7 +536,6 @@ static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( + + static void opj_t1_enc_sigpass(opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_UINT32 orient, + OPJ_INT32 *nmsedec, + OPJ_BYTE type, + OPJ_UINT32 cblksty +@@ -499,7 +554,6 @@ static void opj_t1_enc_sigpass(opj_t1_t *t1, + t1, + &t1->flags[((j+1) * t1->flags_stride) + i + 1], + &t1->data[(j * t1->data_stride) + i], +- orient, + bpno, + one, + nmsedec, +@@ -513,95 +567,139 @@ static void opj_t1_enc_sigpass(opj_t1_t *t1, + static void opj_t1_dec_sigpass_raw( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_INT32 orient, + OPJ_INT32 cblksty) + { + OPJ_INT32 one, half, oneplushalf, vsc; + OPJ_UINT32 i, j, k; ++ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; + one = 1 << bpno; + half = one >> 1; + oneplushalf = one | half; + for (k = 0; k < t1->h; k += 4) { + for (i = 0; i < t1->w; ++i) { ++ opj_colflag_t *colflags2 = colflags1 + i; + for (j = k; j < k + 4 && j < t1->h; ++j) { + vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0; + opj_t1_dec_sigpass_step_raw( + t1, + &t1->flags[((j+1) * t1->flags_stride) + i + 1], ++ colflags2, + &t1->data[(j * t1->w) + i], +- orient, + oneplushalf, +- vsc); ++ vsc, ++ j - k); + } + } ++ colflags1 += t1->flags_stride; + } + } /* VSC and BYPASS by Antonin */ + +-static void opj_t1_dec_sigpass_mqc( ++#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, w, h, flags_stride) \ ++{ \ ++ OPJ_INT32 one, half, oneplushalf; \ ++ OPJ_UINT32 i, j, k; \ ++ OPJ_INT32 *data1 = t1->data; \ ++ opj_flag_t *flags1 = &t1->flags[1]; \ ++ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ ++ one = 1 << bpno; \ ++ half = one >> 1; \ ++ oneplushalf = one | half; \ ++ for (k = 0; k < (h & ~3u); k += 4) { \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ if( *colflags2 == 0 ) continue; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 0, flags_stride); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 1, flags_stride); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 2, flags_stride); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 3, flags_stride); \ ++ data2 += w; \ ++ } \ ++ data1 += w << 2; \ ++ flags1 += flags_stride << 2; \ ++ colflags1 += flags_stride; \ ++ } \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ for (j = k; j < h; ++j) { \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, j - k, flags_stride); \ ++ data2 += w; \ ++ } \ ++ } \ ++} ++ ++static void opj_t1_dec_sigpass_mqc_64x64( + opj_t1_t *t1, +- OPJ_INT32 bpno, +- OPJ_INT32 orient) ++ OPJ_INT32 bpno) ++{ ++ opj_t1_dec_sigpass_mqc_internal(t1, bpno, 64, 64, 66); ++} ++ ++static void opj_t1_dec_sigpass_mqc_generic( ++ opj_t1_t *t1, ++ OPJ_INT32 bpno) ++{ ++ opj_t1_dec_sigpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->flags_stride); ++} ++ ++/* VSC and BYPASS by Antonin */ ++static void opj_t1_dec_sigpass_mqc_vsc( ++ opj_t1_t *t1, ++ OPJ_INT32 bpno) + { +- OPJ_INT32 one, half, oneplushalf; ++ OPJ_INT32 one, half, oneplushalf, vsc; + OPJ_UINT32 i, j, k; + OPJ_INT32 *data1 = t1->data; + opj_flag_t *flags1 = &t1->flags[1]; ++ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; + one = 1 << bpno; + half = one >> 1; + oneplushalf = one | half; +- for (k = 0; k < (t1->h & ~3u); k += 4) { ++ for (k = 0; k < (t1->h & ~3); k += 4) { + for (i = 0; i < t1->w; ++i) { + OPJ_INT32 *data2 = data1 + i; + opj_flag_t *flags2 = flags1 + i; ++ opj_colflag_t *colflags2 = colflags1 + i; + flags2 += t1->flags_stride; +- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); ++ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 0); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); ++ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 1); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); ++ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 2); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); ++ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 1, 3); + data2 += t1->w; + } + data1 += t1->w << 2; + flags1 += t1->flags_stride << 2; ++ colflags1 += t1->flags_stride; + } + for (i = 0; i < t1->w; ++i) { +- OPJ_INT32 *data2 = data1 + i; +- opj_flag_t *flags2 = flags1 + i; ++ opj_colflag_t *colflags2 = colflags1 + i; + for (j = k; j < t1->h; ++j) { +- flags2 += t1->flags_stride; +- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- } +- } +-} /* VSC and BYPASS by Antonin */ +- +-static void opj_t1_dec_sigpass_mqc_vsc( +- opj_t1_t *t1, +- OPJ_INT32 bpno, +- OPJ_INT32 orient) +-{ +- OPJ_INT32 one, half, oneplushalf, vsc; +- OPJ_UINT32 i, j, k; +- one = 1 << bpno; +- half = one >> 1; +- oneplushalf = one | half; +- for (k = 0; k < t1->h; k += 4) { +- for (i = 0; i < t1->w; ++i) { +- for (j = k; j < k + 4 && j < t1->h; ++j) { +- vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0; +- opj_t1_dec_sigpass_step_mqc_vsc( +- t1, +- &t1->flags[((j+1) * t1->flags_stride) + i + 1], +- &t1->data[(j * t1->w) + i], +- orient, +- oneplushalf, +- vsc); +- } ++ vsc = (j == t1->h - 1) ? 1 : 0; ++ opj_t1_dec_sigpass_step_mqc_vsc( ++ t1, ++ &t1->flags[((j+1) * t1->flags_stride) + i + 1], ++ colflags2, ++ &t1->data[(j * t1->w) + i], ++ oneplushalf, ++ vsc, ++ j - k); + } + } + } /* VSC and BYPASS by Antonin */ +@@ -639,64 +737,81 @@ static void opj_t1_enc_refpass_step( opj_t1_t *t1, + static INLINE void opj_t1_dec_refpass_step_raw( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, + OPJ_INT32 neghalf, +- OPJ_INT32 vsc) ++ OPJ_INT32 row) + { +- OPJ_INT32 v, t, flag; ++ OPJ_INT32 v, t; + + opj_raw_t *raw = t1->raw; /* RAW component */ + +- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); +- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { ++ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == ++ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { + v = (OPJ_INT32)opj_raw_decode(raw); + t = v ? poshalf : neghalf; + *datap += *datap < 0 ? -t : t; +- *flagsp |= T1_REFINE; ++ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } /* VSC and BYPASS by Antonin */ + + static INLINE void opj_t1_dec_refpass_step_mqc( + opj_t1_t *t1, ++#ifdef CONSISTENCY_CHECK + opj_flag_t *flagsp, ++#else ++ opj_flag_t *flagsp_unused, ++#endif ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, +- OPJ_INT32 neghalf) ++ OPJ_INT32 neghalf, ++ OPJ_INT32 row) + { +- OPJ_INT32 v, t, flag; ++ OPJ_INT32 v, t; + + opj_mqc_t *mqc = t1->mqc; /* MQC component */ +- +- flag = *flagsp; +- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag((OPJ_UINT32)flag)); /* ESSAI */ ++#ifdef CONSISTENCY_CHECK ++ assert( ((*flagsp & (T1_SIG | T1_VISIT)) == T1_SIG) == ++ ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) ); ++#endif ++ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == ++ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { ++ OPJ_UINT32 tmp1 = (*colflagsp & (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG; ++ OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2 : tmp1; ++ opj_mqc_setcurctx(mqc, tmp2); /* ESSAI */ + v = opj_mqc_decode(mqc); + t = v ? poshalf : neghalf; + *datap += *datap < 0 ? -t : t; +- *flagsp |= T1_REFINE; ++ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } /* VSC and BYPASS by Antonin */ + + static INLINE void opj_t1_dec_refpass_step_mqc_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, + OPJ_INT32 poshalf, + OPJ_INT32 neghalf, +- OPJ_INT32 vsc) ++ OPJ_INT32 vsc, ++ OPJ_INT32 row) + { + OPJ_INT32 v, t, flag; + + opj_mqc_t *mqc = t1->mqc; /* MQC component */ + +- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); +- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag((OPJ_UINT32)flag)); /* ESSAI */ ++ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == ++ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { ++ OPJ_INT32 flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); ++ OPJ_UINT32 tmp1 = (flag & T1_SIG_OTH) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG; ++ OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2 : tmp1; ++ opj_mqc_setcurctx(mqc, tmp2); /* ESSAI */ + v = opj_mqc_decode(mqc); + t = v ? poshalf : neghalf; + *datap += *datap < 0 ? -t : t; +- *flagsp |= T1_REFINE; ++ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); + } + } /* VSC and BYPASS by Antonin */ + +@@ -739,89 +854,134 @@ static void opj_t1_dec_refpass_raw( + OPJ_INT32 one, poshalf, neghalf; + OPJ_UINT32 i, j, k; + OPJ_INT32 vsc; ++ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; + one = 1 << bpno; + poshalf = one >> 1; + neghalf = bpno > 0 ? -poshalf : -1; + for (k = 0; k < t1->h; k += 4) { + for (i = 0; i < t1->w; ++i) { ++ opj_colflag_t *colflags2 = colflags1 + i; + for (j = k; j < k + 4 && j < t1->h; ++j) { +- vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0; + opj_t1_dec_refpass_step_raw( + t1, + &t1->flags[((j+1) * t1->flags_stride) + i + 1], ++ colflags2, + &t1->data[(j * t1->w) + i], + poshalf, +- neghalf, +- vsc); ++ neghalf, j - k); + } + } ++ colflags1 += t1->flags_stride; + } + } /* VSC and BYPASS by Antonin */ + +-static void opj_t1_dec_refpass_mqc( ++#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \ ++{ \ ++ OPJ_INT32 one, poshalf, neghalf; \ ++ OPJ_UINT32 i, j, k; \ ++ OPJ_INT32 *data1 = t1->data; \ ++ opj_flag_t *flags1 = &t1->flags[1]; \ ++ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ ++ one = 1 << bpno; \ ++ poshalf = one >> 1; \ ++ neghalf = bpno > 0 ? -poshalf : -1; \ ++ for (k = 0; k < (h & ~3u); k += 4) { \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ if( *colflags2 == 0 ) continue; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 0); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 1); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 2); \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 3); \ ++ data2 += w; \ ++ } \ ++ data1 += w << 2; \ ++ flags1 += flags_stride << 2; \ ++ colflags1 += flags_stride; \ ++ } \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ for (j = k; j < h; ++j) { \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, j - k); \ ++ data2 += w; \ ++ } \ ++ } \ ++} ++ ++static void opj_t1_dec_refpass_mqc_64x64( ++ opj_t1_t *t1, ++ OPJ_INT32 bpno) ++{ ++ opj_t1_dec_refpass_mqc_internal(t1, bpno, 64, 64, 66); ++} ++ ++static void opj_t1_dec_refpass_mqc_generic( ++ opj_t1_t *t1, ++ OPJ_INT32 bpno) ++{ ++ opj_t1_dec_refpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->flags_stride); ++} ++ ++/* VSC and BYPASS by Antonin */ ++static void opj_t1_dec_refpass_mqc_vsc( + opj_t1_t *t1, + OPJ_INT32 bpno) + { + OPJ_INT32 one, poshalf, neghalf; + OPJ_UINT32 i, j, k; ++ OPJ_INT32 vsc; + OPJ_INT32 *data1 = t1->data; + opj_flag_t *flags1 = &t1->flags[1]; ++ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; + one = 1 << bpno; + poshalf = one >> 1; + neghalf = bpno > 0 ? -poshalf : -1; +- for (k = 0; k < (t1->h & ~3u); k += 4) { ++ for (k = 0; k < (t1->h & ~3); k += 4) { + for (i = 0; i < t1->w; ++i) { + OPJ_INT32 *data2 = data1 + i; + opj_flag_t *flags2 = flags1 + i; ++ opj_colflag_t *colflags2 = colflags1 + i; + flags2 += t1->flags_stride; +- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); ++ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 0); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); ++ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 1); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); ++ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 2); + data2 += t1->w; + flags2 += t1->flags_stride; +- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); ++ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 1, 3); + data2 += t1->w; + } + data1 += t1->w << 2; + flags1 += t1->flags_stride << 2; ++ colflags1 += t1->flags_stride; + } + for (i = 0; i < t1->w; ++i) { +- OPJ_INT32 *data2 = data1 + i; +- opj_flag_t *flags2 = flags1 + i; ++ opj_colflag_t *colflags2 = colflags1 + i; + for (j = k; j < t1->h; ++j) { +- flags2 += t1->flags_stride; +- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); +- data2 += t1->w; +- } +- } +-} /* VSC and BYPASS by Antonin */ +- +-static void opj_t1_dec_refpass_mqc_vsc( +- opj_t1_t *t1, +- OPJ_INT32 bpno) +-{ +- OPJ_INT32 one, poshalf, neghalf; +- OPJ_UINT32 i, j, k; +- OPJ_INT32 vsc; +- one = 1 << bpno; +- poshalf = one >> 1; +- neghalf = bpno > 0 ? -poshalf : -1; +- for (k = 0; k < t1->h; k += 4) { +- for (i = 0; i < t1->w; ++i) { +- for (j = k; j < k + 4 && j < t1->h; ++j) { +- vsc = ((j == k + 3 || j == t1->h - 1)) ? 1 : 0; +- opj_t1_dec_refpass_step_mqc_vsc( +- t1, +- &t1->flags[((j+1) * t1->flags_stride) + i + 1], +- &t1->data[(j * t1->w) + i], +- poshalf, +- neghalf, +- vsc); +- } ++ vsc = (j == t1->h - 1) ? 1 : 0; ++ opj_t1_dec_refpass_step_mqc_vsc( ++ t1, ++ &t1->flags[((j+1) * t1->flags_stride) + i + 1], ++ colflags2, ++ &t1->data[(j * t1->w) + i], ++ poshalf, neghalf, ++ vsc, ++ j - k); + } + } + } /* VSC and BYPASS by Antonin */ +@@ -831,7 +991,6 @@ static void opj_t1_enc_clnpass_step( + opj_t1_t *t1, + opj_flag_t *flagsp, + OPJ_INT32 *datap, +- OPJ_UINT32 orient, + OPJ_INT32 bpno, + OPJ_INT32 one, + OPJ_INT32 *nmsedec, +@@ -848,7 +1007,7 @@ static void opj_t1_enc_clnpass_step( + goto LABEL_PARTIAL; + } + if (!(*flagsp & (T1_SIG | T1_VISIT))) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient)); ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag)); + v = (opj_int_abs(*datap) & one) ? 1 : 0; + opj_mqc_encode(mqc, (OPJ_UINT32)v); + if (v) { +@@ -866,55 +1025,90 @@ static void opj_t1_enc_clnpass_step( + static void opj_t1_dec_clnpass_step_partial( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf) ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row) + { + OPJ_INT32 v, flag; + opj_mqc_t *mqc = t1->mqc; /* MQC component */ + +- OPJ_ARG_NOT_USED(orient); +- + flag = *flagsp; + opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); + v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); ++#ifdef CONSISTENCY_CHECK + *flagsp &= ~T1_VISIT; ++#endif + } /* VSC and BYPASS by Antonin */ + + static void opj_t1_dec_clnpass_step( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, +- OPJ_INT32 oneplushalf) ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row) + { + OPJ_INT32 v, flag; + + opj_mqc_t *mqc = t1->mqc; /* MQC component */ +- +- flag = *flagsp; +- if (!(flag & (T1_SIG | T1_VISIT))) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); ++#ifdef CONSISTENCY_CHECK ++ assert( (!(*flagsp & (T1_SIG | T1_VISIT))) == (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (4*row)))) ); ++#endif ++ if (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (4*row)))) { ++ flag = *flagsp; ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); + if (opj_mqc_decode(mqc)) { + opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); + v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); + } + } ++#ifdef CONSISTENCY_CHECK + *flagsp &= ~T1_VISIT; ++#endif + } /* VSC and BYPASS by Antonin */ + ++static void opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit( ++ opj_t1_t *t1, ++ opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, ++ OPJ_INT32 *datap, ++ OPJ_INT32 oneplushalf, ++ OPJ_INT32 row, ++ OPJ_INT32 flags_stride) ++{ ++ OPJ_INT32 v; ++ OPJ_INT32 flag; ++ ++ opj_mqc_t *mqc = t1->mqc; /* MQC component */ ++ ++ flag = *flagsp; ++ /*if (!(flag & (T1_SIG | T1_VISIT)))*/ ++ { ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); ++ if (opj_mqc_decode(mqc)) { ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); ++ v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); ++ *datap = v ? -oneplushalf : oneplushalf; ++ opj_t1_updateflagscolflags(flagsp, colflagsp, v, flags_stride, row); ++ } ++ } ++ /*flagsp &= ~T1_VISIT;*/ ++} ++ + static void opj_t1_dec_clnpass_step_vsc( + opj_t1_t *t1, + opj_flag_t *flagsp, ++ opj_colflag_t *colflagsp, + OPJ_INT32 *datap, +- OPJ_INT32 orient, + OPJ_INT32 oneplushalf, + OPJ_INT32 partial, +- OPJ_INT32 vsc) ++ OPJ_INT32 vsc, ++ OPJ_INT32 row) + { + OPJ_INT32 v, flag; + +@@ -924,23 +1118,24 @@ static void opj_t1_dec_clnpass_step_vsc( + if (partial) { + goto LABEL_PARTIAL; + } +- if (!(flag & (T1_SIG | T1_VISIT))) { +- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); ++ if (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { ++ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); + if (opj_mqc_decode(mqc)) { + LABEL_PARTIAL: + opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); + v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); + *datap = v ? -oneplushalf : oneplushalf; +- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); ++ opj_t1_updateflagscolflags(flagsp, colflagsp, v, t1->flags_stride, row); + } + } ++#ifdef CONSISTENCY_CHECK + *flagsp &= ~T1_VISIT; ++#endif + } + + static void opj_t1_enc_clnpass( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_UINT32 orient, + OPJ_INT32 *nmsedec, + OPJ_UINT32 cblksty) + { +@@ -992,7 +1187,6 @@ static void opj_t1_enc_clnpass( + t1, + &t1->flags[((j+1) * t1->flags_stride) + i + 1], + &t1->data[(j * t1->data_stride) + i], +- orient, + bpno, + one, + nmsedec, +@@ -1003,130 +1197,186 @@ static void opj_t1_enc_clnpass( + } + } + +-static void opj_t1_dec_clnpass( ++#define MACRO_t1_flags_internal(x,y,flags_stride) t1->flags[((x)*(flags_stride))+(y)] ++ ++#define opj_t1_dec_clnpass_internal(consistency_check, t1, bpno, cblksty, w, h, flags_stride) \ ++{ \ ++ OPJ_INT32 one, half, oneplushalf, agg, runlen, vsc; \ ++ OPJ_UINT32 i, j, k; \ ++ OPJ_INT32 segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM; \ ++ \ ++ opj_mqc_t *mqc = t1->mqc; /* MQC component */ \ ++ \ ++ one = 1 << bpno; \ ++ half = one >> 1; \ ++ oneplushalf = one | half; \ ++ if (cblksty & J2K_CCP_CBLKSTY_VSC) { \ ++ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ ++ for (k = 0; k < h; k += 4) { \ ++ for (i = 0; i < w; ++i) { \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ if (k + 3 < h) { \ ++ agg = !((*colflags2 & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0 | \ ++ T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_SIG_OTHER_ROW_1 | \ ++ T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_SIG_OTHER_ROW_2 | \ ++ T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3)) || \ ++ ((MACRO_t1_flags_internal(1 + k + 3,1 + i,flags_stride) \ ++ & ((~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG_OTH)))); \ ++ } else { \ ++ agg = 0; \ ++ } \ ++ if (agg) { \ ++ opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); \ ++ if (!opj_mqc_decode(mqc)) { \ ++ continue; \ ++ } \ ++ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ ++ runlen = opj_mqc_decode(mqc); \ ++ runlen = (runlen << 1) | opj_mqc_decode(mqc); \ ++ } else { \ ++ runlen = 0; \ ++ } \ ++ for (j = k + (OPJ_UINT32)runlen; j < k + 4 && j < h; ++j) { \ ++ vsc = (j == k + 3 || j == h - 1) ? 1 : 0; \ ++ opj_t1_dec_clnpass_step_vsc( \ ++ t1, \ ++ &t1->flags[((j+1) * flags_stride) + i + 1], \ ++ colflags2, \ ++ &t1->data[(j * w) + i], \ ++ oneplushalf, \ ++ agg && (j == k + (OPJ_UINT32)runlen), \ ++ vsc, j - k); \ ++ } \ ++ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ ++ } \ ++ colflags1 += flags_stride; \ ++ } \ ++ } else { \ ++ OPJ_INT32 *data1 = t1->data; \ ++ opj_flag_t *flags1 = &t1->flags[1]; \ ++ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ ++ for (k = 0; k < (h & ~3u); k += 4) { \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ opj_colflag_t colflags = *colflags2; \ ++ agg = !(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0 | \ ++ T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_SIG_OTHER_ROW_1 | \ ++ T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_SIG_OTHER_ROW_2 | \ ++ T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3 | T1_COLFLAG_SIG_OTHER_ROW_3)); \ ++ if( consistency_check ) { \ ++ assert( agg == !((MACRO_t1_flags_internal(1 + k, 1 + i,flags_stride) | \ ++ MACRO_t1_flags_internal(1 + k + 1, 1 + i,flags_stride) | \ ++ MACRO_t1_flags_internal(1 + k + 2, 1 + i,flags_stride) | \ ++ MACRO_t1_flags_internal(1 + k + 3, 1 + i,flags_stride)) & (T1_SIG | T1_VISIT | T1_SIG_OTH)) ); \ ++ } \ ++ if (agg) { \ ++ opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); \ ++ if (!opj_mqc_decode(mqc)) { \ ++ continue; \ ++ } \ ++ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ ++ runlen = opj_mqc_decode(mqc); \ ++ runlen = (runlen << 1) | opj_mqc_decode(mqc); \ ++ flags2 += (OPJ_UINT32)runlen * flags_stride; \ ++ data2 += (OPJ_UINT32)runlen * w; \ ++ for (j = (OPJ_UINT32)runlen; j < 4; ++j) { \ ++ flags2 += flags_stride; \ ++ if (j == (OPJ_UINT32)runlen) { \ ++ opj_t1_dec_clnpass_step_partial(t1, flags2, colflags2, data2, oneplushalf, j); \ ++ } else { \ ++ opj_t1_dec_clnpass_step(t1, flags2, colflags2, data2, oneplushalf, j); \ ++ } \ ++ data2 += w; \ ++ } \ ++ } else { \ ++ flags2 += flags_stride; \ ++ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ ++ if (!(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0))) {\ ++ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 0, flags_stride); \ ++ } \ ++ if( consistency_check ) *flags2 &= ~T1_VISIT; \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ ++ if (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) {\ ++ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 1, flags_stride); \ ++ } \ ++ if( consistency_check ) *flags2 &= ~T1_VISIT; \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ ++ if (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) {\ ++ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 2, flags_stride); \ ++ } \ ++ if( consistency_check ) *flags2 &= ~T1_VISIT; \ ++ data2 += w; \ ++ flags2 += flags_stride; \ ++ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ ++ if (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) {\ ++ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 3, flags_stride); \ ++ } \ ++ if( consistency_check ) *flags2 &= ~T1_VISIT; \ ++ data2 += w; \ ++ } \ ++ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ ++ } \ ++ data1 += w << 2; \ ++ flags1 += flags_stride << 2; \ ++ colflags1 += flags_stride; \ ++ } \ ++ for (i = 0; i < w; ++i) { \ ++ OPJ_INT32 *data2 = data1 + i; \ ++ opj_flag_t *flags2 = flags1 + i; \ ++ opj_colflag_t *colflags2 = colflags1 + i; \ ++ for (j = k; j < h; ++j) { \ ++ flags2 += flags_stride; \ ++ opj_t1_dec_clnpass_step(t1, flags2, colflags2, data2, oneplushalf, j - k); \ ++ data2 += w; \ ++ } \ ++ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ ++ } \ ++ } \ ++ \ ++ if (segsym) { \ ++ OPJ_INT32 v = 0; \ ++ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ ++ v = opj_mqc_decode(mqc); \ ++ v = (v << 1) | opj_mqc_decode(mqc); \ ++ v = (v << 1) | opj_mqc_decode(mqc); \ ++ v = (v << 1) | opj_mqc_decode(mqc); \ ++ /* \ ++ if (v!=0xa) { \ ++ opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v); \ ++ } \ ++ */ \ ++ } \ ++} /* VSC and BYPASS by Antonin */ ++ ++static void opj_t1_dec_clnpass_64x64( + opj_t1_t *t1, + OPJ_INT32 bpno, +- OPJ_INT32 orient, + OPJ_INT32 cblksty) + { +- OPJ_INT32 one, half, oneplushalf, agg, runlen, vsc; +- OPJ_UINT32 i, j, k; +- OPJ_INT32 segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM; +- +- opj_mqc_t *mqc = t1->mqc; /* MQC component */ +- +- one = 1 << bpno; +- half = one >> 1; +- oneplushalf = one | half; +- if (cblksty & J2K_CCP_CBLKSTY_VSC) { +- for (k = 0; k < t1->h; k += 4) { +- for (i = 0; i < t1->w; ++i) { +- if (k + 3 < t1->h) { +- agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) +- || MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) +- || MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) +- || (MACRO_t1_flags(1 + k + 3,1 + i) +- & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH)); +- } else { +- agg = 0; +- } +- if (agg) { +- opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); +- if (!opj_mqc_decode(mqc)) { +- continue; +- } +- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); +- runlen = opj_mqc_decode(mqc); +- runlen = (runlen << 1) | opj_mqc_decode(mqc); +- } else { +- runlen = 0; +- } +- for (j = k + (OPJ_UINT32)runlen; j < k + 4 && j < t1->h; ++j) { +- vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0; +- opj_t1_dec_clnpass_step_vsc( +- t1, +- &t1->flags[((j+1) * t1->flags_stride) + i + 1], +- &t1->data[(j * t1->w) + i], +- orient, +- oneplushalf, +- agg && (j == k + (OPJ_UINT32)runlen), +- vsc); +- } +- } +- } +- } else { +- OPJ_INT32 *data1 = t1->data; +- opj_flag_t *flags1 = &t1->flags[1]; +- for (k = 0; k < (t1->h & ~3u); k += 4) { +- for (i = 0; i < t1->w; ++i) { +- OPJ_INT32 *data2 = data1 + i; +- opj_flag_t *flags2 = flags1 + i; +- agg = !((MACRO_t1_flags(1 + k, 1 + i) | +- MACRO_t1_flags(1 + k + 1, 1 + i) | +- MACRO_t1_flags(1 + k + 2, 1 + i) | +- MACRO_t1_flags(1 + k + 3, 1 + i)) & (T1_SIG | T1_VISIT | T1_SIG_OTH)); +- if (agg) { +- opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); +- if (!opj_mqc_decode(mqc)) { +- continue; +- } +- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); +- runlen = opj_mqc_decode(mqc); +- runlen = (runlen << 1) | opj_mqc_decode(mqc); +- flags2 += (OPJ_UINT32)runlen * t1->flags_stride; +- data2 += (OPJ_UINT32)runlen * t1->w; +- for (j = (OPJ_UINT32)runlen; j < 4 && j < t1->h; ++j) { +- flags2 += t1->flags_stride; +- if (agg && (j == (OPJ_UINT32)runlen)) { +- opj_t1_dec_clnpass_step_partial(t1, flags2, data2, orient, oneplushalf); +- } else { +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- } +- data2 += t1->w; +- } +- } else { +- flags2 += t1->flags_stride; +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- flags2 += t1->flags_stride; +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- flags2 += t1->flags_stride; +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- flags2 += t1->flags_stride; +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- } +- } +- data1 += t1->w << 2; +- flags1 += t1->flags_stride << 2; +- } +- for (i = 0; i < t1->w; ++i) { +- OPJ_INT32 *data2 = data1 + i; +- opj_flag_t *flags2 = flags1 + i; +- for (j = k; j < t1->h; ++j) { +- flags2 += t1->flags_stride; +- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); +- data2 += t1->w; +- } +- } +- } ++#ifdef CONSISTENCY_CHECK ++ opj_t1_dec_clnpass_internal(OPJ_TRUE, t1, bpno, cblksty, 64, 64, 66); ++#else ++ opj_t1_dec_clnpass_internal(OPJ_FALSE, t1, bpno, cblksty, 64, 64, 66); ++#endif ++} + +- if (segsym) { +- OPJ_INT32 v = 0; +- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); +- v = opj_mqc_decode(mqc); +- v = (v << 1) | opj_mqc_decode(mqc); +- v = (v << 1) | opj_mqc_decode(mqc); +- v = (v << 1) | opj_mqc_decode(mqc); +- /* +- if (v!=0xa) { +- opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v); +- } +- */ +- } +-} /* VSC and BYPASS by Antonin */ ++static void opj_t1_dec_clnpass_generic( ++ opj_t1_t *t1, ++ OPJ_INT32 bpno, ++ OPJ_INT32 cblksty) ++{ ++#ifdef CONSISTENCY_CHECK ++ opj_t1_dec_clnpass_internal(OPJ_TRUE, t1, bpno, cblksty, t1->w, t1->h, t1->flags_stride); ++#else ++ opj_t1_dec_clnpass_internal(OPJ_FALSE, t1, bpno, cblksty, t1->w, t1->h, t1->flags_stride); ++#endif ++} + + + /** mod fixed_quality */ +@@ -1198,6 +1448,21 @@ static OPJ_BOOL opj_t1_allocate_buffers( + t1->flagssize=flagssize; + } + memset(t1->flags,0,flagssize * sizeof(opj_flag_t)); ++ ++ if (!t1->encoder) { ++ OPJ_UINT32 colflags_size=t1->flags_stride * ((h+3) / 4 + 2); ++ ++ if(colflags_size > t1->colflags_size){ ++ opj_aligned_free(t1->colflags); ++ t1->colflags = (opj_colflag_t*) opj_aligned_malloc(colflags_size * sizeof(opj_colflag_t)); ++ if(!t1->colflags){ ++ /* FIXME event manager error callback */ ++ return OPJ_FALSE; ++ } ++ t1->colflags_size=colflags_size; ++ } ++ memset(t1->colflags,0,colflags_size * sizeof(opj_colflag_t)); ++ } + + t1->w=w; + t1->h=h; +@@ -1268,16 +1533,147 @@ void opj_t1_destroy(opj_t1_t *p_t1) + p_t1->flags = 00; + } + ++ if (p_t1->colflags) { ++ opj_aligned_free(p_t1->colflags); ++ p_t1->colflags = 00; ++ } + opj_free(p_t1); + } + +-OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, +- opj_tcd_tilecomp_t* tilec, +- opj_tccp_t* tccp +- ) ++typedef struct ++{ ++ OPJ_UINT32 resno; ++ opj_tcd_cblk_dec_t* cblk; ++ opj_tcd_band_t* band; ++ opj_tcd_tilecomp_t* tilec; ++ opj_tccp_t* tccp; ++ volatile OPJ_BOOL* pret; ++} opj_t1_cblk_decode_processing_job_t; ++ ++static void opj_t1_destroy_wrapper(void* t1) ++{ ++ opj_t1_destroy( (opj_t1_t*) t1 ); ++} ++ ++static void opj_t1_clbl_decode_processor(void* user_data, opj_tls_t* tls) ++{ ++ opj_tcd_cblk_dec_t* cblk; ++ opj_tcd_band_t* band; ++ opj_tcd_tilecomp_t* tilec; ++ opj_tccp_t* tccp; ++ OPJ_INT32* restrict datap; ++ OPJ_UINT32 cblk_w, cblk_h; ++ OPJ_INT32 x, y; ++ OPJ_UINT32 i, j; ++ opj_t1_cblk_decode_processing_job_t* job; ++ opj_t1_t* t1; ++ OPJ_UINT32 resno; ++ OPJ_UINT32 tile_w; ++ ++ job = (opj_t1_cblk_decode_processing_job_t*) user_data; ++ resno = job->resno; ++ cblk = job->cblk; ++ band = job->band; ++ tilec = job->tilec; ++ tccp = job->tccp; ++ tile_w = (OPJ_UINT32)(tilec->x1 - tilec->x0); ++ ++ if( !*(job->pret) ) ++ { ++ opj_free(job); ++ return; ++ } ++ ++ t1 = (opj_t1_t*) opj_tls_get(tls, OPJ_TLS_KEY_T1); ++ if( t1 == NULL ) ++ { ++ t1 = opj_t1_create( OPJ_FALSE ); ++ opj_tls_set( tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper ); ++ } ++ ++ if (OPJ_FALSE == opj_t1_decode_cblk( ++ t1, ++ cblk, ++ band->bandno, ++ (OPJ_UINT32)tccp->roishift, ++ tccp->cblksty)) { ++ *(job->pret) = OPJ_FALSE; ++ opj_free(job); ++ return; ++ } ++ ++ x = cblk->x0 - band->x0; ++ y = cblk->y0 - band->y0; ++ if (band->bandno & 1) { ++ opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; ++ x += pres->x1 - pres->x0; ++ } ++ if (band->bandno & 2) { ++ opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; ++ y += pres->y1 - pres->y0; ++ } ++ ++ datap=t1->data; ++ cblk_w = t1->w; ++ cblk_h = t1->h; ++ ++ if (tccp->roishift) { ++ OPJ_INT32 thresh = 1 << tccp->roishift; ++ for (j = 0; j < cblk_h; ++j) { ++ for (i = 0; i < cblk_w; ++i) { ++ OPJ_INT32 val = datap[(j * cblk_w) + i]; ++ OPJ_INT32 mag = abs(val); ++ if (mag >= thresh) { ++ mag >>= tccp->roishift; ++ datap[(j * cblk_w) + i] = val < 0 ? -mag : mag; ++ } ++ } ++ } ++ } ++ if (tccp->qmfbid == 1) { ++ OPJ_INT32* restrict tiledp = &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; ++ for (j = 0; j < cblk_h; ++j) { ++ i = 0; ++ for (; i < (cblk_w & ~3); i += 4) { ++ OPJ_INT32 tmp0 = datap[(j * cblk_w) + i]; ++ OPJ_INT32 tmp1 = datap[(j * cblk_w) + i+1]; ++ OPJ_INT32 tmp2 = datap[(j * cblk_w) + i+2]; ++ OPJ_INT32 tmp3 = datap[(j * cblk_w) + i+3]; ++ ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp0/2; ++ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+1] = tmp1/2; ++ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+2] = tmp2/2; ++ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+3] = tmp3/2; ++ } ++ for (; i < cblk_w; ++i) { ++ OPJ_INT32 tmp = datap[(j * cblk_w) + i]; ++ ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp/2; ++ } ++ } ++ } else { /* if (tccp->qmfbid == 0) */ ++ OPJ_FLOAT32* restrict tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; ++ for (j = 0; j < cblk_h; ++j) { ++ OPJ_FLOAT32* restrict tiledp2 = tiledp; ++ for (i = 0; i < cblk_w; ++i) { ++ OPJ_FLOAT32 tmp = (OPJ_FLOAT32)*datap * band->stepsize; ++ *tiledp2 = tmp; ++ datap++; ++ tiledp2++; ++ } ++ tiledp += tile_w; ++ } ++ } ++ ++ opj_free(job); ++} ++ ++ ++void opj_t1_decode_cblks( opj_thread_pool_t* tp, ++ volatile OPJ_BOOL* pret, ++ opj_tcd_tilecomp_t* tilec, ++ opj_tccp_t* tccp ++ ) + { + OPJ_UINT32 resno, bandno, precno, cblkno; +- OPJ_UINT32 tile_w = (OPJ_UINT32)(tilec->x1 - tilec->x0); + + for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) { + opj_tcd_resolution_t* res = &tilec->resolutions[resno]; +@@ -1290,74 +1686,29 @@ OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, + + for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) { + opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno]; +- OPJ_INT32* restrict datap; +- OPJ_UINT32 cblk_w, cblk_h; +- OPJ_INT32 x, y; +- OPJ_UINT32 i, j; +- +- if (OPJ_FALSE == opj_t1_decode_cblk( +- t1, +- cblk, +- band->bandno, +- (OPJ_UINT32)tccp->roishift, +- tccp->cblksty)) { +- return OPJ_FALSE; +- } ++ opj_t1_cblk_decode_processing_job_t* job; + +- x = cblk->x0 - band->x0; +- y = cblk->y0 - band->y0; +- if (band->bandno & 1) { +- opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; +- x += pres->x1 - pres->x0; +- } +- if (band->bandno & 2) { +- opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; +- y += pres->y1 - pres->y0; +- } +- +- datap=t1->data; +- cblk_w = t1->w; +- cblk_h = t1->h; +- +- if (tccp->roishift) { +- OPJ_INT32 thresh = 1 << tccp->roishift; +- for (j = 0; j < cblk_h; ++j) { +- for (i = 0; i < cblk_w; ++i) { +- OPJ_INT32 val = datap[(j * cblk_w) + i]; +- OPJ_INT32 mag = abs(val); +- if (mag >= thresh) { +- mag >>= tccp->roishift; +- datap[(j * cblk_w) + i] = val < 0 ? -mag : mag; +- } +- } +- } +- } +- if (tccp->qmfbid == 1) { +- OPJ_INT32* restrict tiledp = &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; +- for (j = 0; j < cblk_h; ++j) { +- for (i = 0; i < cblk_w; ++i) { +- OPJ_INT32 tmp = datap[(j * cblk_w) + i]; +- ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp/2; +- } +- } +- } else { /* if (tccp->qmfbid == 0) */ +- OPJ_FLOAT32* restrict tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; +- for (j = 0; j < cblk_h; ++j) { +- OPJ_FLOAT32* restrict tiledp2 = tiledp; +- for (i = 0; i < cblk_w; ++i) { +- OPJ_FLOAT32 tmp = (OPJ_FLOAT32)*datap * band->stepsize; +- *tiledp2 = tmp; +- datap++; +- tiledp2++; +- } +- tiledp += tile_w; +- } +- } ++ job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1, sizeof(opj_t1_cblk_decode_processing_job_t)); ++ if( !job ) ++ { ++ *pret = OPJ_FALSE; ++ return; ++ } ++ job->resno = resno; ++ job->cblk = cblk; ++ job->band = band; ++ job->tilec = tilec; ++ job->tccp = tccp; ++ job->pret = pret; ++ opj_thread_pool_submit_job( tp, opj_t1_clbl_decode_processor, job ); ++ if( !(*pret) ) ++ return; + } /* cblkno */ + } /* precno */ + } /* bandno */ + } /* resno */ +- return OPJ_TRUE; ++ ++ return; + } + + +@@ -1369,12 +1720,14 @@ static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1, + { + opj_raw_t *raw = t1->raw; /* RAW component */ + opj_mqc_t *mqc = t1->mqc; /* MQC component */ +- ++ + OPJ_INT32 bpno_plus_one; + OPJ_UINT32 passtype; + OPJ_UINT32 segno, passno; + OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */ + ++ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256; ++ + if(!opj_t1_allocate_buffers( + t1, + (OPJ_UINT32)(cblk->x1 - cblk->x0), +@@ -1408,45 +1761,91 @@ static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1, + } + } + +- for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { +- switch (passtype) { +- case 0: +- if (type == T1_TYPE_RAW) { +- opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty); +- } else { +- if (cblksty & J2K_CCP_CBLKSTY_VSC) { +- opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one, (OPJ_INT32)orient); +- } else { +- opj_t1_dec_sigpass_mqc(t1, bpno_plus_one, (OPJ_INT32)orient); +- } +- } +- break; +- case 1: +- if (type == T1_TYPE_RAW) { +- opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); +- } else { +- if (cblksty & J2K_CCP_CBLKSTY_VSC) { +- opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); +- } else { +- opj_t1_dec_refpass_mqc(t1, bpno_plus_one); +- } +- } +- break; +- case 2: +- opj_t1_dec_clnpass(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty); +- break; +- } +- +- if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { +- opj_mqc_resetstates(mqc); +- opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); +- opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); +- opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); +- } +- if (++passtype == 3) { +- passtype = 0; +- bpno_plus_one--; +- } ++ if( t1->w == 64 && t1->h == 64 ) ++ { ++ for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { ++ switch (passtype) { ++ case 0: ++ if (type == T1_TYPE_RAW) { ++ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ } else { ++ if (cblksty & J2K_CCP_CBLKSTY_VSC) { ++ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one); ++ } else { ++ opj_t1_dec_sigpass_mqc_64x64(t1, bpno_plus_one); ++ } ++ } ++ break; ++ case 1: ++ if (type == T1_TYPE_RAW) { ++ opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ } else { ++ if (cblksty & J2K_CCP_CBLKSTY_VSC) { ++ opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); ++ } else { ++ opj_t1_dec_refpass_mqc_64x64(t1, bpno_plus_one); ++ } ++ } ++ break; ++ case 2: ++ opj_t1_dec_clnpass_64x64(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ break; ++ } ++ ++ if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { ++ opj_mqc_resetstates(mqc); ++ opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); ++ opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); ++ opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); ++ } ++ if (++passtype == 3) { ++ passtype = 0; ++ bpno_plus_one--; ++ } ++ } ++ } ++ else ++ { ++ for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { ++ switch (passtype) { ++ case 0: ++ if (type == T1_TYPE_RAW) { ++ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ } else { ++ if (cblksty & J2K_CCP_CBLKSTY_VSC) { ++ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one); ++ } else { ++ opj_t1_dec_sigpass_mqc_generic(t1, bpno_plus_one); ++ } ++ } ++ break; ++ case 1: ++ if (type == T1_TYPE_RAW) { ++ opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ } else { ++ if (cblksty & J2K_CCP_CBLKSTY_VSC) { ++ opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); ++ } else { ++ opj_t1_dec_refpass_mqc_generic(t1, bpno_plus_one); ++ } ++ } ++ break; ++ case 2: ++ opj_t1_dec_clnpass_generic(t1, bpno_plus_one, (OPJ_INT32)cblksty); ++ break; ++ } ++ ++ if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { ++ opj_mqc_resetstates(mqc); ++ opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); ++ opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); ++ opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); ++ } ++ if (++passtype == 3) { ++ passtype = 0; ++ bpno_plus_one--; ++ } ++ } + } + } + return OPJ_TRUE; +@@ -1585,6 +1984,8 @@ static void opj_t1_encode_cblk(opj_t1_t *t1, + OPJ_BYTE type = T1_TYPE_MQ; + OPJ_FLOAT64 tempwmsedec; + ++ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256; ++ + max = 0; + for (i = 0; i < t1->w; ++i) { + for (j = 0; j < t1->h; ++j) { +@@ -1611,13 +2012,13 @@ static void opj_t1_encode_cblk(opj_t1_t *t1, + + switch (passtype) { + case 0: +- opj_t1_enc_sigpass(t1, bpno, orient, &nmsedec, type, cblksty); ++ opj_t1_enc_sigpass(t1, bpno, &nmsedec, type, cblksty); + break; + case 1: + opj_t1_enc_refpass(t1, bpno, &nmsedec, type, cblksty); + break; + case 2: +- opj_t1_enc_clnpass(t1, bpno, orient, &nmsedec, cblksty); ++ opj_t1_enc_clnpass(t1, bpno, &nmsedec, cblksty); + /* code switch SEGMARK (i.e. SEGSYM) */ + if (cblksty & J2K_CCP_CBLKSTY_SEGSYM) + opj_mqc_segmark_enc(mqc); +diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h +index 3bc0ad9..5afc649 100644 +--- a/src/lib/openjp2/t1.h ++++ b/src/lib/openjp2/t1.h +@@ -50,6 +50,9 @@ in T1.C are used by some function in TCD.C. + /* ----------------------------------------------------------------------- */ + #define T1_NMSEDEC_BITS 7 + ++/* CAUTION: the value of those constants must not be changed, otherwise the */ ++/* optimization of opj_t1_updateflags() will break! */ ++/* BEGINNING of flags that apply to opj_flag_t */ + #define T1_SIG_NE 0x0001 /**< Context orientation : North-East direction */ + #define T1_SIG_SE 0x0002 /**< Context orientation : South-East direction */ + #define T1_SIG_SW 0x0004 /**< Context orientation : South-West direction */ +@@ -67,9 +70,10 @@ in T1.C are used by some function in TCD.C. + #define T1_SGN_W 0x0800 + #define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W) + +-#define T1_SIG 0x1000 +-#define T1_REFINE 0x2000 +-#define T1_VISIT 0x4000 ++#define T1_SIG 0x1000 /**< No longer used by decoder */ ++#define T1_REFINE 0x2000 /**< No longer used by decoder */ ++#define T1_VISIT 0x4000 /**< No longer used by decoder */ ++/* END of flags that apply to opj_flag_t */ + + #define T1_NUMCTXS_ZC 9 + #define T1_NUMCTXS_SC 5 +@@ -89,10 +93,32 @@ in T1.C are used by some function in TCD.C. + #define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */ + #define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/ + ++/* Those flags are used by opj_colflag_t */ ++#define T1_COLFLAG_RBS 4 /* RBS = Row Bit Shift */ ++#define T1_COLFLAG_SIG_OTHER_ROW_0 (1 << 0) /**< This sample has at least one significant neighbour */ ++#define T1_COLFLAG_SIG_ROW_0 (1 << 1) /**< This sample is significant */ ++#define T1_COLFLAG_VISIT_ROW_0 (1 << 2) /**< This sample has been visited */ ++#define T1_COLFLAG_REFINE_ROW_0 (1 << 3) /**< This sample has been refined */ ++#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << T1_COLFLAG_RBS) ++#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << T1_COLFLAG_RBS) ++#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << T1_COLFLAG_RBS) ++#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << T1_COLFLAG_RBS) ++#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3*T1_COLFLAG_RBS)) ++#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3*T1_COLFLAG_RBS)) ++ + /* ----------------------------------------------------------------------- */ + + typedef OPJ_INT16 opj_flag_t; + ++/** Flags for 4 consecutive rows of a column */ ++typedef OPJ_UINT16 opj_colflag_t; ++ + /** + Tier-1 coding (coding of code-block coefficients) + */ +@@ -105,11 +131,17 @@ typedef struct opj_t1 { + + OPJ_INT32 *data; + opj_flag_t *flags; ++ /** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3, ++ colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ... ++ This array avoids too much cache trashing when processing by 4 vertical samples ++ as done in the various decoding steps. */ ++ opj_colflag_t* colflags; + OPJ_UINT32 w; + OPJ_UINT32 h; + OPJ_UINT32 datasize; + OPJ_UINT32 flagssize; + OPJ_UINT32 flags_stride; ++ OPJ_UINT32 colflags_size; + OPJ_UINT32 data_stride; + OPJ_BOOL encoder; + } opj_t1_t; +@@ -140,7 +172,8 @@ Decode the code-blocks of a tile + @param tilec The tile to decode + @param tccp Tile coding parameters + */ +-OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, ++void opj_t1_decode_cblks( opj_thread_pool_t* tp, ++ volatile OPJ_BOOL* pret, + opj_tcd_tilecomp_t* tilec, + opj_tccp_t* tccp); + +diff --git a/src/lib/openjp2/t1_generate_luts.c b/src/lib/openjp2/t1_generate_luts.c +index cba7245..1e6e7b0 100644 +--- a/src/lib/openjp2/t1_generate_luts.c ++++ b/src/lib/openjp2/t1_generate_luts.c +@@ -216,7 +216,7 @@ int main(int argc, char **argv) + } + } + +- printf("static OPJ_BYTE lut_ctxno_zc[1024] = {\n "); ++ printf("static const OPJ_BYTE lut_ctxno_zc[1024] = {\n "); + for (i = 0; i < 1023; ++i) { + printf("%i, ", lut_ctxno_zc[i]); + if(!((i+1)&0x1f)) +@@ -225,7 +225,7 @@ int main(int argc, char **argv) + printf("%i\n};\n\n", lut_ctxno_zc[1023]); + + /* lut_ctxno_sc */ +- printf("static OPJ_BYTE lut_ctxno_sc[256] = {\n "); ++ printf("static const OPJ_BYTE lut_ctxno_sc[256] = {\n "); + for (i = 0; i < 255; ++i) { + printf("0x%x, ", t1_init_ctxno_sc(i << 4)); + if(!((i+1)&0xf)) +@@ -234,7 +234,7 @@ int main(int argc, char **argv) + printf("0x%x\n};\n\n", t1_init_ctxno_sc(255 << 4)); + + /* lut_spb */ +- printf("static OPJ_BYTE lut_spb[256] = {\n "); ++ printf("static const OPJ_BYTE lut_spb[256] = {\n "); + for (i = 0; i < 255; ++i) { + printf("%i, ", t1_init_spb(i << 4)); + if(!((i+1)&0x1f)) +@@ -268,16 +268,16 @@ int main(int argc, char **argv) + (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0)); + } + +- printf("static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n "); ++ printf("static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n "); + dump_array16(lut_nmsedec_sig, 1 << T1_NMSEDEC_BITS); + +- printf("static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n "); ++ printf("static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n "); + dump_array16(lut_nmsedec_sig0, 1 << T1_NMSEDEC_BITS); + +- printf("static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n "); ++ printf("static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n "); + dump_array16(lut_nmsedec_ref, 1 << T1_NMSEDEC_BITS); + +- printf("static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n "); ++ printf("static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n "); + dump_array16(lut_nmsedec_ref0, 1 << T1_NMSEDEC_BITS); + + return 0; +diff --git a/src/lib/openjp2/t1_luts.h b/src/lib/openjp2/t1_luts.h +index 37776b6..c66a8ae 100644 +--- a/src/lib/openjp2/t1_luts.h ++++ b/src/lib/openjp2/t1_luts.h +@@ -1,6 +1,6 @@ + /* This file was automatically generated by t1_generate_luts.c */ + +-static OPJ_BYTE lut_ctxno_zc[1024] = { ++static const OPJ_BYTE lut_ctxno_zc[1024] = { + 0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +@@ -35,7 +35,7 @@ static OPJ_BYTE lut_ctxno_zc[1024] = { + 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8 + }; + +-static OPJ_BYTE lut_ctxno_sc[256] = { ++static const OPJ_BYTE lut_ctxno_sc[256] = { + 0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd, + 0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc, + 0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa, +@@ -54,7 +54,7 @@ static OPJ_BYTE lut_ctxno_sc[256] = { + 0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd + }; + +-static OPJ_BYTE lut_spb[256] = { ++static const OPJ_BYTE lut_spb[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +@@ -65,7 +65,7 @@ static OPJ_BYTE lut_spb[256] = { + 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + +-static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { ++static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +@@ -84,7 +84,7 @@ static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { + 0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680 + }; + +-static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { ++static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080, + 0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200, + 0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400, +@@ -103,7 +103,7 @@ static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { + 0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00 + }; + +-static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { ++static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { + 0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480, + 0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080, + 0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80, +@@ -122,7 +122,7 @@ static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { + 0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780 + }; + +-static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = { ++static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = { + 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980, + 0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300, + 0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00, +diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c +index b8cd307..2980f72 100644 +--- a/src/lib/openjp2/tcd.c ++++ b/src/lib/openjp2/tcd.c +@@ -580,7 +580,8 @@ OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd, + + OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, + opj_image_t * p_image, +- opj_cp_t * p_cp ) ++ opj_cp_t * p_cp, ++ opj_thread_pool_t* p_tp ) + { + p_tcd->image = p_image; + p_tcd->cp = p_cp; +@@ -597,6 +598,7 @@ OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, + + p_tcd->tcd_image->tiles->numcomps = p_image->numcomps; + p_tcd->tp_pos = p_cp->m_specific_param.m_enc.m_tp_pos; ++ p_tcd->thread_pool = p_tp; + + return OPJ_TRUE; + } +@@ -1566,30 +1568,22 @@ static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd, + static OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t *p_tcd ) + { + OPJ_UINT32 compno; +- opj_t1_t * l_t1; + opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles; + opj_tcd_tilecomp_t* l_tile_comp = l_tile->comps; + opj_tccp_t * l_tccp = p_tcd->tcp->tccps; +- +- +- l_t1 = opj_t1_create(OPJ_FALSE); +- if (l_t1 == 00) { +- return OPJ_FALSE; +- } ++ volatile OPJ_BOOL ret = OPJ_TRUE; + + for (compno = 0; compno < l_tile->numcomps; ++compno) { +- /* The +3 is headroom required by the vectorized DWT */ +- if (OPJ_FALSE == opj_t1_decode_cblks(l_t1, l_tile_comp, l_tccp)) { +- opj_t1_destroy(l_t1); +- return OPJ_FALSE; +- } ++ opj_t1_decode_cblks(p_tcd->thread_pool, &ret, l_tile_comp, l_tccp); ++ if( !ret ) ++ break; + ++l_tile_comp; + ++l_tccp; + } + +- opj_t1_destroy(l_t1); ++ opj_thread_pool_wait_completion(p_tcd->thread_pool, 0); + +- return OPJ_TRUE; ++ return ret; + } + + +@@ -1616,7 +1610,7 @@ static OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd ) + */ + + if (l_tccp->qmfbid == 1) { +- if (! opj_dwt_decode(l_tile_comp, l_img_comp->resno_decoded+1)) { ++ if (! opj_dwt_decode(p_tcd->thread_pool, l_tile_comp, l_img_comp->resno_decoded+1)) { + return OPJ_FALSE; + } + } +diff --git a/src/lib/openjp2/tcd.h b/src/lib/openjp2/tcd.h +index 07f8379..77817bf 100644 +--- a/src/lib/openjp2/tcd.h ++++ b/src/lib/openjp2/tcd.h +@@ -220,6 +220,8 @@ typedef struct opj_tcd + OPJ_UINT32 tcd_tileno; + /** tell if the tcd is a decoder. */ + OPJ_UINT32 m_is_decoder : 1; ++ /** Thread pool */ ++ opj_thread_pool_t* thread_pool; + } opj_tcd_t; + + /** @name Exported functions */ +@@ -249,12 +251,14 @@ void opj_tcd_destroy(opj_tcd_t *tcd); + * @param p_tcd TCD handle. + * @param p_image raw image. + * @param p_cp coding parameters. ++ * @param p_tp thread pool + * + * @return true if the encoding values could be set (false otherwise). + */ + OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, + opj_image_t * p_image, +- opj_cp_t * p_cp ); ++ opj_cp_t * p_cp, ++ opj_thread_pool_t* p_tp); + + /** + * Allocates memory for decoding a specific tile. +diff --git a/src/lib/openjp2/thread.c b/src/lib/openjp2/thread.c +new file mode 100644 +index 0000000..b2f8b5b +--- /dev/null ++++ b/src/lib/openjp2/thread.c +@@ -0,0 +1,959 @@ ++/* ++ * The copyright in this software is being made available under the 2-clauses ++ * BSD License, included below. This software may be subject to other third ++ * party and contributor rights, including patent rights, and no such rights ++ * are granted under this license. ++ * ++ * Copyright (c) 2016, Even Rouault ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include "opj_includes.h" ++ ++#include "thread.h" ++#include <assert.h> ++ ++#ifdef MUTEX_win32 ++ ++/* Some versions of x86_64-w64-mingw32-gc -m32 resolve InterlockedCompareExchange() */ ++/* as __sync_val_compare_and_swap_4 but fails to link it. As this protects against */ ++/* a rather unlikely race, skip it */ ++#if !(defined(__MINGW32__) && defined(__i386__)) ++#define HAVE_INTERLOCKED_COMPARE_EXCHANGE 1 ++#endif ++ ++#include <windows.h> ++ ++OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) ++{ ++ return OPJ_TRUE; ++} ++ ++int OPJ_CALLCONV opj_get_num_cpus(void) ++{ ++ SYSTEM_INFO info; ++ DWORD dwNum; ++ GetSystemInfo(&info); ++ dwNum = info.dwNumberOfProcessors; ++ if( dwNum < 1 ) ++ return 1; ++ return (int)dwNum; ++} ++ ++struct opj_mutex_t ++{ ++ CRITICAL_SECTION cs; ++}; ++ ++opj_mutex_t* opj_mutex_create(void) ++{ ++ opj_mutex_t* mutex = (opj_mutex_t*) opj_malloc(sizeof(opj_mutex_t)); ++ if( !mutex ) ++ return NULL; ++ InitializeCriticalSectionAndSpinCount(&(mutex->cs), 4000); ++ return mutex; ++} ++ ++void opj_mutex_lock(opj_mutex_t* mutex) ++{ ++ EnterCriticalSection( &(mutex->cs) ); ++} ++ ++void opj_mutex_unlock(opj_mutex_t* mutex) ++{ ++ LeaveCriticalSection( &(mutex->cs) ); ++} ++ ++void opj_mutex_destroy(opj_mutex_t* mutex) ++{ ++ if( !mutex ) return; ++ DeleteCriticalSection( &(mutex->cs) ); ++ opj_free( mutex ); ++} ++ ++struct opj_cond_waiter_list_t ++{ ++ HANDLE hEvent; ++ struct opj_cond_waiter_list_t* next; ++}; ++typedef struct opj_cond_waiter_list_t opj_cond_waiter_list_t; ++ ++struct opj_cond_t ++{ ++ opj_mutex_t *internal_mutex; ++ opj_cond_waiter_list_t *waiter_list; ++}; ++ ++static DWORD TLSKey = 0; ++static volatile LONG inTLSLockedSection = 0; ++static volatile int TLSKeyInit = OPJ_FALSE; ++ ++opj_cond_t* opj_cond_create(void) ++{ ++ opj_cond_t* cond = (opj_cond_t*) opj_malloc(sizeof(opj_cond_t)); ++ if( !cond ) ++ return NULL; ++ ++ /* Make sure that the TLS key is allocated in a thread-safe way */ ++ /* We cannot use a global mutex/critical section since its creation itself would not be */ ++ /* thread-safe, so use InterlockedCompareExchange trick */ ++ while( OPJ_TRUE ) ++ { ++ ++#if HAVE_INTERLOCKED_COMPARE_EXCHANGE ++ if( InterlockedCompareExchange(&inTLSLockedSection, 1, 0) == 0 ) ++#endif ++ { ++ if( !TLSKeyInit ) ++ { ++ TLSKey = TlsAlloc(); ++ TLSKeyInit = OPJ_TRUE; ++ } ++#if HAVE_INTERLOCKED_COMPARE_EXCHANGE ++ InterlockedCompareExchange(&inTLSLockedSection, 0, 1); ++#endif ++ break; ++ } ++ } ++ ++ if( TLSKey == TLS_OUT_OF_INDEXES ) ++ { ++ opj_free(cond); ++ return NULL; ++ } ++ cond->internal_mutex = opj_mutex_create(); ++ if (cond->internal_mutex == NULL) ++ { ++ opj_free(cond); ++ return NULL; ++ } ++ cond->waiter_list = NULL; ++ return cond; ++} ++ ++void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) ++{ ++ opj_cond_waiter_list_t* item; ++ HANDLE hEvent = (HANDLE) TlsGetValue( TLSKey ); ++ if (hEvent == NULL) ++ { ++ hEvent = CreateEvent(NULL, /* security attributes */ ++ 0, /* manual reset = no */ ++ 0, /* initial state = unsignaled */ ++ NULL /* no name */); ++ assert(hEvent); ++ ++ TlsSetValue( TLSKey, hEvent ); ++ } ++ ++ /* Insert the waiter into the waiter list of the condition */ ++ opj_mutex_lock(cond->internal_mutex); ++ ++ item = (opj_cond_waiter_list_t*)opj_malloc(sizeof(opj_cond_waiter_list_t)); ++ assert(item != NULL); ++ ++ item->hEvent = hEvent; ++ item->next = cond->waiter_list; ++ ++ cond->waiter_list = item; ++ ++ opj_mutex_unlock(cond->internal_mutex); ++ ++ /* Release the client mutex before waiting for the event being signaled */ ++ opj_mutex_unlock(mutex); ++ ++ /* Ideally we would check that we do not get WAIT_FAILED but it is hard */ ++ /* to report a failure. */ ++ WaitForSingleObject(hEvent, INFINITE); ++ ++ /* Reacquire the client mutex */ ++ opj_mutex_lock(mutex); ++} ++ ++void opj_cond_signal(opj_cond_t* cond) ++{ ++ opj_cond_waiter_list_t* psIter; ++ ++ /* Signal the first registered event, and remove it from the list */ ++ opj_mutex_lock(cond->internal_mutex); ++ ++ psIter = cond->waiter_list; ++ if (psIter != NULL) ++ { ++ SetEvent(psIter->hEvent); ++ cond->waiter_list = psIter->next; ++ opj_free(psIter); ++ } ++ ++ opj_mutex_unlock(cond->internal_mutex); ++} ++ ++void opj_cond_destroy(opj_cond_t* cond) ++{ ++ if( !cond ) return; ++ opj_mutex_destroy(cond->internal_mutex); ++ assert(cond->waiter_list == NULL); ++ opj_free(cond); ++} ++ ++struct opj_thread_t ++{ ++ opj_thread_fn thread_fn; ++ void* user_data; ++ HANDLE hThread; ++}; ++ ++static DWORD WINAPI opj_thread_callback_adapter( void *info ) ++{ ++ opj_thread_t* thread = (opj_thread_t*) info; ++ HANDLE hEvent = NULL; ++ ++ thread->thread_fn( thread->user_data ); ++ ++ /* Free the handle possible allocated by a cond */ ++ while( OPJ_TRUE ) ++ { ++ /* Make sure TLSKey is not being created just at that moment... */ ++#if HAVE_INTERLOCKED_COMPARE_EXCHANGE ++ if( InterlockedCompareExchange(&inTLSLockedSection, 1, 0) == 0 ) ++#endif ++ { ++ if( TLSKeyInit ) ++ { ++ hEvent = (HANDLE) TlsGetValue( TLSKey ); ++ } ++#if HAVE_INTERLOCKED_COMPARE_EXCHANGE ++ InterlockedCompareExchange(&inTLSLockedSection, 0, 1); ++#endif ++ break; ++ } ++ } ++ if( hEvent ) ++ CloseHandle(hEvent); ++ ++ return 0; ++} ++ ++opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) ++{ ++ opj_thread_t* thread; ++ DWORD nThreadId = 0; ++ ++ assert( thread_fn ); ++ ++ thread = (opj_thread_t*) opj_malloc( sizeof(opj_thread_t) ); ++ if( !thread ) ++ return NULL; ++ thread->thread_fn = thread_fn; ++ thread->user_data = user_data; ++ ++ thread->hThread = CreateThread( NULL, 0, opj_thread_callback_adapter, thread, ++ 0, &nThreadId ); ++ ++ if( thread->hThread == NULL ) ++ { ++ opj_free( thread ); ++ return NULL; ++ } ++ return thread; ++} ++ ++void opj_thread_join( opj_thread_t* thread ) ++{ ++ WaitForSingleObject(thread->hThread, INFINITE); ++ CloseHandle( thread->hThread ); ++ ++ opj_free(thread); ++} ++ ++#elif MUTEX_pthread ++ ++#include <pthread.h> ++#include <stdlib.h> ++#include <unistd.h> ++ ++OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) ++{ ++ return OPJ_TRUE; ++} ++ ++int OPJ_CALLCONV opj_get_num_cpus(void) ++{ ++#ifdef _SC_NPROCESSORS_ONLN ++ return (int)sysconf(_SC_NPROCESSORS_ONLN); ++#else ++ return 1; ++#endif ++} ++ ++struct opj_mutex_t ++{ ++ pthread_mutex_t mutex; ++}; ++ ++opj_mutex_t* opj_mutex_create(void) ++{ ++ opj_mutex_t* mutex = (opj_mutex_t*) opj_malloc(sizeof(opj_mutex_t)); ++ if( !mutex ) ++ return NULL; ++ pthread_mutex_t pthr_mutex = PTHREAD_MUTEX_INITIALIZER; ++ mutex->mutex = pthr_mutex; ++ return mutex; ++} ++ ++void opj_mutex_lock(opj_mutex_t* mutex) ++{ ++ pthread_mutex_lock(&(mutex->mutex)); ++} ++ ++void opj_mutex_unlock(opj_mutex_t* mutex) ++{ ++ pthread_mutex_unlock(&(mutex->mutex)); ++} ++ ++void opj_mutex_destroy(opj_mutex_t* mutex) ++{ ++ if( !mutex ) return; ++ pthread_mutex_destroy(&(mutex->mutex)); ++ opj_free(mutex); ++} ++ ++struct opj_cond_t ++{ ++ pthread_cond_t cond; ++}; ++ ++opj_cond_t* opj_cond_create(void) ++{ ++ opj_cond_t* cond = (opj_cond_t*) opj_malloc(sizeof(opj_cond_t)); ++ if( !cond ) ++ return NULL; ++ if( pthread_cond_init(&(cond->cond), NULL) != 0 ) ++ { ++ opj_free(cond); ++ return NULL; ++ } ++ return cond; ++} ++ ++void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) ++{ ++ pthread_cond_wait(&(cond->cond), &(mutex->mutex)); ++} ++ ++void opj_cond_signal(opj_cond_t* cond) ++{ ++ int ret = pthread_cond_signal(&(cond->cond)); ++ (void)ret; ++ assert(ret == 0); ++} ++ ++void opj_cond_destroy(opj_cond_t* cond) ++{ ++ if( !cond ) return; ++ pthread_cond_destroy(&(cond->cond)); ++ opj_free(cond); ++} ++ ++ ++struct opj_thread_t ++{ ++ opj_thread_fn thread_fn; ++ void* user_data; ++ pthread_t thread; ++}; ++ ++static void* opj_thread_callback_adapter( void* info ) ++{ ++ opj_thread_t* thread = (opj_thread_t*) info; ++ thread->thread_fn( thread->user_data ); ++ return NULL; ++} ++ ++opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) ++{ ++ pthread_attr_t attr; ++ opj_thread_t* thread; ++ ++ assert( thread_fn ); ++ ++ thread = (opj_thread_t*) opj_malloc( sizeof(opj_thread_t) ); ++ if( !thread ) ++ return NULL; ++ thread->thread_fn = thread_fn; ++ thread->user_data = user_data; ++ ++ pthread_attr_init( &attr ); ++ pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); ++ if( pthread_create( &(thread->thread), &attr, ++ opj_thread_callback_adapter, (void *) thread ) != 0 ) ++ { ++ opj_free( thread ); ++ return NULL; ++ } ++ return thread; ++} ++ ++void opj_thread_join( opj_thread_t* thread ) ++{ ++ void* status; ++ pthread_join( thread->thread, &status); ++ ++ opj_free(thread); ++} ++ ++#else ++/* Stub implementation */ ++ ++OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) ++{ ++ return OPJ_FALSE; ++} ++ ++int OPJ_CALLCONV opj_get_num_cpus(void) ++{ ++ return 1; ++} ++ ++opj_mutex_t* opj_mutex_create(void) ++{ ++ return NULL; ++} ++ ++void opj_mutex_lock(opj_mutex_t* mutex) ++{ ++ (void) mutex; ++} ++ ++void opj_mutex_unlock(opj_mutex_t* mutex) ++{ ++ (void) mutex; ++} ++ ++void opj_mutex_destroy(opj_mutex_t* mutex) ++{ ++ (void) mutex; ++} ++ ++opj_cond_t* opj_cond_create(void) ++{ ++ return NULL; ++} ++ ++void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) ++{ ++ (void) cond; ++ (void) mutex; ++} ++ ++void opj_cond_signal(opj_cond_t* cond) ++{ ++ (void) cond; ++} ++ ++void opj_cond_destroy(opj_cond_t* cond) ++{ ++ (void) cond; ++} ++ ++opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) ++{ ++ (void) thread_fn; ++ (void) user_data; ++ return NULL; ++} ++ ++void opj_thread_join( opj_thread_t* thread ) ++{ ++ (void) thread; ++} ++ ++#endif ++ ++typedef struct ++{ ++ int key; ++ void* value; ++ opj_tls_free_func opj_free_func; ++} opj_tls_key_val_t; ++ ++struct opj_tls_t ++{ ++ opj_tls_key_val_t* key_val; ++ int key_val_count; ++}; ++ ++static opj_tls_t* opj_tls_new(void) ++{ ++ return (opj_tls_t*) opj_calloc(1, sizeof(opj_tls_t)); ++} ++ ++static void opj_tls_destroy(opj_tls_t* tls) ++{ ++ int i; ++ if( !tls ) return; ++ for(i=0;i<tls->key_val_count;i++) ++ { ++ if( tls->key_val[i].opj_free_func ) ++ tls->key_val[i].opj_free_func(tls->key_val[i].value); ++ } ++ opj_free(tls->key_val); ++ opj_free(tls); ++} ++ ++void* opj_tls_get(opj_tls_t* tls, int key) ++{ ++ int i; ++ for(i=0;i<tls->key_val_count;i++) ++ { ++ if( tls->key_val[i].key == key ) ++ return tls->key_val[i].value; ++ } ++ return NULL; ++} ++ ++OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value, opj_tls_free_func opj_free_func) ++{ ++ opj_tls_key_val_t* new_key_val; ++ int i; ++ for(i=0;i<tls->key_val_count;i++) ++ { ++ if( tls->key_val[i].key == key ) ++ { ++ if( tls->key_val[i].opj_free_func ) ++ tls->key_val[i].opj_free_func(tls->key_val[i].value); ++ tls->key_val[i].value = value; ++ tls->key_val[i].opj_free_func = opj_free_func; ++ return OPJ_TRUE; ++ } ++ } ++ new_key_val = (opj_tls_key_val_t*) opj_realloc( tls->key_val, ++ (tls->key_val_count + 1) * sizeof(opj_tls_key_val_t) ); ++ if( !new_key_val ) ++ return OPJ_FALSE; ++ tls->key_val = new_key_val; ++ new_key_val[tls->key_val_count].key = key; ++ new_key_val[tls->key_val_count].value = value; ++ new_key_val[tls->key_val_count].opj_free_func = opj_free_func; ++ tls->key_val_count ++; ++ return OPJ_TRUE; ++} ++ ++ ++typedef struct ++{ ++ opj_job_fn job_fn; ++ void *user_data; ++} opj_worker_thread_job_t; ++ ++typedef struct ++{ ++ opj_thread_pool_t *tp; ++ opj_thread_t *thread; ++ int marked_as_waiting; ++ ++ opj_mutex_t *mutex; ++ opj_cond_t *cond; ++} opj_worker_thread_t; ++ ++typedef enum ++{ ++ OPJWTS_OK, ++ OPJWTS_STOP, ++ OPJWTS_ERROR ++} opj_worker_thread_state; ++ ++struct opj_job_list_t ++{ ++ opj_worker_thread_job_t* job; ++ struct opj_job_list_t* next; ++}; ++typedef struct opj_job_list_t opj_job_list_t; ++ ++struct opj_worker_thread_list_t ++{ ++ opj_worker_thread_t* worker_thread; ++ struct opj_worker_thread_list_t* next; ++}; ++typedef struct opj_worker_thread_list_t opj_worker_thread_list_t; ++ ++struct opj_thread_pool_t ++{ ++ opj_worker_thread_t* worker_threads; ++ int worker_threads_count; ++ opj_cond_t* cond; ++ opj_mutex_t* mutex; ++ volatile opj_worker_thread_state state; ++ opj_job_list_t* job_queue; ++ volatile int pending_jobs_count; ++ opj_worker_thread_list_t* waiting_worker_thread_list; ++ int waiting_worker_thread_count; ++ opj_tls_t* tls; ++ int signaling_threshold; ++}; ++ ++static OPJ_BOOL opj_thread_pool_setup(opj_thread_pool_t* tp, int num_threads); ++static opj_worker_thread_job_t* opj_thread_pool_get_next_job(opj_thread_pool_t* tp, ++ opj_worker_thread_t* worker_thread, ++ OPJ_BOOL signal_job_finished); ++ ++opj_thread_pool_t* opj_thread_pool_create(int num_threads) ++{ ++ opj_thread_pool_t* tp; ++ ++ tp = (opj_thread_pool_t*) opj_calloc(1, sizeof(opj_thread_pool_t)); ++ if( !tp ) ++ return NULL; ++ tp->state = OPJWTS_OK; ++ ++ if( num_threads <= 0 ) ++ { ++ tp->tls = opj_tls_new(); ++ if( !tp->tls ) ++ { ++ opj_free(tp); ++ tp = NULL; ++ } ++ return tp; ++ } ++ ++ tp->mutex = opj_mutex_create(); ++ if( !tp->mutex ) ++ { ++ opj_free(tp); ++ return NULL; ++ } ++ if( !opj_thread_pool_setup(tp, num_threads) ) ++ { ++ opj_thread_pool_destroy(tp); ++ return NULL; ++ } ++ return tp; ++} ++ ++static void opj_worker_thread_function(void* user_data) ++{ ++ opj_worker_thread_t* worker_thread; ++ opj_thread_pool_t* tp; ++ opj_tls_t* tls; ++ OPJ_BOOL job_finished = OPJ_FALSE; ++ ++ worker_thread = (opj_worker_thread_t* ) user_data; ++ tp = worker_thread->tp; ++ tls = opj_tls_new(); ++ ++ while( OPJ_TRUE ) ++ { ++ opj_worker_thread_job_t* job = opj_thread_pool_get_next_job(tp, worker_thread, job_finished); ++ if( job == NULL ) ++ break; ++ ++ if( job->job_fn ) ++ { ++ job->job_fn(job->user_data, tls); ++ } ++ opj_free(job); ++ job_finished = OPJ_TRUE; ++ } ++ ++ opj_tls_destroy(tls); ++} ++ ++static OPJ_BOOL opj_thread_pool_setup(opj_thread_pool_t* tp, int num_threads) ++{ ++ int i; ++ OPJ_BOOL bRet = OPJ_TRUE; ++ ++ assert( num_threads > 0 ); ++ ++ tp->cond = opj_cond_create(); ++ if( tp->cond == NULL ) ++ return OPJ_FALSE; ++ ++ tp->worker_threads = (opj_worker_thread_t*) opj_calloc( num_threads, ++ sizeof(opj_worker_thread_t) ); ++ if( tp->worker_threads == NULL ) ++ return OPJ_FALSE; ++ tp->worker_threads_count = num_threads; ++ ++ for(i=0;i<num_threads;i++) ++ { ++ tp->worker_threads[i].tp = tp; ++ ++ tp->worker_threads[i].mutex = opj_mutex_create(); ++ if( tp->worker_threads[i].mutex == NULL ) ++ { ++ tp->worker_threads_count = i; ++ bRet = OPJ_FALSE; ++ break; ++ } ++ ++ tp->worker_threads[i].cond = opj_cond_create(); ++ if( tp->worker_threads[i].cond == NULL ) ++ { ++ opj_mutex_destroy(tp->worker_threads[i].mutex); ++ tp->worker_threads_count = i; ++ bRet = OPJ_FALSE; ++ break; ++ } ++ ++ tp->worker_threads[i].marked_as_waiting = OPJ_FALSE; ++ ++ tp->worker_threads[i].thread = opj_thread_create(opj_worker_thread_function, ++ &(tp->worker_threads[i])); ++ if( tp->worker_threads[i].thread == NULL ) ++ { ++ tp->worker_threads_count = i; ++ bRet = OPJ_FALSE; ++ break; ++ } ++ } ++ ++ /* Wait all threads to be started */ ++ /* printf("waiting for all threads to be started\n"); */ ++ opj_mutex_lock(tp->mutex); ++ while( tp->waiting_worker_thread_count < num_threads ) ++ { ++ opj_cond_wait(tp->cond, tp->mutex); ++ } ++ opj_mutex_unlock(tp->mutex); ++ /* printf("all threads started\n"); */ ++ ++ if( tp->state == OPJWTS_ERROR ) ++ bRet = OPJ_FALSE; ++ ++ return bRet; ++} ++ ++/* ++void opj_waiting() ++{ ++ printf("waiting!\n"); ++} ++*/ ++ ++static opj_worker_thread_job_t* opj_thread_pool_get_next_job(opj_thread_pool_t* tp, ++ opj_worker_thread_t* worker_thread, ++ OPJ_BOOL signal_job_finished) ++{ ++ while( OPJ_TRUE ) ++ { ++ opj_job_list_t* top_job_iter; ++ ++ opj_mutex_lock(tp->mutex); ++ ++ if( signal_job_finished ) ++ { ++ signal_job_finished = OPJ_FALSE; ++ tp->pending_jobs_count --; ++ /*printf("tp=%p, remaining jobs: %d\n", tp, tp->pending_jobs_count);*/ ++ if( tp->pending_jobs_count <= tp->signaling_threshold ) ++ opj_cond_signal(tp->cond); ++ } ++ ++ if( tp->state == OPJWTS_STOP ) ++ { ++ opj_mutex_unlock(tp->mutex); ++ return NULL; ++ } ++ top_job_iter = tp->job_queue; ++ if( top_job_iter ) ++ { ++ opj_worker_thread_job_t* job; ++ tp->job_queue = top_job_iter->next; ++ ++ job = top_job_iter->job; ++ opj_mutex_unlock(tp->mutex); ++ opj_free(top_job_iter); ++ return job; ++ } ++ ++ /* opj_waiting(); */ ++ if( !worker_thread->marked_as_waiting ) ++ { ++ opj_worker_thread_list_t* item; ++ ++ worker_thread->marked_as_waiting = OPJ_TRUE; ++ tp->waiting_worker_thread_count ++; ++ assert(tp->waiting_worker_thread_count <= tp->worker_threads_count); ++ ++ item= (opj_worker_thread_list_t*) opj_malloc(sizeof(opj_worker_thread_list_t)); ++ if( item == NULL ) ++ { ++ tp->state = OPJWTS_ERROR; ++ opj_cond_signal(tp->cond); ++ ++ opj_mutex_unlock(tp->mutex); ++ return NULL; ++ } ++ ++ item->worker_thread = worker_thread; ++ item->next = tp->waiting_worker_thread_list; ++ tp->waiting_worker_thread_list = item; ++ } ++ ++ /* printf("signaling that worker thread is ready\n"); */ ++ opj_cond_signal(tp->cond); ++ ++ opj_mutex_lock(worker_thread->mutex); ++ opj_mutex_unlock(tp->mutex); ++ ++ /* printf("waiting for job\n"); */ ++ opj_cond_wait( worker_thread->cond, worker_thread->mutex ); ++ ++ opj_mutex_unlock(worker_thread->mutex); ++ /* printf("got job\n"); */ ++ } ++} ++ ++OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, ++ opj_job_fn job_fn, ++ void* user_data) ++{ ++ opj_worker_thread_job_t* job; ++ opj_job_list_t* item; ++ ++ if( tp->mutex == NULL ) ++ { ++ job_fn( user_data, tp->tls ); ++ return OPJ_TRUE; ++ } ++ ++ job = (opj_worker_thread_job_t*)opj_malloc(sizeof(opj_worker_thread_job_t)); ++ if( job == NULL ) ++ return OPJ_FALSE; ++ job->job_fn = job_fn; ++ job->user_data = user_data; ++ ++ item = (opj_job_list_t*) opj_malloc(sizeof(opj_job_list_t)); ++ if( item == NULL ) ++ { ++ opj_free(job); ++ return OPJ_FALSE; ++ } ++ item->job = job; ++ ++ opj_mutex_lock(tp->mutex); ++ ++ tp->signaling_threshold = 100 * tp->worker_threads_count; ++ while( tp->pending_jobs_count > tp->signaling_threshold ) ++ { ++ /* printf("%d jobs enqueued. Waiting\n", tp->pending_jobs_count); */ ++ opj_cond_wait(tp->cond, tp->mutex); ++ /* printf("...%d jobs enqueued.\n", tp->pending_jobs_count); */ ++ } ++ ++ item->next = tp->job_queue; ++ tp->job_queue = item; ++ tp->pending_jobs_count ++; ++ ++ if( tp->waiting_worker_thread_list ) ++ { ++ opj_worker_thread_t* worker_thread; ++ opj_worker_thread_list_t* next; ++ opj_worker_thread_list_t* to_opj_free; ++ ++ worker_thread = tp->waiting_worker_thread_list->worker_thread; ++ ++ assert( worker_thread->marked_as_waiting ); ++ worker_thread->marked_as_waiting = OPJ_FALSE; ++ ++ next = tp->waiting_worker_thread_list->next; ++ to_opj_free = tp->waiting_worker_thread_list; ++ tp->waiting_worker_thread_list = next; ++ tp->waiting_worker_thread_count --; ++ ++ opj_mutex_lock(worker_thread->mutex); ++ opj_mutex_unlock(tp->mutex); ++ opj_cond_signal(worker_thread->cond); ++ opj_mutex_unlock(worker_thread->mutex); ++ ++ opj_free(to_opj_free); ++ } ++ else ++ opj_mutex_unlock(tp->mutex); ++ ++ return OPJ_TRUE; ++} ++ ++void opj_thread_pool_wait_completion(opj_thread_pool_t* tp, int max_remaining_jobs) ++{ ++ if( tp->mutex == NULL ) ++ { ++ return; ++ } ++ ++ if( max_remaining_jobs < 0 ) ++ max_remaining_jobs = 0; ++ opj_mutex_lock(tp->mutex); ++ tp->signaling_threshold = max_remaining_jobs; ++ while( tp->pending_jobs_count > max_remaining_jobs ) ++ { ++ /*printf("tp=%p, jobs before wait = %d, max_remaining_jobs = %d\n", tp, tp->pending_jobs_count, max_remaining_jobs);*/ ++ opj_cond_wait(tp->cond, tp->mutex); ++ /*printf("tp=%p, jobs after wait = %d\n", tp, tp->pending_jobs_count);*/ ++ } ++ opj_mutex_unlock(tp->mutex); ++} ++ ++int opj_thread_pool_get_thread_count(opj_thread_pool_t* tp) ++{ ++ return tp->worker_threads_count; ++} ++ ++void opj_thread_pool_destroy(opj_thread_pool_t* tp) ++{ ++ if( !tp ) return; ++ if( tp->cond ) ++ { ++ int i; ++ opj_thread_pool_wait_completion(tp, 0); ++ ++ tp->state = OPJWTS_STOP; ++ ++ for(i=0;i<tp->worker_threads_count;i++) ++ { ++ opj_mutex_lock(tp->worker_threads[i].mutex); ++ opj_cond_signal(tp->worker_threads[i].cond); ++ opj_mutex_unlock(tp->worker_threads[i].mutex); ++ opj_thread_join(tp->worker_threads[i].thread); ++ opj_cond_destroy(tp->worker_threads[i].cond); ++ opj_mutex_destroy(tp->worker_threads[i].mutex); ++ } ++ ++ opj_free(tp->worker_threads); ++ ++ while( tp->waiting_worker_thread_list != NULL ) ++ { ++ opj_worker_thread_list_t* next = tp->waiting_worker_thread_list->next; ++ opj_free( tp->waiting_worker_thread_list ); ++ tp->waiting_worker_thread_list = next; ++ } ++ ++ opj_cond_destroy(tp->cond); ++ } ++ opj_mutex_destroy(tp->mutex); ++ opj_tls_destroy(tp->tls); ++ opj_free(tp); ++} +diff --git a/src/lib/openjp2/thread.h b/src/lib/openjp2/thread.h +new file mode 100644 +index 0000000..241e6d8 +--- /dev/null ++++ b/src/lib/openjp2/thread.h +@@ -0,0 +1,253 @@ ++/* ++ * The copyright in this software is being made available under the 2-clauses ++ * BSD License, included below. This software may be subject to other third ++ * party and contributor rights, including patent rights, and no such rights ++ * are granted under this license. ++ * ++ * Copyright (c) 2016, Even Rouault ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef THREAD_H ++#define THREAD_H ++ ++#include "openjpeg.h" ++ ++/** ++@file thread.h ++@brief Thread API ++ ++The functions in thread.c have for goal to manage mutex, conditions, thread ++creation and thread pools that accept jobs. ++*/ ++ ++/** @defgroup THREAD THREAD - Mutex, conditions, threads and thread pools */ ++/*@{*/ ++ ++/** @name Mutex */ ++/*@{*/ ++ ++/** Opaque type for a mutex */ ++typedef struct opj_mutex_t opj_mutex_t; ++ ++/** Creates a mutex. ++ * @return the mutex or NULL in case of error (can for example happen if the library ++ * is built without thread support) ++ */ ++opj_mutex_t* opj_mutex_create(void); ++ ++/** Lock/acquire the mutex. ++ * @param mutex the mutex to acquire. ++ */ ++void opj_mutex_lock(opj_mutex_t* mutex); ++ ++/** Unlock/release the mutex. ++ * @param mutex the mutex to release. ++ */ ++void opj_mutex_unlock(opj_mutex_t* mutex); ++ ++/** Destroy a mutex ++ * @param mutex the mutex to destroy. ++ */ ++void opj_mutex_destroy(opj_mutex_t* mutex); ++ ++/*@}*/ ++ ++/** @name Condition */ ++/*@{*/ ++ ++/** Opaque type for a condition */ ++typedef struct opj_cond_t opj_cond_t; ++ ++/** Creates a condition. ++ * @return the condition or NULL in case of error (can for example happen if the library ++ * is built without thread support) ++ */ ++opj_cond_t* opj_cond_create(void); ++ ++/** Wait for the condition to be signaled. ++ * The semantics is the same as the POSIX pthread_cond_wait. ++ * The provided mutex *must* be acquired before calling this function, and ++ * released afterwards. ++ * The mutex will be released by this function while it must wait for the condition ++ * and reacquired afterwards. ++ * In some particular situations, the function might return even if the condition is not signaled ++ * with opj_cond_signal(), hence the need to check with an application level ++ * mechanism. ++ * ++ * Waiting thread : ++ * \code ++ * opj_mutex_lock(mutex); ++ * while( !some_application_level_condition ) ++ * { ++ * opj_cond_wait(cond, mutex); ++ * } ++ * opj_mutex_unlock(mutex); ++ * \endcode ++ * ++ * Signaling thread : ++ * \code ++ * opj_mutex_lock(mutex); ++ * some_application_level_condition = TRUE; ++ * opj_cond_signal(cond); ++ * opj_mutex_unlock(mutex); ++ * \endcode ++ * ++ * @param cond the condition to wait. ++ * @param mutex the mutex (in acquired state before calling this function) ++ */ ++void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex); ++ ++/** Signal waiting threads on a condition. ++ * One of the thread waiting with opj_cond_wait() will be waken up. ++ * It is strongly advised that this call is done with the mutex that is used ++ * by opj_cond_wait(), in a acquired state. ++ * @param cond the condition to signal. ++ */ ++void opj_cond_signal(opj_cond_t* cond); ++ ++/** Destroy a condition ++ * @param cond the condition to destroy. ++ */ ++void opj_cond_destroy(opj_cond_t* cond); ++ ++/*@}*/ ++ ++/** @name Thread */ ++/*@{*/ ++ ++/** Opaque type for a thread handle */ ++typedef struct opj_thread_t opj_thread_t; ++ ++/** User function to execute in a thread ++ * @param user_data user data provided with opj_thread_create() ++ */ ++typedef void (*opj_thread_fn)(void* user_data); ++ ++/** Creates a new thread. ++ * @param thread_fn Function to run in the new thread. ++ * @param user_data user data provided to the thread function. Might be NULL. ++ * @return a thread handle or NULL in case of failure (can for example happen if the library ++ * is built without thread support) ++ */ ++opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ); ++ ++/** Wait for a thread to be finished and release associated resources to the ++ * thread handle. ++ * @param thread the thread to wait for being finished. ++ */ ++void opj_thread_join( opj_thread_t* thread ); ++ ++/*@}*/ ++ ++/** @name Thread local storage */ ++/*@{*/ ++/** Opaque type for a thread local storage */ ++typedef struct opj_tls_t opj_tls_t; ++ ++/** Get a thread local value corresponding to the provided key. ++ * @param tls thread local storage handle ++ * @param key key whose value to retrieve. ++ * @return value associated with the key, or NULL is missing. ++ */ ++void* opj_tls_get(opj_tls_t* tls, int key); ++ ++/** Type of the function used to free a TLS value */ ++typedef void (*opj_tls_free_func)(void* value); ++ ++/** Set a thread local value corresponding to the provided key. ++ * @param tls thread local storage handle ++ * @param key key whose value to set. ++ * @param value value to set (may be NULL). ++ * @param free_func function to call currently installed value. ++ * @return OPJ_TRUE if successful. ++ */ ++OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value, opj_tls_free_func free_func); ++ ++/*@}*/ ++ ++/** @name Thread pool */ ++/*@{*/ ++ ++/** Opaque type for a thread pool */ ++typedef struct opj_thread_pool_t opj_thread_pool_t; ++ ++/** Create a new thread pool. ++ * num_thread must nominally be >= 1 to create a real thread pool. If num_threads ++ * is negative or null, then a dummy thread pool will be created. All functions ++ * operating on the thread pool will work, but job submission will be run ++ * synchronously in the calling thread. ++ * ++ * @param num_threads the number of threads to allocate for this thread pool. ++ * @return a thread pool handle, or NULL in case of failure (can for example happen if the library ++ * is built without thread support) ++ */ ++opj_thread_pool_t* opj_thread_pool_create(int num_threads); ++ ++/** User function to execute in a thread ++ * @param user_data user data provided with opj_thread_create() ++ * @param tls handle to thread local storage ++ */ ++typedef void (*opj_job_fn)(void* user_data, opj_tls_t* tls); ++ ++ ++/** Submit a new job to be run by one of the thread in the thread pool. ++ * The job ( thread_fn, user_data ) will be added in the queue of jobs managed ++ * by the thread pool, and run by the first thread that is no longer busy. ++ * ++ * @param tp the thread pool handle. ++ * @param job_fn Function to run. Must not be NULL. ++ * @param user_data User data provided to thread_fn. ++ * @return OPJ_TRUE if the job was successfully submitted. ++ */ ++OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, opj_job_fn job_fn, void* user_data); ++ ++/** Wait that no more than max_remaining_jobs jobs are remaining in the queue of ++ * the thread pool. The aim of this function is to avoid submitting too many ++ * jobs while the thread pool cannot cope fast enough with them, which would ++ * result potentially in out-of-memory situations with too many job descriptions ++ * being queued. ++ * ++ * @param tp the thread pool handle ++ * @param max_remaining_jobs maximum number of jobs allowed to be queued without waiting. ++ */ ++void opj_thread_pool_wait_completion(opj_thread_pool_t* tp, int max_remaining_jobs); ++ ++/** Return the number of threads associated with the thread pool. ++ * ++ * @param tp the thread pool handle. ++ * @return number of threads associated with the thread pool. ++ */ ++int opj_thread_pool_get_thread_count(opj_thread_pool_t* tp); ++ ++/** Destroy a thread pool. ++ * @param tp the thread pool handle. ++ */ ++void opj_thread_pool_destroy(opj_thread_pool_t* tp); ++ ++/*@}*/ ++ ++/*@}*/ ++ ++#endif /* THREAD_H */ +diff --git a/src/lib/openjp2/tls_keys.h b/src/lib/openjp2/tls_keys.h +new file mode 100644 +index 0000000..fb26498 +--- /dev/null ++++ b/src/lib/openjp2/tls_keys.h +@@ -0,0 +1,37 @@ ++/* ++ * The copyright in this software is being made available under the 2-clauses ++ * BSD License, included below. This software may be subject to other third ++ * party and contributor rights, including patent rights, and no such rights ++ * are granted under this license. ++ * ++ * Copyright (c) 2016, Even Rouault ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef TLS_KEYS_H ++#define TLS_KEYS_H ++ ++#define OPJ_TLS_KEY_T1 0 ++ ++#endif diff --git a/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff b/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff new file mode 100644 index 0000000000000000000000000000000000000000..a0d79afeb61fb38af72dd1ef590e91c5be2e9716 --- /dev/null +++ b/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff @@ -0,0 +1,39 @@ +diff -burN openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/CMakeLists.txt openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/CMakeLists.txt +--- openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/CMakeLists.txt 2016-07-01 12:37:01.000000000 +0200 ++++ openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/CMakeLists.txt 2016-07-01 12:37:20.000000000 +0200 +@@ -151,7 +151,7 @@ + endif() + + if (APPLE) +- list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") ++# list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") + option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) + endif() + +diff -burN openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/thirdparty/CMakeLists.txt openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/thirdparty/CMakeLists.txt +--- openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/thirdparty/CMakeLists.txt 2016-07-01 12:37:01.000000000 +0200 ++++ openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/thirdparty/CMakeLists.txt 2016-07-01 12:38:10.000000000 +0200 +@@ -84,7 +84,7 @@ + set(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE) + set(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE) + +-if( BUILD_THIRDPARTY) ++if( BUILD_THIRDPARTY_LCMS ) + # Try to build lcms2 + message(STATUS "We will build LCMS2 lib from thirdparty") + add_subdirectory(liblcms2) +@@ -92,7 +92,7 @@ + set(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) # + set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE) + set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE) +-else(BUILD_THIRDPARTY) ++else() + find_package(LCMS2) + if(LCMS2_FOUND) + message(STATUS "Your system seems to have a LCMS2 lib available, we will use it") +@@ -115,4 +115,4 @@ + message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it") + endif(LCMS_FOUND) + endif(LCMS2_FOUND) +-endif(BUILD_THIRDPARTY) ++endif() diff --git a/SuperBuild/patches/OSSIM/ossim-skip-get-svn-revision.diff b/SuperBuild/patches/OSSIM/ossim-1-skip-svn-revision-all.diff old mode 100755 new mode 100644 similarity index 100% rename from SuperBuild/patches/OSSIM/ossim-skip-get-svn-revision.diff rename to SuperBuild/patches/OSSIM/ossim-1-skip-svn-revision-all.diff diff --git a/SuperBuild/patches/OSSIM/ossim-fix-rpath-for-macx.diff b/SuperBuild/patches/OSSIM/ossim-2-rpathfix-macx.diff old mode 100755 new mode 100644 similarity index 100% rename from SuperBuild/patches/OSSIM/ossim-fix-rpath-for-macx.diff rename to SuperBuild/patches/OSSIM/ossim-2-rpathfix-macx.diff diff --git a/SuperBuild/patches/OSSIM/ossim-3-fixes-win.diff b/SuperBuild/patches/OSSIM/ossim-3-fixes-win.diff new file mode 100644 index 0000000000000000000000000000000000000000..394db523a86b985f93bbb1b316c59b8f77067539 --- /dev/null +++ b/SuperBuild/patches/OSSIM/ossim-3-fixes-win.diff @@ -0,0 +1,156 @@ +diff -burN ossim-1.8.20-3.orig/ossim/include/ossim/ossimConfig.h ossim-1.8.20-3/ossim/include/ossim/ossimConfig.h +--- ossim-1.8.20-3.orig/ossim/include/ossim/ossimConfig.h 1970-01-01 01:00:00.000000000 +0100 ++++ ossim-1.8.20-3/ossim/include/ossim/ossimConfig.h 2016-06-16 15:14:15.251654701 +0200 +@@ -0,0 +1,20 @@ ++/* $Id: ossimConfig.h.in 13607 2008-09-25 19:39:45Z gpotts $ */ ++#ifndef ossimConfig_HEADER ++#define ossimConfig_HEADER ++ ++/* Define to "1" if you have libz installed, "0" if not. */ ++#define OSSIM_HAS_LIBZ 1 ++ ++/* Define to "1" if you have MPI(lam/mpi), "0" if not. */ ++#define OSSIM_HAS_MPI 0 ++ ++/* Define to "1" if you have FREETYPE, "0" if not. */ ++#define OSSIM_HAS_FREETYPE 1 ++ ++/* Define to "1" if you have GEOTIFF, "0" if not. */ ++#define OSSIM_HAS_GEOTIFF 1 ++ ++/* Enable cvs id strings for use with "ident" application. */ ++#define OSSIM_ID_ENABLED 1 ++ ++#endif /* End of "#ifndef ossimConfig_HEADER" */ +diff -burN ossim-1.8.20-3.orig/ossim/include/ossim/ossimVersion.h ossim-1.8.20-3/ossim/include/ossim/ossimVersion.h +--- ossim-1.8.20-3.orig/ossim/include/ossim/ossimVersion.h 1970-01-01 01:00:00.000000000 +0100 ++++ ossim-1.8.20-3/ossim/include/ossim/ossimVersion.h 2016-06-16 15:14:15.251654701 +0200 +@@ -0,0 +1,14 @@ ++#ifndef ossimVersion_HEADER ++#define ossimVersion_HEADER 1 ++ ++#define OSSIM_VERSION "1.8.20" ++#define OSSIM_MAJOR_VERSION_NUMBER 1 ++#define OSSIM_MINOR_VERSION_NUMBER 8 ++#define OSSIM_PATCH_VERSION_NUMBER 20 ++#define OSSIM_RELEASE_NUMBER 1 ++#define OSSIM_REVISION_NUMBER "23665" ++ ++// date format = (yyyymmdd) ++#define OSSIM_BUILD_DATE "20160614" ++ ++#endif /* End of #ifndef ossimVersion_HEADER */ +diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/base/ossimDate.cpp ossim-1.8.20-3/ossim/src/ossim/base/ossimDate.cpp +--- ossim-1.8.20-3.orig/ossim/src/ossim/base/ossimDate.cpp 2016-06-16 15:13:59.447653936 +0200 ++++ ossim-1.8.20-3/ossim/src/ossim/base/ossimDate.cpp 2016-06-16 15:14:15.283654702 +0200 +@@ -232,15 +232,21 @@ + // struct tm gmt = *this; + #if !defined(_MSC_VER) + tzset(); ++ #define TM_TIMEZONE timezone + #else + _tzset(); ++ #if _MSC_VER > 1800 ++ #define TM_TIMEZONE _timezone ++ #else ++ #define TM_TIMEZONE timezone ++ #endif + #endif + + #if ( defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) ) + //gmt.tm_sec -= tm_gmtoff; // Seconds east of UTC + m_timezoneOffset = tm_gmtoff; + #else +- m_timezoneOffset = timezone; // Seconds west of UTC ++ m_timezoneOffset = TM_TIMEZONE; // Seconds west of UTC + if ( tm_isdst ) + { + m_timezoneOffset -= 3600; // Subtract an hour. +@@ -668,16 +674,23 @@ + { + m_mutex.lock(); + struct tm gmt = *this; +-#if !defined(_MSC_VER) ++ ++ #if !defined(_MSC_VER) + tzset(); ++ #define TM_TIMEZONE timezone + #else + _tzset(); ++ #if _MSC_VER > 1800 ++ #define TM_TIMEZONE _timezone ++ #else ++ #define TM_TIMEZONE timezone ++ #endif + #endif + + #if ( defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) ) + gmt.tm_sec -= tm_gmtoff; // Seconds east of UTC + #else +- gmt.tm_sec += timezone; // Seconds west of UTC ++ gmt.tm_sec += TM_TIMEZONE; // Seconds west of UTC + if ( tm_isdst ) + { + gmt.tm_sec -= 3600; // Subtract an hour. +diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/base/ossimPolyArea2d.cpp ossim-1.8.20-3/ossim/src/ossim/base/ossimPolyArea2d.cpp +--- ossim-1.8.20-3.orig/ossim/src/ossim/base/ossimPolyArea2d.cpp 2016-06-16 15:13:59.451653936 +0200 ++++ ossim-1.8.20-3/ossim/src/ossim/base/ossimPolyArea2d.cpp 2016-06-16 15:14:15.287654703 +0200 +@@ -32,15 +32,16 @@ + { + public: + ossimGeometryFactoryWrapper() +- : m_geomFactory(0) + { + geos::geom::PrecisionModel *pm = + new geos::geom::PrecisionModel(geos::geom::PrecisionModel::FLOATING); +- m_geomFactory = new geos::geom::GeometryFactory(pm, -1); ++ m_geomFactory = geos::geom::GeometryFactory::create(pm, -1); ++ + } +- virtual ~ossimGeometryFactoryWrapper(){if(m_geomFactory) delete m_geomFactory;m_geomFactory=0;} ++ virtual ~ossimGeometryFactoryWrapper(){} + +- geos::geom::GeometryFactory* m_geomFactory; ++ geos::geom::GeometryFactory::unique_ptr m_geomFactory; ++ //geos::geom::GeometryFactory* m_geomFactory; + }; + + class OssimPolyArea2dPrivate +@@ -55,7 +56,7 @@ + void deleteGeometry() { if(m_geometry) { delete m_geometry; m_geometry = 0; }} + void setGeometry(const ossimPolygon& polygon, const vector<ossimPolygon>& holes = vector<ossimPolygon>()); + void setGeometry(GeometryPtr geom){deleteGeometry();m_geometry=geom;} +- geos::geom::GeometryFactory* geomFactory(){{return m_globalFactory.valid()?m_globalFactory->m_geomFactory:0;}} ++ geos::geom::GeometryFactory* geomFactory(){{return m_globalFactory.valid()?m_globalFactory->m_geomFactory.get():0;}} + GeometryPtr m_geometry; + static ossimRefPtr<ossimGeometryFactoryWrapper> m_globalFactory; + }; +diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/elevation/ossimElevManager.cpp ossim-1.8.20-3/ossim/src/ossim/elevation/ossimElevManager.cpp +--- ossim-1.8.20-3.orig/ossim/src/ossim/elevation/ossimElevManager.cpp 2016-06-16 15:13:59.459653937 +0200 ++++ ossim-1.8.20-3/ossim/src/ossim/elevation/ossimElevManager.cpp 2016-06-16 15:14:15.295654703 +0200 +@@ -634,7 +634,10 @@ + } + return spacing; + } +- ++inline std::ostream& operator<<(std::ostream& out, std::ostream& obj) ++{ ++ return obj; ++} + std::ostream& ossimElevManager::print(ostream& out) const + { + out << "\nossimElevManager @ "<< (ossim_uint64) this +diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/elevation/ossimElevSource.cpp ossim-1.8.20-3/ossim/src/ossim/elevation/ossimElevSource.cpp +--- ossim-1.8.20-3.orig/ossim/src/ossim/elevation/ossimElevSource.cpp 2016-06-16 15:13:59.459653937 +0200 ++++ ossim-1.8.20-3/ossim/src/ossim/elevation/ossimElevSource.cpp 2016-06-16 15:14:15.295654703 +0200 +@@ -261,6 +261,10 @@ + { + theComputeStatsFlag = flag; + } ++inline std::ostream& operator<<(std::ostream& out, std::ostream& obj) ++{ ++ return obj; ++} + + std::ostream& ossimElevSource::print(std::ostream& out) const + { diff --git a/SuperBuild/patches/PROJ/CMakeLists.txt b/SuperBuild/patches/PROJ/CMakeLists.txt deleted file mode 100644 index 7f1ad4cbffee95e450f4b04ee6bd1a596db23ade..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/PROJ/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) - -project(proj_install) - -file(GLOB ${PROJECT_NAME}_HEADERS "${PROJ4_BUILD_DIR}/projects.h" "${PROJ4_BUILD_DIR}/proj_api.h" "${PROJ_INCLUDE_DIR}/org_proj4_Projections.h" ) -file(GLOB ${PROJECT_NAME}_LIBS "${PROJ4_BUILD_DIR}/*.lib" ) -file(GLOB ${PROJECT_NAME}_DLLS "${PROJ4_BUILD_DIR}/*.dll" ) - -foreach(${PROJECT_NAME}_HEADER ${${PROJECT_NAME}_HEADERS}) -install(FILES ${${PROJECT_NAME}_HEADER} - DESTINATION include - COMPONENT Development) -endforeach() - -foreach(${PROJECT_NAME}_LIB ${${PROJECT_NAME}_LIBS}) -install(FILES ${${PROJECT_NAME}_LIB} - DESTINATION lib - COMPONENT Development) -endforeach() - -foreach(${PROJECT_NAME}_DLL ${${PROJECT_NAME}_DLLS}) -install(FILES ${${PROJECT_NAME}_DLL} - DESTINATION bin - COMPONENT Development) -endforeach() \ No newline at end of file diff --git a/SuperBuild/patches/PROJ/proj-fix-rpath-for-macx.diff b/SuperBuild/patches/PROJ/proj-fix-rpath-for-macx.diff old mode 100755 new mode 100644 diff --git a/SuperBuild/patches/QT4/configure_qt4.bat.in b/SuperBuild/patches/QT4/configure_qt4.bat.in index 83de6aa796f71af9e34d30e094c01c6cdae93a37..ce92ad480dce9d657b13a155cf2296568ddebc68 100755 --- a/SuperBuild/patches/QT4/configure_qt4.bat.in +++ b/SuperBuild/patches/QT4/configure_qt4.bat.in @@ -1,10 +1,10 @@ set SB_SAVE_INCLUDE=%INCLUDE% set SB_SAVE_LIB=%LIB% -set INCLUDE=%INCLUDE%;@CMAKE_WIN_INSTALL_PREFIX@\include -set LIB=%LIB%;@CMAKE_WIN_INSTALL_PREFIX@\lib +set INCLUDE=%INCLUDE%;@QT4_INCLUDE_PREFIX_NATIVE@;@QT4_INCLUDE_PREFIX_NATIVE@\freetype2 +set LIB=%LIB%;@QT4_LIB_PREFIX_NATIVE@ -configure -prefix @CMAKE_WIN_INSTALL_PREFIX@ -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-webkit -qt-sql-sqlite -plugin-sql-sqlite -no-nis -no-qt3support -system-zlib -system-libpng -system-libtiff -system-libjpeg -system-sqlite -L @CMAKE_WIN_INSTALL_PREFIX@\lib -I @CMAKE_WIN_INSTALL_PREFIX@\include -no-openssl -no-nsis -silent -fast -no-javascript-jit -no-openssl -no-declarative +@QT4_CONFIGURE_SCRIPT@ -prefix @QT4_INSTALL_PREFIX_NATIVE@ -L @QT4_LIB_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@\freetype2 -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative -no-qt3support -no-xmlpatterns -system-sqlite -qt-sql-sqlite -plugin-sql-sqlite -no-openssl -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib @QT4_SB_CONFIG@ set INCLUDE=%SB_SAVE_INCLUDE% set LIB=%SB_SAVE_LIB% diff --git a/SuperBuild/patches/QT4/configure_qt4.sh.in b/SuperBuild/patches/QT4/configure_qt4.sh.in index 50deeeec80816c716bdad41c684a0ffd7aad2e66..8f8a01a3d3b41bf303a9cbd0deccbd9ac44fff72 100755 --- a/SuperBuild/patches/QT4/configure_qt4.sh.in +++ b/SuperBuild/patches/QT4/configure_qt4.sh.in @@ -1 +1 @@ -@QT4_SB_SRC@/configure -prefix @SB_INSTALL_PREFIX@ -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative -no-nis -no-javascript-jit -no-qt3support -no-xmlpatterns -no-openssl -plugin-sql-sqlite -no-libpng -no-libtiff -no-libjpeg -no-libmng -system-zlib -graphicssystem opengl -system-sqlite -L @SB_INSTALL_PREFIX@/lib -I @SB_INSTALL_PREFIX@/include -I @SB_INSTALL_PREFIX@/include/freetype2 @QT4_SB_CONFIG@ +@QT4_CONFIGURE_SCRIPT@ -prefix @QT4_INSTALL_PREFIX_NATIVE@ -L @QT4_LIB_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@/freetype2 -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative -no-qt3support -no-xmlpatterns -system-sqlite -qt-sql-sqlite -plugin-sql-sqlite -no-openssl -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib @QT4_SB_CONFIG@ diff --git a/SuperBuild/patches/QT4/qt4-1-skip-qtnetwork-module-all.diff b/SuperBuild/patches/QT4/qt4-1-skip-qtnetwork-module-all.diff new file mode 100755 index 0000000000000000000000000000000000000000..215f87cecafdb32d103dfa8cd7f9b5bd3de03734 --- /dev/null +++ b/SuperBuild/patches/QT4/qt4-1-skip-qtnetwork-module-all.diff @@ -0,0 +1,32 @@ +diff -burN qt-everywhere-opensource-src-4.8.7.orig/src/plugins/graphicssystems/graphicssystems.pro qt-everywhere-opensource-src-4.8.7/src/plugins/graphicssystems/graphicssystems.pro +--- qt-everywhere-opensource-src-4.8.7.orig/src/plugins/graphicssystems/graphicssystems.pro 2016-07-06 10:15:46.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/plugins/graphicssystems/graphicssystems.pro 2016-07-06 14:09:07.000000000 +0200 +@@ -1,5 +1,4 @@ + TEMPLATE = subdirs +-SUBDIRS += trace + !wince*:contains(QT_CONFIG, opengl):SUBDIRS += opengl + contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { + SUBDIRS += openvg +diff -burN qt-everywhere-opensource-src-4.8.7.orig/src/plugins/plugins.pro qt-everywhere-opensource-src-4.8.7/src/plugins/plugins.pro +--- qt-everywhere-opensource-src-4.8.7.orig/src/plugins/plugins.pro 2016-07-06 10:15:46.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/plugins/plugins.pro 2016-07-06 12:58:14.000000000 +0200 +@@ -1,6 +1,6 @@ + TEMPLATE = subdirs + +-SUBDIRS *= sqldrivers script bearer ++SUBDIRS *= sqldrivers + unix:!symbian { + contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv)|contains(QT_CONFIG,sun-libiconv):SUBDIRS *= codecs + } else { +diff -burN qt-everywhere-opensource-src-4.8.7.orig/src/src.pro qt-everywhere-opensource-src-4.8.7/src/src.pro +--- qt-everywhere-opensource-src-4.8.7.orig/src/src.pro 2016-07-06 10:15:47.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/src.pro 2016-07-06 10:18:44.000000000 +0200 +@@ -4,7 +4,7 @@ + unset(SRC_SUBDIRS) + win32:SRC_SUBDIRS += src_winmain + symbian:SRC_SUBDIRS += src_s60main +-SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib ++SRC_SUBDIRS += src_corelib src_xml src_sql + nacl: SRC_SUBDIRS -= src_network src_testlib + !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus + !contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui diff --git a/SuperBuild/patches/QT4/qt4-fix-rpath-for-macx.diff b/SuperBuild/patches/QT4/qt4-2-fix_rpath-macx.diff similarity index 100% rename from SuperBuild/patches/QT4/qt4-fix-rpath-for-macx.diff rename to SuperBuild/patches/QT4/qt4-2-fix_rpath-macx.diff diff --git a/SuperBuild/patches/SQLITE/CMakeLists.txt b/SuperBuild/patches/SQLITE/CMakeLists.txt index 3011d59a74cb60a4f4b45c5b6707867a683e9708..9b3cf1ef620f2daf91cbe94c118e1e26f1d71e48 100644 --- a/SuperBuild/patches/SQLITE/CMakeLists.txt +++ b/SuperBuild/patches/SQLITE/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3) project(sqlite) -set(BUILD_SHARED_LIBS ON) +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) include_directories("${CMAKE_SOURCE_DIR}") add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA=1) diff --git a/SuperBuild/patches/TIFF/nmake.opt b/SuperBuild/patches/TIFF/nmake.opt index 97a1aba4dd8e18d1abcd33ac3aa6e55ab9f21b88..cb1c9ea849db145f3ce36c0e00aeeecfaa6ea0ff 100644 --- a/SuperBuild/patches/TIFF/nmake.opt +++ b/SuperBuild/patches/TIFF/nmake.opt @@ -114,7 +114,7 @@ CHECK_JPEG_YCBCR_SUBSAMPLING = 1 # with no debugging information. # NOTE: /EHsc option required if you want to build the C++ stream API # -OPTFLAGS = /Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE +OPTFLAGS = /Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE -DHAVE_SNPRINTF #OPTFLAGS = /Zi # diff --git a/SuperBuild/patches/TINYXML/CMakeLists.txt b/SuperBuild/patches/TINYXML/CMakeLists.txt index dcfbd2b9896171934932e0b1b9a4bbc456bf03df..5000f2f946618dc578ffa2a20e93b2a9f19a1b7a 100644 --- a/SuperBuild/patches/TINYXML/CMakeLists.txt +++ b/SuperBuild/patches/TINYXML/CMakeLists.txt @@ -2,12 +2,11 @@ cmake_minimum_required(VERSION 2.8.3) project(tinyXMLlib) -set(BUILD_SHARED_LIBS ON) -if(MSVC) -set(BUILD_SHARED_LIBS OFF) #force off +option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() - -add_definitions(-DTINYXML_USE_STL=1) +add_definitions(-DTIXML_USE_STL=1) set(tinyXMLlib_SRCS tinystr.cpp diff --git a/Utilities/Completion/CMakeLists.txt b/Utilities/Completion/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7647a6916d182d299269f3be5089ec799f5dc4f8 --- /dev/null +++ b/Utilities/Completion/CMakeLists.txt @@ -0,0 +1,13 @@ + +find_package(OTB REQUIRED) +include(${OTB_USE_FILE}) + +add_executable(completionGenerator EXCLUDE_FROM_ALL completionGenerator.cxx) +target_link_libraries(completionGenerator ${OTB_LIBRARIES}) + +add_custom_target(generate-completion + COMMAND bin/completionGenerator lib/otb/applications otbcli_completion + DEPENDS completionGenerator + WORKING_DIRECTORY ${OTB_BINARY_DIR} + ) + diff --git a/Utilities/Completion/completionGenerator.cxx b/Utilities/Completion/completionGenerator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..367298e53f2120050d9c84914bcaad1665264ce3 --- /dev/null +++ b/Utilities/Completion/completionGenerator.cxx @@ -0,0 +1,124 @@ +/*========================================================================= + + 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 "otbWrapperApplicationRegistry.h" +#include "otbWrapperParameter.h" +#include "otbWrapperChoiceParameter.h" +#include "itksys/SystemTools.hxx" + +/** + * Small executable to : + * - find available application + * - get list of parameters + * - and fill a bash completion script + * + * This script can be sourced to be used, or deployed into a folder such as + * /etc/bash_completion.d + * For choice parameters, the completion will propose the available choices + */ + +int main(int argc, char* argv[]) +{ + if (argc < 3) + { + std::cerr << "Usage : " << argv[0] << " module_path output_script" << std::endl; + return EXIT_FAILURE; + } + std::string module_path(argv[1]); + std::string output_path(argv[2]); + + otb::Wrapper::ApplicationRegistry::SetApplicationPath(module_path); + + std::vector<std::string> appList = otb::Wrapper::ApplicationRegistry::GetAvailableApplications(false); + + otb::Wrapper::Application::Pointer appPtr; + + std::ofstream ofs; + ofs.open(output_path.c_str()); + + for (unsigned int i=0 ; i < appList.size() ; ++i) + { + appPtr = otb::Wrapper::ApplicationRegistry::CreateApplication(appList[i],false); + if (appPtr.IsNull()) + { + std::cout << "Error loading application "<< appList[i] << std::endl; + return EXIT_FAILURE; + } + std::vector<std::string> keys = appPtr->GetParametersKeys(); + + ofs << "# completion for application "<< appList[i] << std::endl; + ofs << "_otbcli_"<<appList[i]<<"()" << std::endl; + ofs << "{" << std::endl; + + ofs << " local cur prev" << std::endl; + ofs << " COMPREPLY=()" << std::endl; + ofs << " cur=\"${COMP_WORDS[COMP_CWORD]}\"" << std::endl; + ofs << " prev=\"${COMP_WORDS[COMP_CWORD-1]}\"" << std::endl; + ofs << " case \"$cur\" in" << std::endl; + ofs << " -*)" << std::endl; + ofs << " key_list=\""; + for (unsigned int k=0 ; k < keys.size() ; k++ ) + { + ofs << "-" << keys[k] << " "; + } + ofs << "\"" << std::endl; + ofs << " COMPREPLY=( $( compgen -W \"$key_list\" -- $cur) )" << std::endl; + ofs << " return 0" << std::endl; + ofs << " ;;" << std::endl; + ofs << " esac" << std::endl; + + // detect choice parameters + std::vector<std::string> choiceKeys; + for (unsigned int k=0 ; k < keys.size() ; k++ ) + { + if ( appPtr->GetParameterType(keys[k]) == otb::Wrapper::ParameterType_Choice) + { + choiceKeys.push_back(keys[k]); + } + } + if (choiceKeys.size()) + { + ofs << " case \"$prev\" in" << std::endl; + for (unsigned int k=0 ; k < choiceKeys.size() ; k++) + { + ofs << " -" << choiceKeys[k] << ")" << std::endl; + ofs << " key_list=\""; + std::vector<std::string> choices = dynamic_cast<otb::Wrapper::ChoiceParameter*>(appPtr->GetParameterByKey(choiceKeys[k]))->GetChoiceKeys(); + for (unsigned int j=0 ; j < choices.size() ; j++) + { + ofs << choices[j]; + if (j+1 < choices.size() ) + { + ofs << " "; + } + } + ofs << "\"" << std::endl; + ofs << " COMPREPLY=( $( compgen -W \"$key_list\" -- $cur) )" << std::endl; + ofs << " ;;" << std::endl; + } + ofs << " esac" << std::endl; + } + + ofs << " return 0" << std::endl; + ofs << "}" << std::endl; + ofs << "complete -o default -F _otbcli_" << appList[i] << " otbcli_"<< appList[i] << std::endl; + } + ofs.close(); + + return EXIT_SUCCESS; +} diff --git a/Utilities/Maintenance/BuildHeaderTest.py b/Utilities/Maintenance/BuildHeaderTest.py index d71c66c1fcbe645c2d27c4a76fc9402574284acf..4d2a19c3cf06a3c6a84a02359e4820dc8bd22fbf 100644 --- a/Utilities/Maintenance/BuildHeaderTest.py +++ b/Utilities/Maintenance/BuildHeaderTest.py @@ -108,14 +108,18 @@ def main(): else: max_idx = added_header_idx + maximum_number_of_headers for i in range(added_header_idx, max_idx): - # Use the .hxx if possible. + # Use the .hxx or .txx if possible. hxx_file = h_files[i][:-1] + 'hxx' + txx_file = h_files[i][:-1] + 'txx' # Files that include VTK headers need to link to VTK. if h_files[i] in BANNED_HEADERS or h_files[i].lower().find('vtk') != -1: to_include = '// #include "' + h_files[i] + '" // Banned in BuildHeaderTest.py\n' elif os.path.exists(os.path.join(module_source_path, 'include', hxx_file)): to_include = '#include "' + hxx_file + '"\n' + elif os.path.exists(os.path.join(module_source_path, 'include', + txx_file)): + to_include = '#include "' + txx_file + '"\n' else: to_include = '#include "' + h_files[i] + '"\n' diff --git a/Utilities/Maintenance/SuperbuildDownloadList.sh b/Utilities/Maintenance/SuperbuildDownloadList.sh index 10ae48a2c62fb8776261b7a3b1125bcc790b6a0f..b42290875432dfc0bcc03201d2400071ae1b6e2e 100755 --- a/Utilities/Maintenance/SuperbuildDownloadList.sh +++ b/Utilities/Maintenance/SuperbuildDownloadList.sh @@ -9,7 +9,7 @@ echo 'Usage: '$0' <download_directory> <archive_output_directory>' exit 1 fi -WGET="wget -nv -q --show-progress --progress=bar" +WGET="wget -nv -q" SB_CMAKE_DIR_REL=$(dirname $0)/../../SuperBuild/CMake SB_CMAKE_DIR=$(readlink -f ${SB_CMAKE_DIR_REL}) diff --git a/Utilities/Maintenance/TravisBuild.sh b/Utilities/Maintenance/TravisBuild.sh index 25adee9f2245b2991c81e13f018f0c386f025254..5790954f01fa15dbcb40e25861588de8c1db1c6a 100755 --- a/Utilities/Maintenance/TravisBuild.sh +++ b/Utilities/Maintenance/TravisBuild.sh @@ -8,9 +8,6 @@ CTEST_DASHBOARD_ROOT=$HOME/build WGET=`which wget` SED=`which sed` -#develop xdk is used for all branches whose name does not contains release-X.Y -XDK_VERSION="develop" - if [[ -z "$TRAVIS_BRANCH" ]]; then TRAVIS_BRANCH='develop' TRAVIS_BUILD_NUMBER=1 @@ -18,28 +15,29 @@ if [[ -z "$TRAVIS_BRANCH" ]]; then export TRAVIS_BRANCH export TRAVIS_BUILD_NUMBER export TRAVIS_PULL_REQUEST - mkdir -p $CTEST_DASHBOARD_ROOT/orfeotoolbox/build - git clone --depth=1 --branch=$TRAVIS_BRANCH https://github.com/orfeotoolbox/OTB fi -#if a branch contains release-X.Y then xdk is taken from packages/xdk/OTB-X.Y -if [[ "$TRAVIS_BRANCH" =~ release-* ]]; then - VERSION_SMALL=$(echo $TRAVIS_BRANCH| sed 's/.*release-//'| cut -d'-' -f 1) - XDK_VERSION="OTB-$VERSION_SMALL" +if [ ! -f $CTEST_DASHBOARD_ROOT/orfeotoolbox/OTB/CMakeLists.txt ]; then + mkdir -p $CTEST_DASHBOARD_ROOT/orfeotoolbox + cd $CTEST_DASHBOARD_ROOT/orfeotoolbox + git clone --depth=1 --branch=$TRAVIS_BRANCH https://github.com/orfeotoolbox/OTB fi -VERSION_STRING=$($WGET -q -O- "https://www.orfeo-toolbox.org/packages/xdk/$XDK_VERSION/"| \ - $SED -n 's,.*OTB-\([0-9][^<]*\).*-xdk-Linux.*,\1,p') +CMAKE_FILE=$CTEST_DASHBOARD_ROOT/orfeotoolbox/OTB/CMakeLists.txt +VERION_MAJOR=$(sed -n '/set.OTB_VERSION_MAJOR/p' $CMAKE_FILE|cut -d '"' -f 2) +VERION_MINOR=$(sed -n '/set.OTB_VERSION_MINOR/p' $CMAKE_FILE|cut -d '"' -f 2) +VERION_PATCH=$(sed -n '/set.OTB_VERSION_PATCH/p' $CMAKE_FILE|cut -d '"' -f 2) +OTB_VERSION="$VERION_MAJOR.$VERION_MINOR" +OTB_VERSION_FULL="$VERION_MAJOR.$VERION_MINOR.$VERION_PATCH" -XDK_FILE=OTB-$VERSION_STRING-xdk-Linux64.run -CMAKE_PREFIX_PATH=/tmp/OTB-$VERSION_STRING-xdk-Linux64 +XDK_FILE=OTB-$OTB_VERSION_FULL-xdk-Linux64.run +CMAKE_PREFIX_PATH=/tmp/OTB-$OTB_VERSION_FULL-xdk-Linux64 OTB_INSTALL_DIR=$CTEST_DASHBOARD_ROOT/orfeotoolbox/install XDK_INSTALL_DIR="/tmp/${XDK_FILE%.*}" #export variables for later use in cmake file export CTEST_COMMAND export OTB_VERSION -export XDK_VERSION export CTEST_DASHBOARD_ROOT export CTEST_CMAKE_GENERATOR export CMAKE_MAKE_PROGRAM @@ -48,15 +46,15 @@ export OTB_INSTALL_DIR export XDK_INSTALL_DIR #print -echo "VERSION_STRING=$VERSION_STRING" echo "TRAVIS_BRANCH=$TRAVIS_BRANCH" -echo "CTEST_DASHBOARD_ROOT=$CTEST_DASHBOARD_ROOT" echo "CTEST_COMMAND=$CTEST_COMMAND" -echo "XDK_VERSION=$XDK_VERSION" +echo "OTB_VERSION=$OTB_VERSION" +echo "CTEST_DASHBOARD_ROOT=$CTEST_DASHBOARD_ROOT" echo "XDK_FILE=$XDK_FILE" echo "OTB_INSTALL_DIR=$OTB_INSTALL_DIR" echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" echo "XDK_INSTALL_DIR=$XDK_INSTALL_DIR" +echo "XDK_URL=https://www.orfeo-toolbox.org/packages/xdk/OTB-$OTB_VERSION/$XDK_FILE" #change to /tmp cd /tmp @@ -70,7 +68,7 @@ wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip - unzip ninja-linux.zip #download, extract OTB XDK -wget https://www.orfeo-toolbox.org/packages/xdk/$XDK_VERSION/$XDK_FILE --no-check-certificate +wget https://www.orfeo-toolbox.org/packages/xdk/OTB-$OTB_VERSION/$XDK_FILE --no-check-certificate chmod +x /tmp/$XDK_FILE /tmp/$XDK_FILE diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..f2367928051339119b165c547984e6965f497a69 --- /dev/null +++ b/VERSION @@ -0,0 +1,3 @@ +OTB Version: @OTB_VERSION_STRING@ +Build Date: @OTB_BUILD_TIMESTAMP@ +@OTB_GIT_STATUS_MESSAGE@