diff --git a/.clang-format b/.clang-format index 7566ce76e21e3d07f7b85572b87f2933da8c8d63..bf8ff45ff1f436bb1bb358bded3ebbf5da219bbd 100644 --- a/.clang-format +++ b/.clang-format @@ -1,94 +1,30 @@ --- -Language: Cpp -BasedOnStyle: Mozilla -AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false +AlignConsecutiveAssignments: true AlignConsecutiveDeclarations: true AlignEscapedNewlinesLeft: true AlignOperands: true AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline +AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterReturnType: All AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: true -BinPackArguments: false -BinPackParameters: true -BraceWrapping: - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: GNU -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: true -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 200 -# ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerAllOnOneLineOrOnePerLine: false +BreakBeforeBraces: Allman +ColumnLimit: 160 +ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 -ContinuationIndentWidth: 2 -Cpp11BracedListStyle: false +Cpp11BracedListStyle: true DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|isl|json)/)' - Priority: 3 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '$' -IndentCaseLabels: true IndentWidth: 2 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' +Language: Cpp MaxEmptyLinesToKeep: 2 NamespaceIndentation: None -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: true -ObjCSpaceBeforeProtocolList: false -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 0 PointerAlignment: Left -ReflowComments: true -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: true -SpacesInCStyleCastParentheses: false -SpacesInContainerLiterals: true -SpacesInParentheses: true -SpacesInSquareBrackets: false -Standard: Cpp03 +SortIncludes: false +Standard: Cpp11 TabWidth: 2 UseTab: Never ... diff --git a/CMake/OTBModuleEnablement.cmake b/CMake/OTBModuleEnablement.cmake index 4ec34d94df5315c4381769b3c33a380358163a86..453b8213d096224d76511b0b8ff50800f551d1a8 100644 --- a/CMake/OTBModuleEnablement.cmake +++ b/CMake/OTBModuleEnablement.cmake @@ -196,6 +196,8 @@ foreach(otb-module ${OTB_MODULES_ALL}) if(OTB_MODULE_${otb-module}_ACTIVATION_OPTION AND NOT ${OTB_MODULE_${otb-module}_ACTIVATION_OPTION}) otb_module_disable("${otb-module}" "${OTB_MODULE_${otb-module}_ACTIVATION_OPTION}") + elseif(OTB_MODULE_${otb-module}_IS_DEPRECATED AND NOT OTB_USE_DEPRECATED) + otb_module_disable("${otb-module}" "OTB_USE_DEPRECATED") endif() endforeach() diff --git a/CMake/OTBModuleMacros.cmake b/CMake/OTBModuleMacros.cmake index 127ae794a0c5709c01363d8e0d66b94cdf36de47..095575a4e90097860d15f533563f54d495c704d0 100644 --- a/CMake/OTBModuleMacros.cmake +++ b/CMake/OTBModuleMacros.cmake @@ -69,6 +69,9 @@ macro(otb_module _name) elseif("${arg}" MATCHES "^ENABLE_SHARED$") set(_doing "") set(OTB_MODULE_${otb-module}_ENABLE_SHARED 1) + elseif("${arg}" MATCHES "^DEPRECATED$") + set(_doing "") + set(OTB_MODULE_${otb-module}_IS_DEPRECATED 1) elseif("${arg}" MATCHES "^[A-Z][A-Z][A-Z]$") set(_doing "") message(AUTHOR_WARNING "Unknown argument [${arg}]") @@ -221,6 +224,7 @@ macro(otb_module_impl) generate_export_header(${otb-module} EXPORT_FILE_NAME ${_export_header_file} EXPORT_MACRO_NAME ${otb-module}_EXPORT + DEPRECATED_MACRO_NAME ${otb-module}_DEPRECATED NO_EXPORT_MACRO_NAME ${otb-module}_HIDDEN STATIC_DEFINE OTB_STATIC ) install(FILES diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e9e0a2ba1819a98a2feea1ad2d66bb40a64f0e0..b54eb9fda5d739b3344c2fd2837bd43681b3e38b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -455,6 +455,12 @@ add_subdirectory(Utilities/Doxygen) add_subdirectory(Utilities/Completion) +option(BUILD_COOKBOOK "Build the CookBook documentation." OFF) + +if (BUILD_COOKBOOK) + add_subdirectory(Documentation/Cookbook) +endif() + #---------------------------------------------------------------------------- # Provide a target to generate the SuperBuild archive (only for Unix) if(UNIX) diff --git a/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in b/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in index 3c3a810ca20cd0987143828e74ee9e2d9d1771be..ff3c204aa76e02eedb85f763d3a476f749d3c16c 100644 --- a/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in +++ b/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in @@ -1,6 +1,8 @@ #!/bin/sh -export LD_LIBRARY_PATH=@OTB_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH -export PYTHONPATH=@OTB_PYTHONPATH@:$PYTHONPATH -export OTB_APPLICATION_PATH=@OTB_APPLICATION_PATH@ -@PYTHON_EXECUTABLE@ @CMAKE_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py -o "$1" +#cmake builds with rpath in the binary dir, so we don't need to set LD_LIBRARY_PATH here +#export LD_LIBRARY_PATH=@CMAKE_BINARY_DIR@/lib:$LD_LIBRARY_PATH +export PYTHONPATH=@PYTHONPATH_COOKBOOK@:$PYTHONPATH +export OTB_APPLICATION_PATH=@CMAKE_BINARY_DIR@/lib/otb/applications + +python3 @CMAKE_CURRENT_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py -o "$1" diff --git a/Documentation/Cookbook/CMakeLists.txt b/Documentation/Cookbook/CMakeLists.txt index 52cd4f4f0174e3cb2a05131a97624d66170ac3cc..766102aab683e1727b8443e476e12b5f15eef865 100644 --- a/Documentation/Cookbook/CMakeLists.txt +++ b/Documentation/Cookbook/CMakeLists.txt @@ -1,62 +1,38 @@ -set(OUT_OF_SOURCE_BUILD FALSE) - -if(NOT PROJECT_NAME) - cmake_minimum_required(VERSION 3.0) - project(OTBCookBook) - set(OUT_OF_SOURCE_BUILD TRUE) - option(BUILD_TESTING "Build the testing tree." ON) -endif() - -if(BUILD_TESTING) - enable_testing() - include(CTest) -endif() - -string(TIMESTAMP OTB_COPYRIGHT_YEAR "%Y") -set(OTB_COPYRIGHT_TEXT "${OTB_COPYRIGHT_YEAR} CNES.The OTB CookBook is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA)") - -#find OTB -find_package(OTB REQUIRED) - -if( OTB_FOUND ) - include(${OTB_USE_FILE}) - message(STATUS "Found OTB: ${OTB_DIR} (found version \"${OTB_VERSION}\")") -else() - message(FATAL_ERROR "OTB not found. Please set OTB_DIR") +# +# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Build the cookbook +# + +if (NOT UNIX) + message (STATUS "Not on Unix: skipping Cookbook build.") return() endif() -get_filename_component(OTB_INSTALL_PREFIX ${OTB_MODULES_DIR} PATH) -get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) -get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) -get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) - -message(STATUS "OTB_PYTHONPATH = '${OTB_PYTHONPATH}'") -message(STATUS "OTB_APPLICATION_PATH = '${OTB_APPLICATION_PATH}'") -message(STATUS "OTB_INSTALL_PREFIX = '${OTB_INSTALL_PREFIX}'") - -if(NOT OTB_PYTHONPATH) - message(FATAL_ERROR "OTB_PYTHONPATH empty") -endif() - -if(NOT OTB_APPLICATION_PATH) - message(FATAL_ERROR "OTB_APPLICATION_PATH empty") -endif() - -if(NOT OTB_INSTALL_PREFIX) - message(FATAL_ERROR "OTB_INSTALL_PREFIX empty") -endif() - - -macro(remove_and_make_directories) - foreach(dir in ${ARGV}) - execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${dir}) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}) - endforeach() -endmacro() +message(STATUS "") +message(STATUS "Configuring Cookbook...") -#find Python -find_package(PythonInterp REQUIRED) +# here we could add +# find_package (Python3 COMPONENTS Interpreter) +# but it requires cmake 3.12+ find_program(SH_INTERP sh) mark_as_advanced(SH_INTERP) @@ -73,18 +49,50 @@ mark_as_advanced(SPHINX_BUILD) find_program(PDFLATEX_COMMAND NAMES pdflatex ) mark_as_advanced(PDFLATEX_COMMAND) -foreach(cmd LATEX_COMMAND TAR_COMMAND PDFLATEX_COMMAND SPHINX_BUILD SH_INTERP) +# Check that we found everything we need +foreach(cmd + LATEX_COMMAND + TAR_COMMAND + PDFLATEX_COMMAND + SPHINX_BUILD + SH_INTERP) if(NOT ${cmd}) - message(FATAL_ERROR "${cmd} not set. Cannot continue") + message(FATAL_ERROR "Error while configuring Cookbook, ${cmd} not set. Cannot continue") endif() endforeach() -set(RST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rst) +# We need to set PYTHONPATH for the script otbGenerateWrappersRstDoc.py, depending on how the Python3 module was built +if (OTB_WRAP_PYTHON3) + set(PYTHONPATH_COOKBOOK "${CMAKE_BINARY_DIR}/lib/otb/python3") +elseif (OTB_WRAP_PYTHON) + # Cookbook only supports Python3 + # But OTB_WRAP_PYTHON can wrap both python2 and python3 + if (${PYTHONLIBS_VERSION_STRING} STRGREATER "3.0.0") + set(PYTHONPATH_COOKBOOK "${CMAKE_BINARY_DIR}/lib/otb/python") + else() + message(FATAL_ERROR "Must wrap OTB with python lib 3+ to build the cookbook, but found version ${PYTHONLIBS_VERSION_STRING}") + endif() +endif() +set(RST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rst) set(RST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rst) set(LATEX_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex) set(HTML_DIR ${CMAKE_CURRENT_BINARY_DIR}/html) +# Print summary of Cookbook configuration +message(STATUS "RST_SOURCE_DIR = ${RST_SOURCE_DIR}") +message(STATUS "RST_BINARY_DIR = ${RST_BINARY_DIR}") +message(STATUS "LATEX_DIR = ${LATEX_DIR}") +message(STATUS "HTML_DIR = ${HTML_DIR}") +message(STATUS "PYTHONPATH_COOKBOOK = ${PYTHONPATH_COOKBOOK}") + +# Clean any existing build +macro(remove_and_make_directories) + foreach(dir in ${ARGV}) + execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${dir}) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}) + endforeach() +endmacro() remove_and_make_directories( ${HTML_DIR} @@ -107,23 +115,28 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Art DESTINATION ${RST_BINARY_DIR}) set(SPHINX_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR}) -configure_file(${RST_SOURCE_DIR}/conf.py.in ${SPHINX_CONF_DIR}/conf.py @ONLY) +string(TIMESTAMP OTB_COPYRIGHT_YEAR "%Y") +set(OTB_COPYRIGHT_TEXT "${OTB_COPYRIGHT_YEAR} CNES.The OTB CookBook is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA)") -#configure_file(${RST_SOURCE_DIR}/Makefile.in ${RST_GENERATED_SOURCE_DIR}/Makefile.sphinx @ONLY) -# Internal variables. -# PAPEROPT_a4 = -D latex_paper_size=a4 -# PAPEROPT_letter = -D latex_paper_size=letter -# ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# # the i18n builder cannot share the environment and doctrees with the others -# I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +configure_file(${RST_SOURCE_DIR}/conf.py.in ${SPHINX_CONF_DIR}/conf.py @ONLY) add_custom_target(generate_otbapps_rst COMMAND ${SH_INTERP} ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh ${RST_BINARY_DIR} WORKING_DIRECTORY ${RST_BINARY_DIR} COMMENT "Auto-generating Application Reference Documentation in RST" + DEPENDS OTBSWIGWrapper-all ) +# Add all applications as dependencies to rst generation +set(app_names ${OTB_APPLICATIONS_NAME_LIST}) +list(REMOVE_ITEM app_names "TestApplication") +list(REMOVE_ITEM app_names "ApplicationExample") +list(REMOVE_DUPLICATES app_names) +foreach(app_name ${app_names}) + add_dependencies(generate_otbapps_rst otbapp_${app_name}) +endforeach() + add_custom_target(CookBookHTML COMMAND ${SPHINX_BUILD} -b html diff --git a/Documentation/Cookbook/README.md b/Documentation/Cookbook/README.md index 4d83f1c69a0a8bb7fbca0aab61eb38b5eaa2fc72..f51ff765c3e7a3c42c9b8636cb5d94ceaee59546 100644 --- a/Documentation/Cookbook/README.md +++ b/Documentation/Cookbook/README.md @@ -3,11 +3,11 @@ RST docs for Orfeo Toolbox CookBook Introduction ============ -This is a replacement of old OTB Cookbook which was written in Latex. This version is completely deviate from existing Latex format to reStructured format (rst). +This is a replacement of the old OTB Cookbook which was written in LaTeX. This version has deviated completely from the existing LaTeX format to reStructured format (rst). -Converting existing latex to rst is not that straightforward. All rst files for OTB applications are generated using python script otbGenerateWrappersRstDoc.py. -For others in recipes, we used a tool called pandoc to get an initial rst and then edited out errors manually. You do not have to generate them again. -The old Cookbook in otb-documents is deprecated. +Converting existing LaTeX to rst is not that straightforward. All rst files for OTB applications are generated using the Python script otbGenerateWrappersRstDoc.py. +For others files in the Recipes, we used a tool called pandoc to get an initial rst and then manually edit and remove the errors. You do not have to generate them again. +The old Cookbook in otb-documents is now deprecated. Requirements ============ diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index 7f0606992f8e5c461a1b53d6f1e4460f88141125..7bb739bed0feff46340b2ba82c01a19525465858 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -1,4 +1,24 @@ -#!/usr/bin/python +#!/usr/bin/env python3 +# +# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + import otbApplication import os import sys @@ -59,7 +79,7 @@ def GetPixelType(value): # look for type foundcode = -1 foundname = "" - for ptypename, ptypecode in pixeltypes.iteritems(): + for ptypename, ptypecode in pixeltypes.items(): if value.endswith(ptypename): foundcode = ptypecode foundname = ptypename @@ -133,7 +153,10 @@ def GenerateParameterType(app,param): if app.GetParameterType(param) == otbApplication.ParameterType_InputFilenameList : return "Input File name list" if app.GetParameterType(param) == otbApplication.ParameterType_ListView: - return "List" + if app.GetListViewSingleSelectionMode(param): + return "String" + else: + return "String List" if app.GetParameterType(param) == otbApplication.ParameterType_Group: return "Group" if app.GetParameterType(param) == otbApplication.ParameterType_InputProcessXML: @@ -166,14 +189,14 @@ def FindLengthOfLargestColumnText(app,paramlist): def RstTableHeaderLine(strlist, listlen, delimiter): line = "+" - for i in xrange(len(strlist)): + for i in range(len(strlist)): line += delimiter * listlen[i] + '+' line += linesep return line def RstTableHeading(strlist, listlen): heading = RstTableHeaderLine(strlist, listlen, '-') - for i in xrange(len(strlist)): + for i in range(len(strlist)): spaces = ' ' * ((listlen[i] - len(strlist[i])) ) heading += '|' + strlist[i] + spaces heading += '|' + linesep @@ -189,7 +212,7 @@ def GenerateParametersTable(app,paramlist): colLength = FindLengthOfLargestColumnText(app, paramlist) output = linesep + ".. [#] Table: Parameters table for " + ConvertString(app.GetDocName()) + "." + linesep + linesep headerlist = ["Parameter Key", "Parameter Name", "Parameter Type"] - for i in xrange(len(headerlist)): + for i in range(len(headerlist)): colLength[i] = len(headerlist[i]) if colLength[i] < len(headerlist[i]) else colLength[i] output += RstTableHeading(headerlist, colLength) for param in paramlist: @@ -446,7 +469,7 @@ def ApplicationToRst(appname): try: app = otbApplication.Registry.CreateApplication(appname) except e: - print e + print(e) # TODO: remove this when bug 440 is fixed app.Init() output += RstHeading(app.GetName() + ' - ' + app.GetDocName(), '^') @@ -516,18 +539,19 @@ def GenerateRstForApplications(): allApps = None try: allApps = otbApplication.Registry.GetAvailableApplications( ) + print(allApps) except: - print 'error in otbApplication.Registry.GetAvailableApplications()' + print('error in otbApplication.Registry.GetAvailableApplications()') sys.exit(1) if not allApps: - print 'No OTB applications available. Please check OTB_APPLICATION_PATH env variable' - sys.exit(1) + print('No OTB applications available. Please check OTB_APPLICATION_PATH env variable') + sys.exit(1) writtenTags = [] appNames = [app for app in allApps if app not in blackList] - print "All apps: %s" % (appNames,) + print("All apps: %s" % (appNames,)) appIndexFile = open(RST_DIR + '/Applications.rst', 'w') appIndexFile.write(RstPageHeading("Applications Reference Documentation", "2", ref="apprefdoc")) @@ -535,7 +559,7 @@ def GenerateRstForApplications(): tags = GetApplicationTags(appName) if not tags: - print "No tags for application: " + appName + print("No tags for application: " + appName) sys.exit(1) tag = tags[0] @@ -545,7 +569,7 @@ def GenerateRstForApplications(): tag_ = tag.replace(' ', '_') if not tag_: - print 'empty tag found for ' + appName + print('empty tag found for ' + appName) if not tag_ in writtenTags: appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep) @@ -562,7 +586,7 @@ def GenerateRstForApplications(): tagFile.write("\tapp_" + appName + linesep) tagFile.close() - print "Generating " + appName + ".rst" + " on tag " + tag_ + print("Generating " + appName + ".rst" + " on tag " + tag_) appFile = open(RST_DIR + '/Applications/app_' + appName + '.rst', 'w') out = ApplicationToRst(appName) appFile.write(out) @@ -571,17 +595,16 @@ def GenerateRstForApplications(): return out -# Start parsing options -parser = OptionParser(usage="Export application(s) to rst file.") -parser.add_option("-a",dest="appname",help="Generate rst only for this application (eg: OrthoRectification)") -parser.add_option("-m",dest="module",help="Generate rst only for this module (eg: Image Manipulation)") -parser.add_option("-o",dest="rstdir",help="directory where rst files are generated") -(options, args) = parser.parse_args() +if __name__ == "__main__": + parser = OptionParser(usage="Export application(s) to rst file.") + parser.add_option("-a",dest="appname",help="Generate rst only for this application (eg: OrthoRectification)") + parser.add_option("-m",dest="module",help="Generate rst only for this module (eg: Image Manipulation)") + parser.add_option("-o",dest="rstdir",help="directory where rst files are generated") + (options, args) = parser.parse_args() -RST_DIR = options.rstdir + RST_DIR = options.rstdir -if not options.appname is None: - out = ApplicationToRst(options.appname) - #print out -else: - GenerateRstForApplications() + if not options.appname is None: + out = ApplicationToRst(options.appname) + else: + GenerateRstForApplications() diff --git a/Documentation/Cookbook/rst/AdvancedUse.rst b/Documentation/Cookbook/rst/AdvancedUse.rst index a52a505b4c7be749e3aa3d49bcb6e07ff5fbf6a1..e9813689ce2575da5c16082f6123c12f08ab6419 100644 --- a/Documentation/Cookbook/rst/AdvancedUse.rst +++ b/Documentation/Cookbook/rst/AdvancedUse.rst @@ -3,12 +3,12 @@ Advanced Use This section describes advanced configuration options and tricks. -Environment variables that affects Orfeo ToolBox ------------------------------------------------- +Environment variables that affect Orfeo ToolBox +----------------------------------------------- The following environment variables are parsed by Orfeo ToolBox. Note that they only affect default values, and that settings in extended -filenames, applications, monteverdi or custom C++ code might override +filenames, applications, Monteverdi or custom C++ code might override those values. * ``OTB_DEM_DIRECTORY``: Default directory were DEM tiles are @@ -26,29 +26,29 @@ those values. default level is ``INFO``. In addition to OTB specific environment variables, the following -environment variable are parsed by third party libraries and also +environment variables are parsed by third party libraries and also affect how OTB works: -* ``GDAL_CACHEMAX``: Gdal has an internal cache mechanism to avoid reading or decoding again image chunks. This environnement variable controls how much memory Gdal can use for caching. By default, Gdal can use up to 5 percents of available RAM on system, which may be a lot. Moreover, caching is only needed if the processing chain is likely to request the same chunk several times, which is not likely to happen for a standard pixel based OTB pipeline. Setting a lower value allows to allocate more memory to OTB itself (using applications ``-ram`` parameter or ``OTB_MAX_RAM_HINT`` environment variable). If value is small (less than 100 000, it is assumed to be in megabytes, otherwise, it is assumed to be in bytes. -* ``GDAL_NUM_THREADS``: Gdal can take advantage of multi-threading to decode some formats. This variable controls the number of threads Gdal is allowed to use. -* ``OPJ_NUM_THREADS``: OpenJpeg can take advantage of mutli-threading when decoding images. This variable controls the number of threads OpenJpeg is allowed to use. -* ``ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS``: This variable allows to control the number of threads used by ITK for processing. +* ``GDAL_CACHEMAX``: GDAL has an internal cache mechanism to avoid reading or decoding again image chunks. This environment variable controls the amount of memory that GDAL can use for caching. By default, GDAL can use up to 5 percent of the system's available RAM, which may be a lot. In addition, caching is only needed if the processing chain is likely to request the same chunk several times, which is unlikely to happen for a standard pixel based OTB pipeline. Setting a lower value facilitates the allocation of more memory to OTB itself (using applications ``-ram`` parameter or ``OTB_MAX_RAM_HINT`` environment variable). If the value is small, i.e. less than 100 000, it is assumed to be in megabytes, otherwise, it is assumed to be in bytes. +* ``GDAL_NUM_THREADS``: GDAL can take advantage of multi-threading to decode some formats. This variable controls the number of threads GDAL is allowed to use. +* ``OPJ_NUM_THREADS``: OpenJpeg can take advantage of multi-threading when decoding images. This variable controls the number of threads OpenJpeg is allowed to use. +* ``ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS``: This variable controls the number of threads used by ITK for processing. .. _extended-filenames: Extended filenames ------------------ -Extended filenames is an interesting feature of OTB. With it, you can control -several aspects of the beahvior of the OTB in the OTB-Applications or in our -own C++ applications. Historically this feature has been desingn to solve -an issue with how to handle geo-referencing information. +Extended filenames are an interesting feature of OTB. With them, it is possible to control +several aspects of the behavior of OTB in the OTB-Applications or in our +own C++ applications. Historically this feature was designed to facilitate +how geo-referencing information was handled. Indeed, there are multiple ways to define geo-referencing information. For instance, one can use a geographic transform, a cartographic projection, or a sensor model with RPC coefficients. A single image may contain several of these elements, such as in the “ortho-ready†products: this -is a type of product still in sensor geometry (the sensor model is +is a type of product that is still in sensor geometry (the sensor model is supplied with the image) but it also contains an approximative geographic transform that can be used to have a quick estimate of the image localisation. For instance, your product may contain a “.TIF†file @@ -56,18 +56,18 @@ for the image, along with a “.RPB†file that contains the sensor model coefficients and an “.IMD†file that contains a cartographic projection. This case leads to the following question: which geo-referencing -element should be used when opening this image in OTB. In -fact, it depends on the users need. For an orthorectification +element should be used when the image is opened in OTB. In +fact, it depends on the user's requirements. For an orthorectification application, the sensor model must be used. In order to specify which information should be skipped, a syntax of extended filenames has been developed for both reading and writing. -Since the development of this feature we have extend this mechanism for -other aspaects: like band or overview selection in reader part or support -create option of gdal in writer part.The reader and writer extended filename +Since the development of this feature, we have extended this mechanism for +other aspects. This includes band or overview selection in reader part or support +create option of GDAL in writer part. The reader and writer extended filename support is based on the same syntax, only the options are different. -To benefit from the extended file name mechanism, the following syntax -is to be used: +To benefit from the extended filename mechanism, the following syntax +should be used: :: @@ -82,7 +82,7 @@ Reader options &geom=<path/filename.geom> -- Contains the file name of a valid geom file +- Contains the filename of a valid geom file - Use the content of the specified geom file instead of image-embedded geometric information @@ -117,20 +117,20 @@ Reader options - Select a subset of bands from the input image -- The syntax is inspired by Python indexing syntax with - bands=r1,r2,r3,...,rn where each ri is a band range that can be : +- The syntax is inspired by the Python indexing syntax with + bands=r1,r2,r3,...,rn where each ri is a band range that can be: - a single index (1-based) : - - :code:`2` means 2nd band + - :code:`2` means the second band - :code:`-1` means last band - or a range of bands : - - :code:`3:` means 3rd band until the last one + - :code:`3:` means from the third band until the last band - - :code:`:-2` means the first bands until the second to last + - :code:`:-2` means the first band up until the penultimate band - :code:`2:4` means bands 2,3 and 4 @@ -158,7 +158,7 @@ Reader options &skipgeom=<(bool)true> -- Skip geometric information +- Skip the geometric information - Clears the keyword list @@ -204,9 +204,9 @@ Writer options &gdal:co:<GDALKEY>=<VALUE> -- To specify a gdal creation option +- To specify a GDAL creation option -- For gdal creation option information, see dedicated gdal documentation for each driver. For example, you can find `here <http://www.gdal.org/frmt_gtiff.html>`_ the information about the GeoTiff create options +- For GDAL creation option information, see the dedicated GDAL documentation for each driver. For example, you can find `here <http://www.gdal.org/frmt_gtiff.html>`_ the information about the GeoTiff create options - None by default @@ -241,7 +241,7 @@ Writer options &streaming:sizemode=<VALUE> -- Allows to choose how the size of the streaming pieces is computed +- Provides the option to choose how the size of the streaming pieces is computed - Available values are: @@ -270,8 +270,8 @@ Writer options - if sizemode=nbsplits: number of requested splits for streaming -- If not provided, the default value is set to 0 and result in - different behaviour depending on sizemode (if set to height or +- If not provided, the default value is set to 0 and results in + different behaviours depending on sizemode (if set to height or nbsplits, streaming is deactivated, if set to auto, value is fetched from configuration or cmake configuration file) @@ -338,25 +338,30 @@ The available syntax for boolean options are: &nodata=(double) value / [int:double, int:double ...] -- This options allows one to set specific nodata values for all or selected bands. +- This options allows one to set specific nodata values for all or selected bands. The nodata values can be set in two ways: either using a simple scalar value or band,value pairs. OTB will select either one of them depending on the type of nodata value string specified. + +- If the value is scalar (without bandindex), it will be applied only to the first band of the image. + +- If the value is given as "bandindex:value" pair separated by a ":" then + the nodata value is applied to only those selected band. + +- By default OTB will not alter any existing nodata value. + +- The following examples illustrate the above-mentioned points: - There are two ways of setting nodata values. simple scalar values of band,value pair. - OTB will select either one of them depending on type of nodata value string - -- If value is scalar (without bandindex), it will be applied only to first band of image. +- Scalar value syntax : "image_filename?&nodata=-999" -> nodata value equal to -999 will be assigned to all bands -- If value is given as "bandindex:value" pair separated by a ":" then - nodata value is applied to only those selected band. +- "Band/Value pair" syntax: "image_filename?&nodata=0:-999,1:255,2:254" -> nodata value corresponds to pixels with values [-999,255,254] -- By default OTB will not alter any existing nodata value. +- It is important to note that the band numbering in the nodata writer option follows the GDAL convention and starts at 1. OGR DataSource options ^^^^^^^^^^^^^^^^^^^^^^^ -We extended this process to OGR DataSource. There are three different type of -option : open, creation and layer creation. Those options come from the GDAL -API. In order to use them one just need to specify to which of this family -the option one want to use is from. +We extended this process to OGR DataSource. There are three different types of +options: open, creation and layer creation, which come directly from the GDAL +API. In order to use them, one just needs to specify the family that the option is +from. For open option : @@ -383,7 +388,7 @@ For layer creation option : Examples ^^^^^^^^^^^^^^ -You can find below some examples: +Some examples are provided below: - Write a file with blockSize equal to 256 and with DEFLATE compression diff --git a/Documentation/Cookbook/rst/FAQ.rst b/Documentation/Cookbook/rst/FAQ.rst index 83faac13abd949abb9c97b6ad0e07137e19c0ae2..09329e83119ab23124f469a4b43bb646a5fea3c0 100644 --- a/Documentation/Cookbook/rst/FAQ.rst +++ b/Documentation/Cookbook/rst/FAQ.rst @@ -30,10 +30,10 @@ What's in OTB? - Geospatial analysis. -For a full list of applications see the :ref:`apprefdoc`. +For a full list of applications see the chapter :ref:`apprefdoc`. For an introduction to the C++ API see the `Software Guide <https://www.orfeo-toolbox.org/SoftwareGuide/>`_. -And for exhaustive descrpition of the C++ API see the +And for an exhaustive description of the C++ API see the `Doxygen <https://www.orfeo-toolbox.org/doxygen/>`_. What is ORFEO? diff --git a/Documentation/Cookbook/rst/OTB-Applications.rst b/Documentation/Cookbook/rst/OTB-Applications.rst index 6b33e545d33ba8b3014e3805a56c80a35f3a0b99..3fe1052e956dc584cb898cc474347ac184a04f65 100644 --- a/Documentation/Cookbook/rst/OTB-Applications.rst +++ b/Documentation/Cookbook/rst/OTB-Applications.rst @@ -20,7 +20,7 @@ entry points. While the framework can be extended, the Orfeo ToolBox ships with ergonomic parameters setting, display of documentation, and progress reporting, -- A SWIG interface, which means that any application can be loaded +- A SWIG interface, which means that any application can be loaded, set-up and executed into a high-level language such as Python or Java for instance. @@ -28,20 +28,20 @@ entry points. While the framework can be extended, the Orfeo ToolBox ships with the SWIG/Python interface is available with seamless integration within QGIS. -The complete list of applications is described in the :ref:`apprefdoc`. +The complete list of applications is described in the Chapter :ref:`apprefdoc`. -All standard applications share the same implementation and expose -automatically generated interfaces. -Thus, the command-line interface is prefixed by ``otbcli_``, while the Qt interface is prefixed by -``otbgui_``. For instance, calling ``otbcli_Convert`` will launch the +All standard applications share the same implementation and automatically expose +generated interfaces. +However they are accessed in a slightly different way: the command-line interface is prefixed by ``otbcli_``, while the Qt interface is prefixed by +``otbgui_``. For cwinstance, calling ``otbcli_Convert`` will launch the command-line interface of the Convert application, while -``otbgui_Convert`` will launch its GUI. +``otbgui_Convert`` will launch the GUI. Command-line launcher --------------------- The command-line application launcher loads an application -plugin, to set its parameters, and execute it using the command line. +plugin, allows for its parameters to be set, and can then be executed from the command line. Launching the ``otbApplicationLauncherCommandLine`` without any arguments provided, results in the following help to be displayed: @@ -52,23 +52,23 @@ results in the following help to be displayed: The ``module_name`` parameter corresponds to the application name. The ``[MODULEPATH]`` argument is optional and allows the path to the shared library -(or plugin) correpsonding to the ``module_name`` to be passed to the launcher. +(or plugin) corresponding to the ``module_name`` to be passed to the launcher. It is also possible to set this path with the environment variable ``OTB_APPLICATION_PATH``, making the ``[MODULEPATH]`` optional. This variable is checked by default when no ``[MODULEPATH]`` argument is given. When using multiple paths in ``OTB_APPLICATION_PATH``, one must -make sure to use the standard path separator of the target system, which +ensure that the standard path separator of the target system is used, which is ``:`` on Unix and ``;`` on Windows. An error in the application name (i.e. in parameter ``module_name``) -will make the ``otbApplicationLauncherCommandLine`` lists the name of +will make the ``otbApplicationLauncherCommandLine`` list the name of all applications found in the available path (either ``[MODULEPATH]`` and/or ``OTB_APPLICATION_PATH``). -To ease the use of the applications, and try avoiding extensive -environment customization, ready-to-use scripts are provided by the OTB -installation to launch each application, and takes care of adding the +To ease the use of the applications, and to avoid extensive +environment customizations; ready-to-use scripts are provided by the OTB +installation to launch each application. They take care of adding the standard application installation path to the ``OTB_APPLICATION_PATH`` environment variable. @@ -79,7 +79,7 @@ application with the script called ``otbcli_Orthorectification``. Launching an application without parameters, or with incomplete parameters, will cause the launcher to display a summary of the parameters. This summary will display the minimum set of parameters that are required to execute the application. Here is an -example with the OrthoRectification application: +example based on the OrthoRectification application: :: @@ -125,11 +125,11 @@ example with the OrthoRectification application: For a detailed description of the application behaviour and parameters, please check the application reference documentation presented -chapter [chap:apprefdoc], page or follow the ``DOCUMENTATION`` -hyperlink provided in ``otbApplicationLauncherCommandLine`` output. +in chapter :ref:`apprefdoc` or follow the ``DOCUMENTATION`` +hyperlink provided in the output of ``otbApplicationLauncherCommandLine``. Parameters are passed to the application using the parameter key (which might include one or several ``.`` character), prefixed by a ``-``. -Command-line examples are provided in chapter [chap:apprefdoc], page. +Command-line examples are provided in the chapter :ref:`apprefdoc`. Graphical launcher ------------------ @@ -193,7 +193,7 @@ environment variable ``PYTHONPATH`` to include this directory so that the module becomes available from Python. On Windows, you can install the ``otb-python`` package, and the module -will be available from an OSGeo4W shell automatically. +will be automatically available from an OSGeo4W shell. As for the command line and GUI launchers, the path to the application modules needs to be properly set with the ``OTB_APPLICATION_PATH`` @@ -226,34 +226,6 @@ like this small example: For more information about this Python interface, check the recipe section. -QGIS interface --------------- - -The processing toolbox -^^^^^^^^^^^^^^^^^^^^^^ - -OTB applications are available from QGIS. Use them from the processing -toolbox, which is accessible under Processing :math:`\rightarrow` -ToolBox. Switch to “advanced interface†in the bottom of the application -widget and OTB applications will be there. - -.. figure:: Art/QtImages/qgis-otb.png - -Using a custom OTB -^^^^^^^^^^^^^^^^^^ - -If QGIS cannot find OTB, the “applications folder†and “binaries folder†-can be set from the settings found under Processing :math:`\rightarrow` -Settings :math:`\rightarrow` “service providerâ€. - -.. figure:: Art/QtImages/qgis-otb-settings.png - -On some versions of QGIS, if an existing OTB installation is found, the -textfield settings will not be shown. To use a custom OTB instead of the -existing one, you will need to replace the otbcli, otbgui and library -files in QGIS installation directly. - - Load and save parameters to XML ------------------------------- @@ -355,7 +327,7 @@ Here is an example of MPI call on a cluster:: One can see that the registration and pan-sharpening of the panchromatic and multi-spectral bands of a Pleiades image has been split -among 560 cpus and only took 56 seconds. +between 560 CPUs and only took 56 seconds to complete. Note that this MPI parallel invocation of applications is only available for command-line calls to OTB applications, and only for diff --git a/Documentation/Cookbook/rst/QGIS-interface.rst b/Documentation/Cookbook/rst/QGIS-interface.rst new file mode 100644 index 0000000000000000000000000000000000000000..eb075ef35dd151285236881f80bced5a7e9d3c7e --- /dev/null +++ b/Documentation/Cookbook/rst/QGIS-interface.rst @@ -0,0 +1,85 @@ +QGIS interface +============== + +The QGIS-OTB plugin (requires QGIS > 3.0) +----------------------------------------- + +With QGIS 3.0.2 or later, you will need to manually install the plugin. +Clone qgis-otb-plugin repository and set ``QGIS_PLUGINPATH``: + +For Linux/Unix/MacOSX +^^^^^^^^^^^^^^^^^^^^^ + +:: + + mkdir $HOME/projects; cd $HOME/projects + git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin + export QGIS_PLUGINPATH=$HOME/projects/qgis-otb-plugin + +For Windows +^^^^^^^^^^^ + +Clone qgis-otb-plugin repository to ``C:\qgis-plugins\qgis-otb-plugin`` + +:: + + git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin + +Then set the ``QGIS_PLUGINPATH`` variable: + +* System properties (``Windows Key + R -> sysdm.cpl`` ) +* Select Advanced Tab -> Environment variables. +* Under "user variables for " +* Add or Edit variable ``QGIS_PLUGINPATH`` and set value to ``C:\qgis-plugins\qgis-otb-plugin`` + +Download and Install OTB +^^^^^^^^^^^^^^^^^^^^^^^^ + +OTB is not distributed with qgis-otb-plugin. It is a seperate project and has its own git repository. +Download latest OTB version: https://www.orfeo-toolbox.org/download/. + +Configure plugin in QGIS +^^^^^^^^^^^^^^^^^^^^^^^^ + +Restart QGIS, then install the OTB plugin: +`Plugins -> Manage and Install Plugins`. + +Click on `Installed` tab on left and make sure box next to `OrfeoToolBox (OTB)` is checked. + +Open processing settings +^^^^^^^^^^^^^^^^^^^^^^^^ + +`Settings -> Options -> Processing (left panel)` + +You can see OTB under "Providers": + +* Expand OTB tab +* Tick Activate option +* Set OTB folder. This is location of your OTB installation. +* Set OTB application folder. This is location of your OTB applications. ``<OTB_FOLDER>/lib/otb/applications`` +* Click "ok" to save settings and close dialog. If settings are correct, you will have OTB algorithms loaded in Processing toolbox + +Using the processing toolbox (for QGIS < 3.0) +--------------------------------------------- + +In older QGIS version (3.0 or before), OTB applications are available from QGIS. +Use them from the processing toolbox, which is accessible under `Processing +-> ToolBox`. Switch to “advanced interface†in the bottom of the +application widget and OTB applications will be there. + +.. figure:: Art/QtImages/qgis-otb.png + +Using a custom OTB +^^^^^^^^^^^^^^^^^^ + +If QGIS cannot find OTB, the “applications folder†and “binaries folder†+can be set from the settings found under Processing :math:`\rightarrow` +Settings :math:`\rightarrow` “service providerâ€. + +.. figure:: Art/QtImages/qgis-otb-settings.png + +On some versions of QGIS, if an existing OTB installation is found, the +textfield settings will not be shown. To use a custom OTB instead of the +existing one, you will need to replace the otbcli, otbgui and library +files in QGIS installation directly. + diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index 1e4442b07f398766735fa3898e75692c5b9d52d4..c9e101cb7ab2865e843b0479c3be4ae0d4d6e501 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -14,12 +14,7 @@ import sys import os -HAVE_RTD_THEME=False -try: - import sphinx_rtd_theme - HAVE_RTD_THEME=True -except: - pass +import sphinx_rtd_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -111,11 +106,10 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -if HAVE_RTD_THEME: - html_theme = 'sphinx_rtd_theme' - # Add any paths that contain custom themes here, relative to this directory. - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - +html_theme = 'sphinx_rtd_theme' +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. diff --git a/Documentation/Cookbook/rst/index_TOC.rst b/Documentation/Cookbook/rst/index_TOC.rst index 126fc8debfbd713cdd752205ee33f49ba9b60dfd..9a5d882b4ffe6fc227098d0a4528657783d35222 100644 --- a/Documentation/Cookbook/rst/index_TOC.rst +++ b/Documentation/Cookbook/rst/index_TOC.rst @@ -7,6 +7,7 @@ Table of Contents index Installation OTB-Applications + QGIS-interface Monteverdi AdvancedUse Recipes diff --git a/Documentation/Cookbook/rst/recipes/bandmathx.rst b/Documentation/Cookbook/rst/recipes/bandmathx.rst index 54c0d9eb4eb1309ad9a98f1e41237e83d3030bad..7902bd987d324077f565d6cf92da71f99f5173b4 100644 --- a/Documentation/Cookbook/rst/recipes/bandmathx.rst +++ b/Documentation/Cookbook/rst/recipes/bandmathx.rst @@ -20,6 +20,8 @@ A simple example is given below: As we can see, the new band math filter works with the class otb::VectorImage. +.. _syntax: + Syntax: first elements ---------------------- @@ -134,8 +136,7 @@ or in more simple terms (and only if im2 contains two components): .. math:: im2* \{1,2\}' Concerning division, this operation is not originally defined between -two vectors (see next section “New operators and functions†--[ssec:operators]-). +two vectors (see next section :ref:`operators`). Now, let’s go back to the first formula: this one specifies the addition of two images band to band. With muParserX lib, we can now define such @@ -170,6 +171,8 @@ Fundamentally, a neighbourhood is represented as a matrix inside the muParserX framework; so the remark about mathematically well-defined formulas still stands. +.. _operators: + New operators and functions --------------------------- @@ -205,7 +208,7 @@ ones. For instance: .. math:: im1 ~ mlt ~ 2.0 Note that the operator ’\*’ could have been used instead of ’pw’ one. -But ’pw’ is a little bit more permisive, and can tolerate a +But ’pw’ is a little bit more permissive, and can tolerate a one-dimensional vector as the right operand. **Operators pow and pw** The first operator allows the definition of an @@ -267,20 +270,20 @@ takes two inputs). For instance: .. math:: corr(im1b1N3x3,im1b2N3x3) -**Function maj** This function allows to compute the most represented +**Function maj** This function computes the most represented element within a vector or a matrix (the function can take as many inputs as needed; one maj element value is computed per input). For instance: .. math:: maj(im1b1N3x3,im1b2N3x3) -**Function vmin and vmax** These functions allow to compute the min or +**Function vmin and vmax** These functions calculate the min or max value of a given vector or neighborhood (only one input). For instance: .. math:: (vmax(im3b1N3x5)+vmin(im3b1N3x5)) ~ div ~ \{2.0\} -**Function cat** This function allows to concatenate the results of +**Function cat** This function concatenates the results of several expressions into a multidimensional vector, whatever their respective dimensions (the function can take as many inputs as needed). For instance: @@ -293,8 +296,7 @@ application will call the function ’cat’ automatically. For instance: .. math:: filter->SetExpression("im3b1 ; vmin(im3b1N3x5) ; median(im3b1N3x5) ; vmax(im3b1N3x5)"); -Please, also refer to the next section “Application Programming -Interface†([ssec:API]). +Please, also refer to the next section :ref:`API`. **Function ndvi** This function implements the classical normalized difference vegetation index; it takes two inputs. For instance: @@ -302,7 +304,7 @@ difference vegetation index; it takes two inputs. For instance: .. math:: ndvi(im1b1,im1b4) First argument is related to the visible red band, and the second one to -the near-infrareds band. +the near-infrared band. The table below summarises the different functions and operators. @@ -366,6 +368,8 @@ Functions and operators summary: [variables] +.. _API: + Application Programming Interface (API) --------------------------------------- @@ -381,7 +385,7 @@ of the new band math filter. /** Return a pointer on the nth filter input */ ImageType * GetNthInput(unsigned int idx); -Refer to the section “Syntax: first elements†([ssec:syntax]) where the +Refer to the section :ref:`syntax`, where the two first functions have already been commented. The function GetNthInput is quite clear to understand. @@ -394,13 +398,13 @@ Each time the function SetExpression is called, a new expression is pushed inside the filter. **There are as many outputs as there are expressions. The dimensions of the outputs (number of bands) are totally dependent on the dimensions of the related expressions (see also last -remark of the section “Syntax: first element†-[ssec:syntax]-).** Thus, +remark of the section :ref:`syntax`).** Thus, the filter always performs a pre-evaluation of each expression, in order to guess how to allocate the outputs. The concatenation of the results of many expressions (whose results can have different dimensions) into one unique output is possible. For that -puropose, semi-colons (“;â€) are used as separating characters. For +purpose, semi-colons (“;â€) are used as separating characters. For instance: .. math:: filter->SetExpression("im1 + im2 ; im1b1*im2b1"); @@ -494,7 +498,7 @@ expr. For instance: /** Export constants and expressions to a given filename */ void ExportContext(const std::string& filename); -This function allows the user to export a txt file that saves its +This function allows the user to export a text file that saves its favorite constant or expression definitions. Such a file will be reusable by the ImportContext function (see above). diff --git a/Documentation/Cookbook/rst/recipes/improc.rst b/Documentation/Cookbook/rst/recipes/improc.rst index 6e9e94e97714f6884113dfd1c75bea8c731d7a94..36aa46f1b99da3da55a2cf128745dbfd5b0f3822 100644 --- a/Documentation/Cookbook/rst/recipes/improc.rst +++ b/Documentation/Cookbook/rst/recipes/improc.rst @@ -70,7 +70,7 @@ input image to the default value for DEM (which is -32768): The third mode “apply†can be useful if you apply a formula to the entire image. This will likely change the values of pixels flagged as -no-data, but the no-data value in the image metadata doesn’t change. If +no-data, but the no-data value in the image metadata does not change. If you want to fix all no-data pixels to their original value, you can extract the mask of the original image and apply it on the output image. For instance: @@ -91,8 +91,8 @@ For instance: -mode.apply.mask mask.tif You can also use this “apply†mode with an additional parameter -“mode.apply.ndvalâ€. This parameter allow to set the output nodata value -applying according to your input mask. +“mode.apply.ndvalâ€. This parameter sets the output nodata value +of the input mask. Segmentation ------------ @@ -274,7 +274,7 @@ all the previous steps: Most of the settings from the previous applications are also exposed in this composite application. The range and spatial radius used for the segmentation -step are half the values used for Mean-Shift smooting, which are obtained from +step are half the values used for Mean-Shift smoothing, which are obtained from LargeScaleMeanShift parameters. There are two output modes: vector (default) and raster. When the raster output is chosen, last step (vectorization) is skipped. @@ -295,8 +295,8 @@ Dempster Shafer based Classifier Fusion This framework is dedicated to perform cartographic validation starting from the result of a detection (for example a road extraction), enhance -the results fiability by using a classifier fusion algorithm. Using a -set of descriptor, the processing chain validates or invalidates the +the results viability by using a classifier fusion algorithm. Using a +set of descriptors, the processing chain validates or invalidates the input geometrical features. Fuzzy Model (requisite) @@ -341,7 +341,7 @@ for each studied polyline, the chosen descriptors. In this context, the *ComputePolylineFeatureFromImage* application can be used for a large range of descriptors. It has the following inputs: -- ``-in`` an image (of the sudied scene) corresponding to the chosen +- ``-in`` an image (of the studied scene) corresponding to the chosen descriptor (NDVI, building Mask…) - ``-vd`` a vector data containing polyline of interest @@ -394,7 +394,7 @@ Second Step: Feature Validation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The final application (*VectorDataDSValidation* ) will validate or -unvalidate the studied samples using `the Dempster-Shafer +invalidate the studied samples using `the Dempster-Shafer theory <http://en.wikipedia.org/wiki/Dempster%E2%80%93Shafer_theory>`_ . Its inputs are: diff --git a/Documentation/Cookbook/rst/recipes/optpreproc.rst b/Documentation/Cookbook/rst/recipes/optpreproc.rst index e3f00ca3a47bb36f7b98e0128a280d52593f233a..8c93e84b10babf42a691ec3fc53e91d0348b536a 100644 --- a/Documentation/Cookbook/rst/recipes/optpreproc.rst +++ b/Documentation/Cookbook/rst/recipes/optpreproc.rst @@ -10,7 +10,7 @@ Optical radiometric calibration In remote sensing imagery, pixel values are referred to as Digital Numbers (DN) and they cannot be physically interpreted or compared. They are influenced by various factors such as the amount of light flowing through -the sensor, the gain of the detectors and the analogic to numeric +the sensor, the gain of the detectors and the analogue to digital converter. Depending on the season, the light and atmospheric conditions, the @@ -63,7 +63,7 @@ sensors are: - Formosat -The *OpticalCalibration* application allows to perform optical +The *OpticalCalibration* application performs optical calibration. The mandatory parameters are the input and output images. All other parameters are optional. By default the level of calibration is set to TOA (Top Of Atmosphere). The output images are expressed in @@ -128,7 +128,7 @@ Using either **OTB Applications** or modules from **Monteverdi** , it is possible to perform both steps in a row, or step-by-step fusion, as described in the above sections. -The *BundleToPerfectSensor* application allows to perform both steps in +The *BundleToPerfectSensor* application performs both steps in a row. Seamless sensor modelling is used to perform zooming and registration of the multi-spectral image on the panchromatic image. In the case of a Pléiades bundle, a different approach is used: an affine @@ -157,15 +157,15 @@ application: There are also optional parameters that can be useful for this tool: -- The ``-elev`` option allows to specify the elevation, either with a - DEM formatted for OTB (``-elev.dem`` option, see section [ssec:dem]) +- The ``-elev`` option specifies the elevation, either with a + DEM formatted for OTB (``-elev.dem`` option, see section :ref:`section2`) or with an average elevation (``-elev.default`` option). Since registration and zooming of the multi-spectral image is performed using sensor-models, it may happen that the registration is not - perfect in case of landscape with high elevation variation. Using a - DEM in this case allows to get better registration. + perfect in case of a landscape with a large variation in elevation. In this + case a DEM will allow for a better registration to be achieved. -- The ``-lmSpacing`` option allows to specify the step of the +- The ``-lmSpacing`` option specifies the step of the registration grid between the multi-spectral image and panchromatic image. This is expressed in amount of panchromatic pixels. A lower value gives a more precise registration but implies more computation @@ -173,15 +173,15 @@ There are also optional parameters that can be useful for this tool: Default value is 10 pixels, which gives sufficient precision in most of the cases. -- The ``-mode`` option allows to select the registration mode for the +- The ``-mode`` option selects the registration mode for the multi-spectral image. The ``default`` mode uses the sensor model of each image to create a generic “MS to Pan†transform. The ``phr`` - mode uses a simple affine transform (which doesn’t need an elevation + mode uses a simple affine transform (which does not need an elevation source nor a registration grid). -Pan-sharpening is a quite heavy processing requiring a lot of system -resource. The ``-ram`` option allows you to limit the amount of memory -available for the computation, and to avoid overloading your computer. +Pan-sharpening is a process that requires a lot of system +resources. The ``-ram`` option allows you to limit the amount of memory +available for the computation, and also avoids overloading your computer. Increasing the available amount of RAM may also result in better computation time, seems it optimises the use of the system resources. Default value is 256 Mb. @@ -194,7 +194,7 @@ Figure 5: Pan-sharpened image using Orfeo ToolBox. Please also note that since registration and zooming of the multi-spectral image with the panchromatic image relies on sensor modelling, this tool will work only for images whose sensor models is -available in **Orfeo ToolBox** (see :ref:`section3` for a detailed +available in **Orfeo ToolBox** (see Section :ref:`section3` for a detailed list). It will also work with ortho-ready products in cartographic projection. @@ -204,17 +204,17 @@ Digital Elevation Model management ---------------------------------- A Digital Elevation Model (DEM) is a georeferenced image (or collection -of images) where each pixel corresponds to a local elevation. DEM are +of images) where each pixel corresponds to a local elevation. DEMs are useful for tasks involving sensor to ground and ground to sensor -coordinate transforms, like during ortho-rectification (see :ref:`section3`). These transforms need to find the intersection +coordinate transformations, for example, ortho-rectification (see Section :ref:`section3`). These transforms need to find the intersection between the line of sight of the sensor and the Earth geoid. If a simple spheroid is used as the Earth model, potentially high localisation errors can be made in areas where elevation is high or perturbed. Of course, DEM accuracy and resolution have a great impact on the precision of these transformations. -Two main available DEM, free of charges, and with worldwide cover, are -both delivered as 1 degree by 1 degree tiles: +The two principal DEMs that are available free of charges, and with worldwide cover, are +both delivered as 1 degree by 1 degree tiles. They are: - `The Shuttle Radar topographic Mission (SRTM) <http://www2.jpl.nasa.gov/srtm/>`_ is a DEM with a resolution of 90 metres, @@ -232,7 +232,7 @@ are supposed to be located within a single directory. General elevation support is also supported from GeoTIFF files. Whenever an application or **Monteverdi** module requires a DEM, the -option **elev.dem** allows set the DEM directory. This directory must +option **elev.dem** sets the DEM directory. This directory must contain the DEM tiles, either in DTED or SRTM format or as a GeoTIFF. Subdirectories are not supported. @@ -244,7 +244,7 @@ the Earth. We provide one geoid in the `OTB-Data <https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data/tree/master/Input/DEM>`_ repository. -In all applications, the option **elev.geoid** allows to manage the path +In all applications, the option **elev.geoid** manages the path to the geoid. Finally, it is also possible to use an average elevation in case no DEM is available by using the **elev.default** option. @@ -358,7 +358,7 @@ section. Ortho-rectification with **OTB Applications** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The *OrthoRectification* application allows to perform +The *OrthoRectification* application performs ortho-rectification and map re-projection. The simplest way to use it is the following command: @@ -378,9 +378,10 @@ parameters: - The region of interest (upper-left corner and size of the image) is estimated so as to contain the whole input image extent. -In order to use a Digital Elevation Model (see :ref:`section2`.) for -better localisation performances, one can pass the directory containing -the DEM tiles to the application: +In order to use a Digital Elevation Model to improve +the locational accuracy, one can pass the directory containing +the DEM tiles to the application as follows. Further information regarding +the use of DEMs can be found in Section :ref:`section2`. :: @@ -448,30 +449,30 @@ follows: -outputs.sizex x_size -outputs.sizey y_size -Where the ``-outputs.ulx`` and ``-outputs.uly`` options allow to specify -the coordinates of the upper-left corner of the output image. The -``-outputs.sizex`` and ``-outputs.sizey`` options allow to specify the +Where the ``-outputs.ulx`` and ``-outputs.uly`` options specify +the coordinates of the upper-left corner of the output image, while the options: +``-outputs.sizex`` and ``-outputs.sizey`` specify the size of the output image. A few more interesting options are available: -- The ``-opt.rpc`` option allows to use an estimated RPC model instead +- The ``-opt.rpc`` option uses an estimated RPC model instead of the rigorous SPOT5 model, which speeds-up the processing, -- The ``-opt.gridspacing`` option allows to define the spacing of the +- The ``-opt.gridspacing`` option defines the spacing of the localisation grid used for ortho-rectification. A coarser grid results in speeding-up the processing, but with potential loss of accuracy. A standard value would be 10 times the ground spacing of the output image. -- The ``-interpolator`` option allows to change the interpolation +- The ``-interpolator`` option changes the interpolation algorithm between nearest neighbor, linear and bicubic. Default is nearest neighbor interpolation, but bicubic should be fine in most cases. -- The ``-opt.ram`` option allows to specify the amount of memory - available for the processing (in Mb). Default is 256 Mb. Increasing - this value to fit the available memory on your computer might +- The ``-opt.ram`` option specifies the amount of memory + available for the processing (in Mb), with a default value of 256 Mb. Increasing + this value to fit the available memory on your computer can speed-up the processing. diff --git a/Documentation/Cookbook/rst/recipes/residual_registration.rst b/Documentation/Cookbook/rst/recipes/residual_registration.rst index dbe3d2664f981f941b78214e1f96dda41b74f3b1..aeb8615cba67ba0e3550a3e2611ddd84f1cdbcb0 100644 --- a/Documentation/Cookbook/rst/recipes/residual_registration.rst +++ b/Documentation/Cookbook/rst/recipes/residual_registration.rst @@ -70,8 +70,8 @@ get a set of point which match in both images. The basic idea is to use this set of homologous points and estimate with them a residual transformation between the two images. -There is a wide variety of keypoint detector in the literature. They -allow to detect and describe local features in images. These algorithms +There is a wide variety of keypoint detectors in the literature, and they +allow for the detection and description of local features in images. These algorithms provide for each interesting point a “feature descriptionâ€. This descriptor has the property to be invariant to image translation, scaling, and rotation, partially invariant to illumination changes and @@ -90,16 +90,16 @@ The application offers two modes: full extent of both images (please note that in this mode large image file are not supported). -- The second mode, called *geobins*, allows to set-up spatial binning +- The second mode, called *geobins*, allows for the set-up of spatial binning so as to get fewer points spread across the entire image. In this mode, the corresponding spatial bin in the second image is estimated using geographical transform or sensor modeling, and is padded according to the user defined precision. Moreover, in both modes the application can filter matches whose -co-localization in the first image exceed this precision. Last, the +co-localization in the first image exceed this precision. Finally, the elevation parameters allow to deal more precisely with sensor modelling -in case of sensor geometry data. The *outvector* option allows to create +in case of sensor geometry data. The *outvector* option allows for the creation of a vector file with segments corresponding to the localization error between the matches. @@ -150,7 +150,7 @@ display in a GIS software. Please note again that for a proper use of the application, elevation must be correctly set (including DEM and geoid file). The map parameters -allows to choose a map projection in which the accuracy will be +sets a map projection in which the accuracy will be estimated (in meters). Accuracy values are provided as output of the application (computed @@ -177,7 +177,7 @@ reference. **Orfeo ToolBox** offers since version 3.16 the possibility to use hrefhttp://wiki.orfeo-toolbox.org/index.php/ExtendedFileNameextend image path to use different metadata file as input. That’s what we are going -to use there to orthorectify the QuickBird image using the *.geom* file +to use to orthorectify the QuickBird image using the *.geom* file obtained by the **RefineSensorModel** applications. over the first one using for the second image estimated sensor model which take into account the original sensor model of the slave and which also fit to the diff --git a/Documentation/SoftwareGuide/CMakeLists.txt b/Documentation/SoftwareGuide/CMakeLists.txt index 7c77844ef9c5beb94ba6843d55ed923f10011e79..3bbf2e73d5cc80f496dc968f5aac63524c83246b 100644 --- a/Documentation/SoftwareGuide/CMakeLists.txt +++ b/Documentation/SoftwareGuide/CMakeLists.txt @@ -59,14 +59,8 @@ set(OTB_VERSION_STRING_FULL "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VER # Configure the default OTB_DATA_ROOT for the location of OTB Data. FIND_PATH(OTB_DATA_ROOT README-OTB-Data PATHS $ENV{OTB_DATA_ROOT} ${OTB_SOURCE_DIR}/../OTB-Data) -FIND_PATH(OTB_DATA_LARGEINPUT_ROOT OTBData.readme PATHS $ENV{OTB_DATA_LARGEINPUT_ROOT}) - -IF( NOT OTB_DATA_LARGEINPUT_ROOT ) - MESSAGE(FATAL_ERROR "Large input directory is not set and is mandatory to build the Software Guide.") -ENDIF( NOT OTB_DATA_LARGEINPUT_ROOT ) - # OTB_DATA_PATHS is searched recursively.. you need not enter sub-directories -SET(OTB_DATA_PATHS "${OTB_DATA_ROOT}/Examples::${OTB_DATA_ROOT}/Input::${OTB_DATA_LARGEINPUT_ROOT}" CACHE STRING "Where the OTB data is. Enter a double colon separated list.") +SET(OTB_DATA_PATHS "${OTB_DATA_ROOT}/Examples::${OTB_DATA_ROOT}/Input" CACHE STRING "Where the OTB data is. Enter a double colon separated list.") # # Rebuild the Software Guide figures or not ? diff --git a/Documentation/SoftwareGuide/Latex/Introduction.tex b/Documentation/SoftwareGuide/Latex/Introduction.tex index ad782dca9f16149b810bb283a9ef8d5315e7b984..f67dc0beb7cf2e3899438514b0c6492262bb2df6 100644 --- a/Documentation/SoftwareGuide/Latex/Introduction.tex +++ b/Documentation/SoftwareGuide/Latex/Introduction.tex @@ -154,7 +154,7 @@ The \code{OTB} contains the following subdirectories: OTB is organized into different modules, each one covering different part of image processing. It is therefore important to understand the source code directory structure---found in \code{OTB/Modules}---. \begin{itemize} - \item \code{OTB/Modules/Adapters}---Adapters for Boost, Curl, Gdal, OpenThreads and Ossim. + \item \code{OTB/Modules/Adapters}---Adapters for Boost, Curl, Gdal and Ossim. \item \code{OTB/Modules/Applications}---a set of applications modules that can be launched in different ways (command-line, graphical interface, Python/Java), refer to the OTB Cookbook for more information. \item \code{OTB/Modules/Core}---core classes, macro definitions, @@ -166,16 +166,16 @@ It is therefore important to understand the source code directory structure---fo instance, pansharpening. \item \code{OTB/Modules/Hyperspectral}---hyperspectral images analysis. \item \code{OTB/Modules/IO}---classes that support the reading - and writing of data. + and writing of data. \item \code{OTB/Modules/Learning}---several functionalities for supervised learning and classification. \item \code{OTB/Modules/OBIA}---Object Based Image Analysis filters - and data structures. + and data structures. \item \code{OTB/Modules/Radiometry}---classes allowing to compute - vegetation indices and radiometric corrections. - \item \code{OTB/Modules/Registration}---classes for registration of images or other data structures to each other. - \item \code{OTB/Modules/Remote}---Functions to fetch remote modules. - \item \code{OTB/Modules/Segmentation}---several functionalities for image segmentation. + vegetation indices and radiometric corrections. + \item \code{OTB/Modules/Registration}---classes for registration of images or other data structures to each other. + \item \code{OTB/Modules/Remote}---Functions to fetch remote modules. + \item \code{OTB/Modules/Segmentation}---several functionalities for image segmentation. \item \code{OTB/Modules/ThirdParty}---Modules that import OTB's dependencies. \item \code{OTB/Modules/Wrappers}---Applications wrappers with several access points (command-line, QT Gui, SWIG\ldots). \end{itemize} diff --git a/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx b/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx index a28764cc153d3fafcc93de0e678a92097df8d12f..b41f9b0251166f6da3ae995c03fdf6deeb815584 100644 --- a/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx +++ b/Examples/ChangeDetection/ChangeDetectionFrameworkExample.cxx @@ -26,11 +26,11 @@ // in OTB. This framework uses the generic programming approach. All // change detection filters are // \doxygen{otb}{BinaryFunctorNeighborhoodImageFilter}s, that is, they -// are filters taking two images as input and providing one image as -// output. The change detection computation itself is performed on a +// are filters taking two images as input and provide one image as +// output. The change detection computation itself is performed on // the neighborhood of each pixel of the input images. // -// The first step required to build a change detection filter is to +// The first step in building a change detection filter is to // include the header of the parent class. // // Software Guide : EndLatex @@ -54,7 +54,7 @@ // something accepting the syntax \code{foo()}. This can be // implemented using classical C/C++ functions, but it is preferable // to implement it using C++ functors. These are classical C++ classes -// which overload the \code{()} operator. This allows using them with +// which overload the \code{()} operator. This allows to be used with // the same syntax as C/C++ functions. // // Since change detectors operate on neighborhoods, the functor @@ -107,7 +107,7 @@ public: // the functor used to perform the change detection operation. // // Inside the class only a few \code{typedef}s and the constructors -// and destructors have to be declared. +// and destructors need to be declared. // // Software Guide : EndLatex @@ -152,8 +152,8 @@ private: // Software Guide : BeginLatex // -// Pay attention to the fact that no \code{.hxx} file is needed, since -// filtering operation is implemented in the +// Pay particular attention to the fact that no \code{.hxx} file is needed, since +// the filtering operation is implemented in the // \doxygen{otb}{BinaryFunctorNeighborhoodImageFilter} class. So all // the algorithmics part is inside the functor. // @@ -178,7 +178,7 @@ int main(int argc, char* argv[]) // Software Guide : BeginLatex // // As usual, we start by defining the image types. The internal - // computations will be performed with floating point precision, + // computations will be performed using floating point precision, // while the output image will be stored using one byte per pixel. // // SoftwareGuide : EndLatex @@ -210,7 +210,7 @@ int main(int argc, char* argv[]) // Software Guide : BeginLatex // - // The next step is declaring the filter for the change detection. + // The next step is to declare the filter for the change detection. // // SoftwareGuide : EndLatex diff --git a/Examples/ChangeDetection/DiffChDet.cxx b/Examples/ChangeDetection/DiffChDet.cxx index 3c2e18cbecaf69d28ff5f3158044539cfd1144e2..31b2b003359cafc850f30b692b6574f20da2bc67 100644 --- a/Examples/ChangeDetection/DiffChDet.cxx +++ b/Examples/ChangeDetection/DiffChDet.cxx @@ -107,11 +107,11 @@ int main(int argc, char* argv[]) // // The change detector will give positive and negative values // depending on the sign of the difference. We are usually - // interested only in the asbolute value of the difference. For + // interested only in the absolute value of the difference. For // this purpose, we will use the \doxygen{itk}{AbsImageFilter}. Also, before // saving the image to a file in, for instance, PNG format, we will - // rescale the results of the change detection in order to use all - // the output pixel type range of values. + // rescale the results of the change detection in order to use the full range + // of values of the output pixel type. // // Software Guide : EndLatex diff --git a/Examples/Classification/BayesianPluginClassifier.cxx b/Examples/Classification/BayesianPluginClassifier.cxx index 1bd3df47364332f3311e9a3bd0f0faa6be7999d9..9bb9678da70f3a44c3ea40f09798ada9ba00ade7 100644 --- a/Examples/Classification/BayesianPluginClassifier.cxx +++ b/Examples/Classification/BayesianPluginClassifier.cxx @@ -38,11 +38,11 @@ // different set of parameters, mean vectors and covariance matrices. We // choose the \subdoxygen{itk}{Statistics}{MeanSampleFilter} (sample mean) and the // \subdoxygen{itk}{Statistics}{CovarianceSampleFilter} (sample covariance) for the -// estimation algorithms of the two parameters. If we want more a robust -// estimation algorithm, we can replace these estimation algorithms with more +// estimation algorithms of the two parameters. If we want a more robust +// estimation algorithm, we can replace these estimation algorithms with additional // alternatives without changing other components in the classifier system. // -// It is a bad idea to use the same sample for test and training +// It is a bad idea to use the same sample for both testing and training // (parameter estimation) of the parameters. However, for simplicity, in // this example, we use a sample for test and training. // @@ -254,8 +254,8 @@ int main(int, char *[]) // \label{eq:bayes2} // \end{equation} // - // The remainder of the code snippet shows how to use user-specified class - // labels. The classification result will be stored in a + // The remainder of the code snippet demonstrates how user-specified class + // labels are used. The classification result will be stored in a // MembershipSample object, and for each measurement vector, its // class label will be one of the two class labels, 100 and 200 // (\code{unsigned int}). diff --git a/Examples/Filtering/test/CMakeLists.txt b/Examples/Filtering/test/CMakeLists.txt index 4404e1add63626e73b2a6b08899cb536cc9e3cb4..972d860fc25e9d02d63c31b98e122792023826d0 100644 --- a/Examples/Filtering/test/CMakeLists.txt +++ b/Examples/Filtering/test/CMakeLists.txt @@ -132,13 +132,13 @@ otb_add_test(NAME fiTeMathematicalMorphologyGrayscaleFiltersTest COMMAND ${OTB_T otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter1Test COMMAND ${OTB_TEST_DRIVER} --compare-n-images ${NOTOL} 2 - ${BASELINE}/LaplacianRecursiveGaussianImageFilteroutput5.hdr - ${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.hdr + ${BASELINE}/LaplacianRecursiveGaussianImageFilteroutput5.tif + ${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.tif ${BASELINE}/LaplacianRecursiveGaussianImageFilterOutput5.png ${TEMP}/LaplacianRecursiveGaussianImageFilterOutput5.png Execute $<TARGET_FILE:LaplacianRecursiveGaussianImageFilter1> ${INPUTDATA}/ROISpot5.png - ${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.hdr + ${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.tif 5 ${TEMP}/LaplacianRecursiveGaussianImageFilterOutput5.png ) @@ -148,13 +148,13 @@ otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter1Test COMMAND ${OTB_T otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter2Test COMMAND ${OTB_TEST_DRIVER} --compare-n-images ${NOTOL} 2 - ${BASELINE}/LaplacianRecursiveGaussianImageFilter2output5.hdr - ${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.hdr + ${BASELINE}/LaplacianRecursiveGaussianImageFilter2output5.tif + ${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.tif ${BASELINE}/LaplacianRecursiveGaussianImageFilter2Output5.png ${TEMP}/LaplacianRecursiveGaussianImageFilter2Output5.png Execute $<TARGET_FILE:LaplacianRecursiveGaussianImageFilter2> ${INPUTDATA}/ROISpot5.png - ${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.hdr + ${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.tif 5 ${TEMP}/LaplacianRecursiveGaussianImageFilter2Output5.png ) @@ -210,13 +210,13 @@ otb_add_test(NAME fiTeBinaryThresholdImageFilterTest COMMAND ${OTB_TEST_DRIVER} otb_add_test(NAME fiTeDerivativeImageFilterTest COMMAND ${OTB_TEST_DRIVER} --compare-n-images ${NOTOL} 2 - ${BASELINE}/DerivativeImageFilterFloatOutput.hdr - ${TEMP}/DerivativeImageFilterFloatOutput.hdr + ${BASELINE}/DerivativeImageFilterFloatOutput.tif + ${TEMP}/DerivativeImageFilterFloatOutput.tif ${BASELINE}/DerivativeImageFilterOutput.png ${TEMP}/DerivativeImageFilterOutput.png Execute $<TARGET_FILE:DerivativeImageFilter> ${INPUTDATA}/ROISpot5.png - ${TEMP}/DerivativeImageFilterFloatOutput.hdr + ${TEMP}/DerivativeImageFilterFloatOutput.tif ${TEMP}/DerivativeImageFilterOutput.png 1 0 ) diff --git a/Examples/Hyperspectral/test/CMakeLists.txt b/Examples/Hyperspectral/test/CMakeLists.txt index 0528fb3e9d8f313be67562b71aebfb477d8a2767..a972a10c226fec4069e0206fbbcbafb56933a984 100644 --- a/Examples/Hyperspectral/test/CMakeLists.txt +++ b/Examples/Hyperspectral/test/CMakeLists.txt @@ -30,7 +30,7 @@ otb_add_test(NAME siTvHyperspectralExampleTest COMMAND ${OTB_TEST_DRIVER} ${BASELINE}/siTvHyperspectralUnmixingExampleTestBand3.png ${TEMP}/siTvHyperspectralUnmixingExampleTestBand3.png Execute $<TARGET_FILE:HyperspectralUnmixingExample> - LARGEINPUT{AVIRIS/Indian_pines_corrected.tif} + ${INPUTDATA}/AVIRIS/Indian_pines_corrected.tif ${TEMP}/siTvHyperspectralUnmixingExampleTest.tif ${TEMP}/siTvHyperspectralUnmixingExampleTestBand1.png ${TEMP}/siTvHyperspectralUnmixingExampleTestBand2.png diff --git a/Examples/IO/CMakeLists.txt b/Examples/IO/CMakeLists.txt index d8c7bc86867d03f91faadc18adf5b4d9883e28de..f3aab131cba0881420796838e65b0065fac1bca2 100644 --- a/Examples/IO/CMakeLists.txt +++ b/Examples/IO/CMakeLists.txt @@ -70,12 +70,13 @@ target_link_libraries(RGBImageReadWrite ${OTB_LIBRARIES}) add_executable(StreamingImageReadWrite StreamingImageReadWrite.cxx) target_link_libraries(StreamingImageReadWrite ${OTB_LIBRARIES}) -add_executable(TileMapImageIOExample TileMapImageIOExample.cxx) -target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES}) - add_executable(VectorDataIOExample VectorDataIOExample.cxx) target_link_libraries(VectorDataIOExample ${OTB_LIBRARIES}) +if(OTB_USE_DEPRECATED) + add_executable(TileMapImageIOExample TileMapImageIOExample.cxx) + target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES}) +endif() if(BUILD_TESTING) add_subdirectory(test) diff --git a/Examples/IO/test/CMakeLists.txt b/Examples/IO/test/CMakeLists.txt index 6387ab9ab0f0109b25f4460e92e90855db05ed90..9a410111a55a12135b96cec77f7fb12701736dfd 100644 --- a/Examples/IO/test/CMakeLists.txt +++ b/Examples/IO/test/CMakeLists.txt @@ -101,7 +101,8 @@ otb_add_test(NAME ioTeImageToKmzAndMapFileProductExample COMMAND ${OTB_TEST_DRIV set_property(TEST ioTeImageToKmzAndMapFileProductExample PROPERTY RESOURCE_LOCK web_access) endif() -otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER} +if(OTB_USE_DEPRECATED) + otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER} --compare-image 10.0 ${BASELINE}/openStreetMap.png ${TEMP}/openStreetMap.png @@ -112,4 +113,5 @@ otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER} 1.4835345 43.55968261 12 -) + ) +endif() diff --git a/Examples/Projections/test/CMakeLists.txt b/Examples/Projections/test/CMakeLists.txt index 06b3204e9b9aa326a036eff1640e4db81788a8e3..26098eb64c8d2f7624dbbaf35e6dbd04209f067a 100644 --- a/Examples/Projections/test/CMakeLists.txt +++ b/Examples/Projections/test/CMakeLists.txt @@ -118,11 +118,13 @@ otb_add_test(NAME prTePlaceNameToLonLatExampleTest COMMAND ${OTB_TEST_DRIVER} Execute $<TARGET_FILE:PlaceNameToLonLatExample> Toulouse ) -otb_add_test(NAME prTeCoordinateToNameExampleTest COMMAND ${OTB_TEST_DRIVER} - --compare-ascii ${NOTOL} - ${BASELINE}/CoordinateToNameExample.txt - ${TEMP}/CoordinateToNameExample.txt - Execute $<TARGET_FILE:CoordinateToNameExample> - 103.78 1.29 - ${TEMP}/CoordinateToNameExample.txt -) + +# The following test is disabled (GitLab #1669 !244) +# otb_add_test(NAME prTeCoordinateToNameExampleTest COMMAND ${OTB_TEST_DRIVER} +# --compare-ascii ${NOTOL} +# ${BASELINE}/CoordinateToNameExample.txt +# ${TEMP}/CoordinateToNameExample.txt +# Execute $<TARGET_FILE:CoordinateToNameExample> +# 103.78 1.29 +# ${TEMP}/CoordinateToNameExample.txt +# ) diff --git a/Examples/Registration/ImageRegistration1.cxx b/Examples/Registration/ImageRegistration1.cxx index 83b63c8226f09dbf129cc8331a03640dad97be9f..715cc7e93d06a455ac6f4be81688a77331c90e64 100644 --- a/Examples/Registration/ImageRegistration1.cxx +++ b/Examples/Registration/ImageRegistration1.cxx @@ -19,7 +19,6 @@ */ - // Software Guide : BeginCommandLineArgs // INPUTS: {QB_Suburb.png} // INPUTS: {QB_Suburb13x17y.png} @@ -68,52 +67,51 @@ class CommandIterationUpdate : public itk::Command { public: - typedef CommandIterationUpdate Self; - typedef itk::Command Superclass; + typedef CommandIterationUpdate Self; + typedef itk::Command Superclass; typedef itk::SmartPointer<Self> Pointer; itkNewMacro(Self); protected: - CommandIterationUpdate() {} + CommandIterationUpdate() + { + } public: - typedef itk::RegularStepGradientDescentOptimizer OptimizerType; - typedef const OptimizerType * OptimizerPointer; + typedef const OptimizerType* OptimizerPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) override + void Execute(itk::Object* caller, const itk::EventObject& event) override { - Execute((const itk::Object *) caller, event); + Execute((const itk::Object*)caller, event); } - void Execute(const itk::Object * object, const itk::EventObject& event) override + void Execute(const itk::Object* object, const itk::EventObject& event) override { - OptimizerPointer optimizer = - dynamic_cast<OptimizerPointer>(object); + OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object); if (!itk::IterationEvent().CheckEvent(&event)) - { + { return; - } + } std::cout << optimizer->GetCurrentIteration() << " = "; std::cout << optimizer->GetValue() << " : "; std::cout << optimizer->GetCurrentPosition() << std::endl; } - }; -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { if (argc < 4) - { + { std::cerr << "Missing Parameters " << std::endl; std::cerr << "Usage: " << argv[0]; std::cerr << " fixedImageFile movingImageFile "; std::cerr << "outputImagefile [differenceImageAfter]"; std::cerr << "[differenceImageBefore]" << std::endl; return 1; - } + } // Software Guide : BeginLatex // @@ -125,7 +123,7 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet const unsigned int Dimension = 2; - typedef float PixelType; + typedef float PixelType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -170,9 +168,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::MeanSquaresImageToImageMetric< - FixedImageType, - MovingImageType> MetricType; + typedef itk::MeanSquaresImageToImageMetric<FixedImageType, MovingImageType> MetricType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -183,9 +179,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::LinearInterpolateImageFunction< - MovingImageType, - double> InterpolatorType; + typedef itk::LinearInterpolateImageFunction<MovingImageType, double> InterpolatorType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -197,9 +191,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::ImageRegistrationMethod< - FixedImageType, - MovingImageType> RegistrationType; + typedef itk::ImageRegistrationMethod<FixedImageType, MovingImageType> RegistrationType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -211,11 +203,11 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - MetricType::Pointer metric = MetricType::New(); - TransformType::Pointer transform = TransformType::New(); - OptimizerType::Pointer optimizer = OptimizerType::New(); - InterpolatorType::Pointer interpolator = InterpolatorType::New(); - RegistrationType::Pointer registration = RegistrationType::New(); + MetricType::Pointer metric = MetricType::New(); + TransformType::Pointer transform = TransformType::New(); + OptimizerType::Pointer optimizer = OptimizerType::New(); + InterpolatorType::Pointer interpolator = InterpolatorType::New(); + RegistrationType::Pointer registration = RegistrationType::New(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -239,8 +231,8 @@ int main(int argc, char *argv[]) typedef otb::ImageFileReader<FixedImageType> FixedImageReaderType; typedef otb::ImageFileReader<MovingImageType> MovingImageReaderType; - FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New(); - MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New(); + FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New(); + MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New(); fixedImageReader->SetFileName(argv[1]); movingImageReader->SetFileName(argv[2]); @@ -255,11 +247,9 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::MeanImageFilter< - FixedImageType, FixedImageType> FixedFilterType; + typedef itk::MeanImageFilter<FixedImageType, FixedImageType> FixedFilterType; - typedef itk::MeanImageFilter< - MovingImageType, MovingImageType> MovingFilterType; + typedef itk::MeanImageFilter<MovingImageType, MovingImageType> MovingFilterType; FixedFilterType::Pointer fixedFilter = FixedFilterType::New(); MovingFilterType::Pointer movingFilter = MovingFilterType::New(); @@ -313,8 +303,7 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet fixedFilter->Update(); - registration->SetFixedImageRegion( - fixedFilter->GetOutput()->GetBufferedRegion()); + registration->SetFixedImageRegion(fixedFilter->GetOutput()->GetBufferedRegion()); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -336,10 +325,10 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet typedef RegistrationType::ParametersType ParametersType; - ParametersType initialParameters(transform->GetNumberOfParameters()); + ParametersType initialParameters(transform->GetNumberOfParameters()); - initialParameters[0] = 0.0; // Initial offset in mm along X - initialParameters[1] = 0.0; // Initial offset in mm along Y + initialParameters[0] = 0.0; // Initial offset in mm along X + initialParameters[1] = 0.0; // Initial offset in mm along Y registration->SetInitialTransformParameters(initialParameters); // Software Guide : EndCodeSnippet @@ -412,15 +401,15 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet try - { + { registration->Update(); - } + } catch (itk::ExceptionObject& err) - { + { std::cerr << "ExceptionObject caught !" << std::endl; std::cerr << err << std::endl; return -1; - } + } // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -488,10 +477,10 @@ int main(int argc, char *argv[]) // Print out results // std::cout << "Result = " << std::endl; - std::cout << " Translation X = " << TranslationAlongX << std::endl; - std::cout << " Translation Y = " << TranslationAlongY << std::endl; + std::cout << " Translation X = " << TranslationAlongX << std::endl; + std::cout << " Translation Y = " << TranslationAlongY << std::endl; std::cout << " Iterations = " << numberOfIterations << std::endl; - std::cout << " Metric value = " << bestValue << std::endl; + std::cout << " Metric value = " << bestValue << std::endl; // Software Guide : BeginLatex // @@ -542,9 +531,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::ResampleImageFilter< - MovingImageType, - FixedImageType> ResampleFilterType; + typedef itk::ResampleImageFilter<MovingImageType, FixedImageType> ResampleFilterType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -624,11 +611,10 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef itk::CastImageFilter<FixedImageType, - OutputImageType> CastFilterType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef unsigned char OutputPixelType; + typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + typedef itk::CastImageFilter<FixedImageType, OutputImageType> CastFilterType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -639,8 +625,8 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - WriterType::Pointer writer = WriterType::New(); - CastFilterType::Pointer caster = CastFilterType::New(); + WriterType::Pointer writer = WriterType::New(); + CastFilterType::Pointer caster = CastFilterType::New(); // Software Guide : EndCodeSnippet writer->SetFileName(argv[3]); @@ -680,10 +666,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::SubtractImageFilter< - FixedImageType, - FixedImageType, - FixedImageType> DifferenceFilterType; + typedef itk::SubtractImageFilter<FixedImageType, FixedImageType, FixedImageType> DifferenceFilterType; DifferenceFilterType::Pointer difference = DifferenceFilterType::New(); @@ -715,9 +698,7 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef itk::RescaleIntensityImageFilter< - FixedImageType, - OutputImageType> RescalerType; + typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType> RescalerType; RescalerType::Pointer intensityRescaler = RescalerType::New(); @@ -740,10 +721,10 @@ int main(int argc, char *argv[]) // Software Guide : EndCodeSnippet if (argc > 4) - { + { writer2->SetFileName(argv[4]); writer2->Update(); - } + } // Software Guide : BeginLatex // @@ -765,10 +746,10 @@ int main(int argc, char *argv[]) // Software Guide : EndCodeSnippet if (argc > 5) - { + { writer2->SetFileName(argv[5]); writer2->Update(); - } + } // Software Guide : BeginLatex // diff --git a/Modules/Adapters/BoostAdapters/include/otbBoostDox.h b/Modules/Adapters/BoostAdapters/include/otbBoostDox.h index 431f99a5bd2bab5a761dfbc18d31e97f62404fb2..4a60b4aa9851a109baa3457f7c09da7932045e02 100644 --- a/Modules/Adapters/BoostAdapters/include/otbBoostDox.h +++ b/Modules/Adapters/BoostAdapters/include/otbBoostDox.h @@ -23,7 +23,7 @@ /**\defgroup boost Boost alike helpers * \ingroup Thematic - * \brief Various helpers that are likelly to end-up in boost by themselves eventually. + * \brief Various helpers that are likely to eventually end-up in boost by themselves. * \see http://www.boost.org/ * @{ */ diff --git a/Modules/Adapters/BoostAdapters/include/otbStringUtils.h b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h index 99a91ab82db65091dde7d03842a6c3ceff6f9bff..429b2ede765972aa29d7ec540c7b9c057974253a 100644 --- a/Modules/Adapters/BoostAdapters/include/otbStringUtils.h +++ b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h @@ -69,7 +69,7 @@ Res LexicalCast(In const& in, std::string const& kind) { * \param[in] errmsg a msg complement used to build the error message to be shown if there is \c lexical_cast exception. See \c otb:Utils::LexicalCast(). - * \param delims delimitter characters (space is default) + * \param delims delimiter characters (space is default) * \throw std::bad_alloc in case of exhausted memory * \throw std::runtime_error in case an element from the input string cannot be converted into a valid \c T instance. @@ -95,16 +95,16 @@ ConvertStringToVector(std::string const &str, T& ret, std::string const& errmsg, } /**\ingroup Utils - * split a given std::string of into key value based on given delimitter - * string. default delimitter is '='. If the string does not have a delimitter + * split a given std::string of into key value based on given delimiter + * string. The default delimiter is '='. If the string does not have a delimiter * the key is set to input string and value is set to defValue. * \param[in] str input string * \param key[out] An std::string reference where key will be stored * \param value[out] a reference of \cT where value will be stored - * \param defValue[in] a default value if there is no delimitter fo + * \param defValue[in] a default value if there is no delimiter fo * \param[in] errmsg a msg complement used to build the error message to be shown if there is \c lexical_cast exception. See \cotb:Utils::LexicalCast(). - * \param delims delimitter characters (space is default) + * \param delims delimiter characters (space is default) * \throw std::bad_alloc in case of exhausted memory * \throw std::runtime_error in case an element from the input string cannot be converted into a valid \c T instance. diff --git a/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h b/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h index 20bfa9d7825feba888bd4de68691bfe8a8a5e64d..78b954b6160a5f9ea5edcf133f88966cfb633a60 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h +++ b/Modules/Adapters/GdalAdapters/include/otbGdalDataTypeBridge.h @@ -63,7 +63,7 @@ GDALDataType GetGDALDataType() { if( sizeof(long) == 8 ) { - //itkWarningMacro(<< "Cast a long (64 bits) image into an int (32 bits) one.") + //itkWarningMacro(<< "Cast a long (64 bit) image to an int (32 bit) one.") } return GDT_Int32; } @@ -71,7 +71,7 @@ GDALDataType GetGDALDataType() { if( sizeof(unsigned long) == 8 ) { - //itkWarningMacro(<< "Cast an unsigned long (64 bits) image into an unsigned int (32 bits) one.") + //itkWarningMacro(<< "Cast an unsigned long (64 bit) image to an unsigned int (32 bit) one.") } return GDT_UInt32; } diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h index 3e604dab369c6358a9e59e33fbeed235ac14d600..aab8c8934617be5c85d4da7438e7d3bdaef9ab32 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h @@ -24,8 +24,8 @@ /**\ingroup GeometriesFilters * \file otbGeometriesToGeometriesFilter.h * \since OTB v 3.14.0 - * Commons definitions for geometries filter definition. - * This file contains all the main classes required to define new geometries + * Common definitions for geometry filter definitions. + * This file contains all the main classes required to define new geometry * transformations. */ @@ -46,7 +46,7 @@ namespace otb { /**\ingroup GeometriesFilters * \class GeometriesToGeometriesFilter - * Root abstract class for all geometries to geometries filters. + * Root abstract class for all geometry to geometry filters. * \since OTB v 3.14.0 * * \ingroup OTBGdalAdapters @@ -203,10 +203,10 @@ struct OTBGdalAdapters_EXPORT FieldCopyTransformation /** * Defines the fields in the destination layer. - * The default action is to copy all fieds from one layer to another. + * The default action is to copy all fields from one layer to another. * \param [in] source source \c Layer * \param [in,out] dest destination \c Layer - * \throw itk::ExceptionObject in case the operation can't succeed. + * \throw itk::ExceptionObject in case the operation cannot succeed. */ void DefineFields(ogr::Layer const& source, ogr::Layer & dest) const; private: diff --git a/Modules/Adapters/GdalAdapters/otb-module.cmake b/Modules/Adapters/GdalAdapters/otb-module.cmake index c985c5fb0e477a9f35de9a629e506d865239ee5e..22eeed5db285a40a4bb9f2de9eeecd537d26a981 100644 --- a/Modules/Adapters/GdalAdapters/otb-module.cmake +++ b/Modules/Adapters/GdalAdapters/otb-module.cmake @@ -18,7 +18,7 @@ # limitations under the License. # -set(DOCUMENTATION "Adapters for the Gdal Library ( for reading and writing ).") +set(DOCUMENTATION "Adapters for the GDAL Library ( for reading and writing ).") otb_module(OTBGdalAdapters ENABLE_SHARED diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx index 813176ba07a4d92e587c3666acfe4c4287023006..ea65a5c2c577a97ed2f967418816ac2b1a17a6d0 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx @@ -100,7 +100,7 @@ const ExtensionDriverAssociation k_ExtensionDriverMap[] = char const* DeduceDriverName(std::string filename) { std::transform(filename.begin(), filename.end(), filename.begin(), (int (*)(int))toupper); - if (0 == strncmp(filename.c_str(), "PG:", 3)) + if(filename.compare(0, 3, "PG:") == 0) { return "PostgreSQL"; } diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h deleted file mode 100644 index 44cec720e6d98f3211da7008eb0d6b53b3686015..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef otbDEMConvertAdapter_h -#define otbDEMConvertAdapter_h - -#include "itkObject.h" -#include "itkObjectFactory.h" - -#include "OTBOSSIMAdaptersExport.h" - -namespace otb -{ - -class OTBOSSIMAdapters_EXPORT DEMConvertAdapter: public itk::Object -{ -public: - /** Standard class typedefs. */ - typedef DEMConvertAdapter Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(EllipsoidAdapter, itk::Object); - - int Convert(std::string tempFilename, std::string output); - -protected: - DEMConvertAdapter(); - ~DEMConvertAdapter() override; - -private: - DEMConvertAdapter(const Self &) = delete; - void operator =(const Self&) = delete; -}; - -} // namespace otb - -#endif diff --git a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h deleted file mode 100644 index f3ad24c5a2350a9592c238f6a58ebebe8475dc46..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbGeometricSarSensorModelAdapter_h -#define otbGeometricSarSensorModelAdapter_h - -#include <vector> - -#include "itkObject.h" -#include "itkObjectFactory.h" - -#include "OTBOSSIMAdaptersExport.h" - -namespace ossimplugins -{ -class ossimGeometricSarSensorModel; -class JSDDateTime; -} - -namespace otb -{ - -class ImageKeywordlist; - -/** - * \class GeometricSarSensorModelAdapter - * \brief Wrapper class to access the platform Geometric Sar - * Sensor Modelposition from ossim. - * - * This class is intended to be used in an InSAR setting to get - * information relative to the baseline. If necessary, it could be - * extended to non SAR models, but the optical ossim classes would - * need to be modified. - * - * \ingroup OTBOSSIMAdapters - **/ - -class OTBOSSIMAdapters_EXPORT GeometricSarSensorModelAdapter: public itk::Object -{ -public: - /** Standard class typedefs. */ - typedef GeometricSarSensorModelAdapter Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(GeometricSarSensorModelAdapter, itk::Object); - - void CreateSensorModel(const ImageKeywordlist& image_kwl); - - /** Get the platform position and speed for a given line. */ - void GetPlatformPositionAtLine( - double line, std::vector<double>& position, std::vector<double>& speed); - - /** Get the platform time for a given line. */ - ossimplugins::JSDDateTime getTime(double line); - -protected: - GeometricSarSensorModelAdapter(); - ~GeometricSarSensorModelAdapter() override; - -private: - GeometricSarSensorModelAdapter(const Self &) = delete; - void operator =(const Self&) = delete; - - ossimplugins::ossimGeometricSarSensorModel* m_SensorModel; - -}; - -} // namespace otb - -#endif diff --git a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h deleted file mode 100644 index 2599f7751b8de10a4666b32716581fc6bddfe411..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbPlatformPositionAdapter_h -#define otbPlatformPositionAdapter_h - -#include <vector> - -#include "itkObject.h" -#include "itkObjectFactory.h" - -#include "OTBOSSIMAdaptersExport.h" - -namespace ossimplugins -{ -class ossimGeometricSarSensorModel; -class JSDDateTime; -} - -namespace otb -{ - -class ImageKeywordlist; - -/** - * \class PlatformPositionAdapter - * \brief Wrapper class to access the platform position from ossim - * - * This class is intended to be used in an InSAR setting to get - * information relative to the baseline. If necessary, it could be - * extended to non SAR models, but the optical ossim classes would - * need to be modified. - * - * \ingroup OTBOSSIMAdapters - **/ - -class OTBOSSIMAdapters_EXPORT PlatformPositionAdapter: public itk::Object -{ -public: - /** Standard class typedefs. */ - typedef PlatformPositionAdapter Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(PlatformPositionAdapter, itk::Object); - - void CreateSensorModel(const ImageKeywordlist& image_kwl); - - /** Get the platform position and speed for a given line. */ - void GetPlatformPosition( - double line, std::vector<double>& position, std::vector<double>& speed); - - /** Get the platform position at a given date and time. */ - void GetPlatformPositionAtTime( - ossimplugins::JSDDateTime time, std::vector<double>& position, std::vector<double>& speed); - -protected: - PlatformPositionAdapter(); - ~PlatformPositionAdapter() override; - -private: - PlatformPositionAdapter(const Self &) = delete; - void operator =(const Self&) = delete; - - ossimplugins::ossimGeometricSarSensorModel* m_SensorModel; - -}; - -} // namespace otb - -#endif diff --git a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt index 5bb6d442694c4c355182ad5d7de345d45c8299da..245eabf3cce6bce1194b9435c1fee981d3d76a60 100644 --- a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt +++ b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt @@ -21,10 +21,7 @@ set(OTBOSSIMAdapters_SRC otbDEMHandler.cxx otbImageKeywordlist.cxx - otbGeometricSarSensorModelAdapter.cxx otbSensorModelAdapter.cxx - otbPlatformPositionAdapter.cxx - otbDEMConvertAdapter.cxx otbRPCSolverAdapter.cxx otbDateTimeAdapter.cxx otbMapProjectionAdapter.cxx diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx deleted file mode 100644 index cb40530ebe7b104163e9695be8e998440a080d93..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "otbDEMConvertAdapter.h" - -#include "itkMacro.h" - -// OSSIM include -#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/base/ossimKeywordNames.h" -#include "ossim/base/ossimStdOutProgress.h" -#include "ossim/base/ossimFilename.h" -#include "ossim/base/ossimKeywordlist.h" -#include "ossim/imaging/ossimJpegWriter.h" -#include "ossim/imaging/ossimImageHandler.h" -#include "ossim/imaging/ossimImageSource.h" -#include "ossim/imaging/ossimImageHandlerRegistry.h" -#include "ossim/imaging/ossimImageWriterFactoryRegistry.h" -#include "ossim/imaging/ossimImageWriterFactory.h" -#include "ossim/imaging/ossimImageFileWriter.h" -#include "ossim/imaging/ossimCacheTileSource.h" -#include "ossim/imaging/ossimBandSelector.h" -#include "ossim/imaging/ossimCibCadrgTileSource.h" -#pragma GCC diagnostic pop -#else -#include "ossim/base/ossimKeywordNames.h" -#include "ossim/base/ossimStdOutProgress.h" -#include "ossim/base/ossimFilename.h" -#include "ossim/base/ossimKeywordlist.h" -#include "ossim/imaging/ossimJpegWriter.h" -#include "ossim/imaging/ossimImageHandler.h" -#include "ossim/imaging/ossimImageSource.h" -#include "ossim/imaging/ossimImageHandlerRegistry.h" -#include "ossim/imaging/ossimImageWriterFactoryRegistry.h" -#include "ossim/imaging/ossimImageWriterFactory.h" -#include "ossim/imaging/ossimImageFileWriter.h" -#include "ossim/imaging/ossimCacheTileSource.h" -#include "ossim/imaging/ossimBandSelector.h" -#include "ossim/imaging/ossimCibCadrgTileSource.h" -#endif - -namespace otb -{ - -DEMConvertAdapter::DEMConvertAdapter() -{} - -DEMConvertAdapter::~DEMConvertAdapter() -{} - -int DEMConvertAdapter::Convert(std::string tempFilename, std::string output) -{ - // Keyword list to initialize image writers with. - ossimKeywordlist kwl; - const char* PREFIX = "imagewriter."; - // Define the output file type - std::string output_type("general_raster_bsq_envi"); - kwl.add(PREFIX, ossimKeywordNames::TYPE_KW, output_type.c_str(), true); - - // Get an image handler for the input file. - ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(ossimString(tempFilename)); - - // Initialize the - if (ih->getErrorStatus() == ossimErrorCodes::OSSIM_ERROR) - { - itkExceptionMacro("Error reading image: " << tempFilename << "Exiting application..."); - return EXIT_FAILURE; - } - - ih->initialize(); - - ossimRefPtr<ossimImageSource> source = ih.get(); - ossimRefPtr<ossimBandSelector> bs = nullptr; - - - // Get the image rectangle for the rrLevel selected. - ossimIrect output_rect; - output_rect = source->getBoundingRect(0); - - ossimRefPtr<ossimImageFileWriter> writer = - ossimImageWriterFactoryRegistry::instance()->createWriter(kwl, PREFIX); - - writer->connectMyInputTo(0, source.get()); - writer->open(ossimFilename(output)); - - // Add a listener to get percent complete. - ossimStdOutProgress prog(0, true); - writer->addListener(&prog); - - if (writer->getErrorStatus() == ossimErrorCodes::OSSIM_OK) - { - if( (ih->getOutputScalarType() != OSSIM_UCHAR) && - (PTR_CAST(ossimJpegWriter, writer.get()) ) ) - { - writer->setScaleToEightBitFlag(true); - } - - ossimRefPtr<ossimCacheTileSource> cache = new ossimCacheTileSource; - ossimIpt tileWidthHeight(ih->getImageTileWidth(), - ih->getImageTileHeight()); - // only use the cache if its stripped - if(static_cast<ossim_uint32>(tileWidthHeight.x) == - ih->getBoundingRect().width()) - { - cache->connectMyInputTo(0, source.get()); - cache->setTileSize(tileWidthHeight); - writer->connectMyInputTo(0, cache.get()); - } - else - { - writer->connectMyInputTo(0, source.get()); - } - writer->initialize(); - writer->setAreaOfInterest(output_rect); // Set the output rectangle. - - try - { - writer->execute(); - } - catch(std::exception& e) - { - std::cerr << "std::exception thrown:" << std::endl; - std::cerr << e.what() << std::endl; - itkExceptionMacro("Error occurs writing the output image..."); - return EXIT_FAILURE; - } - } - else - { - itkExceptionMacro("Error detected in the image writer..."); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - -} // namespace otb diff --git a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx deleted file mode 100644 index 90e6908dc0869ec34bb8b974060c8db7684f3412..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "otbGeometricSarSensorModelAdapter.h" - -#include "otbMacro.h" -#include "otbImageKeywordlist.h" - -#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/ossimGeometricSarSensorModel.h" -#include "ossim/projection/ossimProjection.h" -#include "ossim/ossimPluginProjectionFactory.h" -#include "ossim/otb/JSDDateTime.h" -#pragma GCC diagnostic pop -#else -#include "ossim/ossimGeometricSarSensorModel.h" -#include "ossim/projection/ossimProjection.h" -#include "ossim/ossimPluginProjectionFactory.h" -#include "ossim/otb/JSDDateTime.h" -#endif - - -namespace otb { - -GeometricSarSensorModelAdapter::GeometricSarSensorModelAdapter(): - m_SensorModel(nullptr) -{ -} - -GeometricSarSensorModelAdapter::~GeometricSarSensorModelAdapter() -{ - if (m_SensorModel != nullptr) - { - delete m_SensorModel; - m_SensorModel = nullptr; - } -} - - -void GeometricSarSensorModelAdapter::CreateSensorModel(const ImageKeywordlist& image_kwl) -{ - ossimKeywordlist geom; - - image_kwl.convertToOSSIMKeywordlist(geom); - otbMsgDevMacro(<< "CreateSensorModel()"); - otbMsgDevMacro(<< "* type: " << geom.find("type")); - - ossimProjection* sensor = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom); - - m_SensorModel = dynamic_cast<ossimplugins::ossimGeometricSarSensorModel*>(sensor); - if (!m_SensorModel) - { - otbMsgDevMacro(<< "CreateSensorModel() failed"); - } -} - -ossimplugins::JSDDateTime GeometricSarSensorModelAdapter::getTime(double line) -{ - return m_SensorModel->getTime(line); -} - -void GeometricSarSensorModelAdapter::GetPlatformPositionAtLine( - double line, std::vector<double>& position, std::vector<double>& speed) -{ - m_SensorModel->getPlatformPositionAtLine(line, position, speed); -} - -} // namespace otb diff --git a/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx deleted file mode 100644 index f64795a1d5f2705d4112673adb4f1138c8a88661..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/src/otbPlatformPositionAdapter.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "otbPlatformPositionAdapter.h" - -#include "otbMacro.h" -#include "otbImageKeywordlist.h" - -#include "ossim/ossimGeometricSarSensorModel.h" -#include "ossim/otb/PlatformPosition.h" -#include "ossim/projection/ossimProjection.h" -#include "ossim/ossimPluginProjectionFactory.h" - - -namespace otb { - -PlatformPositionAdapter::PlatformPositionAdapter(): - m_SensorModel(nullptr) -{ -} - -PlatformPositionAdapter::~PlatformPositionAdapter() -{ - if (m_SensorModel != nullptr) - { - delete m_SensorModel; - m_SensorModel = nullptr; - } -} - - -void PlatformPositionAdapter::CreateSensorModel(const ImageKeywordlist& image_kwl) -{ - ossimKeywordlist geom; - - image_kwl.convertToOSSIMKeywordlist(geom); - otbMsgDevMacro(<< "CreateSensorModel()"); - otbMsgDevMacro(<< "* type: " << geom.find("type")); - - ossimProjection* sensor = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom); - - m_SensorModel = dynamic_cast<ossimplugins::ossimGeometricSarSensorModel*>(sensor); - if (!m_SensorModel) - { - otbMsgDevMacro(<< "CreateSensorModel() failed"); - } -} - -void PlatformPositionAdapter::GetPlatformPosition( - double line, std::vector<double>& position, std::vector<double>& speed) -{ - m_SensorModel->getPlatformPositionAtLine(line, position, speed); -} - -void PlatformPositionAdapter::GetPlatformPositionAtTime( - ossimplugins::JSDDateTime time, std::vector<double>& position, std::vector<double>& speed) -{ - m_SensorModel->get_platformPosition()->getPlatformPositionAtTime(time, position, speed); -} - -} // namespace otb diff --git a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt index 807fb5c7aa79456f5ad216ac635358c85a187c33..8e402898a7e812d69f7bfe4935391a91ffcc1d41 100644 --- a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt +++ b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt @@ -27,8 +27,6 @@ otbOssimJpegFileResourceLeakTest.cxx otbMapProjectionAdapterTest.cxx otbOssimElevManagerTest2.cxx otbOssimElevManagerTest4.cxx -otbGeometricSarSensorModelAdapter.cxx -otbPlatformPositionAdapter.cxx otbDEMHandlerTest.cxx otbRPCSolverAdapterTest.cxx otbSarSensorModelAdapterTest.cxx @@ -168,31 +166,14 @@ otb_add_test(NAME prTvossimElevManagerTest2 COMMAND otbOSSIMAdaptersTestDriver ) otb_add_test(NAME prTvossimElevManagerTest4 COMMAND otbOSSIMAdaptersTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/prTvossimElevManagerTest4 - ${TEMP}/prTvossimElevManagerTest4.hdr + --compare-image ${EPSILON_9} ${BASELINE}/prTvossimElevManagerTest4.tif + ${TEMP}/prTvossimElevManagerTest4.tif otbOssimElevManagerTest4 ${INPUTDATA}/DEM/srtm_directory - ${TEMP}/prTvossimElevManagerTest4 + ${TEMP}/prTvossimElevManagerTest4.tif -1.8 52 0.02 -0.018 232 422 ) -#commented below test. these are moved to dev_sar_tsx branch for further checks -# otb_add_test(NAME uaTvGeometricSarSensorModelAdapterTest COMMAND otbOSSIMAdaptersTestDriver -# --compare-ascii ${EPSILON_9} -# ${BASELINE_FILES}/uaTvGeometricSarSensorModelAdapterTest.txt -# ${TEMP}/uaTvGeometricSarSensorModelAdapterTest.txt -# otbGeometricSarSensorModelAdapterTest -# LARGEINPUT{TERRASARX/2008-03-10_GrandCanyon_SSC//TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228/TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228.xml} -# ${TEMP}/uaTvGeometricSarSensorModelAdapterTest.txt) - -# otb_add_test(NAME uaTvPlatformPositionComputeBaselineTest COMMAND otbOSSIMAdaptersTestDriver -# --compare-ascii ${EPSILON_9} -# ${BASELINE_FILES}/uaTvPlatformPositionComputeBaselineTest.txt -# ${TEMP}/uaTvPlatformPositionComputeBaselineTest.txt -# otbPlatformPositionComputeBaselineTest -# LARGEINPUT{TERRASARX/2008-03-10_GrandCanyon_SSC//TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228/TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228.xml} -# ${TEMP}/uaTvPlatformPositionComputeBaselineTest.txt) - otb_add_test(NAME uaTvDEMHandler_AboveEllipsoid_NoSRTM_NoGeoid_NoData COMMAND otbOSSIMAdaptersTestDriver otbDEMHandlerTest no diff --git a/Modules/Adapters/OSSIMAdapters/test/otbGeometricSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/test/otbGeometricSarSensorModelAdapter.cxx deleted file mode 100644 index 99fb81070d6545e28605a8b4c2c9468dae577804..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/test/otbGeometricSarSensorModelAdapter.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <iomanip> - -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbGeometricSarSensorModelAdapter.h" - -int otbGeometricSarSensorModelAdapterTest(int argc, char* argv[]) -{ - if (argc != 3) - { - std::cerr << "Usage: " << argv[0] << " imageFile output" << std::endl; - return EXIT_FAILURE; - } - - typedef std::complex<double> PixelType; - typedef otb::Image<PixelType,2> ImageType; - - typedef otb::ImageFileReader<ImageType> ReaderType; - - ReaderType::Pointer image = ReaderType::New(); - - image->SetFileName(argv[1]); - - image->UpdateOutputInformation(); - - typedef otb::GeometricSarSensorModelAdapter SarSensorModelType; - SarSensorModelType::Pointer imageSarModel = SarSensorModelType::New(); - - imageSarModel->CreateSensorModel(image->GetOutput()->GetImageKeywordlist()); - - std::vector<double> imagePosition; - std::vector<double> imageSpeed; - imagePosition.resize(3); - imageSpeed.resize(3); - - - imageSarModel->GetPlatformPositionAtLine(0, imagePosition, imageSpeed); - - std::ofstream file; - file.open(argv[2]); - - file << std::setprecision(15); - - file << "Image:\n"; - //file << "Start Time: " << masterSarModel->getTime(0)<< " m\n"; - file << "Pos X: " << imagePosition[0] << " m\n"; - file << "Pos Y: " << imagePosition[1] << " m\n"; - file << "Pos Z: " << imagePosition[2] << " m\n"; - file << "Spd X: " << imageSpeed[0] << " m/s\n"; - file << "Spd Y: " << imageSpeed[1] << " m/s\n"; - file << "Spd Z: " << imageSpeed[2] << " m/s\n"; - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx index 72d7d2a63bfbbf4c4b47e42c752dca41aa4df5ff..3e189a0ba3437fd5b6556ee417fa6b2cdf89a424 100644 --- a/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx +++ b/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx @@ -27,8 +27,6 @@ void RegisterTests() REGISTER_TEST(otbMapProjectionAdapterTest); REGISTER_TEST(otbOssimElevManagerTest2); REGISTER_TEST(otbOssimElevManagerTest4); - REGISTER_TEST(otbGeometricSarSensorModelAdapterTest); - REGISTER_TEST(otbPlatformPositionComputeBaselineTest); REGISTER_TEST(otbDEMHandlerTest); REGISTER_TEST(otbRPCSolverAdapterTest); REGISTER_TEST(otbSarSensorModelAdapterTest); diff --git a/Modules/Adapters/OSSIMAdapters/test/otbPlatformPositionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/test/otbPlatformPositionAdapter.cxx deleted file mode 100644 index 32d2d0f76bebcf7d2627f18f4928d0763bca7f98..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/test/otbPlatformPositionAdapter.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/*========================================================================= - - Copyright 2011 Emmanuel Christophe - Contributed to ORFEO Toolbox under license Apache 2 - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ -#include <iomanip> - -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbPlatformPositionAdapter.h" - -int otbPlatformPositionComputeBaselineTest(int argc, char* argv[]) -{ - if (argc != 3) - { - std::cerr << "Usage: " << argv[0] << " imageFile output" << std::endl; - return EXIT_FAILURE; - } - - typedef std::complex<double> PixelType; - typedef otb::Image<PixelType,2> ImageType; - - typedef otb::ImageFileReader<ImageType> ReaderType; - - ReaderType::Pointer image = ReaderType::New(); - - image->SetFileName(argv[1]); - - image->UpdateOutputInformation(); - - typedef otb::PlatformPositionAdapter PlatformType; - PlatformType::Pointer imagePlatform = PlatformType::New(); - - imagePlatform->CreateSensorModel(image->GetOutput()->GetImageKeywordlist()); - - std::vector<double> imagePosition; - std::vector<double> imageSpeed; - imagePosition.resize(3); - imageSpeed.resize(3); - - imagePlatform->GetPlatformPosition(0, imagePosition, imageSpeed); - - std::ofstream file; - file.open(argv[2]); - - file << std::setprecision(15); - - file << "Image:\n"; - file << "Pos X: " << imagePosition[0] << " m\n"; - file << "Pos Y: " << imagePosition[1] << " m\n"; - file << "Pos Z: " << imagePosition[2] << " m\n"; - file << "Spd X: " << imageSpeed[0] << " m/s\n"; - file << "Spd Y: " << imageSpeed[1] << " m/s\n"; - file << "Spd Z: " << imageSpeed[2] << " m/s\n"; - - file.close(); - return EXIT_SUCCESS; -} diff --git a/Modules/Adapters/OpenThreadsAdapters/CMakeLists.txt b/Modules/Adapters/OpenThreadsAdapters/CMakeLists.txt deleted file mode 100644 index e37a148a6f48bb85b5c9131e60d7d7abb3cb3aad..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -project(OTBOpenThreadsAdapters) - -set(OTBOpenThreadsAdapters_LIBRARIES OTBOpenThreadsAdapters) -otb_module_impl() diff --git a/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h b/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h deleted file mode 100644 index 543c38ac94ff20785b1e959e0739561b81c1c5b7..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/include/otbThreads.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbThreads_h -#define otbThreads_h - -namespace otb -{ - -/** \class Threads - * \brief Operation from open threads that are used in Monteverdi - * - * Implement the sleep operation from openthreads to remove Monteverdi - * dependence to openthreads at compile time. - * - * - * \ingroup OTBOpenThreadsAdapters - */ -class Threads -{ -public: - - static int Sleep(unsigned int microsec); - -}; - -} // namespace otb - -#endif diff --git a/Modules/Adapters/OpenThreadsAdapters/otb-module.cmake b/Modules/Adapters/OpenThreadsAdapters/otb-module.cmake deleted file mode 100644 index 41738736e996fc80b289f9c349a1b9c9e845df4c..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/otb-module.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set(DOCUMENTATION "Adapters for the OpenThreads library (thread interface for -C++).") - -otb_module(OTBOpenThreadsAdapters - DEPENDS - OTBOpenThreads - - TEST_DEPENDS - OTBITK - OTBTestKernel - - DESCRIPTION - "${DOCUMENTATION}" -) diff --git a/Modules/Adapters/OpenThreadsAdapters/src/otbThreads.cxx b/Modules/Adapters/OpenThreadsAdapters/src/otbThreads.cxx deleted file mode 100644 index 5b0fdaf5714efc13493fef7de14f6bbd4ec619cb..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/src/otbThreads.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "otbThreads.h" -#include <OpenThreads/Thread> - -namespace otb -{ - -int Threads::Sleep(unsigned int microsec) -{ - return OpenThreads::Thread::microSleep(microsec); -} - -} diff --git a/Modules/Adapters/OpenThreadsAdapters/test/CMakeLists.txt b/Modules/Adapters/OpenThreadsAdapters/test/CMakeLists.txt deleted file mode 100644 index c9ff2f8f9e64505af1bc920dbedbd794274935ef..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/test/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -otb_module_test() - -set(OTBOpenThreadsAdaptersTests -otbOpenThreadsAdaptersTestDriver.cxx -otbThreadsTest.cxx -) - -add_executable(otbOpenThreadsAdaptersTestDriver ${OTBOpenThreadsAdaptersTests}) -target_link_libraries(otbOpenThreadsAdaptersTestDriver ${OTBOpenThreadsAdapters-Test_LIBRARIES}) -otb_module_target_label(otbOpenThreadsAdaptersTestDriver) - -# Tests Declaration - -otb_add_test(NAME ioTvThreadsTest COMMAND otbOpenThreadsAdaptersTestDriver otbThreadsTest) - diff --git a/Modules/Adapters/OpenThreadsAdapters/test/otbOpenThreadsAdaptersTestDriver.cxx b/Modules/Adapters/OpenThreadsAdapters/test/otbOpenThreadsAdaptersTestDriver.cxx deleted file mode 100644 index 811c79f3d90f12b42afe5c3d87a41bcbfa502426..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/test/otbOpenThreadsAdaptersTestDriver.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbTestMain.h" - -void RegisterTests() -{ - REGISTER_TEST(otbThreadsTest); -} diff --git a/Modules/Adapters/OpenThreadsAdapters/test/otbThreadsTest.cxx b/Modules/Adapters/OpenThreadsAdapters/test/otbThreadsTest.cxx deleted file mode 100644 index bd0d2d054d473aa4c83a21bb2fee93550436cfbe..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OpenThreadsAdapters/test/otbThreadsTest.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <cstdlib> -#include "otbThreads.h" -#include "itkMacro.h" - -int otbThreadsTest(int itkNotUsed(argc), char* itkNotUsed(argv) []) -{ - otb::Threads::Sleep(10); - return EXIT_SUCCESS; -} diff --git a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx index b2ec075b68b420a8971c40246db133739081bfa8..27813b1dde4fd4658e1d5cfd1baf0a34ce4b469a 100644 --- a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx +++ b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx @@ -98,7 +98,7 @@ private: AddParameter(ParameterType_InputImage, "in2", "Input Image 2"); SetParameterDescription("in2","Mutliband image of the scene after perturbations."); AddParameter(ParameterType_OutputImage, "out", "Change Map"); - SetParameterDescription("out","Multiband image containing change maps. Each map will be in range [-1,1], so a floating point output type is advised."); + SetParameterDescription("out","Multiband image containing change maps. Each map will be in the range [-1,1], so a floating point output type is advised."); AddRAMParameter(); diff --git a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx index 7db23f6b3a588c0c9d1f8ae019ee4dabff551fc6..da9a2e3c48c9d2f36d40fdca08f05bcb26dd27f5 100644 --- a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx @@ -110,7 +110,7 @@ private: // Documentation SetDocName("Confusion matrix Computation"); - SetDocLongDescription("This application computes the confusion matrix of a classification map relatively to a ground truth. " + SetDocLongDescription("This application computes the confusion matrix of a classification map relative to a ground truth dataset. " "This ground truth can be given as a raster or a vector data. Only reference and produced pixels with values different " "from NoData are handled in the calculation of the confusion matrix. The confusion matrix is organized the following way: " "rows = reference labels, columns = produced labels. In the header of the output file, the reference and produced class labels " diff --git a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx index def5b6b1fb47da5ac6dab9e58a14fb457e6d9e7c..8c945d994d9c45a2d2ae608b3052191e8bdbee0d 100644 --- a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx @@ -53,7 +53,7 @@ private: "from a set of images and optionally saves the results in an XML file."); SetDocLongDescription("This application computes a global mean and standard deviation " "for each band of a set of images and optionally saves the results in an XML file." - " The output XML is intended to be used an input " + " The output XML is intended to be used as an input " "for the TrainImagesClassifier application to normalize samples before learning. " "You can also normalize the image with the XML file in the ImageClassifier application."); @@ -66,10 +66,10 @@ private: AddDocTag(Tags::Analysis); AddParameter(ParameterType_InputImageList, "il", "Input images"); - SetParameterDescription( "il", "List of input images filenames." ); + SetParameterDescription( "il", "List of input image filenames." ); AddParameter(ParameterType_Float, "bv", "Background Value"); - SetParameterDescription( "bv", "Background value to ignore in statistics computation." ); + SetParameterDescription( "bv", "Background value to ignore in computation of statistics." ); MandatoryOff("bv"); AddParameter(ParameterType_OutputFilename, "out", "Output XML file"); @@ -135,7 +135,7 @@ private: StreamingStatisticsVImageFilterType::Pointer statsEstimator = StreamingStatisticsVImageFilterType::New(); std::ostringstream processName; processName << "Processing Image (" << imageId+1 << "/" << imageList->Size() << ")"; - AddProcess(statsEstimator->GetStreamer(), processName.str().c_str()); + AddProcess(statsEstimator->GetStreamer(), processName.str()); statsEstimator->SetInput(image); statsEstimator->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); diff --git a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx index 1c9c715bed02a7fa1d849feb36a765bfa3c47a7b..7092df394fc92e3f6ecae017b8e303ab31fe4bc7 100644 --- a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx +++ b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx @@ -79,10 +79,10 @@ private: void DoInit() override { SetName("ComputePolylineFeatureFromImage"); - SetDescription("This application compute for each studied polyline, contained in the input VectorData, the chosen descriptors."); + SetDescription("This application computes the chosen descriptors for each studied polyline contained in the input VectorData."); SetDocName("Compute Polyline Feature From Image"); - SetDocLongDescription("The first step in the classifier fusion based validation is to compute, for each studied polyline, the chosen descriptors. "); + SetDocLongDescription("The first step in the classifier fusion based validation is to compute the chosen descriptors for each studied polyline. "); SetDocLimitations("Since it does not rely on streaming process, take care of the size of input image before launching application."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); diff --git a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx index 1b1c7c98850cd9e45a5321038ffd9ba3fd71684a..975b37fc884354f127b0c0316fa73a62ec853cec 100644 --- a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx +++ b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx @@ -140,6 +140,9 @@ private: AddParameter(ParameterType_StringList, "plasup", "Plausibility Support"); SetParameterDescription("plasup", "Dempster Shafer study hypothesis to compute plausibility"); + AddParameter(ParameterType_OutputFilename, "out", "Output filename"); + SetParameterDescription("out", "Output model file name (xml file) contains the optimal model to perform information fusion."); + AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); @@ -167,9 +170,6 @@ private: AddParameter(ParameterType_Bool,"optobs","Optimizer Observer"); SetParameterDescription("optobs","Activate the optimizer observer"); - AddParameter(ParameterType_OutputFilename,"out","Output filename"); - SetParameterDescription("out","Output model file name (xml file) contains the optimal model to perform information fusion."); - // Doc example parameter settings SetDocExampleParameterValue("psin", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp"); SetDocExampleParameterValue("nsin", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp"); @@ -212,7 +212,7 @@ private: if (IsParameterEnabled("initmod")) { std::string descModFile = GetParameterString("initmod"); - descMod = FuzzyDescriptorsModelManager::Read(descModFile.c_str()); + descMod = FuzzyDescriptorsModelManager::Read(descModFile); descList = FuzzyDescriptorsModelManager::GetDescriptorList(descMod); } else diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx index a8dd7f071069a626f0571de89db6b5f334cf3f48..554edc2407ec481df0d1c1559f820cc190ef4385 100644 --- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx +++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx @@ -119,6 +119,9 @@ private: AddParameter(ParameterType_InputImageList, "il", "Input classifications"); SetParameterDescription( "il", "List of input classification maps to fuse. Labels in each classification image must represent the same class." ); + AddParameter(ParameterType_OutputImage, "out", "The output classification image"); + SetParameterDescription("out", "The output classification image resulting from the fusion of the input classification images."); + SetDefaultOutputPixelType("out", ImagePixelType_uint8); /** GROUP FUSION METHOD */ AddParameter(ParameterType_Choice, "method", "Fusion method"); @@ -157,10 +160,6 @@ private: "labels in the input classifications. By default, 'undecidedlabel = 0'."); SetDefaultParameterInt("undecidedlabel",0); - AddParameter(ParameterType_OutputImage,"out","The output classification image"); - SetParameterDescription("out","The output classification image resulting from the fusion of the input classification images."); - SetDefaultOutputPixelType("out",ImagePixelType_uint8); - // Doc example parameter settings SetDocExampleParameterValue("il", "classification1.tif classification2.tif classification3.tif"); SetDocExampleParameterValue("method", "dempstershafer"); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index 2c0a7d65a730ccfdcc0e1fb1218f6ec33e306ea1..d0a57ffa4bc7d86b704921e2d1e2f1d27301d817 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -259,11 +259,11 @@ protected: otbAppLogINFO("output model : " << GetInternalApplication("training")->GetParameterString("io.out")); } - void ComputeImageStatistics(const std::string &imageFileName, + void ComputeImageStatistics( ImageBaseType * img, const std::string &imagesStatsFileName) { - std::vector<std::string> imageFileNameList = {imageFileName}; - GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList); + // std::vector<std::string> imageFileNameList = {imageFileName}; + GetInternalApplication("imgstats")->SetParameterImageBase("il", img); GetInternalApplication("imgstats")->SetParameterString("out", imagesStatsFileName); ExecuteInternal( "imgstats" ); @@ -486,7 +486,7 @@ private: actualNBSamplesForKMeans); // Compute Images second order statistics - Superclass::ComputeImageStatistics(GetParameterString("in"), fileNames.imgStatOutput); + Superclass::ComputeImageStatistics(GetParameterImageBase("in"), fileNames.imgStatOutput); // Compute a train model with TrainVectorClassifier app Superclass::TrainKMModel(GetParameterImage("in"), fileNames.sampleOutput, diff --git a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx index 0b60504fed8ea033038900f466b86054bc6402b3..ac4b60b7bfd1214655e224a2ddcef8ff4c5141f5 100644 --- a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx +++ b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx @@ -334,12 +334,17 @@ private: std::string outputBase = outputPath.substr(0, outputPath.find_last_of('.')); std::string outputExt = outputPath.substr(outputPath.find_last_of('.'), std::string::npos); unsigned int overflowCount = 0; + bool noSamples=true; for (unsigned int i=0 ; i<nbInputs ; i++ ) { // Print results oss.str(std::string("")); - oss << " className requiredSamples totalSamples rate" << std::endl; + oss << " className requiredSamples totalSamples rate\n"; MapRateType rates = m_CalculatorList->GetRatesByClass(i); + if(!rates.empty()) + { + noSamples = false; + } MapRateType::const_iterator itRates = rates.begin(); for(; itRates != rates.end(); ++itRates) { @@ -358,6 +363,10 @@ private: oss << outputBase << "_" << i+1 << outputExt; m_CalculatorList->GetNthElement(i)->Write(oss.str()); } + if (noSamples) + { + otbAppLogFATAL("No samples found in the inputs!"); + } if (overflowCount) { std::string plural(overflowCount>1?"s":""); diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx index 045836b9e4deced4e551055c342ec3118f28f089..af39d262e52379e4b3789842ce4a455e8afadb2f 100644 --- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx @@ -141,9 +141,9 @@ private: #ifdef OTB_USE_LIBSVM clock_t tic = clock(); - std::string shapefile = GetParameterString("inshp").c_str(); - std::string XMLfile = GetParameterString("instats").c_str(); - std::string modelfile = GetParameterString("insvm").c_str(); + std::string shapefile = GetParameterString("inshp"); + std::string XMLfile = GetParameterString("instats"); + std::string modelfile = GetParameterString("insvm"); typedef double ValueType; typedef itk::VariableLengthVector<ValueType> MeasurementType; diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index bd7f51f59c48f7d28cd9d1928b85bbfbef754d51..751cba5c08ad7c1b8f590d69fc256fd16ae3f5c9 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -121,7 +121,7 @@ private: // Doc example parameter settings SetDocExampleParameterValue("in", "support_image.tif"); SetDocExampleParameterValue("vec", "variousVectors.sqlite"); - SetDocExampleParameterValue("field", "label"); + SetDocExampleParameterValue("field", "CLASS"); SetDocExampleParameterValue("out","polygonStat.xml"); SetOfficialDocLink(); diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx index 05aee81453b8b62de06c103d4b96c70b40cfce0b..c0a1a8935fd88ad7937e25c645de9b694118ee2b 100644 --- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx @@ -118,19 +118,20 @@ public: ComputePolygonStatistics( imageList, validationVectorFileList, fileNames.polyStatValidOutputs ); ComputeSamplingRate( fileNames.polyStatValidOutputs, fileNames.rateValidOut, rates.fmv ); SelectAndExtractValidationSamples( fileNames, imageList, validationVectorFileList ); -// if( HasInputVector ) // if input vector is provided the sampleTrainOutputs is the previously extracted sampleOutputs + fileNames.sampleTrainOutputs = fileNames.sampleOutputs; } else if(GetParameterFloat("sample.vtr") != 0.0)// Split training data to validation { -// if( !HasInputVector ) // Compute one class statistics and sampling rate for the generated vector. -// ComputePolygonStatistics( imageList, fileNames.sampleOutputs, fileNames.polyStatTrainOutputs ); -// ComputeSamplingRate( fileNames.polyStatTrainOutputs, fileNames.rateTrainOut, rates.fmt ); SplitTrainingToValidationSamples( fileNames, imageList ); } - else // nothing to do, except update fileNames + else // Update sampleTrainOutputs and clear sampleValidOutputs { fileNames.sampleTrainOutputs = fileNames.sampleOutputs; + + // Corner case where no dedicated validation set is provided and split ratio is set to 0 (all samples for training) + // In this case SampleValidOutputs should be cleared + fileNames.sampleValidOutputs.clear(); } } diff --git a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx index 61a8908f9cab792791aa2c7a5ca54837ff57a1c8..dd055e13ea4a9dead60c36d6a06aa3183a7388b3 100644 --- a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx @@ -84,6 +84,9 @@ private: AddParameter(ParameterType_StringList, "plasup", "Plausibility Support"); SetParameterDescription("plasup", "Dempster Shafer study hypothesis to compute plausibility"); + AddParameter(ParameterType_OutputVectorData, "out", "Output Vector Data"); + SetParameterDescription("out", "Output VectorData containing only the validated samples"); + AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); @@ -94,9 +97,6 @@ private: MandatoryOff("thd"); SetParameterFloat("thd",0.5); - AddParameter(ParameterType_OutputVectorData, "out", "Output Vector Data"); - SetParameterDescription("out", "Output VectorData containing only the validated samples"); - // Doc example parameter settings SetDocExampleParameterValue("in", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp"); SetDocExampleParameterValue("belsup", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp"); @@ -125,7 +125,7 @@ private: // Load the descriptors model std::string descModFile = GetParameterString("descmod"); - DescriptorsModelType descMod = FuzzyDescriptorsModelManager::Read(descModFile.c_str()); + DescriptorsModelType descMod = FuzzyDescriptorsModelManager::Read(descModFile); LabelSetType Bhyp, Phyp; int nbSet; diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h index bdad273d83e1ef015e0937227a6c01014976fa94..364310ce8c02354023969ec6aa20d3906ee8c845 100644 --- a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h +++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h @@ -82,7 +82,7 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Standard macro */ - itkTypeMacro(LearningApplicationBase, otb::Application) + itkTypeMacro(LearningApplicationBase, otb::Application); typedef TInputValue InputValueType; typedef TOutputValue OutputValueType; diff --git a/Modules/Applications/AppClassification/include/otbTrainImagesBase.h b/Modules/Applications/AppClassification/include/otbTrainImagesBase.h index 6e7ffc57c2f779701ac7f81d34e9c6daeace62f7..379ae38c8e36c9972a683821d018593bc3a6f474 100644 --- a/Modules/Applications/AppClassification/include/otbTrainImagesBase.h +++ b/Modules/Applications/AppClassification/include/otbTrainImagesBase.h @@ -54,7 +54,7 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Standard macro */ - itkTypeMacro( TrainImagesBase, Superclass ) + itkTypeMacro( TrainImagesBase, Superclass ); /** filters typedefs*/ typedef otb::OGRDataToSamplePositionFilter<FloatVectorImageType, UInt8ImageType, otb::PeriodicSampler> PeriodicSamplerType; @@ -234,7 +234,6 @@ protected: sampleTrainOutputs.push_back( outModel + "_samplesTrain_" + strIndex + ".shp" ); sampleValidOutputs.push_back( outModel + "_samplesValid_" + strIndex + ".shp" ); } - } void clear() diff --git a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h index ce6d04f39775e8183b63fb3c3c57521b3a966e75..6c23afbfdb6677a579f0953a0f8fa30571cd6c6c 100644 --- a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h +++ b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h @@ -59,7 +59,7 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Standard macro */ - itkTypeMacro(Self, Superclass) + itkTypeMacro(Self, Superclass); typedef Superclass::SampleType SampleType; typedef Superclass::ListSampleType ListSampleType; diff --git a/Modules/Applications/AppClassification/test/CMakeLists.txt b/Modules/Applications/AppClassification/test/CMakeLists.txt index 0473a653759af2a2f24cedf87257da70eafa50e6..46f4e82dcf3142883cd94d7508458647dd02c47a 100644 --- a/Modules/Applications/AppClassification/test/CMakeLists.txt +++ b/Modules/Applications/AppClassification/test/CMakeLists.txt @@ -46,7 +46,7 @@ otb_test_application(NAME apTvClSOMClassificationFull -vm ${INPUTDATA}/poupees_sub_c1.png -tp 0.8 -ts 13000 - -som ${TEMP}/apTvClSOMClassificationMap.hdr + -som ${TEMP}/apTvClSOMClassificationMap.tif -sx 30 -sy 30 -nx 9 @@ -59,8 +59,8 @@ otb_test_application(NAME apTvClSOMClassificationFull VALID --compare-n-images ${NOTOL} 2 ${BASELINE}/apTvClSOMClassificationFull.tif ${TEMP}/apTvClSOMClassificationFull.tif - ${BASELINE}/apTvClSOMClassificationMap.hdr - ${TEMP}/apTvClSOMClassificationMap.hdr) + ${BASELINE}/apTvClSOMClassificationMap.tif + ${TEMP}/apTvClSOMClassificationMap.tif) #----------- ImageClassifier TESTS ---------------- diff --git a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx index 8a5463e6b8758a93b724148b965c34db79653746..d367a97ec1b422403325bed89759064c6e338b44 100644 --- a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx +++ b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx @@ -124,6 +124,14 @@ private: SetMinimumParameterIntValue("band2",1); SetDefaultParameterInt("band2",1); + AddParameter(ParameterType_OutputFilename, "out", "Output file with tie points"); + SetParameterDescription("out", "File containing the list of tie points"); + + AddParameter(ParameterType_OutputFilename, "outvector", "Output vector file with tie points"); + SetParameterDescription("outvector", "File containing segments representing matches "); + MandatoryOff("outvector"); + DisableParameter("outvector"); + AddParameter(ParameterType_Choice,"algorithm","Keypoints detection algorithm"); SetParameterDescription("algorithm","Choice of the detection algorithm to use"); @@ -183,14 +191,6 @@ private: // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); - AddParameter(ParameterType_OutputFilename,"out","Output file with tie points"); - SetParameterDescription("out","File containing the list of tie points"); - - AddParameter(ParameterType_OutputFilename,"outvector","Output vector file with tie points"); - SetParameterDescription("outvector","File containing segments representing matches "); - MandatoryOff("outvector"); - DisableParameter("outvector"); - // Doc example parameter settings SetDocExampleParameterValue("in1", "sensor_stereo_left.tif"); SetDocExampleParameterValue("in2","sensor_stereo_right.tif"); diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h index da91402fdaddd776926b1479205ca19238f82ac8..2d55a299415cf511403e94531e582369773a13df 100644 --- a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h +++ b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h @@ -77,7 +77,7 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Standard macro */ - itkTypeMacro(TrainDimensionalityReductionApplicationBase, otb::Application) + itkTypeMacro(TrainDimensionalityReductionApplicationBase, otb::Application); typedef TInputValue InputValueType; typedef TOutputValue OutputValueType; diff --git a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx index cbadc412bb8edd5ff8654c459c5ae03c1e707a02..20be637f3db3a1656e48916d6150f385bd3c6a36 100644 --- a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx +++ b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx @@ -37,187 +37,179 @@ namespace Wrapper class EdgeExtraction : public Application { public: -/** Standard class typedefs. */ -typedef EdgeExtraction Self; -typedef Application Superclass; -typedef itk::SmartPointer<Self> Pointer; -typedef itk::SmartPointer<const Self> ConstPointer; - -typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType,FloatImageType::InternalPixelType> - ExtractorFilterType; -typedef itk::GradientMagnitudeImageFilter<FloatImageType, FloatImageType> - GradientFilterType; -typedef itk::SobelEdgeDetectionImageFilter<FloatImageType, FloatImageType> - SobelFilterType; -//typedef itk::CannyEdgeDetectionImageFilter<FloatImageType, FloatImageType> -// CannyFilterType; -typedef TouziEdgeDetectorImageFilter<FloatImageType, FloatImageType> - TouziFilterType; - -/** Standard macro */ -itkNewMacro(Self); - -itkTypeMacro(EdgeExtraction, otb::Application); + /** Standard class typedefs. */ + typedef EdgeExtraction Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; -private: + typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType, FloatImageType::InternalPixelType> ExtractorFilterType; + typedef itk::GradientMagnitudeImageFilter<FloatImageType, FloatImageType> GradientFilterType; + typedef itk::SobelEdgeDetectionImageFilter<FloatImageType, FloatImageType> SobelFilterType; + // typedef itk::CannyEdgeDetectionImageFilter<FloatImageType, FloatImageType> + // CannyFilterType; + typedef TouziEdgeDetectorImageFilter<FloatImageType, FloatImageType> TouziFilterType; -void DoInit() override -{ -SetName("EdgeExtraction"); -SetDescription( - "This application computes edge features on every pixel of the input image " - "selected channel"); - -// Documentation -SetDocName("Edge Feature Extraction"); -SetDocLongDescription( - "This application computes edge features on a selected channel of the input." - "It uses different filter such as gradient, Sobel and Touzi"); - -SetDocLimitations("None"); -SetDocAuthors("OTB-Team"); -SetDocSeeAlso("otb class"); - -AddDocTag(Tags::FeatureExtraction); -AddDocTag("Edge"); - -AddParameter(ParameterType_InputImage, "in", "Input Image"); -SetParameterDescription("in", "The input image on which the features are computed."); - -AddParameter(ParameterType_Int, "channel", "Selected Channel"); -SetParameterDescription("channel", "The selected channel index"); -SetDefaultParameterInt("channel", 1); -SetMinimumParameterIntValue("channel", 1); - -AddRAMParameter(); - -AddParameter(ParameterType_Choice, "filter", "Edge feature"); -SetParameterDescription("filter", "Choice of edge feature"); - -//Gradient Section -AddChoice("filter.gradient", "Gradient"); -SetParameterDescription("filter.gradient", - "This filter computes the gradient magnitude of the image at each pixel."); - -//Sobel Section -AddChoice("filter.sobel", "Sobel"); -SetParameterDescription("filter.sobel", - "This filter uses the Sobel operator to calculate the image gradient and " - "then finds the magnitude of this gradient vector."); - -//Touzi Section -AddChoice("filter.touzi", "Touzi"); -SetParameterDescription("filter.touzi", - "This filter is more suited for radar images. It has a spatial parameter " - "to avoid speckle noise perturbations. The larger the radius is, " - "less sensible to the speckle noise the filter is, but micro edge will be missed."); -AddParameter(ParameterType_Int, "filter.touzi.xradius", - "The X radius of the neighborhood."); -SetDefaultParameterInt("filter.touzi.xradius", 1); -AddParameter(ParameterType_Int, "filter.touzi.yradius", - "The Y radius of the neighborhood."); -SetDefaultParameterInt("filter.touzi.yradius", 1); - -//Canny Section -/* -AddChoice("filter.canny", "Canny"); -AddParameter(ParameterType_Float, "filter.canny.variance", ""); -SetDefaultParameterFloat("filter.canny.variance", 1.0); -AddParameter(ParameterType_Float, "filter.canny.maximumerror", ""); -SetDefaultParameterFloat("filter.canny.maximumerror", 0.01); -AddParameter(ParameterType_Float, "filter.canny.upperthreshold", ""); -SetDefaultParameterFloat("filter.canny.upperthreshold", 15.0); -AddParameter(ParameterType_Float, "filter.canny.lowerthreshold", ""); -SetDefaultParameterFloat("filter.canny.lowerthreshold", 3.0); -*/ - -AddParameter(ParameterType_OutputImage, "out", "Feature Output Image"); -SetParameterDescription("out", "Output image containing the edge features."); - -// Doc example parameter settings -SetDocExampleParameterValue("in", "qb_RoadExtract.tif"); -SetDocExampleParameterValue("channel", "1"); -SetDocExampleParameterValue("out", "Edges.tif"); - -SetOfficialDocLink(); -} - -void DoUpdateParameters() override -{ - // Nothing to do here : all parameters are independent -} + /** Standard macro */ + itkNewMacro(Self); -void DoExecute() override -{ - FloatVectorImageType::Pointer inImage = GetParameterImage("in"); - inImage->UpdateOutputInformation(); - int nbChan = inImage->GetNumberOfComponentsPerPixel(); + itkTypeMacro(EdgeExtraction, otb::Application); - if( GetParameterInt("channel") > nbChan ) +private: + void DoInit() override + { + SetName("EdgeExtraction"); + SetDescription( + "This application computes edge features on every pixel of the input image " + "selected channel"); + + // Documentation + SetDocName("Edge Feature Extraction"); + SetDocLongDescription( + "This application computes edge features on a selected channel of the input." + "It uses different filter such as gradient, Sobel and Touzi"); + + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso("otb class"); + + AddDocTag(Tags::FeatureExtraction); + AddDocTag("Edge"); + + AddParameter(ParameterType_InputImage, "in", "Input Image"); + SetParameterDescription("in", "The input image on which the features are computed."); + + AddParameter(ParameterType_OutputImage, "out", "Feature Output Image"); + SetParameterDescription("out", "Output image containing the edge features."); + + AddParameter(ParameterType_Int, "channel", "Selected Channel"); + SetParameterDescription("channel", "The selected channel index"); + SetDefaultParameterInt("channel", 1); + SetMinimumParameterIntValue("channel", 1); + + AddRAMParameter(); + + AddParameter(ParameterType_Choice, "filter", "Edge feature"); + SetParameterDescription("filter", "Choice of edge feature"); + + // Gradient Section + AddChoice("filter.gradient", "Gradient"); + SetParameterDescription("filter.gradient", "This filter computes the gradient magnitude of the image at each pixel."); + + // Sobel Section + AddChoice("filter.sobel", "Sobel"); + SetParameterDescription("filter.sobel", + "This filter uses the Sobel operator to calculate the image gradient and " + "then finds the magnitude of this gradient vector."); + + // Touzi Section + AddChoice("filter.touzi", "Touzi"); + SetParameterDescription("filter.touzi", + "This filter is more suited for radar images. It has a spatial parameter " + "to avoid speckle noise perturbations. The larger the radius is, " + "less sensible to the speckle noise the filter is, but micro edge will be missed."); + AddParameter(ParameterType_Int, "filter.touzi.xradius", "The X radius of the neighborhood."); + SetDefaultParameterInt("filter.touzi.xradius", 1); + AddParameter(ParameterType_Int, "filter.touzi.yradius", "The Y radius of the neighborhood."); + SetDefaultParameterInt("filter.touzi.yradius", 1); + + // Canny Section + /* + AddChoice("filter.canny", "Canny"); + AddParameter(ParameterType_Float, "filter.canny.variance", ""); + SetDefaultParameterFloat("filter.canny.variance", 1.0); + AddParameter(ParameterType_Float, "filter.canny.maximumerror", ""); + SetDefaultParameterFloat("filter.canny.maximumerror", 0.01); + AddParameter(ParameterType_Float, "filter.canny.upperthreshold", ""); + SetDefaultParameterFloat("filter.canny.upperthreshold", 15.0); + AddParameter(ParameterType_Float, "filter.canny.lowerthreshold", ""); + SetDefaultParameterFloat("filter.canny.lowerthreshold", 3.0); + */ + + // Doc example parameter settings + SetDocExampleParameterValue("in", "qb_RoadExtract.tif"); + SetDocExampleParameterValue("channel", "1"); + SetDocExampleParameterValue("out", "Edges.tif"); + + SetOfficialDocLink(); + } + + void DoUpdateParameters() override + { + // Nothing to do here : all parameters are independent + } + + void DoExecute() override + { + FloatVectorImageType::Pointer inImage = GetParameterImage("in"); + inImage->UpdateOutputInformation(); + int nbChan = inImage->GetNumberOfComponentsPerPixel(); + + if (GetParameterInt("channel") > nbChan) { - otbAppLogCRITICAL("Selected band is not available..."); - return; + otbAppLogCRITICAL("Selected band is not available..."); + return; } - const std::string edgeType = GetParameterString("filter"); + const std::string edgeType = GetParameterString("filter"); - m_ExtractorFilter = ExtractorFilterType::New(); - m_ExtractorFilter->SetInput(inImage); - m_ExtractorFilter->SetStartX(inImage->GetLargestPossibleRegion().GetIndex(0)); - m_ExtractorFilter->SetStartY(inImage->GetLargestPossibleRegion().GetIndex(1)); - m_ExtractorFilter->SetSizeX(inImage->GetLargestPossibleRegion().GetSize(0)); - m_ExtractorFilter->SetSizeY(inImage->GetLargestPossibleRegion().GetSize(1)); - m_ExtractorFilter->SetChannel(GetParameterInt("channel")); - m_ExtractorFilter->UpdateOutputInformation(); + m_ExtractorFilter = ExtractorFilterType::New(); + m_ExtractorFilter->SetInput(inImage); + m_ExtractorFilter->SetStartX(inImage->GetLargestPossibleRegion().GetIndex(0)); + m_ExtractorFilter->SetStartY(inImage->GetLargestPossibleRegion().GetIndex(1)); + m_ExtractorFilter->SetSizeX(inImage->GetLargestPossibleRegion().GetSize(0)); + m_ExtractorFilter->SetSizeY(inImage->GetLargestPossibleRegion().GetSize(1)); + m_ExtractorFilter->SetChannel(GetParameterInt("channel")); + m_ExtractorFilter->UpdateOutputInformation(); - m_GradientFilter = GradientFilterType::New(); - m_SobelFilter = SobelFilterType::New(); - m_TouziFilter = TouziFilterType::New(); - //m_CannyFilter = CannyFilterType::New(); + m_GradientFilter = GradientFilterType::New(); + m_SobelFilter = SobelFilterType::New(); + m_TouziFilter = TouziFilterType::New(); + // m_CannyFilter = CannyFilterType::New(); - if( edgeType == "gradient" ) + if (edgeType == "gradient") { - m_GradientFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); - SetParameterOutputImage("out", m_GradientFilter->GetOutput()); + m_GradientFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); + SetParameterOutputImage("out", m_GradientFilter->GetOutput()); } - if( edgeType == "sobel" ) + if (edgeType == "sobel") { - m_SobelFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); - SetParameterOutputImage("out", m_SobelFilter->GetOutput()); + m_SobelFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); + SetParameterOutputImage("out", m_SobelFilter->GetOutput()); } - if( edgeType == "touzi" ) + if (edgeType == "touzi") { - m_TouziFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); - TouziFilterType::SizeType rad; - rad[0] = this->GetParameterInt("filter.touzi.xradius"); - rad[1] = this->GetParameterInt("filter.touzi.yradius"); - m_TouziFilter->SetRadius(rad); - SetParameterOutputImage("out", m_TouziFilter->GetOutput()); - } -/* - if( edgeType == "canny" ) - { - - m_CannyFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); - m_CannyFilter->SetVariance(GetParameterFloat("filter.canny.variance")); - m_CannyFilter->SetMaximumError(GetParameterFloat("filter.canny.maximumerror")); - m_CannyFilter->SetUpperThreshold(GetParameterFloat("filter.canny.upperthreshold")); - m_CannyFilter->SetLowerThreshold(GetParameterFloat("filter.canny.lowerthreshold")); - - SetParameterOutputImage("out", m_CannyFilter->GetOutput()); + m_TouziFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); + TouziFilterType::SizeType rad; + rad[0] = this->GetParameterInt("filter.touzi.xradius"); + rad[1] = this->GetParameterInt("filter.touzi.yradius"); + m_TouziFilter->SetRadius(rad); + SetParameterOutputImage("out", m_TouziFilter->GetOutput()); } -*/ -} - -ExtractorFilterType::Pointer m_ExtractorFilter; -GradientFilterType::Pointer m_GradientFilter; -SobelFilterType::Pointer m_SobelFilter; -TouziFilterType::Pointer m_TouziFilter; -//CannyFilterType::Pointer m_CannyFilter; + /* + if( edgeType == "canny" ) + { + + m_CannyFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput())); + m_CannyFilter->SetVariance(GetParameterFloat("filter.canny.variance")); + m_CannyFilter->SetMaximumError(GetParameterFloat("filter.canny.maximumerror")); + m_CannyFilter->SetUpperThreshold(GetParameterFloat("filter.canny.upperthreshold")); + m_CannyFilter->SetLowerThreshold(GetParameterFloat("filter.canny.lowerthreshold")); + + SetParameterOutputImage("out", m_CannyFilter->GetOutput()); + } + */ + } + + ExtractorFilterType::Pointer m_ExtractorFilter; + GradientFilterType::Pointer m_GradientFilter; + SobelFilterType::Pointer m_SobelFilter; + TouziFilterType::Pointer m_TouziFilter; + // CannyFilterType::Pointer m_CannyFilter; }; -} -} +} // namespace Wrapper +} // namespace otb OTB_APPLICATION_EXPORT(otb::Wrapper::EdgeExtraction) diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index 13c2306602d67449e1c280474c643b48a6e40358..38ee5a8c6f9a3e2a396cb978688d061d9064ff30 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -115,7 +115,6 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("VertexComponentAnalysis"); - AddDocTag("Miscellaneous"); AddDocTag(Tags::Hyperspectral); AddParameter(ParameterType_InputImage, "in", "Input Image Filename"); diff --git a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx index e919d57f5d110ad42a682d2363effa88d1b17e2d..7c9b4260768728fcd3f84c7ab813bfce63f7fa0b 100644 --- a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx @@ -71,18 +71,12 @@ private: "unmix hyperspectral data, in IEEE Transactions on Geoscience and" "Remote Sensing, vol. 43, no. 4, pp. 898-910, April 2005."); - AddDocTag("Miscellaneous"); AddDocTag(Tags::Hyperspectral); AddDocTag(Tags::DimensionReduction); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in","Input hyperspectral data cube"); - AddParameter(ParameterType_Int, "ne", "Number of endmembers"); - SetParameterDescription("ne","The number of endmembers to extract from the hyperspectral image."); - SetParameterInt("ne",1); - MandatoryOn("ne"); - AddParameter(ParameterType_OutputImage, "outendm", "Output Endmembers"); SetParameterDescription("outendm","Endmembers, stored in a" "one-line multi-spectral image.Each pixel corresponds to one" @@ -90,6 +84,11 @@ private: "signature of the corresponding endmember."); MandatoryOn("outendm"); + AddParameter(ParameterType_Int, "ne", "Number of endmembers"); + SetParameterDescription("ne", "The number of endmembers to extract from the hyperspectral image."); + SetParameterInt("ne", 1); + MandatoryOn("ne"); + AddRANDParameter(); // Doc example parameter settings SetDocExampleParameterValue("in", "cupriteSubHsi.tif"); diff --git a/Modules/Applications/AppImageUtils/app/CMakeLists.txt b/Modules/Applications/AppImageUtils/app/CMakeLists.txt index 1a858124b5c4f2320b3ec05a14c6ac9d7e312132..e89f03ee6f9ca3ae2b2e931e455411704f99a63d 100644 --- a/Modules/Applications/AppImageUtils/app/CMakeLists.txt +++ b/Modules/Applications/AppImageUtils/app/CMakeLists.txt @@ -59,12 +59,6 @@ otb_create_application( SOURCES otbQuicklook.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) -otb_create_application( - NAME DEMConvert - SOURCES otbDEMConvert.cxx - LINK_LIBRARIES ${${otb-module}_LIBRARIES}) - - otb_create_application( NAME ConcatenateImages SOURCES otbConcatenateImages.cxx diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index cbdcb90795e11c3400a1bbeb9ab02c4b612f98db..643d643fdf9535afb3ab02106bfafb96a0daf276 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -61,9 +61,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("BandMath application, ImageStatistics"); - AddDocTag("Miscellaneous"); - AddDocTag("Statistics"); - AddDocTag(Tags::Manip); + AddDocTag(Tags::Manip); AddParameter(ParameterType_Group, "ref", "Reference image properties"); AddParameter(ParameterType_InputImage, "ref.in", "Reference image"); @@ -114,7 +112,7 @@ 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); @@ -172,12 +170,12 @@ private: void DoExecute() override { // Init filters - ExtractROIMonoFilterType::Pointer extractRefFilter = + ExtractROIMonoFilterType::Pointer extractRefFilter = ExtractROIMonoFilterType::New(); - ExtractROIMonoFilterType::Pointer extractMeasFilter = + ExtractROIMonoFilterType::Pointer extractMeasFilter = ExtractROIMonoFilterType::New(); - StreamingCompareImageFilterType::Pointer compareFilter = - StreamingCompareImageFilterType::New(); + StreamingCompareImageFilterType::Pointer compareFilter = + StreamingCompareImageFilterType::New(); // Get input image pointers FloatVectorImageType::Pointer refIm = this->GetParameterImage("ref.in"); diff --git a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx b/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx deleted file mode 100644 index f9a8d67a2a88bc9485257d2fba6df3cbff725b75..0000000000000000000000000000000000000000 --- a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbWrapperApplication.h" -#include "otbWrapperApplicationFactory.h" - -#include "otbDEMConvertAdapter.h" - -#include "itkImageIOFactory.h" - -namespace otb -{ -namespace Wrapper -{ - -class DEMConvert : public Application -{ -public: - /** Standard class typedefs. */ - typedef DEMConvert Self; - typedef Application Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Standard macro */ - itkNewMacro(Self); - - itkTypeMacro(DEMConvert, otb::Application); - -private: - void DoInit() override - { - SetName("DEMConvert"); - SetDescription("Converts a geo-referenced DEM image into a general raster file compatible with OTB DEM handling."); - - SetDocName("DEM Conversion"); - SetDocLongDescription("In order to be understood by the Orfeo ToolBox and the underlying OSSIM library, a geo-referenced Digital Elevation Model image can be converted into a general raster image, which consists in 3 files with the following extensions: .ras, .geom and .omd. Once converted, you have to place these files in a separate directory, and you can then use this directory to set the \"DEM Directory\" parameter of a DEM based OTB application or filter."); - SetDocLimitations("For this application to work one need the input " - "pixel type to be retrieved. It can only be done through GDAL IO driver " - "for now."); - SetDocAuthors("OTB-Team"); - SetDocSeeAlso(" "); - - AddDocTag(Tags::Manip); - - AddParameter(ParameterType_InputImage, "in", "Input geo-referenced DEM"); - SetParameterDescription("in", "Input geo-referenced DEM to convert to general raster format."); - - AddParameter(ParameterType_OutputFilename, "out", "Prefix of the output files"); - std::ostringstream oss; - oss << "will be used to get the prefix (name withtout extensions) of the files to write. "; - oss << "Three files - prefix.geom, prefix.omd and prefix.ras - will be generated."; - SetParameterDescription("out", oss.str()); - //MandatoryOn("out"); - - // Doc example parameter settings - SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_Elev.tif"); - SetDocExampleParameterValue("out", "outputDEM"); - - SetOfficialDocLink(); -} - -void DoUpdateParameters() override -{ - // nothing to update -} - -/* The main is simple : read image using OTB and write it as a tif. -* Read this tif using OSSIM and convert it as a general raster file -* (.ras, .geom and . omd) -*/ - -void DoExecute() override -{ - // Load input image - FloatVectorImageType::Pointer inImage = GetParameterImage("in"); - - // Set temporary tif filename (for ossim) - std::string ofname = GetParameterString("out"); - std::string path = itksys::SystemTools::GetFilenamePath(ofname); - std::string fname = itksys::SystemTools::GetFilenameWithoutExtension(ofname); - std::string tempFilename = path+"/"+fname+"_DEMConvert.tif"; - std::string tempFilenameGeom = path+"/"+fname+"_DEMConvert.geom"; - - // Generate the tif image using OTB while keeping the same pixel - // type then the input image - // Initialize an outputParameter and set its output pixeltype - OutputImageParameter::Pointer paramOut = OutputImageParameter::New(); - std::ostringstream osswriter; - osswriter<< "writing temporary tif file"; - - // Set the filename of the current output image - paramOut->SetFileName(tempFilename); - paramOut->SetValue(inImage); - - // Set the output pixel type - ImageIOBase::IOComponentType typeInfo; - bool hasType( itk::ExposeMetaData< ImageIOBase::IOComponentType >( inImage->GetMetaDataDictionary(), - MetaDataKey::DataType , typeInfo) ); - if ( ! hasType ) - itkExceptionMacro("The pixel type could not be retrieved."); - switch(typeInfo) - { - case ImageIOBase::UCHAR: - paramOut->SetPixelType(ImagePixelType_uint8); - break; - case ImageIOBase::CHAR: - itkExceptionMacro("This application doesn't support image pixel type char."); - break; - case ImageIOBase::USHORT: - paramOut->SetPixelType(ImagePixelType_uint16); - break; - case ImageIOBase::SHORT: - paramOut->SetPixelType(ImagePixelType_int16); - break; - case ImageIOBase::UINT: - paramOut->SetPixelType(ImagePixelType_uint32); - break; - case ImageIOBase::INT: - paramOut->SetPixelType(ImagePixelType_int32); - break; - case ImageIOBase::ULONG: - itkExceptionMacro("This application doesn't support image pixel type unsigned long."); - break; - case ImageIOBase::LONG: - itkExceptionMacro("This application doesn't support image pixel type long."); - break; - case ImageIOBase::FLOAT: - paramOut->SetPixelType(ImagePixelType_float); - break; - case ImageIOBase::DOUBLE: - paramOut->SetPixelType(ImagePixelType_double); - break; - case ImageIOBase::CSHORT: - paramOut->SetPixelType(ImagePixelType_cint16); - break; - case ImageIOBase::CINT: - paramOut->SetPixelType(ImagePixelType_cint32); - break; - case ImageIOBase::CFLOAT: - paramOut->SetPixelType(ImagePixelType_cfloat); - break; - case ImageIOBase::CDOUBLE: - paramOut->SetPixelType(ImagePixelType_cdouble); - break; - case ImageIOBase::UNKNOWNCOMPONENTTYPE: - itkExceptionMacro("The pixel type is unknown."); - break; - } - - // Add the tempfilename to be written - paramOut->InitializeWriters(); - AddProcess(paramOut->GetWriter(), osswriter.str()); - paramOut->Write(); - - // Set the output ras file - std::string output = path+"/"+fname+".ras"; - - DEMConvertAdapter::Pointer DEMConverter = DEMConvertAdapter::New(); - DEMConverter->Convert(tempFilename, output); - - // remove the temprorary tif file - if( !itksys::SystemTools::RemoveFile(tempFilename) ) - { - itkExceptionMacro("Problem while removing the file " << tempFilename); - } - - // remove the geom file if any - if( itksys::SystemTools::FileExists(tempFilenameGeom) - && !itksys::SystemTools::RemoveFile(tempFilenameGeom)) - { - itkExceptionMacro("Problem while removing the Geom file " << tempFilenameGeom); - } - } - -}; - -} // namespace otb -} -OTB_APPLICATION_EXPORT(otb::Wrapper::DEMConvert) - - diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index 80c55244c8de69e0ba860acb9eb91751a06f92c7..ea8bb52d905adbee6cb8277fce8002076655d466 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -41,7 +41,7 @@ public: typedef otb::MultiChannelExtractROI<FloatVectorImageType::InternalPixelType, FloatVectorImageType::InternalPixelType> ExtractROIFilterType; - typedef otb::GenericRSTransform<> RSTransformType; + typedef otb::GenericRSTransform<> RSTransformType; /** Standard macro */ itkNewMacro(Self); @@ -64,10 +64,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Miscellaneous"); - AddDocTag("Utilities"); - AddDocTag("Coordinates"); - AddDocTag("Raster"); + AddDocTag(Tags::Manip); + AddDocTag(Tags::Coordinates); AddParameter(ParameterType_InputImage , "in", "Input Image"); SetParameterDescription("in" , "Input image"); @@ -81,19 +79,19 @@ private: "This will be the Y coordinate interpreted depending on the " "chosen mode"); - AddParameter(ParameterType_Choice , "mode" , + AddParameter(ParameterType_Choice , "mode" , "Coordinate system used to designate the pixel"); - SetParameterDescription( "mode" , + SetParameterDescription( "mode" , "Different modes can be selected, default mode is Index."); AddChoice( "mode.index" , "Index"); - SetParameterDescription( "mode.index" , + SetParameterDescription( "mode.index" , "This mode uses the given coordinates as index to locate the pixel."); AddChoice( "mode.physical" , "Image physical space"); - SetParameterDescription( "mode.physical" , + SetParameterDescription( "mode.physical" , "This mode interprets the given coordinates in the image " "physical space."); AddChoice( "mode.epsg" , "EPSG coordinates"); - SetParameterDescription( "mode.epsg" , + SetParameterDescription( "mode.epsg" , "This mode interprets the given coordinates in the specified " "geographical coordinate system by the EPSG code."); @@ -169,7 +167,7 @@ private: RSTransformType::Pointer inverse = RSTransformType::New(); if ( HasUserValue("mode.epsg.code") ) { - std::string wktFromEpsg = + std::string wktFromEpsg = otb::GeoInformationConversion::ToWKT(GetParameterInt( "mode.epsg.code" )); inverse->SetOutputProjectionRef(wktFromEpsg); } @@ -193,13 +191,13 @@ private: if ( coma != std::string::npos ) { std::size_t zero = boundaries[i].find_last_not_of("0"); - if ( zero != std::string::npos ) + if ( zero != std::string::npos ) boundaries[i].erase(zero + 1); else boundaries[i] = "0"; } } - + std::string box = ""; box += "["+boundaries[2]+" , "+boundaries[0]+"] x "; box += "["+boundaries[3]+" , "+boundaries[1]+"]"; @@ -217,7 +215,7 @@ private: { id[0] = static_cast< int >( GetParameterFloat( "coordx" ) ); id[1] = static_cast< int >( GetParameterFloat( "coordy" ) ); - if (static_cast< unsigned int >( id[0] ) >= + if (static_cast< unsigned int >( id[0] ) >= inImage->GetLargestPossibleRegion().GetSize()[0] || static_cast< unsigned int >( id[1] ) >= inImage->GetLargestPossibleRegion().GetSize()[1] @@ -239,16 +237,16 @@ private: pixel[ 1 ] = GetParameterFloat( "coordy" ); isPixelIn = inImage->TransformPhysicalPointToIndex(pixel,id); } - + else if ( mode == "epsg" ) { RSTransformType::Pointer rsTransform = RSTransformType::New(); if ( HasUserValue("mode.epsg.code") ) { - std::string wktFromEpsg = + std::string wktFromEpsg = otb::GeoInformationConversion::ToWKT( GetParameterInt( "mode.epsg.code" ) ); rsTransform->SetInputProjectionRef(wktFromEpsg); - } + } rsTransform->SetOutputKeywordList( inImage->GetImageKeywordlist() ); rsTransform->SetOutputProjectionRef( inImage->GetProjectionRef() ); rsTransform->InstantiateTransform(); @@ -274,7 +272,7 @@ private: // Extract the channels if needed if ( GetParameterByKey("cl")->GetActive() ) { - for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) + for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) { extractor->SetChannel(GetSelectedItems("cl")[idx] + 1 ); } @@ -286,7 +284,7 @@ private: region.SetIndex(id); extractor->SetExtractionRegion(region); - extractor->Update(); + extractor->Update(); // Display the pixel value id.Fill(0); diff --git a/Modules/Applications/AppImageUtils/test/CMakeLists.txt b/Modules/Applications/AppImageUtils/test/CMakeLists.txt index 413fb1f19630cd6e2975aa9ef3ff761096abe787..4e099298e98ab6930a22e531b09108b24c9fa3ec 100644 --- a/Modules/Applications/AppImageUtils/test/CMakeLists.txt +++ b/Modules/Applications/AppImageUtils/test/CMakeLists.txt @@ -294,11 +294,6 @@ otb_test_application(NAME apTvUtQuicklookSpot5 ${TEMP}/apTvUtQuicklookSpot5.img ) - -#----------- DEMConvert TESTS ---------------- - - - #----------- ConcatenateImages TESTS ---------------- otb_test_application(NAME apTvUtConcatenateImages APP ConcatenateImages diff --git a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx index 6d00a5e411f90a1b247bb7928ce84228f53e0f08..e17020ba963d566d4ad168fcdc1be92d87fa3e4e 100644 --- a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx +++ b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx @@ -56,9 +56,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("Conversion"); - AddDocTag("Miscellaneous"); - AddDocTag("KMZ"); - AddDocTag("Export"); + AddDocTag(Tags::Vector); AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); @@ -138,4 +136,3 @@ private: } OTB_APPLICATION_EXPORT(otb::Wrapper::KmzExport) - diff --git a/Modules/Applications/AppMathParser/app/otbBandMath.cxx b/Modules/Applications/AppMathParser/app/otbBandMath.cxx index 2503d924eb04d348d1d5062e87195466ce0f1608..50fd803aa2ba80cf2302d8e376f115824fc09a32 100644 --- a/Modules/Applications/AppMathParser/app/otbBandMath.cxx +++ b/Modules/Applications/AppMathParser/app/otbBandMath.cxx @@ -94,7 +94,7 @@ private: SetDocLimitations( "None" ); SetDocAuthors( "OTB-Team" ); SetDocSeeAlso("[1] http://beltoforion.de/article.php?a=muparser"); - AddDocTag( "Miscellaneous" ); + AddDocTag(Tags::Manip); AddParameter( ParameterType_InputImageList, "il", "Input image-list" ); SetParameterDescription( diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 1d87d0c3270ef98fb50e7fc2a066342615fa62ab..7352a2d73c7707cca23ff44e87d0d6dc4d89176a 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -205,7 +205,7 @@ private: SetDocAuthors( "OTB-Team" ); SetDocSeeAlso("[1] http://articles.beltoforion.de/article.php?a=muparserx\n" "[2] BandMath"); - AddDocTag( "Miscellaneous" ); + AddDocTag(Tags::Manip); AddParameter( ParameterType_InputImageList, "il", "Input image-list" ); SetParameterDescription( "il", "Image-list to perform computation on." ); diff --git a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx index 095da8b17f0c1a4bbce2b64ad4dcdb82fe816eea..388a96d55ae98537ddfc1933d39f4f87acf65278 100644 --- a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx +++ b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx @@ -71,6 +71,9 @@ AddDocTag("Statistics"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to compute the features on."); +AddParameter(ParameterType_OutputImage, "out", "Feature Output Image"); +SetParameterDescription("out", "Output image containing the local statistical moments."); + AddParameter(ParameterType_Int, "channel", "Selected Channel"); SetParameterDescription("channel", "The selected channel index"); SetDefaultParameterInt("channel", 1); @@ -83,9 +86,6 @@ SetParameterDescription("radius", "The computational window radius."); SetMinimumParameterIntValue("radius",1); SetDefaultParameterInt("radius",3); -AddParameter(ParameterType_OutputImage, "out", "Feature Output Image"); -SetParameterDescription("out", "Output image containing the local statistical moments."); - // Doc example parameter settings SetDocExampleParameterValue("in", "qb_RoadExtract.tif"); SetDocExampleParameterValue("channel", "1"); diff --git a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx index 3e3a0765facc654571e7a0c5d534d6b6f06264f4..02e5e60952da02c0afa0c0e8f2a14dcdf03e87ca 100644 --- a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx @@ -63,8 +63,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Miscellaneous"); - AddDocTag(Tags::Coordinates); + AddDocTag(Tags::Geometry); AddParameter(ParameterType_Float, "lat", "Latitude"); SetParameterDescription("lat", "Latitude value of desired point."); diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index 13481a950ce16699ebab60f976673bc9c5d9450d..757ad47487014bf871c50ffab2aa37f7a2391d78 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -101,6 +101,9 @@ private: AddParameter(ParameterType_InputImage, "inm", "The image to reproject"); SetParameterDescription("inm","The image to reproject into the geometry of the reference input."); + AddParameter(ParameterType_OutputImage, "out", "Output image"); + SetParameterDescription("out", "Output reprojected image."); + // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); @@ -115,9 +118,6 @@ private: SetDefaultParameterFloat("fv", 0.); MandatoryOff("fv"); - AddParameter(ParameterType_OutputImage, "out", "Output image"); - SetParameterDescription("out","Output reprojected image."); - // Superposition mode AddParameter(ParameterType_Choice,"mode", "Mode"); SetParameterDescription("mode", "Superimposition mode"); diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx index c6a4122b0bb8c9e36e0ad727bbe839c5566f7fa8..f11d6384eb813df4ddfb224e675f5f7e8948b3eb 100644 --- a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx +++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx @@ -232,28 +232,28 @@ private: AddDocTag(Tags::SAR); - AddParameter(ParameterType_InputImage, "inc", "Input : multi-band complex image"); + AddParameter(ParameterType_InputImage, "inc", "Input: multi-band complex image"); SetParameterDescription("inc", "Input : multi-band complex image"); MandatoryOff("inc"); - - AddParameter(ParameterType_InputImage, "inf", "Input : multi-band real image"); + + AddParameter(ParameterType_InputImage, "inf", "Input: multi-band real image"); SetParameterDescription("inf", "Input : multi-band real image"); MandatoryOff("inf"); - AddParameter(ParameterType_InputImage, "inhh", "Input : one-band complex image (HH)"); + AddParameter(ParameterType_InputImage, "inhh", "Input: one-band complex image (HH)"); SetParameterDescription("inhh", "Input : one-band complex image (HH)"); MandatoryOff("inhh"); - - AddParameter(ParameterType_InputImage, "inhv", "Input : one-band complex image (HV)"); + + AddParameter(ParameterType_InputImage, "inhv", "Input: one-band complex image (HV)"); SetParameterDescription("inhv", "Input : one-band complex image (HV)"); MandatoryOff("inhv"); - - AddParameter(ParameterType_InputImage, "invh", "Input : one-band complex image (VH)"); + + AddParameter(ParameterType_InputImage, "invh", "Input: one-band complex image (VH)"); SetParameterDescription("invh", "Input : one-band complex image (VH)"); MandatoryOff("invh"); - - AddParameter(ParameterType_InputImage, "invv", "Input : one-band complex image (VV)"); + + AddParameter(ParameterType_InputImage, "invv", "Input: one-band complex image (VV)"); SetParameterDescription("invv", "Input : one-band complex image (VV)"); MandatoryOff("invv"); diff --git a/Modules/Applications/AppSegmentation/app/CMakeLists.txt b/Modules/Applications/AppSegmentation/app/CMakeLists.txt index b6003d6cace04f209ae9d30ab53ee13a4ee9f500..0d3eb912ac5ec845ee4799cb8a1f70f33b29baad 100644 --- a/Modules/Applications/AppSegmentation/app/CMakeLists.txt +++ b/Modules/Applications/AppSegmentation/app/CMakeLists.txt @@ -57,3 +57,8 @@ otb_create_application( NAME LargeScaleMeanShift SOURCES otbLargeScaleMeanShift.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + +otb_create_application( + NAME SmallRegionsMerging + SOURCES otbSmallRegionsMerging.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES}) diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx index a0ee5f7b50d05f543079478b3784d63ddb8bea94..632e5dcbb33d519fa501f576da54e4c8e7e66baf 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx @@ -104,6 +104,7 @@ private: "[2] LSMSegmentation\n" "[3] LSMSVectorization"); AddDocTag(Tags::Segmentation); + AddDocTag(Tags::Deprecated); AddDocTag("LSMS"); AddParameter(ParameterType_InputImage, "in", "Input image"); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx index 34daa10b318d8186d203dd618b0a548753e6066d..c948d5d7164d3e3014af3918be8e2137a7fa0099 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx @@ -282,7 +282,7 @@ private: std::ostringstream sqloss; sqloss.str(""); sqloss<<"SELECT * FROM \""<<layername<<"\" ORDER BY label"; - otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str().c_str(), nullptr, nullptr); + otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str(), nullptr, nullptr); otb::ogr::Feature firstFeature = layerTmp.ogr().GetNextFeature(); //Geometry fusion diff --git a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx index 176ae2fe07778c5b3a75d2c2c5da1cc3961d3c49..9d11b930460ff5dd94f2503aa0234bc62161f842 100644 --- a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx @@ -86,7 +86,7 @@ private: ClearApplications(); AddApplication("MeanShiftSmoothing", "smoothing", "Smoothing step"); AddApplication("LSMSSegmentation", "segmentation", "Segmentation step"); - AddApplication("LSMSSmallRegionsMerging", "merging", "Small region merging step"); + AddApplication("SmallRegionsMerging", "merging", "Small region merging step"); AddApplication("LSMSVectorization", "vectorization", "Vectorization step"); ShareParameter("in","smoothing.in"); @@ -130,8 +130,6 @@ private: Connect("merging.ram","smoothing.ram"); Connect("vectorization.ram","smoothing.ram"); - Connect("merging.tilesizex","segmentation.tilesizex"); - Connect("merging.tilesizey","segmentation.tilesizey"); Connect("vectorization.tilesizex","segmentation.tilesizex"); Connect("vectorization.tilesizey","segmentation.tilesizey"); @@ -193,13 +191,13 @@ private: if (IsParameterEnabled("mode.vector.imfield") && HasValue("mode.vector.imfield")) { - GetInternalApplication("vectorization")->SetParameterString("in", - GetParameterString("mode.vector.imfield")); + GetInternalApplication("vectorization")->SetParameterInputImage("in", + GetParameterImage<ImageBaseType>("mode.vector.imfield")); } else { - GetInternalApplication("vectorization")->SetParameterString("in", - GetParameterString("in")); + GetInternalApplication("vectorization")->SetParameterInputImage("in", + GetParameterImage<ImageBaseType>("in")); } GetInternalApplication("vectorization")->SetParameterString("inseg", tmpFilenames[2]); @@ -211,7 +209,7 @@ private: } DisableParameter("mode.raster.out"); - if( IsParameterEnabled( "cleanup" ) ) + if( GetParameterInt( "cleanup" ) ) { otbAppLogINFO( <<"Final clean-up ..." ); for (unsigned int i=0 ; i<tmpFilenames.size() ; ++i) diff --git a/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e1b46e572ebc2d73d2fd92192b4ef81140815f18 --- /dev/null +++ b/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbWrapperApplication.h" +#include "otbWrapperApplicationFactory.h" + +#include "otbStreamingStatisticsMapFromLabelImageFilter.h" +#include "otbLabelImageSmallRegionMergingFilter.h" +#include "itkChangeLabelImageFilter.h" + +#include "otbStopwatch.h" + +namespace otb +{ +namespace Wrapper +{ +class SmallRegionsMerging : public Application +{ +public: + typedef SmallRegionsMerging Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef FloatVectorImageType ImageType; + typedef ImageType::InternalPixelType ImagePixelType; + typedef UInt32ImageType LabelImageType; + typedef LabelImageType::InternalPixelType LabelImagePixelType; + + typedef otb::StreamingStatisticsMapFromLabelImageFilter + <ImageType, LabelImageType> StatisticsMapFromLabelImageFilterType; + + typedef otb::LabelImageSmallRegionMergingFilter<LabelImageType> + LabelImageSmallRegionMergingFilterType; + + typedef itk::ChangeLabelImageFilter<LabelImageType,LabelImageType> + ChangeLabelImageFilterType; + + itkNewMacro(Self); + itkTypeMacro(Merging, otb::Application); + +private: + ChangeLabelImageFilterType::Pointer m_ChangeLabelFilter; + + void DoInit() override + { + SetName("SmallRegionsMerging"); + SetDescription("This application merges small regions of a segmentation " + "result."); + + SetDocName("Small Region Merging"); + SetDocLongDescription("Given a segmentation result and the original image," + " it will merge segments whose size in pixels is" + " lower than minsize parameter with the adjacent" + " segments with the adjacent segment with closest" + " radiometry and acceptable size. \n\n" + "Small segments will be processed by increasing size:" + " first all segments for which area is equal to 1" + " pixel will be merged with adjacent segments, then" + " all segments of area equal to 2 pixels will be" + " processed, until segments of area minsize."); + + SetDocLimitations( "None") ; + + SetDocAuthors("OTB-Team"); + SetDocSeeAlso("Segmentation"); + AddDocTag(Tags::Segmentation); + + AddParameter(ParameterType_InputImage, "in", "Input image"); + SetParameterDescription( "in", "The input image, containing initial" + " spectral signatures corresponding to the segmented image (inseg)." ); + AddParameter(ParameterType_InputImage, "inseg", "Segmented image"); + SetParameterDescription( "inseg", "Segmented image where each pixel value" + " is the unique integer label of the segment it belongs to." ); + + AddParameter(ParameterType_OutputImage, "out", "Output Image"); + SetParameterDescription( "out", "The output image. The output image is the" + " segmented image where the minimal segments have been merged." ); + SetDefaultOutputPixelType("out",ImagePixelType_uint32); + + AddParameter(ParameterType_Int, "minsize", "Minimum Segment Size"); + SetParameterDescription("minsize", "Minimum Segment Size. If, after the " + " segmentation, a segment is of size strictly lower than this criterion," + " the segment is merged with the segment that has the closest sepctral" + " signature."); + + SetDefaultParameterInt("minsize", 50); + SetMinimumParameterIntValue("minsize", 1); + MandatoryOff("minsize"); + + AddRAMParameter(); + + // Doc example parameter settings + SetDocExampleParameterValue("in","smooth.tif"); + SetDocExampleParameterValue("inseg","segmentation.tif"); + SetDocExampleParameterValue("out","merged.tif"); + SetDocExampleParameterValue("minsize","50"); + + SetOfficialDocLink(); + } + + void DoUpdateParameters() override + { + } + + void DoExecute() override + { + // Start Timer for the application + auto Timer = Stopwatch::StartNew(); + + unsigned int minSize = GetParameterInt("minsize"); + + //Acquisition of the input image dimensions + ImageType::Pointer imageIn = GetParameterImage("in"); + + LabelImageType::Pointer labelIn = GetParameterUInt32Image("inseg"); + + // Compute statistics for each segment + auto labelStatsFilter = StatisticsMapFromLabelImageFilterType::New(); + labelStatsFilter->SetInput(imageIn); + labelStatsFilter->SetInputLabelImage(labelIn); + AddProcess(labelStatsFilter->GetStreamer() , "Computing stats on input" + " image ..."); + labelStatsFilter->Update(); + + // Convert Map to Unordered map + + auto labelPopulationMap = labelStatsFilter->GetLabelPopulationMap(); + std::unordered_map< unsigned int,double> labelPopulation; + for (auto population : labelPopulationMap) + { + labelPopulation[population.first]=population.second; + } + auto meanValueMap = labelStatsFilter->GetMeanValueMap(); + std::unordered_map< unsigned int, itk::VariableLengthVector<double> > + meanValues; + for (const auto & mean : meanValueMap) + { + meanValues[mean.first] = mean.second; + } + + // Compute the LUT from the original label image to the merged output + // label image. + auto regionMergingFilter = LabelImageSmallRegionMergingFilterType::New(); + regionMergingFilter->SetInputLabelImage( labelIn ); + regionMergingFilter->SetLabelPopulation( labelPopulation ); + regionMergingFilter->SetLabelStatistic( meanValues ); + regionMergingFilter->SetMinSize( minSize); + + AddProcess(regionMergingFilter, "Computing LUT ..."); + regionMergingFilter->Update(); + + // Relabelling using the LUT + auto changeLabelFilter = ChangeLabelImageFilterType::New(); + changeLabelFilter->SetInput(labelIn); + + const auto & LUT = regionMergingFilter->GetLUT(); + + for (auto const & label : LUT) + { + if (label.first != label.second) + { + changeLabelFilter->SetChange(label.first, label.second); + } + } + SetParameterOutputImage("out", changeLabelFilter->GetOutput()); + RegisterPipeline(); + + Timer.Stop(); + otbAppLogINFO( "Total elapsed time: "<< + float(Timer.GetElapsedMilliseconds())/1000 <<" seconds."); + + } + +}; +} +} + +OTB_APPLICATION_EXPORT(otb::Wrapper::SmallRegionsMerging) + + diff --git a/Modules/Applications/AppSegmentation/test/CMakeLists.txt b/Modules/Applications/AppSegmentation/test/CMakeLists.txt index e04c3bbc1e328924e605ab1fd77fce88dcf800dc..d62fd6c7e8dd7f3178e6c876d677dcea58cb42d4 100644 --- a/Modules/Applications/AppSegmentation/test/CMakeLists.txt +++ b/Modules/Applications/AppSegmentation/test/CMakeLists.txt @@ -250,6 +250,20 @@ otb_test_application(NAME apTvLSMS3SmallRegionsMerging set_property(TEST apTvLSMS3SmallRegionsMerging PROPERTY DEPENDS apTvLSMS2Segmentation) +#----------- SmallRegionsMerging TESTS ---------------- +otb_test_application(NAME apTvSmallRegionsMerging + APP SmallRegionsMerging + OPTIONS -in ${TEMP}/apTvLSMS1_filtered_range.tif + -inseg ${TEMP}/apTvLSMS2_Segmentation.tif + -out ${TEMP}/apTvSmallMerged.tif uint32 + -minsize 10 + VALID --compare-image ${NOTOL} + ${BASELINE}/apTvSmallMerged.tif + ${TEMP}/apTvSmallMerged.tif + ) + +set_property(TEST apTvSmallRegionsMerging PROPERTY DEPENDS apTvLSMS2Segmentation) + #----------- LSMSVectorization TESTS ---------------- otb_test_application(NAME apTvLSMS4Vectorization_SmallMerged APP LSMSVectorization @@ -308,3 +322,4 @@ otb_test_application(NAME apTvSeLargeScaleMeanShiftTest ${BASELINE_FILES}/apTvSeLargeScaleMeanShiftTestOut.shp ${TEMP}/apTvSeLargeScaleMeanShiftTestOut.shp ) + diff --git a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx index 64bf6ca0e4fc62c24b6c200dde2eb2b72b29ddf9..360b8d53104cc4a2f3af2ce295de8e67cad8ff15 100644 --- a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx +++ b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx @@ -111,7 +111,6 @@ public: <VectorImageType, FieldImageType, VLVToFixedArrayType> CastFilterType; typedef StreamingWarpImageFilter <FloatVectorImageType, FloatVectorImageType, FieldImageType> WarpFilterType; - typedef otb::ImageFileReader<VectorImageType> InternalReaderType; private: void DoInit() override @@ -130,7 +129,8 @@ private: "X and Y offsets, as well as the metric value. A sub-pixel accuracy can " "be expected. The input images should have the same size and same " "physical space."); - SetDocLimitations("None"); + SetDocLimitations("If the 'warp' option is activated, the pipeline will be " + "executed twice."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); @@ -262,6 +262,8 @@ private: SetDocExampleParameterValue("ery", "2"); SetDocExampleParameterValue("mrx", "3"); SetDocExampleParameterValue("mry", "3"); + SetDocExampleParameterValue("w", "StereoMoving.png"); + SetDocExampleParameterValue("wo", "StereoMoving_FineRegistered.png"); SetOfficialDocLink(); } @@ -473,19 +475,30 @@ private: SetParameterOutputImage<VectorImageType>("out", m_Il2vi->GetOutput()); + if (HasValue("w") && !HasValue("wo")) + { + otbAppLogWARNING("You should set a filename for the warped image"); + } + + if (!HasValue("w") && HasValue("wo")) + { + // in this case, the pipeline cannot be resolved : the output image (wo) + // won't be computed and a segfault can occur. + otbAppLogFATAL("w option has not been set : the ouput image cannot be produced." + "Stop execution because the pipeline cannot be resolved"); + + } + // If an image to warp has been given if (HasValue("w") && HasValue("wo")) { - otbAppLogINFO("Doing warping : ON"); - - m_outputReader = InternalReaderType::New(); - m_outputReader->SetFileName(GetParameterString("out")); - + otbAppLogINFO("Output image will be warped"); + otbAppLogWARNING("Warping will need to execute the pipeline twice"); m_ExtractROIFilter = ExtractROIFilterType::New(); m_ExtractROIFilter->SetChannel(1); m_ExtractROIFilter->SetChannel(2); - m_ExtractROIFilter->SetInput(m_outputReader->GetOutput()); - + m_ExtractROIFilter->SetInput(m_Il2vi->GetOutput()); + m_Cast = CastFilterType::New(); m_Cast->SetInput(m_ExtractROIFilter->GetOutput()); @@ -501,10 +514,7 @@ private: SetParameterOutputImage("wo", m_Warp->GetOutput()); } - else - { - otbAppLogINFO("Doing warping : OFF"); - } + } @@ -525,7 +535,6 @@ private: IL2VIFilterType::Pointer m_Il2vi; - InternalReaderType::Pointer m_outputReader; ExtractROIFilterType::Pointer m_ExtractROIFilter; CastFilterType::Pointer m_Cast; WarpFilterType::Pointer m_Warp; diff --git a/Modules/Applications/AppStereo/test/CMakeLists.txt b/Modules/Applications/AppStereo/test/CMakeLists.txt index b613727a50c276d168d9a88bb05d0074486000aa..f7a3e9c8458fa53beb630eb1eaca77472f7980ce 100644 --- a/Modules/Applications/AppStereo/test/CMakeLists.txt +++ b/Modules/Applications/AppStereo/test/CMakeLists.txt @@ -113,6 +113,30 @@ otb_test_application(NAME apTvDmFineRegistrationTest ${TEMP}/apTvDmFineRegistrationTest.tif ) +# test warping option +otb_test_application(NAME apTvDmFineRegistrationWithWarpingTest + APP FineRegistration + OPTIONS -ref ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif + -sec ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_centered_rigid.tif + -out ${TEMP}/apTvDmFineRegistrationWarpingTest.tif + -erx 5 + -ery 5 + -mrx 3 + -mry 3 + -ssrx 8 + -ssry 8 + -spa 0.1 + -cva 0.01 + -cox -2 + -vmlt 0.999 + -w ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_centered_rigid.tif + -wo ${TEMP}/apTvDmFineRegistrationWarpedOutput.tif + VALID --compare-image ${EPSILON_10} + ${BASELINE}/apTvDmFineRegistrationWithWarpingTest.tif + ${TEMP}/apTvDmFineRegistrationWarpedOutput.tif + + ) + #----------- GeneratePlyFile TESTS ---------------- diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx index 4c0b30ae6e11e01f744a51d04c51cf46e76aa907..ce741c94d66b71df0c327b0c3e9fccead967c67f 100644 --- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx +++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx @@ -66,7 +66,7 @@ private: SetDescription("Rasterize a vector dataset."); SetDocName("Rasterization"); - SetDocLongDescription("This application allows reprojecting and rasterize a vector dataset. The grid of the rasterized output can be set by using a reference image, or by setting all parmeters (origin, size, spacing) by hand. In the latter case, at least the spacing (ground sampling distance) is needed (other parameters are computed automatically). The rasterized output can also be in a different projection reference system than the input dataset.\n There are two rasterize mode available in the application. The first is the binary mode: it allows rendering all pixels belonging to a geometry of the input dataset in the foreground color, while rendering the other in background color. The second one allows rendering pixels belonging to a geometry woth respect to an attribute of this geometry. The field of the attribute to render can be set by the user. In the second mode, the background value is still used for unassociated pixels."); + SetDocLongDescription("This application allows reprojecting and rasterize a vector dataset. The grid of the rasterized output can be set by using a reference image, or by setting all parmeters (origin, size, spacing) by hand. In the latter case, at least the spacing (ground sampling distance) is needed (other parameters are computed automatically). The rasterized output can also be in a different projection reference system than the input dataset.\n There are two rasterize mode available in the application. The first is the binary mode: it allows rendering all pixels belonging to a geometry of the input dataset in the foreground color, while rendering the other in background color. The second one allows rendering pixels belonging to a geometry with respect to an attribute of this geometry. The field of the attribute to render can be set by the user. In the second mode, the background value is still used for unassociated pixels."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("For now, support of input dataset with multiple layers having different projection reference system is limited."); diff --git a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx index 389b0f0cf0c19e09f5d3eb2473568eb0fb47e2f7..d3a58b43fabf1c33364b54c2a1dd6cc6423a8427 100644 --- a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx @@ -72,9 +72,7 @@ private: SetDocSeeAlso("[1] TrainImagesClassifier \n" "[2] http://www.openstreetmap.fr/"); - AddDocTag("Miscellaneous"); - AddDocTag(Tags::Meta); - AddDocTag(Tags::Vector); + AddDocTag(Tags::Vector); AddParameter(ParameterType_OutputVectorData, "out", "Output vector data"); SetParameterDescription("out", "Vector data file to store downloaded features"); @@ -224,4 +222,3 @@ private: } OTB_APPLICATION_EXPORT(otb::Wrapper::OSMDownloader) - diff --git a/Modules/Core/Common/test/otbStopwatchTest.cxx b/Modules/Core/Common/test/otbStopwatchTest.cxx index c271f004d219f279b0b7b5bf9bb27478e86e8424..10c4de3cd6ad14760c956a5e87077afc81793516 100644 --- a/Modules/Core/Common/test/otbStopwatchTest.cxx +++ b/Modules/Core/Common/test/otbStopwatchTest.cxx @@ -20,18 +20,17 @@ #include <cassert> +#include <chrono> #include <iostream> #include <cstdlib> - -#if 0 -#include <unistd.h> - -#include "itkTimeProbe.h" -#endif +#include <thread> #include "itkMacro.h" + #include "otbStopwatch.h" +using namespace std::chrono_literals; + int otbStopwatchTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::Stopwatch sw; @@ -51,42 +50,21 @@ int otbStopwatchTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) assert( sw.IsRunning() ); sw.Stop(); -#if 0 // We have no portable sleep() and otbThreads is not linked here sw.Start(); - usleep(500 * 1000); + std::this_thread::sleep_for(500ms); sw.Stop(); assert( sw.GetElapsedMilliseconds() > 450 && sw.GetElapsedMilliseconds() < 550 ); sw.Start(); - usleep(500 * 1000); + std::this_thread::sleep_for(500ms); sw.Stop(); assert( sw.GetElapsedMilliseconds() > 900 && sw.GetElapsedMilliseconds() < 1100 ); sw.Restart(); - usleep(500 * 1000); + std::this_thread::sleep_for(500ms); sw.Stop(); assert( sw.GetElapsedMilliseconds() > 450 && sw.GetElapsedMilliseconds() < 550 ); - const int iterations = 100000; - sw.Restart(); - for (int i = 0; i < iterations; i++) - { - itk::TimeProbe chrono; - chrono.Start(); - chrono.Stop(); - } - std::cerr << "itk::TimeProbe time: " << sw.GetElapsedMilliseconds() << std::endl; - - sw.Restart(); - for (int i = 0; i < iterations; i++) - { - auto chrono = otb::Stopwatch::StartNew(); - chrono.Stop(); - } - std::cerr << "otb::Stopwatch time: " << sw.GetElapsedMilliseconds() << std::endl; - - #endif - return EXIT_SUCCESS; } diff --git a/Modules/Core/ImageBase/include/otbVectorImage.hxx b/Modules/Core/ImageBase/include/otbVectorImage.hxx index d40402b8fe292530a16790363f70a179ecb90217..692f5d3480ccf77df20ee38795dc518118a0b180 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.hxx +++ b/Modules/Core/ImageBase/include/otbVectorImage.hxx @@ -42,10 +42,9 @@ std::string VectorImage<TPixel, VImageDimension>::GetProjectionRef(void) const } template <class TPixel, unsigned int VImageDimension> -void -VectorImage<TPixel, VImageDimension>::SetProjectionRef(const std::string& kwl) -{ - itk::EncapsulateMetaData<std::string>(this->GetMetaDataDictionary(),MetaDataKey::ProjectionRefKey,kwl); +void VectorImage<TPixel, VImageDimension>::SetProjectionRef(const std::string& kwl) +{ + itk::EncapsulateMetaData<std::string>(this->GetMetaDataDictionary(), MetaDataKey::ProjectionRefKey, kwl); } @@ -116,130 +115,111 @@ double VectorImage<TPixel, VImageDimension>::GetGCPZ(unsigned int GCPnum) const } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::VectorType -VectorImage<TPixel, VImageDimension>::GetGeoTransform(void) const +typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetGeoTransform(void) const { return (this->GetMetaDataInterface()->GetGeoTransform()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::VectorType -VectorImage<TPixel, VImageDimension>::GetUpperLeftCorner(void) const +typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetUpperLeftCorner(void) const { return (this->GetMetaDataInterface()->GetUpperLeftCorner()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::VectorType -VectorImage<TPixel, VImageDimension>::GetUpperRightCorner(void) const +typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetUpperRightCorner(void) const { return (this->GetMetaDataInterface()->GetUpperRightCorner()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::VectorType -VectorImage<TPixel, VImageDimension>::GetLowerLeftCorner(void) const +typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetLowerLeftCorner(void) const { return (this->GetMetaDataInterface()->GetLowerLeftCorner()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::VectorType -VectorImage<TPixel, VImageDimension>::GetLowerRightCorner(void) const +typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetLowerRightCorner(void) const { return (this->GetMetaDataInterface()->GetLowerRightCorner()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::SpacingType -VectorImage<TPixel, VImageDimension>::GetSignedSpacing() const +typename VectorImage<TPixel, VImageDimension>::SpacingType VectorImage<TPixel, VImageDimension>::GetSignedSpacing() const { auto spacing = this->GetSpacing(); - for ( unsigned int i = 0; i < VImageDimension; ++i ) - { - if (this->m_Direction[i][i] < 0 ) - spacing[i] = - spacing[i]; - } + for (unsigned int i = 0; i < VImageDimension; ++i) + { + if (this->m_Direction[i][i] < 0) + spacing[i] = -spacing[i]; + } return spacing; } template <class TPixel, unsigned int VImageDimension> -void VectorImage<TPixel, VImageDimension> -::SetSignedSpacing( SpacingType spacing) +void VectorImage<TPixel, VImageDimension>::SetSignedSpacing(SpacingType spacing) { - for ( unsigned int i = 0; i < VImageDimension; i++ ) + for (unsigned int i = 0; i < VImageDimension; i++) + { + if (spacing[i] < 0.0) { - if ( spacing[i] < 0.0 ) + if (this->m_Direction[i][i] > 0) { - if ( this->m_Direction[i][i] > 0 ) + for (unsigned j = 0; j < VImageDimension; ++j) { - for ( unsigned j = 0; j < VImageDimension; ++j ) - { - this->m_Direction[j][i] = - this->m_Direction[j][i]; - } + this->m_Direction[j][i] = -this->m_Direction[j][i]; } - spacing[i] = - spacing[i]; } + spacing[i] = -spacing[i]; } + } this->SetSpacing(spacing); this->ComputeIndexToPhysicalPointMatrices(); this->Modified(); } template <class TPixel, unsigned int VImageDimension> -void VectorImage<TPixel, VImageDimension> -::SetSignedSpacing( double spacing[ VImageDimension ]) +void VectorImage<TPixel, VImageDimension>::SetSignedSpacing(double spacing[VImageDimension]) { SpacingType s(spacing); this->SetSignedSpacing(s); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType -VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) +typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) { ImageKeywordlist kwl; - itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), - MetaDataKey::OSSIMKeywordlistKey, - kwl); - return kwl; + itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl); + return kwl; } template <class TPixel, unsigned int VImageDimension> -const typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType -VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) const +const typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) const { ImageKeywordlist kwl; - itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), - MetaDataKey::OSSIMKeywordlistKey, - kwl); - return kwl; + itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl); + return kwl; } template <class TPixel, unsigned int VImageDimension> -void -VectorImage<TPixel,VImageDimension>::SetImageKeywordList(const ImageKeywordlistType& kwl) +void VectorImage<TPixel, VImageDimension>::SetImageKeywordList(const ImageKeywordlistType& kwl) { - itk::EncapsulateMetaData<ImageKeywordlistType>(this->GetMetaDataDictionary(),MetaDataKey::OSSIMKeywordlistKey,kwl); + itk::EncapsulateMetaData<ImageKeywordlistType>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl); } template <class TPixel, unsigned int VImageDimension> -void -VectorImage<TPixel, VImageDimension> -::CopyInformation(const itk::DataObject * data) +void VectorImage<TPixel, VImageDimension>::CopyInformation(const itk::DataObject* data) { Superclass::CopyInformation(data); this->itk::Object::SetMetaDataDictionary(data->GetMetaDataDictionary()); } template <class TPixel, unsigned int VImageDimension> -typename VectorImage<TPixel, VImageDimension>::ImageMetadataInterfacePointerType -VectorImage<TPixel, VImageDimension> -::GetMetaDataInterface() const +typename VectorImage<TPixel, VImageDimension>::ImageMetadataInterfacePointerType VectorImage<TPixel, VImageDimension>::GetMetaDataInterface() const { if (m_ImageMetadataInterface.IsNull()) m_ImageMetadataInterface = ImageMetadataInterfaceFactory::CreateIMI(this->GetMetaDataDictionary()); @@ -247,8 +227,7 @@ VectorImage<TPixel, VImageDimension> } template <class TPixel, unsigned int VImageDimension> -void -VectorImage<TPixel, VImageDimension>::PrintSelf(std::ostream& os, itk::Indent indent) const +void VectorImage<TPixel, VImageDimension>::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); this->GetMetaDataInterface()->PrintMetadata(os, indent, this->GetMetaDataDictionary()); diff --git a/Modules/Core/ImageBase/test/CMakeLists.txt b/Modules/Core/ImageBase/test/CMakeLists.txt index b2ac501075ef0e5e3488aa02d722a56af9168154..4e1896b536bbbf6e149d29f06e37783b755e2fce 100644 --- a/Modules/Core/ImageBase/test/CMakeLists.txt +++ b/Modules/Core/ImageBase/test/CMakeLists.txt @@ -133,11 +133,11 @@ otb_add_test(NAME coTvMultiChannelROI_RGB2RGB_PNG COMMAND otbImageBaseTestDriver -channels 1 2 3 ) otb_add_test(NAME coTvMultiChannelROI_5c_BSQ COMMAND otbImageBaseTestDriver - --compare-image ${NOTOL} ${BASELINE}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.hdr - ${TEMP}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.hdr + --compare-image ${NOTOL} ${BASELINE}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.tif + ${TEMP}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.tif otbMultiChannelExtractROI ${INPUTDATA}/poupees.hdr - ${TEMP}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.hdr + ${TEMP}/coMultiChannelExtractROI_RGB_ENVI_poupees_303_2_134_330_channels_12321.tif -startX 303 -startY 2 -sizeX 134 -sizeY 330 -channels 1 2 3 2 1 ) otb_add_test(NAME coTvMultiChannelROI_RGB2NG_PNG1 COMMAND otbImageBaseTestDriver @@ -204,8 +204,8 @@ otb_add_test(NAME coTvExtractROITestMetaData_HDR COMMAND otbImageBaseTestDriver --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 - ${TEMP}/coTvExtractROITestMetaData2.hdr + ${TEMP}/coTvExtractROITestMetaData1.tif + ${TEMP}/coTvExtractROITestMetaData2.tif ${TEMP}/coTvExtractROITestMetaData1_hdr.txt ${TEMP}/coTvExtractROITestMetaData2_hdr.txt ) @@ -698,7 +698,7 @@ otb_add_test(NAME ioTvMultiChannelROI_JPEG2000_2_TIF_res3_2 COMMAND otbImageBa otb_add_test(NAME ioTvMultiMonoChannelROI_RADARSAT2ENVI COMMAND otbImageBaseTestDriver otbMultiToMonoChannelExtractROI -ushort LARGEINPUT{RADARSAT1/GOMA/SCENE01/} - -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr + -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.tif -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 @@ -706,11 +706,11 @@ if(OTB_DATA_USE_LARGEINPUT) # --- RADARSAT (GDAL) dir name --- otb_add_test(NAME ioTvMultiMonoChannelROI_RADARSAT_ENVI2ENVI COMMAND otbImageBaseTestDriver # THOMAS (provisoire) : Images OK mais erreur au DIFF ITK !!! - # --compare-image ${EPSILON_9} ${BASELINE}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr - # ${TEMP}/ioMultiMonoChannelROI_RADARSAT_ENVI2ENVI_2559_3591_337_280_2.hdr + # --compare-image ${EPSILON_9} ${BASELINE}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.tif + # ${TEMP}/ioMultiMonoChannelROI_RADARSAT_ENVI2ENVI_2559_3591_337_280_2.tif otbMultiToMonoChannelExtractROI - -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.hdr - -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT_ENVI2ENVI_2559_3591_337_280_2.hdr + -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT2ENVI_2559_3591_337_280.tif + -ushort ${TEMP}/ioMultiMonoChannelROI_RADARSAT_ENVI2ENVI_2559_3591_337_280_2.tif -startX 0 -startY 0 -sizeX ParseHdfSubsetName337 -sizeY 280 ) set_tests_properties(ioTvMultiMonoChannelROI_RADARSAT_ENVI2ENVI PROPERTIES DEPENDS ioTvMultiMonoChannelROI_RADARSAT2ENVI) diff --git a/Modules/Core/PointSet/include/otbRandomPointSetSource.h b/Modules/Core/PointSet/include/otbRandomPointSetSource.h index 4659e73fadf8c2b3b2eb9c2c6f4f43cb7ef52123..bf337f49c391433e346dacb3473628990921004a 100644 --- a/Modules/Core/PointSet/include/otbRandomPointSetSource.h +++ b/Modules/Core/PointSet/include/otbRandomPointSetSource.h @@ -56,10 +56,10 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(RandomPointSetSource, PointSetSource) + itkTypeMacro(RandomPointSetSource, PointSetSource); /** Some convenient typedefs. */ typedef itk::DataObject::Pointer DataObjectPointer; @@ -72,13 +72,13 @@ public: typedef GeneratorType::Pointer GeneratorPointerType; typedef GeneratorType::IntegerType SeedType; - itkSetMacro(NumberOfPoints, unsigned int) - itkGetMacro(NumberOfPoints, unsigned int) + itkSetMacro(NumberOfPoints, unsigned int); + itkGetMacro(NumberOfPoints, unsigned int); - itkSetMacro(MinPoint, PointType) - itkGetMacro(MinPoint, PointType) - itkSetMacro(MaxPoint, PointType) - itkGetMacro(MaxPoint, PointType) + itkSetMacro(MinPoint, PointType); + itkGetMacro(MinPoint, PointType); + itkSetMacro(MaxPoint, PointType); + itkGetMacro(MaxPoint, PointType); void SetSeed(SeedType seed) { diff --git a/Modules/Core/Transform/include/otbTransform.h b/Modules/Core/Transform/include/otbTransform.h index e015b8e23c2975ad7b1ffe93a06dfc2ef6d33f56..bfb76af294a5d89ea24161e8bcbe63c1e7107844 100644 --- a/Modules/Core/Transform/include/otbTransform.h +++ b/Modules/Core/Transform/include/otbTransform.h @@ -107,7 +107,7 @@ public: { return OutputVectorType(); } /** Method to transform a vnl_vector. */ - virtual OutputVnlVectorType TransforVector(const InputVnlVectorType &) const + OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override { return OutputVnlVectorType(); } using Superclass::TransformCovariantVector; diff --git a/Modules/Core/Transform/test/CMakeLists.txt b/Modules/Core/Transform/test/CMakeLists.txt index 58aa22bd30e551b5be61fa4da44aec87057f8bf3..b79876631a61d18631eaad0129417c6e1b679043 100644 --- a/Modules/Core/Transform/test/CMakeLists.txt +++ b/Modules/Core/Transform/test/CMakeLists.txt @@ -92,11 +92,11 @@ otb_add_test(NAME prTvTestCreateProjectionWithOSSIM_Toulouse COMMAND otbTransfor ) otb_add_test(NAME bfTvLogPolarTransformResample COMMAND otbTransformTestDriver - --compare-image ${EPSILON_7} ${BASELINE}/bfLogPolarTransformResampleOutput.hdr - ${TEMP}/bfLogPolarTransformResampleOutput.hdr + --compare-image ${EPSILON_7} ${BASELINE}/bfLogPolarTransformResampleOutput.tif + ${TEMP}/bfLogPolarTransformResampleOutput.tif otbLogPolarTransformResample ${INPUTDATA}/circle.hdr - ${TEMP}/bfLogPolarTransformResampleOutput.hdr + ${TEMP}/bfLogPolarTransformResampleOutput.tif ) otb_add_test(NAME bfTvLogPolarTransform COMMAND otbTransformTestDriver @@ -169,11 +169,11 @@ otb_add_test(NAME bfTvInverseLogPolarTransform COMMAND otbTransformTestDriver 6 0 0 10 20 45 60 3.14 3.14 1 0 0 1 ) otb_add_test(NAME bfTvInverseLogPolarTransformResample COMMAND otbTransformTestDriver - --compare-image ${NOTOL} ${BASELINE}/bfInverseLogPolarTransformResampleOutput.hdr - ${TEMP}/bfInverseLogPolarTransformResampleOutput.hdr + --compare-image ${NOTOL} ${BASELINE}/bfInverseLogPolarTransformResampleOutput.tif + ${TEMP}/bfInverseLogPolarTransformResampleOutput.tif otbInverseLogPolarTransformResample - ${BASELINE}/bfLogPolarTransformResampleOutput.hdr - ${TEMP}/bfInverseLogPolarTransformResampleOutput.hdr + ${BASELINE}/bfLogPolarTransformResampleOutput.tif + ${TEMP}/bfInverseLogPolarTransformResampleOutput.tif ) otb_add_test(NAME bfTvStreamingResampleImageFilterWithAffineTransform COMMAND otbTransformTestDriver otbStreamingResampleImageFilterWithAffineTransform diff --git a/Modules/Detection/RoadExtraction/test/CMakeLists.txt b/Modules/Detection/RoadExtraction/test/CMakeLists.txt index c33f442a42837be77675eee3eee58c389dff8d57..cbc3d301b8c90035239c558e275a29b6b9320c44 100644 --- a/Modules/Detection/RoadExtraction/test/CMakeLists.txt +++ b/Modules/Detection/RoadExtraction/test/CMakeLists.txt @@ -59,12 +59,12 @@ otb_add_test(NAME feTvLikelihoodPathListFilter COMMAND otbRoadExtractionTestDriv otb_add_test(NAME feTvRemoveWrongDirectionFilter COMMAND otbRoadExtractionTestDriver --compare-image ${EPSILON_8} - ${BASELINE}/feTvRemoveWrongDirectionOutput.hdr - ${TEMP}/feTvRemoveWrongDirectionOutput.hdr + ${BASELINE}/feTvRemoveWrongDirectionOutput.tif + ${TEMP}/feTvRemoveWrongDirectionOutput.tif otbRemoveWrongDirectionFilter ${INPUTDATA}/InputForRoadDetection_IsolatedRem.hdr ${INPUTDATA}/InputForRoadDetectionScalarProductDir.hdr - ${TEMP}/feTvRemoveWrongDirectionOutput.hdr + ${TEMP}/feTvRemoveWrongDirectionOutput.tif ) otb_add_test(NAME feTvSimplifyPathListFilter COMMAND otbRoadExtractionTestDriver @@ -89,21 +89,21 @@ otb_add_test(NAME feTvAlignMV2ITK COMMAND otbRoadExtractionTestDriver otb_add_test(NAME feTvNonMaxRemovalByDirectionFilter COMMAND otbRoadExtractionTestDriver --compare-image ${EPSILON_8} - ${BASELINE}/feTvNonMaxRemovalByDirectionOutput.hdr - ${TEMP}/feTvNonMaxRemovalByDirectionOutput.hdr + ${BASELINE}/feTvNonMaxRemovalByDirectionOutput.tif + ${TEMP}/feTvNonMaxRemovalByDirectionOutput.tif otbNonMaxRemovalByDirectionFilter ${INPUTDATA}/InputForRoadDetection_WrongRem.hdr ${INPUTDATA}/InputForRoadDetectionScalarProductDir.hdr - ${TEMP}/feTvNonMaxRemovalByDirectionOutput.hdr + ${TEMP}/feTvNonMaxRemovalByDirectionOutput.tif ) otb_add_test(NAME feTvRoadExtractionFilter COMMAND otbRoadExtractionTestDriver --compare-image ${EPSILON_8} - ${BASELINE}/feTvOutputRoadDetection.hdr - ${TEMP}/feTvOutputRoadDetection.hdr + ${BASELINE}/feTvOutputRoadDetection.tif + ${TEMP}/feTvOutputRoadDetection.tif otbRoadExtractionFilter ${INPUTDATA}/qb_RoadExtract.img.hdr - ${TEMP}/feTvOutputRoadDetection.hdr + ${TEMP}/feTvOutputRoadDetection.tif 337 557 432 859 # ReferencePixel 1.0 # Alpha 0.00005 # AmplitudeThreshold @@ -154,12 +154,12 @@ otb_add_test(NAME feTvParallelLinePathListFilter COMMAND otbRoadExtractionTestDr otb_add_test(NAME feTvRemoveIsolatedByDirectionFilter COMMAND otbRoadExtractionTestDriver --compare-image ${EPSILON_8} - ${BASELINE}/feTvRemoveIsolatedByDirectionOutput.hdr - ${TEMP}/feTvRemoveIsolatedByDirectionOutput.hdr + ${BASELINE}/feTvRemoveIsolatedByDirectionOutput.tif + ${TEMP}/feTvRemoveIsolatedByDirectionOutput.tif otbRemoveIsolatedByDirectionFilter ${INPUTDATA}/InputForRoadDetectionScalarProductMod.hdr ${INPUTDATA}/InputForRoadDetectionScalarProductDir.hdr - ${TEMP}/feTvRemoveIsolatedByDirectionOutput.hdr + ${TEMP}/feTvRemoveIsolatedByDirectionOutput.tif ) otb_add_test(NAME fzTvVectorDataToRoadDescriptionFilter COMMAND otbRoadExtractionTestDriver @@ -183,14 +183,14 @@ otb_add_test(NAME feTpSimplifyManyPathListFilter COMMAND otbRoadExtractionTestDr otb_add_test(NAME feTvNeighborhoodScalarProductFilter COMMAND otbRoadExtractionTestDriver --compare-n-images ${EPSILON_6} 2 - ${BASELINE}/feTvNeighborhoodScalarProductModulusOutput.hdr - ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.hdr - ${BASELINE}/feTvNeighborhoodScalarProductDirectionOutput.hdr - ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.hdr + ${BASELINE}/feTvNeighborhoodScalarProductModulusOutput.tif + ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.tif + ${BASELINE}/feTvNeighborhoodScalarProductDirectionOutput.tif + ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.tif otbNeighborhoodScalarProductFilter ${INPUTDATA}/InputForRoadDetection_SpectralAngle.hdr - ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.hdr - ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.hdr + ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.tif + ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.tif 1.0 ) diff --git a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h index a747383b911b32a6b814433e64008b30d78a395d..751d64d0df188c7643509e7a24a661b5150601fe 100644 --- a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h +++ b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h @@ -27,7 +27,7 @@ #include "itkBinaryErodeImageFilter.h" #include "itkBinaryDilateImageFilter.h" #include "itkBinaryBallStructuringElement.h" - +#include "itkMacro.h" #include "itkSobelEdgeDetectionImageFilter.h" #include "otbEdgeDetectorImageFilter.h" #include "otbEdgeDensityImageFilter.h" diff --git a/Modules/Feature/Corner/test/CMakeLists.txt b/Modules/Feature/Corner/test/CMakeLists.txt index b2e4394d997857131cdc1d9168ea014a44a422cf..bdbe07435d0534e8273a1c7fd4e3af1aac89d73d 100644 --- a/Modules/Feature/Corner/test/CMakeLists.txt +++ b/Modules/Feature/Corner/test/CMakeLists.txt @@ -81,7 +81,7 @@ otb_add_test(NAME feTvHarrisPoupee COMMAND otbCornerTestDriver otb_add_test(NAME feTvHarrisProduceImageToValidHarrisToPointSet COMMAND otbCornerTestDriver otbHarrisImage ${INPUTDATA}/small_points.hdr - ${TEMP}/small_points_harris.hdr + ${TEMP}/small_points_harris.tif 1.0 1.0 1.0) otb_add_test(NAME feTvHarrisImageQB COMMAND otbCornerTestDriver diff --git a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.hxx b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.hxx index 816a4aaa90a295dc63dd92f1461d44337f1e6c2f..3ea3409f7ea9d4dd75fb7fb9a6857bd78f43ddf4 100644 --- a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.hxx +++ b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.hxx @@ -24,7 +24,7 @@ #include "otbSiftFastImageFilter.h" -#include "siftfast.h" +#include "otb_siftfast.h" #include "itkContinuousIndex.h" #include "itkImageRegionConstIterator.h" diff --git a/Modules/Feature/Descriptors/test/CMakeLists.txt b/Modules/Feature/Descriptors/test/CMakeLists.txt index fd88b492462d80b1c872f472443dfafe04c3d4e9..6e567acdbd65ef630ede16c6e1131dd2989398e1 100644 --- a/Modules/Feature/Descriptors/test/CMakeLists.txt +++ b/Modules/Feature/Descriptors/test/CMakeLists.txt @@ -171,14 +171,14 @@ otb_add_test(NAME feTvImageToSIFTKeyPointSetFilterQB_SuburbOutputAscii COMMAND o otb_add_test(NAME feTvForwardFourierMellinImageFilter COMMAND otbDescriptorsTestDriver --compare-n-images ${EPSILON_6} 2 - ${BASELINE}/feForwardFourierMellinImageFilterReal.hdr - ${TEMP}/feForwardFourierMellinImageFilterReal.hdr - ${BASELINE}/feForwardFourierMellinImageFilterImag.hdr - ${TEMP}/feForwardFourierMellinImageFilterImag.hdr + ${BASELINE}/feForwardFourierMellinImageFilterReal.tif + ${TEMP}/feForwardFourierMellinImageFilterReal.tif + ${BASELINE}/feForwardFourierMellinImageFilterImag.tif + ${TEMP}/feForwardFourierMellinImageFilterImag.tif otbFourierMellinImageFilter ${INPUTDATA}/circle.hdr - ${TEMP}/feForwardFourierMellinImageFilterReal.hdr - ${TEMP}/feForwardFourierMellinImageFilterImag.hdr) + ${TEMP}/feForwardFourierMellinImageFilterReal.tif + ${TEMP}/feForwardFourierMellinImageFilterImag.tif) otb_add_test(NAME feTvImageToHessianDeterminantImageFilter COMMAND otbDescriptorsTestDriver --compare-image ${EPSILON_3} diff --git a/Modules/Feature/Edge/test/CMakeLists.txt b/Modules/Feature/Edge/test/CMakeLists.txt index 58725177180eb05ec902252798e76ca802450301..3389a4e9f54541400e2cefd7cbac18207521e4b9 100644 --- a/Modules/Feature/Edge/test/CMakeLists.txt +++ b/Modules/Feature/Edge/test/CMakeLists.txt @@ -72,11 +72,11 @@ otb_add_test(NAME bfTvHorizontalSobelVectorImageFilter COMMAND otbEdgeTestDriver -out ${TEMP}/bfTvHorizontalSobelVectorImageFilter.tif) otb_add_test(NAME feTvAsymmetricFusionOfLineDetector COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreAsymmetricFusion_amst_2_3.hdr - ${TEMP}/feFiltreAsymmetricFusion_amst_2_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreAsymmetricFusion_amst_2_3.tif + ${TEMP}/feFiltreAsymmetricFusion_amst_2_3.tif otbAsymmetricFusionOfLineDetector ${INPUTDATA}/amst.png - ${TEMP}/feFiltreAsymmetricFusion_amst_2_3.hdr + ${TEMP}/feFiltreAsymmetricFusion_amst_2_3.tif 2 3) @@ -97,20 +97,20 @@ otb_add_test(NAME feTvLocalHoughDraw2 COMMAND otbEdgeTestDriver 20 20 1) otb_add_test(NAME feTvLocalHoughDraw COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLocalHoughDraw_ImageLine_20_20_2.hdr - ${TEMP}/feFiltreLocalHoughDraw_ImageLine_20_20_2.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLocalHoughDraw_ImageLine_20_20_2.tif + ${TEMP}/feFiltreLocalHoughDraw_ImageLine_20_20_2.tif otbLocalHoughDraw ${INPUTDATA}/ImageLine.bsq.hdr - ${TEMP}/feFiltreLocalHoughDraw_ImageLine_20_20_2.hdr + ${TEMP}/feFiltreLocalHoughDraw_ImageLine_20_20_2.tif 20 20 1) otb_add_test(NAME feTvAssociativeSymmetricalSum COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreASS_amst_2_3.hdr - ${TEMP}/feFiltreASS_amst_2_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreASS_amst_2_3.tif + ${TEMP}/feFiltreASS_amst_2_3.tif otbAssociativeSymmetricalSum - ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.hdr - ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.hdr - ${TEMP}/feFiltreASS_amst_2_3.hdr) + ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.tif + ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.tif + ${TEMP}/feFiltreASS_amst_2_3.tif) @@ -136,11 +136,11 @@ otb_add_test(NAME bfTvEdgeDensityImageFilter COMMAND otbEdgeTestDriver ) otb_add_test(NAME feTvLineCorrelation COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLineCorrelation_amst_2_3.hdr - ${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLineCorrelation_amst_2_3.tif + ${TEMP}/feFiltreLineCorrelation_amst_2_3.tif otbLineCorrelationDetector ${INPUTDATA}/amst.png - ${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr + ${TEMP}/feFiltreLineCorrelation_amst_2_3.tif 2 3) otb_add_test(NAME bfTvSobelVectorImageFilter COMMAND otbEdgeTestDriver @@ -160,12 +160,12 @@ otb_add_test(NAME feTvHoughTransform2DLinesImage COMMAND otbEdgeTestDriver ) otb_add_test(NAME feTvPixelSuppressionByDirection COMMAND otbEdgeTestDriver - --compare-image ${NOTOL} ${BASELINE}/feFiltrePixelSuppr_ImageLine_2_0_3.hdr - ${TEMP}/feFiltrePixelSuppr_ImageLine_2_0_3.hdr + --compare-image ${NOTOL} ${BASELINE}/feFiltrePixelSuppr_ImageLine_2_0_3.tif + ${TEMP}/feFiltrePixelSuppr_ImageLine_2_0_3.tif otbPixelSuppressionByDirection ${INPUTDATA}/ImageLine_hd.bsq.hdr ${INPUTDATA}/ImageLineDir.bsq.hdr - ${TEMP}/feFiltrePixelSuppr_ImageLine_2_0_3.hdr + ${TEMP}/feFiltrePixelSuppr_ImageLine_2_0_3.tif 2 0.3) @@ -179,28 +179,28 @@ otb_add_test(NAME feTvLocalHough COMMAND otbEdgeTestDriver 20 20 1) otb_add_test(NAME feTvExtractSegments COMMAND otbEdgeTestDriver - --compare-image ${NOTOL} ${BASELINE}/feFiltreExtractSegments_ImageLine.hdr - ${TEMP}/feFiltreExtractSegments_ImageLine.hdr + --compare-image ${NOTOL} ${BASELINE}/feFiltreExtractSegments_ImageLine.tif + ${TEMP}/feFiltreExtractSegments_ImageLine.tif otbExtractSegments ${INPUTDATA}/ImageLine_hd.bsq.hdr ${INPUTDATA}/ImageLineDir.bsq.hdr - ${TEMP}/feFiltreExtractSegments_ImageLine.hdr + ${TEMP}/feFiltreExtractSegments_ImageLine.tif 10 0.3 10 10 3 10 0.5) otb_add_test(NAME feTvLineRatio COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLineRatio_amst_2_3.hdr - ${TEMP}/feFiltreLineRatio_amst_2_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreLineRatio_amst_2_3.tif + ${TEMP}/feFiltreLineRatio_amst_2_3.tif otbLineRatioDetector ${INPUTDATA}/amst.png - ${TEMP}/feFiltreLineRatio_amst_2_3.hdr + ${TEMP}/feFiltreLineRatio_amst_2_3.tif 2 3) otb_add_test(NAME feTvTouziDir COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreTouzi_amst_dir_3.hdr - ${TEMP}/feFiltreTouzi_amst_dir_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreTouzi_amst_dir_3.tif + ${TEMP}/feFiltreTouzi_amst_dir_3.tif otbTouziEdgeDetectorDirection ${INPUTDATA}/amst.png - ${TEMP}/feFiltreTouzi_amst_dir_3.hdr + ${TEMP}/feFiltreTouzi_amst_dir_3.tif 3) otb_add_test(NAME bfTvVerticalSobelVectorImageFilter COMMAND otbEdgeTestDriver @@ -232,35 +232,35 @@ otb_add_test(NAME feTvStreamingLineSegmentDetector1000 COMMAND otbEdgeTestDriver ) otb_add_test(NAME feTvTouzi COMMAND otbEdgeTestDriver - --compare-image ${EPSILON_8} ${BASELINE}/feFiltreTouzi_amst_3.hdr - ${TEMP}/feFiltreTouzi_amst_3.hdr + --compare-image ${EPSILON_8} ${BASELINE}/feFiltreTouzi_amst_3.tif + ${TEMP}/feFiltreTouzi_amst_3.tif otbTouziEdgeDetector ${INPUTDATA}/amst.png - ${TEMP}/feFiltreTouzi_amst_3.hdr + ${TEMP}/feFiltreTouzi_amst_3.tif 3) otb_add_test(NAME feTvLineRatioLinearAmsters1 COMMAND otbEdgeTestDriver --compare-n-images ${EPSILON_8} 2 - ${BASELINE}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr - ${BASELINE}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr + ${BASELINE}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.tif + ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.tif + ${BASELINE}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.tif + ${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.tif otbLineRatioDetectorLinear ${INPUTDATA}/amst_ers1.ima.extrait.419_187_70_66.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr + ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.tif + ${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.tif 1 2) otb_add_test(NAME feTvLineRatioLinear COMMAND otbEdgeTestDriver --compare-n-images ${EPSILON_8} 2 - ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr - ${BASELINE}/feFiltreLineRatioLinear_amst_dir_2_3.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr + ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.tif + ${TEMP}/feFiltreLineRatioLinear_amst_2_3.tif + ${BASELINE}/feFiltreLineRatioLinear_amst_dir_2_3.tif + ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.tif otbLineRatioDetectorLinear ${INPUTDATA}/amst.png - ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr - ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr + ${TEMP}/feFiltreLineRatioLinear_amst_2_3.tif + ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.tif 2 3) otb_add_test(NAME feTvLineSegmentDetector COMMAND otbEdgeTestDriver @@ -274,14 +274,14 @@ otb_add_test(NAME feTvLineSegmentDetector COMMAND otbEdgeTestDriver otb_add_test(NAME feTvLineCorrelationLinear COMMAND otbEdgeTestDriver --compare-n-images ${EPSILON_8} 2 - ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.hdr - ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr - ${BASELINE}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr - ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr + ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.tif + ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.tif + ${BASELINE}/feFiltreLineCorrelationLinear_amst_dir_2_3.tif + ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.tif otbLineCorrelationDetectorLinear ${INPUTDATA}/amst.png - ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr - ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr + ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.tif + ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.tif 2 3) otb_add_test(NAME feTvFillGapsFilter COMMAND otbEdgeTestDriver diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h index e03748dc54cbe3539f34ae37b549127755ec418b..ab44998126a053778b72cd2f443b44b6b6327760 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h @@ -22,8 +22,8 @@ #define otbScalarImageToAdvancedTexturesFilter_h #include "otbGreyLevelCooccurrenceIndexedList.h" +#include "itkMacro.h" #include "itkImageToImageFilter.h" - namespace otb { /** diff --git a/Modules/Filtering/ChangeDetection/test/CMakeLists.txt b/Modules/Filtering/ChangeDetection/test/CMakeLists.txt index f978339e6ebaa8de247f45eb6131c642765671d4..248aba75a87a1d75f017be2f1cdcb54c1e07e664 100644 --- a/Modules/Filtering/ChangeDetection/test/CMakeLists.txt +++ b/Modules/Filtering/ChangeDetection/test/CMakeLists.txt @@ -53,13 +53,13 @@ otb_add_test(NAME cdTvJHMI COMMAND otbChangeDetectionTestDriver otb_add_test(NAME cdTvMeanDiff COMMAND otbChangeDetectionTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/cdMeanDiffImage.hdr - ${TEMP}/cdMeanDiffImage.hdr + ${BASELINE}/cdMeanDiffImage.tif + ${TEMP}/cdMeanDiffImage.tif otbMeanDiffChangeDetectionTest ${INPUTDATA}/GomaAvant.png ${INPUTDATA}/GomaApres.png 2 - ${TEMP}/cdMeanDiffImage.hdr + ${TEMP}/cdMeanDiffImage.tif ) otb_add_test(NAME cdTvMultivariateAlterationDetectorImageFilterSameNbBands COMMAND otbChangeDetectionTestDriver @@ -113,22 +113,22 @@ otb_add_test(NAME cdTvCorrel COMMAND otbChangeDetectionTestDriver otb_add_test(NAME cdTvKullbackLeiblerProfileImageFilter COMMAND otbChangeDetectionTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/cdTVKullbackLeiblerProfileImageFilterOutput.hdr - ${TEMP}/cdTVKullbackLeiblerProfileImageFilterOutput.hdr + ${BASELINE}/cdTVKullbackLeiblerProfileImageFilterOutput.tif + ${TEMP}/cdTVKullbackLeiblerProfileImageFilterOutput.tif otbKullbackLeiblerProfileImageFilter ${INPUTDATA}/GomaAvant.png ${INPUTDATA}/GomaApres.png - ${TEMP}/cdTVKullbackLeiblerProfileImageFilterOutput.hdr + ${TEMP}/cdTVKullbackLeiblerProfileImageFilterOutput.tif 5 51) otb_add_test(NAME cdTvKullbackLeiblerDistanceImageFilter COMMAND otbChangeDetectionTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/cdTVKullbackLeiblerDistanceImageFilterOutput.hdr - ${TEMP}/cdTVKullbackLeiblerDistanceImageFilterOutput.hdr + ${BASELINE}/cdTVKullbackLeiblerDistanceImageFilterOutput.tif + ${TEMP}/cdTVKullbackLeiblerDistanceImageFilterOutput.tif otbKullbackLeiblerDistanceImageFilter ${INPUTDATA}/GomaAvant.png ${INPUTDATA}/GomaApres.png - ${TEMP}/cdTVKullbackLeiblerDistanceImageFilterOutput.hdr + ${TEMP}/cdTVKullbackLeiblerDistanceImageFilterOutput.tif 35) otb_add_test(NAME cdTvMeanRatio COMMAND otbChangeDetectionTestDriver diff --git a/Modules/Filtering/Contrast/include/otbApplyGainFilter.h b/Modules/Filtering/Contrast/include/otbApplyGainFilter.h index 89deb206440993133ec4b36a099e8026b5418185..08e02f74ac67c31646aae5cbb8c368bf1b5cf7ec 100644 --- a/Modules/Filtering/Contrast/include/otbApplyGainFilter.h +++ b/Modules/Filtering/Contrast/include/otbApplyGainFilter.h @@ -59,35 +59,35 @@ public : typedef typename OutputImageType::RegionType OutputImageRegionType; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(ComputeHistoFilter, ImageToImageFilter) + itkTypeMacro(ComputeHistoFilter, ImageToImageFilter); /** Get/Set macro to get/set the nodata value */ - itkSetMacro(NoData, InputPixelType) - itkGetMacro(NoData, InputPixelType) + itkSetMacro(NoData, InputPixelType); + itkGetMacro(NoData, InputPixelType); /** Get/Set macro to get/set the nodata flag value */ - itkBooleanMacro(NoDataFlag) - itkGetMacro(NoDataFlag, bool) - itkSetMacro(NoDataFlag, bool) + itkBooleanMacro(NoDataFlag); + itkGetMacro(NoDataFlag, bool); + itkSetMacro(NoDataFlag, bool); /** Get/Set macro to get/set the ThumbSizeFromSpacing flag value */ - itkBooleanMacro(ThumbSizeFromSpacing) - itkGetMacro(ThumbSizeFromSpacing, bool) - itkSetMacro(ThumbSizeFromSpacing, bool) + itkBooleanMacro(ThumbSizeFromSpacing); + itkGetMacro(ThumbSizeFromSpacing, bool); + itkSetMacro(ThumbSizeFromSpacing, bool); /** Get/Set macro to get/set the thumbnail's size */ - itkSetMacro(ThumbSize, typename InputImageType::SizeType) - itkGetMacro(ThumbSize, typename InputImageType::SizeType) + itkSetMacro(ThumbSize, typename InputImageType::SizeType); + itkGetMacro(ThumbSize, typename InputImageType::SizeType); /** Get/Set macro to get/set the minimum value */ - itkSetMacro(Min, InputPixelType) - itkGetMacro(Min, InputPixelType) + itkSetMacro(Min, InputPixelType); + itkGetMacro(Min, InputPixelType); /** Get/Set macro to get/set the maximum value */ - itkSetMacro(Max, InputPixelType) - itkGetMacro(Max, InputPixelType) + itkSetMacro(Max, InputPixelType); + itkGetMacro(Max, InputPixelType); /** Set the input look up table*/ void SetInputLut( const LutType * lut) ; diff --git a/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.h b/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.h index d8fe0d2c66353d22bf1c5ee224479ec774acb8c5..2cff5480a98edf261fb5b66a6dbb1159d5efff36 100644 --- a/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.h +++ b/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.h @@ -78,12 +78,12 @@ public : typedef typename InputImageType::PixelType InputPixelType; typedef typename OutputImageType::RegionType OutputImageRegionType; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(CLHistogramEqualizationFilter, ImageToImageFilter) + itkTypeMacro(CLHistogramEqualizationFilter, ImageToImageFilter); - itkGetMacro(Min , InputPixelType) - // itkSetMacro(Min, InputPixelType) + itkGetMacro(Min , InputPixelType); + // itkSetMacro(Min, InputPixelType); void SetMin( InputPixelType min ) { m_HistoFilter->SetMin(min); @@ -92,8 +92,8 @@ public : m_Min = min; }; - itkGetMacro(Max , InputPixelType) - // itkSetMacro(Max, InputPixelType) + itkGetMacro(Max , InputPixelType); + // itkSetMacro(Max, InputPixelType); void SetMax( InputPixelType max ) { m_HistoFilter->SetMax(max); @@ -102,16 +102,16 @@ public : m_Max = max; }; - itkGetMacro(NbBin , unsigned long) - // itkSetMacro(NbBin, unsigned long) + itkGetMacro(NbBin , unsigned long); + // itkSetMacro(NbBin, unsigned long); void SetNbBin( unsigned long bin ) { m_HistoFilter->SetNbBin(bin); m_NbBin = bin; }; - itkGetMacro(ThumbSize , typename InputImageType::SizeType) - // itkSetMacro(ThumbSize, typename InputImageType::SizeType) + itkGetMacro(ThumbSize , typename InputImageType::SizeType); + // itkSetMacro(ThumbSize, typename InputImageType::SizeType); void SetThumbSize( typename InputImageType::SizeType size ) { m_HistoFilter->SetThumbSize(size); @@ -120,16 +120,16 @@ public : m_ThumbSize = size; }; - itkGetMacro(Threshold , double) - // itkSetMacro(Threshold, double) + itkGetMacro(Threshold , double); + // itkSetMacro(Threshold, double); void SetThreshold( double t ) { m_HistoFilter->SetThreshold(t); m_Threshold = t; }; - itkGetMacro(NoData , InputPixelType) - // itkSetMacro(NoData, InputPixelType) + itkGetMacro(NoData , InputPixelType); + // itkSetMacro(NoData, InputPixelType); void SetNoData( InputPixelType n ) { m_HistoFilter->SetNoData(n); @@ -138,8 +138,8 @@ public : } - itkGetMacro(NoDataFlag , bool) - // itkSetMacro(NoDataFlag, bool) + itkGetMacro(NoDataFlag , bool); + // itkSetMacro(NoDataFlag, bool); void SetNoDataFlag( bool flag ) { m_HistoFilter->SetNoDataFlag(flag); diff --git a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h index 0dd3c07c998d94661d98b83a88c534be9d6d9c56..d5df45e0212db055a76ecdb5d1d2561f7140ac9f 100644 --- a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h +++ b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h @@ -61,21 +61,21 @@ public: typedef typename OutputImageType::RegionType OutputImageRegionType; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(ComputeGainLutFilter, ImageToImageFilter) + itkTypeMacro(ComputeGainLutFilter, ImageToImageFilter); /** Get/Set macro to get/set the number of pixel by histogram */ - itkSetMacro(NbPixel, unsigned long) - itkGetMacro(NbPixel, unsigned long) + itkSetMacro(NbPixel, unsigned long); + itkGetMacro(NbPixel, unsigned long); /** Get/Set macro to get/set the minimum value */ - itkSetMacro(Min, double) - itkGetMacro(Min, double) + itkSetMacro(Min, double); + itkGetMacro(Min, double); /** Get/Set macro to get/set the maximum value */ - itkSetMacro(Max, double) - itkGetMacro(Max, double) + itkSetMacro(Max, double); + itkGetMacro(Max, double); protected: ComputeGainLutFilter() ; diff --git a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h index 5068cae0ab82336f90a67989ff4c58a7e22e9850..9a8bedca4684d8338b406031bc9ef2910349b897 100644 --- a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h +++ b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h @@ -60,39 +60,39 @@ public: typedef typename OutputImageType::RegionType OutputImageRegionType; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(ComputeHistoFilter, ImageToImageFilter) + itkTypeMacro(ComputeHistoFilter, ImageToImageFilter); /** Get/Set macro to get/set the number of bin. Default value is 256 */ - itkSetMacro(NbBin, unsigned int) - itkGetMacro(NbBin, unsigned int) + itkSetMacro(NbBin, unsigned int); + itkGetMacro(NbBin, unsigned int); /** Get/Set macro to get/set the minimum value */ - itkSetMacro(Min, InputPixelType) - itkGetMacro(Min, InputPixelType) + itkSetMacro(Min, InputPixelType); + itkGetMacro(Min, InputPixelType); /** Get/Set macro to get/set the maximum value */ - itkSetMacro(Max, InputPixelType) - itkGetMacro(Max, InputPixelType) + itkSetMacro(Max, InputPixelType); + itkGetMacro(Max, InputPixelType); /** Get/Set macro to get/set the nodata value */ - itkSetMacro(NoData, InputPixelType) - itkGetMacro(NoData, InputPixelType) + itkSetMacro(NoData, InputPixelType); + itkGetMacro(NoData, InputPixelType); /** Get/Set macro to get/set the nodata flag value */ - itkBooleanMacro(NoDataFlag) - itkGetMacro(NoDataFlag, bool) - itkSetMacro(NoDataFlag, bool) + itkBooleanMacro(NoDataFlag); + itkGetMacro(NoDataFlag, bool); + itkSetMacro(NoDataFlag, bool); /** Get/Set macro to get/set the thumbnail's size */ - itkSetMacro(ThumbSize, SizeType) - itkGetMacro(ThumbSize, SizeType) + itkSetMacro(ThumbSize, SizeType); + itkGetMacro(ThumbSize, SizeType); /** Get/Set macro to get/set the threshold parameter */ - itkSetMacro(Threshold , float) - itkGetMacro(Threshold , float) + itkSetMacro(Threshold , float); + itkGetMacro(Threshold , float); typename OutputImageType::Pointer GetHistoOutput(); diff --git a/Modules/Filtering/DimensionalityReduction/test/otbSparseWvltToAngleMapperListFilter.cxx b/Modules/Filtering/DimensionalityReduction/test/otbSparseWvltToAngleMapperListFilter.cxx index 961de094c3bbb96e36d7c85614931e065632c6da..ca112c92b8d37a79d9ba7db12bfbac1f6d418154 100644 --- a/Modules/Filtering/DimensionalityReduction/test/otbSparseWvltToAngleMapperListFilter.cxx +++ b/Modules/Filtering/DimensionalityReduction/test/otbSparseWvltToAngleMapperListFilter.cxx @@ -67,7 +67,6 @@ int otbSparseWvltToAngleMapperListFilterTest ( int argc, char * argv[] ) std::string inputImageName [ nbInputImages ]; for ( unsigned int i = 0; i < nbInputImages; i++ ) inputImageName[i] = parseResult->GetParameterString("--InputImages", i); - //const char * outputImageName = parseResult->GetParameterString("--OutputImages").c_str(); // Parameter (to be changed if necessary) const double threshold = parseResult->IsOptionPresent("--Threshold") ? parseResult->GetParameterDouble("--Threshold") : 10.; diff --git a/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h b/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h index 22085dd00f9b5da1e3962550d4788e99d7855640..0eb620fad6bd11a8d5add06c105b3c391db65be1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h @@ -56,10 +56,10 @@ public: typedef itk::SmartPointer< const Self > ConstPointer; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(InPlacePassFilter, InPlaceImageFilter) + itkTypeMacro(InPlacePassFilter, InPlaceImageFilter); protected: InPlacePassFilter() { diff --git a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt index adc522717529ad846c0ebfcc477d431321f2e43b..b464ed261465142a362ad6cb5ade993ef645ffa4 100644 --- a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt +++ b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt @@ -127,21 +127,21 @@ otb_add_test(NAME feTvSqrtSpectralAngleImageFilter COMMAND otbImageManipulationT otb_add_test(NAME bfTvStreamingShrinkImageFilterQBPAN COMMAND otbImageManipulationTestDriver --compare-image ${NOTOL} - ${BASELINE}/bfTvStreamingShrinkImageFilterQBPANOutput.hdr - ${TEMP}/bfTvStreamingShrinkImageFilterQBPANOutput.hdr + ${BASELINE}/bfTvStreamingShrinkImageFilterQBPANOutput.tif + ${TEMP}/bfTvStreamingShrinkImageFilterQBPANOutput.tif otbStreamingShrinkImageFilter LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} - ${TEMP}/bfTvStreamingShrinkImageFilterQBPANOutput.hdr + ${TEMP}/bfTvStreamingShrinkImageFilterQBPANOutput.tif 50 ) otb_add_test(NAME bfTvStreamingShrinkImageFilterQBMUL COMMAND otbImageManipulationTestDriver --compare-image ${NOTOL} - ${BASELINE}/bfTvStreamingShrinkImageFilterQBMULOutput.hdr - ${TEMP}/bfTvStreamingShrinkImageFilterQBMULOutput.hdr + ${BASELINE}/bfTvStreamingShrinkImageFilterQBMULOutput.tif + ${TEMP}/bfTvStreamingShrinkImageFilterQBMULOutput.tif otbStreamingShrinkImageFilter LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF} - ${TEMP}/bfTvStreamingShrinkImageFilterQBMULOutput.hdr + ${TEMP}/bfTvStreamingShrinkImageFilterQBMULOutput.tif 20 ) @@ -466,11 +466,11 @@ otb_add_test(NAME bfTvBoundingRegionCalculator COMMAND otbImageManipulationTestD otb_add_test(NAME bfTvPerBandVectorImageFilterWithSobelFilter COMMAND otbImageManipulationTestDriver --compare-image ${EPSILON_7} - ${BASELINE}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.hdr - ${TEMP}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.hdr + ${BASELINE}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.tif + ${TEMP}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.tif otbPerBandVectorImageFilterWithSobelFilter ${INPUTDATA}/poupees.png - ${TEMP}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.hdr + ${TEMP}/bfTvPerBandVectorImageFilterWithSobelFilterOutput.tif ) @@ -495,11 +495,11 @@ otb_add_test(NAME bfTvThresholdVectorImageFilterTest COMMAND otbImageManipulatio otb_add_test(NAME bfTvPerBandVectorImageFilterWithMeanFilter COMMAND otbImageManipulationTestDriver --compare-image ${EPSILON_7} - ${BASELINE}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.hdr - ${TEMP}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.hdr + ${BASELINE}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.tif + ${TEMP}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.tif otbPerBandVectorImageFilterWithMeanFilter ${INPUTDATA}/poupees.png - ${TEMP}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.hdr + ${TEMP}/bfTvPerBandVectorImageFilterWithMeanFilterOutput.tif ) otb_add_test(NAME bfTvAmplitudeFunctorTest COMMAND otbImageManipulationTestDriver @@ -526,12 +526,12 @@ otb_add_test(NAME bfTvClampImageFilterConversionTest COMMAND otbImageManipulatio otb_add_test(NAME coTvConcatenateVectorImageFilter COMMAND otbImageManipulationTestDriver --compare-image ${NOTOL} - ${BASELINE}/coConcatenateVectorImageFilterOutput1.hdr - ${TEMP}/coConcatenateVectorImageFilterOutput1.hdr + ${BASELINE}/coConcatenateVectorImageFilterOutput1.tif + ${TEMP}/coConcatenateVectorImageFilterOutput1.tif otbConcatenateVectorImageFilter ${INPUTDATA}/poupees.png ${INPUTDATA}/poupees.png - ${TEMP}/coConcatenateVectorImageFilterOutput1.hdr + ${TEMP}/coConcatenateVectorImageFilterOutput1.tif ) otb_add_test(NAME bfTvBinaryImageToDensityImageFilter COMMAND otbImageManipulationTestDriver @@ -547,18 +547,18 @@ otb_add_test(NAME bfTvBinaryImageToDensityImageFilter COMMAND otbImageManipulati otb_add_test(NAME bfTvSpectralAngleDistanceImageFilter COMMAND otbImageManipulationTestDriver --compare-image ${EPSILON_7} - ${BASELINE}/bfTvSpectralAngleDistanceOutput.hdr - ${TEMP}/bfTvSpectralAngleDistanceOutput.hdr + ${BASELINE}/bfTvSpectralAngleDistanceOutput.tif + ${TEMP}/bfTvSpectralAngleDistanceOutput.tif otbSpectralAngleDistanceImageFilter ${INPUTDATA}/qb_RoadExtract.img.hdr - ${TEMP}/bfTvSpectralAngleDistanceOutput.hdr + ${TEMP}/bfTvSpectralAngleDistanceOutput.tif 337 557 432 859 ) otb_add_test(NAME bfTvSpectralAngleDistanceImageFilterOneChannel COMMAND otbImageManipulationTestDriver otbSpectralAngleDistanceImageFilter ${INPUTDATA}/DeuxCercles.hdr - ${TEMP}/bfTvSpectralAngleDistanceOneChannelOutput.hdr + ${TEMP}/bfTvSpectralAngleDistanceOneChannelOutput.tif 100 ) set_property(TEST bfTvSpectralAngleDistanceImageFilterOneChannel PROPERTY WILL_FAIL true) diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h index bad5b738a9a2dbbd976a0f645fcb6a26ebb574c7..52b639eb2f7f17f0775df5953210128447d9c023 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h @@ -81,11 +81,11 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); ; /** Run-time type information (and related methods). */ - itkTypeMacro(MaskMuParserFilter, itk::ImageToImageFilter) + itkTypeMacro(MaskMuParserFilter, itk::ImageToImageFilter); ; /** Some convenient typedefs. */ diff --git a/Modules/Filtering/MorphologicalPyramid/test/CMakeLists.txt b/Modules/Filtering/MorphologicalPyramid/test/CMakeLists.txt index 560cbb52e8e7d9c3ccc3bc21bc3d429a300d173a..dbc5f7afb6fe545d1e7ad239e7ec323dc8c12b69 100644 --- a/Modules/Filtering/MorphologicalPyramid/test/CMakeLists.txt +++ b/Modules/Filtering/MorphologicalPyramid/test/CMakeLists.txt @@ -60,7 +60,7 @@ otb_add_test(NAME msTvMorphoPyrSegmentBright COMMAND otbMorphologicalPyramidTest ${BASELINE}/msPyrSegmenter_IKO_Halles_4_2_sf.tif ${TEMP}/msPyrSegmenter_IKO_Halles_4_2_sf.tif otbMorphologicalPyramidSegmenter - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/msPyrSegmenter_IKO_Halles_4_2_sf.tif 0 @@ -75,7 +75,7 @@ otb_add_test(NAME msTvMorphoPyrSegmentDark COMMAND otbMorphologicalPyramidTestDr ${BASELINE}/msPyrSegmenter_IKO_Halles_4_2_if.tif ${TEMP}/msPyrSegmenter_IKO_Halles_4_2_if.tif otbMorphologicalPyramidSegmenter - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.hdr + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/msPyrSegmenter_IKO_Halles_4_2_if.tif 1 @@ -97,30 +97,30 @@ otb_add_test(NAME msTvMorphoPyrSynthesisFilter COMMAND otbMorphologicalPyramidTe otb_add_test(NAME msTvMorphoPyrMRToMSConverter COMMAND otbMorphologicalPyramidTestDriver --compare-n-images ${EPSILON_8} 3 - ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr - ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_if_full.hdr - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.hdr - ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_an_full.hdr - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_an_full.hdr + ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_sf_full.tif + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.tif + ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_if_full.tif + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.tif + ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_an_full.tif + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_an_full.tif otbMorphologicalPyramidMRToMSConverter ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.hdr - ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_an_full.hdr + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.tif + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_if_full.tif + ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_an_full.tif 4 2.0) otb_add_test(NAME msTvMorphoPyrResampler COMMAND otbMorphologicalPyramidTestDriver --compare-n-images ${EPSILON_8} 2 - ${BASELINE}/msPyrResampler_IKO_LesHalles_256_2.hdr - ${TEMP}/msPyrResampler_IKO_LesHalles_256_2.hdr - ${BASELINE}/msPyrResampler_IKO_LesHalles_full.hdr - ${TEMP}/msPyrResampler_IKO_LesHalles_full.hdr + ${BASELINE}/msPyrResampler_IKO_LesHalles_256_2.tif + ${TEMP}/msPyrResampler_IKO_LesHalles_256_2.tif + ${BASELINE}/msPyrResampler_IKO_LesHalles_full.tif + ${TEMP}/msPyrResampler_IKO_LesHalles_full.tif otbMorphologicalPyramidResampler ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif - ${TEMP}/msPyrResampler_IKO_LesHalles_256_2.hdr - ${TEMP}/msPyrResampler_IKO_LesHalles_full.hdr + ${TEMP}/msPyrResampler_IKO_LesHalles_256_2.tif + ${TEMP}/msPyrResampler_IKO_LesHalles_full.tif 256 256 ) diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx index f6e71596833cc4f22c0b7c73dbf0d7c88cb7bf00..3a47ff168f4abe0520ab7dc39c4bd6423661edd4 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx @@ -275,7 +275,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> GenericRSTransformPointerType invTransform = GenericRSTransformType::New(); m_Transform->GetInverse(invTransform); - if(strcmp(map.c_str(),"UTM")== 0) + if(map == "UTM") { // Build the UTM transform : Need the zone & the hemisphere // For this we us the geographic coordinate of the input UL corner @@ -310,7 +310,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> CPLFree(utmRefC); OSRRelease(oSRS); } - else if(strcmp(map.c_str(),"WGS84")==0) + else if(map == "WGS84") { projectionRef = otb::GeoInformationConversion::ToWKT(4326); //WGS84 } diff --git a/Modules/Filtering/Projection/test/CMakeLists.txt b/Modules/Filtering/Projection/test/CMakeLists.txt index 76d7f0bb1f39d2317f3a8f84a17191b42a2aaed5..0df148140be007718ea36a1ca715d05cb83e0f12 100644 --- a/Modules/Filtering/Projection/test/CMakeLists.txt +++ b/Modules/Filtering/Projection/test/CMakeLists.txt @@ -412,10 +412,10 @@ otb_add_test(NAME prTvVectorDataTransformFilter COMMAND otbProjectionTestDriver ) otb_add_test(NAME prTvRationalTransformToDisplacementFieldSourceTest COMMAND otbProjectionTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/prTvRationalTransformToDisplacementFieldSourceTest.hdr - ${TEMP}/prTvRationalTransformToDisplacementFieldSourceTest.hdr + --compare-image ${EPSILON_9} ${BASELINE}/prTvRationalTransformToDisplacementFieldSourceTest.tif + ${TEMP}/prTvRationalTransformToDisplacementFieldSourceTest.tif otbRationalTransformToDisplacementFieldSourceTest - ${TEMP}/prTvRationalTransformToDisplacementFieldSourceTest.hdr + ${TEMP}/prTvRationalTransformToDisplacementFieldSourceTest.tif ) otb_add_test(NAME prTvVectorDataProjectionFilterFromMapToSensor COMMAND otbProjectionTestDriver diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h index 316bd2f93949b149711c8a8812f25aebb7fae96c..b7b8ae9db12e36fee93200e4f6305d6369ecaff6 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h @@ -159,7 +159,7 @@ public: typedef typename TImage::PixelType PixelType; typedef typename TImage::InternalPixelType InternalPixelType; - itkTypeMacro(FastImageRegionConstIterator, ImageRegionConstIterator) + itkTypeMacro(FastImageRegionConstIterator, ImageRegionConstIterator); ; FastImageRegionConstIterator() : @@ -468,8 +468,8 @@ public: typedef double RealType; /** Type macro */ - itkTypeMacro(MeanShiftSmoothingImageFilter, ImageToImageFilter) -; itkNewMacro(Self) + itkTypeMacro(MeanShiftSmoothingImageFilter, ImageToImageFilter); +; itkNewMacro(Self); ; /** Template parameters typedefs */ diff --git a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h index c71eb4e133c07d58fea196528668c9c17fede5f9..4d67d5d368c26d7c834f189cb406178d0ce4eb70 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h @@ -61,7 +61,7 @@ typedef Image32 image_32; namespace otb { -namespace mapnik_otb +namespace [[deprecated]] mapnik_otb { // this should be removed once mapnik support for version < 2.0 is dropped. // should be around 01/2013. diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h index 39787388eacc4b5e09e8c9b4e22acb72c3c23cd4..c750dc4436cec0613b185f7b0b7919e581de67d7 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h @@ -42,10 +42,12 @@ namespace otb * * \sa VectorDataToMapFilter * + * \deprecated + * * \ingroup OTBVectorDataRendering */ -class ITK_EXPORT VectorDataStyle : public itk::LightObject +class [[deprecated]] VectorDataStyle : public itk::LightObject { public: /** Standard class typedefs. */ diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h index 4bc29e139f69c66ecfaa025bcd31457c06a5be32..67d3a2e8204c0be74fbbd194dc53895ff829f31e 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h @@ -68,12 +68,13 @@ namespace otb * otb::Image< itk::RGBAPixel<InternalPixelType> >, * otb::Image< itk::RGBPixel<InternalPixelType> >. * - * - * \ingroup OTBVectorDataRendering + * \deprecated + * + * \ingroup OTBVectorDataRendering */ template <class TVectorData, class TImage> -class ITK_EXPORT VectorDataToMapFilter : public itk::ImageSource<TImage> +class [[deprecated]] VectorDataToMapFilter : public itk::ImageSource<TImage> { public: /** Standard class typedefs. */ diff --git a/Modules/Filtering/VectorDataRendering/otb-module.cmake b/Modules/Filtering/VectorDataRendering/otb-module.cmake index 4953d8191c7f2fd5b356abb6c76b3dcb8b7a512e..4251586660098e8e8d6753ffd33e99b55bc4d0ad 100644 --- a/Modules/Filtering/VectorDataRendering/otb-module.cmake +++ b/Modules/Filtering/VectorDataRendering/otb-module.cmake @@ -37,6 +37,8 @@ otb_module(OTBVectorDataRendering OTBVectorDataIO OTBImageBase + DEPRECATED + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h index c9c40db02fd165548957b1e1ccef4c06d2ce2456..6c4439962ec58a4eca66296dd6b4f9c7a3a8efea 100644 --- a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h +++ b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h @@ -17,7 +17,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #ifndef otbPlaceNameToLonLat_h #define otbPlaceNameToLonLat_h diff --git a/Modules/IO/Carto/include/otbWorldFile.h b/Modules/IO/Carto/include/otbWorldFile.h index 41ffaef2ae2c2ce7df5691d3db252d64bda63b02..934cdfcba3426ef03a0c05031702304ad147f05f 100644 --- a/Modules/IO/Carto/include/otbWorldFile.h +++ b/Modules/IO/Carto/include/otbWorldFile.h @@ -53,21 +53,21 @@ public: /** Method for creation through the object factory. */ itkNewMacro(Self); - itkGetMacro(LonOrigin, double) - itkSetMacro(LonOrigin, double) - itkGetMacro(LatOrigin, double) - itkSetMacro(LatOrigin, double) - itkGetMacro(LonSpacing, double) - itkSetMacro(LonSpacing, double) - itkGetMacro(LatSpacing, double) - itkSetMacro(LatSpacing, double) - itkGetMacro(LonRotation, double) - itkSetMacro(LonRotation, double) - itkGetMacro(LatRotation, double) - itkSetMacro(LatRotation, double) + itkGetMacro(LonOrigin, double); + itkSetMacro(LonOrigin, double); + itkGetMacro(LatOrigin, double); + itkSetMacro(LatOrigin, double); + itkGetMacro(LonSpacing, double); + itkSetMacro(LonSpacing, double); + itkGetMacro(LatSpacing, double); + itkSetMacro(LatSpacing, double); + itkGetMacro(LonRotation, double); + itkSetMacro(LonRotation, double); + itkGetMacro(LatRotation, double); + itkSetMacro(LatRotation, double); - itkGetStringMacro(ImageFilename) - itkSetStringMacro(ImageFilename) + itkGetStringMacro(ImageFilename); + itkSetStringMacro(ImageFilename); void Update(); diff --git a/Modules/IO/Carto/otb-module.cmake b/Modules/IO/Carto/otb-module.cmake index 05a65c228af7b16c0e5c244c74250e363c497d7d..1e2a5660635b7b80b09c3817d1c9a2f48e9cec64 100644 --- a/Modules/IO/Carto/otb-module.cmake +++ b/Modules/IO/Carto/otb-module.cmake @@ -43,7 +43,6 @@ ENABLE_SHARED TEST_DEPENDS OTBCommandLineParser - OTBOpenThreadsAdapters OTBTestKernel DESCRIPTION diff --git a/Modules/IO/Carto/src/CMakeLists.txt b/Modules/IO/Carto/src/CMakeLists.txt index e03f186976027a865d8127af2371b8e8f8672939..8388260db728e97a61c89eead4ac739f1d079e37 100644 --- a/Modules/IO/Carto/src/CMakeLists.txt +++ b/Modules/IO/Carto/src/CMakeLists.txt @@ -21,8 +21,8 @@ set(OTBCarto_SRC otbCoordinateToName.cxx otbOSMDataToVectorDataGenerator.cxx - otbPlaceNameToLonLat.cxx otbWorldFile.cxx + otbPlaceNameToLonLat.cxx ) add_library(OTBCarto ${OTBCarto_SRC}) @@ -37,7 +37,6 @@ target_link_libraries(OTBCarto ${OTBCurlAdapters_LIBRARIES} ${OTBVectorDataIO_LIBRARIES} ${OTBImageManipulation_LIBRARIES} - ) otb_module_target(OTBCarto) diff --git a/Modules/IO/Carto/test/otbCoordinateToNameTest.cxx b/Modules/IO/Carto/test/otbCoordinateToNameTest.cxx index 34f9ad4787ae9f8957eb6ba3401eff7c0cc058ed..448c435f6a28c3707d764d16632c7bfda0a1227b 100644 --- a/Modules/IO/Carto/test/otbCoordinateToNameTest.cxx +++ b/Modules/IO/Carto/test/otbCoordinateToNameTest.cxx @@ -21,11 +21,12 @@ #include <fstream> +#include <chrono> #include <cstdlib> +#include <thread> #include "otbCoordinateToName.h" #include "otbCurlHelperStub.h" -#include "otbThreads.h" int otbCoordinateToNameTest(int argc, char* argv[]) { @@ -50,9 +51,10 @@ int otbCoordinateToNameTest(int argc, char* argv[]) if ((argc > 4) && atoi(argv[4]) == 1) { + using namespace std::chrono_literals; conv->MultithreadOn(); conv->Evaluate(); - otb::Threads::Sleep(10000000); //Make sure that the web request has the time to complete + std::this_thread::sleep_for(10s); } else { diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx index 51d39776ffbad8841372ee678f37b6bcfeb54953..22cdc92cd695dbba7937858a4d994bc9ea0ceba5 100644 --- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx @@ -1548,6 +1548,15 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) geoTransform[2] = 0.; geoTransform[4] = 0.; dataset->SetGeoTransform(const_cast<double*>(geoTransform.GetDataPointer())); + + // Error if writing to a ENVI file with a positive Y spacing + if(driverShortName == "ENVI" && geoTransform[5] > 0.) + { + itkExceptionMacro( + << "Can not write to ENVI file format with a positive Y spacing (" + << m_FileName + <<")"); + } } /* -------------------------------------------------------------------- */ diff --git a/Modules/IO/IOONERA/src/otbONERAImageIO.cxx b/Modules/IO/IOONERA/src/otbONERAImageIO.cxx index 1400b49c272b8eeb92db34b8143be3ee8f79eccc..0940079a527b17afd0e0f21eaae14767b48b6872 100644 --- a/Modules/IO/IOONERA/src/otbONERAImageIO.cxx +++ b/Modules/IO/IOONERA/src/otbONERAImageIO.cxx @@ -539,7 +539,7 @@ void ONERAImageIO::InternalWriteImageInformation() } /*-------- This part deals with writing header information ------ */ - const std::string DataFileName = System::GetRootName(m_FileName.c_str()) + ".dat"; + const std::string DataFileName = System::GetRootName(m_FileName) + ".dat"; m_Headerfile << "# [fichier en-tete produit par les routines de otb (Orfeo ToolBox) ]" << std::endl; diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h index 867a347701bc7b4dfe4aff1c888403b6010c6db5..6e86d7609ee47537611d241bc4e382af6062d91a 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h @@ -44,14 +44,14 @@ enum TileMapAddressingStyle {GM = 0, OSM = 1, NEARMAP = 2, LOCAL = 3}; } /** \class TileMapImageIO - * + * \deprecated * \brief ImageIO object for reading and writing TileMap images * * * * \ingroup OTBIOTileMap */ -class OTBIOTileMap_EXPORT TileMapImageIO : public otb::ImageIOBase +class OTBIOTileMap_DEPRECATED_EXPORT TileMapImageIO : public otb::ImageIOBase { public: diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h index 658eefcd5eaf9b27b7a65f0dc1e4ae0c13d505cf..bd0c3e44e8ef2b461209483c83fd9bfacddef7cc 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h @@ -28,11 +28,12 @@ namespace otb { /** \class TileMapImageIOFactory + * \deprecated * \brief Creation of a TileMapImageIO object using object factory. * * \ingroup OTBIOTileMap */ -class OTBIOTileMap_EXPORT TileMapImageIOFactory : public itk::ObjectFactoryBase +class OTBIOTileMap_DEPRECATED_EXPORT TileMapImageIOFactory : public itk::ObjectFactoryBase { public: /** Standard class typedefs. */ diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h index 004a816a13ef76cf1b6d5ffe76d79cd263dd4017..03e2b36bff43ba0282af30a388a9c9103fd5b0a6 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h @@ -34,13 +34,14 @@ namespace otb { /** \class TileMapImageIOHelper + * \deprecated * \brief This class IO TileMapImage * * * \ingroup OTBIOTileMap */ -class OTBIOTileMap_EXPORT TileMapImageIOHelper: public itk::Object +class OTBIOTileMap_DEPRECATED_EXPORT TileMapImageIOHelper: public itk::Object { public: /** Standard class typedefs. */ diff --git a/Modules/IO/IOTileMap/otb-module.cmake b/Modules/IO/IOTileMap/otb-module.cmake index 281428906684d61f2591bbbba470d40ebfc28578..d08b994a7a1c694f64193d3d169f489faedd26a7 100644 --- a/Modules/IO/IOTileMap/otb-module.cmake +++ b/Modules/IO/IOTileMap/otb-module.cmake @@ -38,6 +38,8 @@ ENABLE_SHARED OTBTransform OTBImageManipulation + DEPRECATED + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.hxx b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.hxx index 147b83856810617f3596c5628703e12286f957e9..7b82b888512f631c813f613630746503a92e1858 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.hxx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.hxx @@ -101,7 +101,7 @@ StatisticsXMLFileReader<TMeasurementVector> unsigned int index = 0; for(unsigned int idx = 0; idx < m_MeasurementVectorContainer.size() ; ++idx) { - if(strcmp(m_MeasurementVectorContainer[idx].first.c_str(), statisticName) == 0 ) + if(m_MeasurementVectorContainer[idx].first == statisticName) { found = true; index = idx; diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.hxx b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.hxx index 332bf2fe57ced60bc9dadcd81d53714fa013a5cb..31dc266f95d61eb6aa7328b905cb1d7630c558b5 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.hxx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.hxx @@ -47,7 +47,7 @@ StatisticsXMLFileWriter<TMeasurementVector> // Check if the statistic name is already added for(unsigned int idx= 0; idx< m_MeasurementVectorContainer.size(); ++idx) { - if(strcmp(m_MeasurementVectorContainer[idx].first.c_str(), name) == 0 ) + if(m_MeasurementVectorContainer[idx].first == name) { itkExceptionMacro(<<"Token selected (" <<name<<") is already added to the XML file"); diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.h b/Modules/IO/ImageIO/include/otbImageFileReader.h index 9b6bfcf8f9368a8ea559b54014bbd00961bbc8ff..365d6b302aa2912854b869e80704c085d47792f6 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageFileReader.h @@ -147,10 +147,6 @@ public: virtual const char* GetFileName () const; - /** Get the resolution information from the file */ - bool GetResolutionsInfo( std::vector<unsigned int>& res, - std::vector<std::string>& desc); - /** Get the number of overviews available into the file specified * Returns: overview count, zero if none. */ unsigned int GetOverviewsCount(); diff --git a/Modules/IO/ImageIO/otb-module.cmake b/Modules/IO/ImageIO/otb-module.cmake index d592ba8b086549b5a132f64f0867282e9b7a4de8..7692218a57663cd19956628b787b34f827173a4d 100644 --- a/Modules/IO/ImageIO/otb-module.cmake +++ b/Modules/IO/ImageIO/otb-module.cmake @@ -33,13 +33,15 @@ otb_module(OTBImageIO OTBIOMSTAR OTBIOONERA OTBIORAD - OTBIOTileMap OTBITK OTBImageBase OTBOSSIMAdapters OTBObjectList OTBStreaming + OPTIONAL_DEPENDS + OTBIOTileMap #This module is deprecated + TEST_DEPENDS OTBStatistics OTBTestKernel diff --git a/Modules/IO/ImageIO/src/CMakeLists.txt b/Modules/IO/ImageIO/src/CMakeLists.txt index e604942a7cd4b8473e595bd457dfbdac05523938..e1e43c6579ecc595913b414efab2f8f6679e2b04 100644 --- a/Modules/IO/ImageIO/src/CMakeLists.txt +++ b/Modules/IO/ImageIO/src/CMakeLists.txt @@ -34,10 +34,11 @@ target_link_libraries(OTBImageIO ${OTBIOGDAL_LIBRARIES} ${OTBStreaming_LIBRARIES} ${OTBBoost_LIBRARIES} - ${OTBIOTileMap_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBExtendedFilename_LIBRARIES} ${OTBOSSIMAdapters_LIBRARIES} + #Deprecated modules + ${OTBIOTileMap_LIBRARIES} ) diff --git a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx index dd2248509579e286b1a452d3ebeff41d6a709d47..664fd51b85b2126f749296874d8c29998296c34e 100644 --- a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx +++ b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx @@ -33,7 +33,9 @@ #include "otbBSQImageIOFactory.h" #include "otbRADImageIOFactory.h" +#if OTB_USE_DEPRECATED #include "otbTileMapImageIOFactory.h" +#endif namespace otb { @@ -95,11 +97,12 @@ ImageIOFactory::RegisterBuiltInFactories() itk::ObjectFactoryBase::RegisterFactory(RADImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(BSQImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(LUMImageIOFactory::New()); - itk::ObjectFactoryBase::RegisterFactory(TileMapImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(GDALImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(ONERAImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(MSTARImageIOFactory::New()); - +#if OTB_USE_DEPRECATED + itk::ObjectFactoryBase::RegisterFactory(TileMapImageIOFactory::New()); +#endif firstTime = false; } } diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt index f6cbe8fb68c8d9689ed167a1346198265da57de9..d9c01a09d810355b0aff9405302cc69032845b27 100644 --- a/Modules/IO/ImageIO/test/CMakeLists.txt +++ b/Modules/IO/ImageIO/test/CMakeLists.txt @@ -59,7 +59,6 @@ otbImageFileReaderRADFloat.cxx otbVectorImageFileReaderWriterTest.cxx otbIntImageIOTest.cxx otbImageFileReaderONERA.cxx -otbImageFileReaderServerName.cxx otbPNGIndexedNbBandsTest.cxx otbImageFileReaderTest.cxx otbVectorImageFileWriterTestWithoutInput.cxx @@ -78,6 +77,10 @@ otbMultiImageFileWriterTest.cxx otbWriteGeomFile.cxx ) +if(OTB_USE_DEPRECATED) + set(OTBImageIOTests ${OTBImageIOTests} otbImageFileReaderServerName.cxx) +endif() + add_executable(otbImageIOTestDriver ${OTBImageIOTests}) target_link_libraries(otbImageIOTestDriver ${OTBImageIO-Test_LIBRARIES}) otb_module_target_label(otbImageIOTestDriver) @@ -97,14 +100,14 @@ otb_add_test(NAME ioTvImageFileWriterExtendedFileName_Box COMMAND otbImageIOTest otb_add_test(NAME ioTvONERAImageFileReaderComplex COMMAND otbImageIOTestDriver --compare-n-images ${EPSILON_9} 2 - ${BASELINE}/ioImageFileReaderONERAComplexReal.hdr - ${TEMP}/ioImageFileReaderONERAComplexReal.hdr - ${BASELINE}/ioImageFileReaderONERAComplexImag.hdr - ${TEMP}/ioImageFileReaderONERAComplexImag.hdr + ${BASELINE}/ioImageFileReaderONERAComplexReal.tif + ${TEMP}/ioImageFileReaderONERAComplexReal.tif + ${BASELINE}/ioImageFileReaderONERAComplexImag.tif + ${TEMP}/ioImageFileReaderONERAComplexImag.tif otbImageFileReaderONERAComplex LARGEINPUT{ONERA/spa3_0215_rad.ent} - ${TEMP}/ioImageFileReaderONERAComplexReal.hdr - ${TEMP}/ioImageFileReaderONERAComplexImag.hdr ) + ${TEMP}/ioImageFileReaderONERAComplexReal.tif + ${TEMP}/ioImageFileReaderONERAComplexImag.tif ) otb_add_test(NAME ioTvImageFileReaderRADCR42TIF COMMAND otbImageIOTestDriver otbImageFileReaderRADComplexFloat @@ -487,13 +490,13 @@ otb_add_test(NAME ioTvStreamingImageFileWriterCalculateNumberOfDivisions_SetAuto 10 ) -otb_add_test(NAME ioTvImageFileReaderRADCI22ENVI COMMAND otbImageIOTestDriver +otb_add_test(NAME ioTvImageFileReaderRADCI22TIF COMMAND otbImageIOTestDriver --compare-image ${EPSILON_9} - ${BASELINE}/ioImageFileReaderRADCI22ENVI.hdr - ${TEMP}/ioImageFileReaderRADCI22ENVI.hdr + ${BASELINE}/ioImageFileReaderRADCI22TIF.tif + ${TEMP}/ioImageFileReaderRADCI22TIF.tif otbImageFileReaderRADComplexFloatExtract LARGEINPUT{RAD_CI2/3017_HH.rad} - ${TEMP}/ioImageFileReaderRADCI22ENVI.hdr ) + ${TEMP}/ioImageFileReaderRADCI22TIF.tif ) otb_add_test(NAME ioTvImageFileReaderTIF2RADCI4 COMMAND otbImageIOTestDriver otbImageFileReaderRADComplexInt @@ -519,10 +522,12 @@ otb_add_test(NAME ioTvONERAImageFileWriterComplex COMMAND otbImageIOTestDriver LARGEINPUT{ONERA/spa3_0215_rad.ent} ${TEMP}/ioImageFileReaderONERAComplexWrite.ent ) -otb_add_test(NAME ioTvImageFileReaderServerNameOTBTest COMMAND otbImageIOTestDriver - otbImageFileReaderServerName - ${OTB_DATA_ROOT}/Examples/osmfile.otb) -set_property(TEST ioTvImageFileReaderServerNameOTBTest PROPERTY RESOURCE_LOCK web_access) +if(OTB_USE_DEPRECATED) + otb_add_test(NAME ioTvImageFileReaderServerNameOTBTest COMMAND otbImageIOTestDriver + otbImageFileReaderServerName + ${OTB_DATA_ROOT}/Examples/osmfile.otb) + set_property(TEST ioTvImageFileReaderServerNameOTBTest PROPERTY RESOURCE_LOCK web_access) +endif() #dashboard_hell # otb_add_test(NAME ioTvImageFileReaderServerNameHTTPTest COMMAND otbImageIOTestDriver @@ -713,7 +718,7 @@ otb_add_test(NAME ioTvVImageFileReader_RESOLUTION_4 COMMAND otbImageIOTestDriver ${TEMP}/ioImageFileReader_RESOLUTION_4.tif ) otb_add_test(NAME ioTvVectorImageFileReaderWriterJP22TIF COMMAND otbImageIOTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioTvVectorImageFileReaderWriterJP22TIFOutput + --compare-image ${EPSILON_9} ${BASELINE}/ioTvVectorImageFileReaderWriterJP22TIFOutput.tif ${TEMP}/ioTvVectorImageFileReaderWriterJP22TIFOutput.tif otbVectorImageFileReaderWriterTest LARGEINPUT{JPEG2000/QB_multicomp_small.jpx} @@ -737,11 +742,11 @@ set_property(TEST ioTvImageFileReaderIntHDR2BSQ PROPERTY DEPENDS ioTvImageFileRe otb_add_test(NAME ioTvONERAImageFileReader COMMAND otbImageIOTestDriver --compare-image ${EPSILON_9} - ${BASELINE}/ioImageFileReaderONERA.hdr - ${TEMP}/ioImageFileReaderONERA.hdr + ${BASELINE}/ioImageFileReaderONERA.tif + ${TEMP}/ioImageFileReaderONERA.tif otbImageFileReaderONERATest LARGEINPUT{ONERA/spa3_0215_rad.ent} - ${TEMP}/ioImageFileReaderONERA.hdr + ${TEMP}/ioImageFileReaderONERA.tif 10 10 100 100 ) otb_add_test(NAME ioTvImageFileReaderFloatHDR2BSQ COMMAND otbImageIOTestDriver @@ -1289,7 +1294,7 @@ otb_add_test(NAME ioTvImageFileReaderIntHDR2LUM COMMAND otbImageIOTestDriver set_tests_properties(ioTvImageFileReaderIntHDR2LUM PROPERTIES DEPENDS ioTvImageFileReaderIntLUM2HDR) otb_add_test(NAME ioTvImageFileReaderPNG2ENVI COMMAND otbImageIOTestDriver - --compare-image ${EPSILON_9} ${BASELINE}/ioImageFileReaderPNG2ENVI.hdr + --compare-image ${EPSILON_9} ${BASELINE}/ioImageFileReaderPNG2ENVI.tif ${TEMP}/ioImageFileReaderPNG2ENVI.hdr otbImageFileReaderTest ${INPUTDATA}/cthead1.png diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx index 1d59f88e8a8ba93e3616e1efd30f644bfe4ce0db..d92b29cfd41761023e98370683bf15e51ce719a5 100644 --- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx +++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx @@ -85,7 +85,6 @@ void RegisterTests() REGISTER_TEST(otbVectorImageFileReaderWriterTest); REGISTER_TEST(otbIntImageIOTest); REGISTER_TEST(otbImageFileReaderONERATest); - REGISTER_TEST(otbImageFileReaderServerName); REGISTER_TEST(otbPNGIndexedNbBandsTest); REGISTER_TEST(otbImageFileReaderTest); REGISTER_TEST(otbVectorImageFileWriterScalarTestWithoutInputShort); @@ -153,4 +152,7 @@ void RegisterTests() REGISTER_TEST(otbImageFileWriterOptBandTest); REGISTER_TEST(otbMultiImageFileWriterTest); REGISTER_TEST(otbWriteGeomFile); +#if OTB_USE_DEPRECATED + REGISTER_TEST(otbImageFileReaderServerName); +#endif } diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx index 2599f7ea278e374e5b0eec8dbdac24ffc4199972..fae2a40dfe64a70447af91c8ade41eb539f20fb5 100644 --- a/Modules/IO/TestKernel/src/otbTestHelper.cxx +++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx @@ -1678,7 +1678,7 @@ std::map<std::string, int> TestHelper::RegressionTestBaselines(char *baselineFil std::string myPath = itksys::SystemTools::GetFilenamePath(baselineFilename); itksys::Directory myDir; - myDir.Load(myPath.c_str()); + myDir.Load(myPath); const unsigned int nbFiles = myDir.GetNumberOfFiles(); const std::string originalBaseline = itksys::SystemTools::GetFilenameWithoutLastExtension(baselineFilename); diff --git a/Modules/Learning/LearningBase/test/CMakeLists.txt b/Modules/Learning/LearningBase/test/CMakeLists.txt index 9956d7dbae16f4669ac5b03dab78355c28dadfe6..ac3ebd8a9462d2cc1653b6324e6ad529a1c6ba64 100644 --- a/Modules/Learning/LearningBase/test/CMakeLists.txt +++ b/Modules/Learning/LearningBase/test/CMakeLists.txt @@ -45,11 +45,11 @@ otb_add_test(NAME leTvDecisionTreeWithRealValues COMMAND otbLearningBaseTestDriv otb_add_test(NAME leTvKMeansImageClassificationFilter COMMAND otbLearningBaseTestDriver --compare-image ${NOTOL} - ${BASELINE}/leKMeansImageClassificationFilterOutput.hdr - ${TEMP}/leKMeansImageClassificationFilterOutput.hdr + ${BASELINE}/leKMeansImageClassificationFilterOutput.tif + ${TEMP}/leKMeansImageClassificationFilterOutput.tif otbKMeansImageClassificationFilter ${INPUTDATA}/poupees_sub.png - ${TEMP}/leKMeansImageClassificationFilterOutput.hdr + ${TEMP}/leKMeansImageClassificationFilterOutput.tif 2 0 0 0 0 255 255 255 255 diff --git a/Modules/Learning/SOM/test/CMakeLists.txt b/Modules/Learning/SOM/test/CMakeLists.txt index 11a22c788e2f76e21b05e975aecc66f3d27a285e..16357a35bd4ce17f008c1b768655fcb337dc59da 100644 --- a/Modules/Learning/SOM/test/CMakeLists.txt +++ b/Modules/Learning/SOM/test/CMakeLists.txt @@ -40,40 +40,40 @@ otb_module_target_label(otbSOMTestDriver) otb_add_test(NAME leTvSOM COMMAND otbSOMTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/leSOMPoupeesSubOutputMap1.hdr - ${TEMP}/leSOMPoupeesSubOutputMap1.hdr + ${BASELINE}/leSOMPoupeesSubOutputMap1.tif + ${TEMP}/leSOMPoupeesSubOutputMap1.tif otbSOM ${INPUTDATA}/poupees_sub.png - ${TEMP}/leSOMPoupeesSubOutputMap1.hdr + ${TEMP}/leSOMPoupeesSubOutputMap1.tif 32 32 10 10 5 1.0 0.1 0) otb_add_test(NAME leTvSOMImageClassificationFilter COMMAND otbSOMTestDriver --compare-image ${NOTOL} - ${BASELINE}/leSOMPoupeesClassified.hdr - ${TEMP}/leSOMImageClassificationFilterOutput.hdr + ${BASELINE}/leSOMPoupeesClassified.tif + ${TEMP}/leSOMImageClassificationFilterOutput.tif otbSOMImageClassificationFilter ${INPUTDATA}/poupees_sub.png - ${BASELINE}/leSOMPoupeesSubOutputMap1.hdr - ${TEMP}/leSOMImageClassificationFilterOutput.hdr + ${BASELINE}/leSOMPoupeesSubOutputMap1.tif + ${TEMP}/leSOMImageClassificationFilterOutput.tif ) otb_add_test(NAME leTvSOMActivationBuilder COMMAND otbSOMTestDriver --compare-image ${NOTOL} - ${BASELINE}/leSOMPoupeesSubActivationMap1.hdr + ${BASELINE}/leSOMPoupeesSubActivationMap1.tif ${TEMP}/leSOMPoupeesSubActivationMap1.tif otbSOMActivationBuilder ${INPUTDATA}/poupees_sub.png - ${BASELINE}/leSOMPoupeesSubOutputMap1.hdr + ${BASELINE}/leSOMPoupeesSubOutputMap1.tif ${TEMP}/leSOMPoupeesSubActivationMap1.tif 32 32 10 10 5 1.0 0.1 128) otb_add_test(NAME leTvSOMWithMissingValue COMMAND otbSOMTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/leSOMWithMissingValue.hdr - ${TEMP}/leSOMWithMissingValue.hdr + ${BASELINE}/leSOMWithMissingValue.tif + ${TEMP}/leSOMWithMissingValue.tif otbSOMWithMissingValueTest ${INPUTDATA}/poupees_sub.png - ${TEMP}/leSOMWithMissingValue.hdr + ${TEMP}/leSOMWithMissingValue.tif 32 32 10 10 5 1.0 0.1 0) otb_add_test(NAME leTvSOMMap COMMAND otbSOMTestDriver @@ -81,30 +81,30 @@ otb_add_test(NAME leTvSOMMap COMMAND otbSOMTestDriver otb_add_test(NAME leTvPeriodicSOM COMMAND otbSOMTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/lePeriodicSOMPoupeesSubOutputMap1.hdr - ${TEMP}/lePeriodicSOMPoupeesSubOutputMap1.hdr + ${BASELINE}/lePeriodicSOMPoupeesSubOutputMap1.tif + ${TEMP}/lePeriodicSOMPoupeesSubOutputMap1.tif otbPeriodicSOMTest ${INPUTDATA}/poupees_sub.png - ${TEMP}/lePeriodicSOMPoupeesSubOutputMap1.hdr + ${TEMP}/lePeriodicSOMPoupeesSubOutputMap1.tif 32 32 10 10 5 1.0 0.1 0) otb_add_test(NAME leTvSOMClassifier COMMAND otbSOMTestDriver --compare-image ${NOTOL} - ${BASELINE}/leSOMPoupeesClassified.hdr - ${TEMP}/leSOMPoupeesClassified.hdr + ${BASELINE}/leSOMPoupeesClassified.tif + ${TEMP}/leSOMPoupeesClassified.tif otbSOMClassifier ${INPUTDATA}/poupees_sub.png - ${BASELINE}/leSOMPoupeesSubOutputMap1.hdr - ${TEMP}/leSOMPoupeesClassified.hdr + ${BASELINE}/leSOMPoupeesSubOutputMap1.tif + ${TEMP}/leSOMPoupeesClassified.tif ) otb_add_test(NAME leTvSOMbasedImageFilter COMMAND otbSOMTestDriver --compare-image ${NOTOL} - ${BASELINE}/leSOMbasedImageFilterOutput.hdr - ${TEMP}/leSOMbasedImageFilterOutput.hdr + ${BASELINE}/leSOMbasedImageFilterOutput.tif + ${TEMP}/leSOMbasedImageFilterOutput.tif otbSOMbasedImageFilterTest ${INPUTDATA}/poupees_sub.png - ${BASELINE}/leSOMPoupeesSubOutputMap1.hdr - ${TEMP}/leSOMbasedImageFilterOutput.hdr + ${BASELINE}/leSOMPoupeesSubOutputMap1.tif + ${TEMP}/leSOMbasedImageFilterOutput.tif ) diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h index 6e89b686539a5ec0b1849e69e00ef25181f43a24..1600b022bc545ace4446d523d865e2b376f79b19 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h @@ -93,7 +93,7 @@ public: } /** Set the SVM type to C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR */ - otbSetSVMParameterMacro(SVMType, svm_type, int) + otbSetSVMParameterMacro(SVMType, svm_type, int); /** Get the SVM type (C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR) */ int GetSVMType(void) const @@ -106,7 +106,7 @@ public: polynomial: (gamma*u'*v + coef0)^degree radial basis function: exp(-gamma*|u-v|^2) sigmoid: tanh(gamma*u'*v + coef0)*/ - otbSetSVMParameterMacro(KernelType, kernel_type, int) + otbSetSVMParameterMacro(KernelType, kernel_type, int); /** Get the kernel type */ int GetKernelType(void) const @@ -115,7 +115,7 @@ public: } /** Set the degree of the polynomial kernel */ - otbSetSVMParameterMacro(PolynomialKernelDegree,degree,int) + otbSetSVMParameterMacro(PolynomialKernelDegree,degree,int); /** Get the degree of the polynomial kernel */ int GetPolynomialKernelDegree(void) const @@ -124,7 +124,7 @@ public: } /** Set the gamma parameter for poly/rbf/sigmoid kernels */ - otbSetSVMParameterMacro(KernelGamma,gamma,double) + otbSetSVMParameterMacro(KernelGamma,gamma,double); /** Get the gamma parameter for poly/rbf/sigmoid kernels */ double GetKernelGamma(void) const @@ -133,7 +133,7 @@ public: } /** Set the coef0 parameter for poly/sigmoid kernels */ - otbSetSVMParameterMacro(KernelCoef0,coef0,double) + otbSetSVMParameterMacro(KernelCoef0,coef0,double); /** Get the coef0 parameter for poly/sigmoid kernels */ double GetKernelCoef0(void) const @@ -142,7 +142,7 @@ public: } /** Set the C parameter for the training for C_SVC, EPSILON_SVR and C_SVR */ - otbSetSVMParameterMacro(C,C,double) + otbSetSVMParameterMacro(C,C,double); /** Get the C parameter for the training for C_SVC, EPSILON_SVR and NU_SVR */ double GetC(void) const @@ -169,7 +169,7 @@ public: bool HasProbabilities(void) const; /** Set the tolerance for the stopping criterion for the training*/ - otbSetSVMParameterMacro(Epsilon,eps,double) + otbSetSVMParameterMacro(Epsilon,eps,double); /** Get the tolerance for the stopping criterion for the training*/ double GetEpsilon(void) const @@ -178,7 +178,7 @@ public: } /** Set the value of p for EPSILON_SVR */ - otbSetSVMParameterMacro(P,p,double) + otbSetSVMParameterMacro(P,p,double); /** Get the value of p for EPSILON_SVR */ double GetP(void) const @@ -187,7 +187,7 @@ public: } /** Set the Nu parameter for the training */ - otbSetSVMParameterMacro(Nu,nu,double) + otbSetSVMParameterMacro(Nu,nu,double); /** Set the Nu parameter for the training */ double GetNu(void) const diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h index e04c7fd19e3c718fe655536959b66d50b63b979d..276e9ca3492d21db03d2872b38e4c80cc44002b9 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h @@ -29,10 +29,9 @@ #include "itkVariableSizeMatrix.h" #include "otbCvRTreesWrapper.h" -class CvRTreesWrapper; - namespace otb { + template <class TInputValue, class TTargetValue> class ITK_EXPORT RandomForestsMachineLearningModel : public MachineLearningModel <TInputValue, TTargetValue> diff --git a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h index 36b3e2b6757da85fc8a736a9d4318b1fb7eb2e35..61c0aa964d74d91686a0bfe96cc72e5fbf607551 100644 --- a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h +++ b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h @@ -117,44 +117,44 @@ public: typedef typename LabelMapToLabelImageFilterType::Pointer LabelMapToLabelImageFilterPointer; /** Standard Macro*/ - itkTypeMacro(ImageSimulationMethod, ImageSource) -; itkNewMacro(Self) + itkTypeMacro(ImageSimulationMethod, ImageSource); +; itkNewMacro(Self); ; - itkSetMacro(NumberOfComponentsPerPixel, unsigned int) -; itkGetMacro(NumberOfComponentsPerPixel, unsigned int) + itkSetMacro(NumberOfComponentsPerPixel, unsigned int); +; itkGetMacro(NumberOfComponentsPerPixel, unsigned int); ; //prolate radius - itkSetMacro(Radius, unsigned int) -; itkGetMacro(Radius, unsigned int) + itkSetMacro(Radius, unsigned int); +; itkGetMacro(Radius, unsigned int); ; - itkSetMacro(SatRSRFilename, std::string) -; itkGetMacro(SatRSRFilename, std::string) + itkSetMacro(SatRSRFilename, std::string); +; itkGetMacro(SatRSRFilename, std::string); ; - itkSetMacro(PathRoot, std::string) -; itkGetMacro(PathRoot, std::string) + itkSetMacro(PathRoot, std::string); +; itkGetMacro(PathRoot, std::string); ; - itkSetMacro(Mean, double) -; itkGetMacro(Mean, double) + itkSetMacro(Mean, double); +; itkGetMacro(Mean, double); ; - itkSetMacro(Variance, double) -; itkGetMacro(Variance, double) + itkSetMacro(Variance, double); +; itkGetMacro(Variance, double); ; - itkSetObjectMacro(Spatialisation, SpatialisationType) + itkSetObjectMacro(Spatialisation, SpatialisationType); ; // itkSetObjectMacro(LabelMapToSimulatedImage, LabelMapToSimulatedImageType); // itkSetObjectMacro(FTM, FTMType); /** Set/Get Input */ - itkSetObjectMacro(InputVectorData, InputVectorDataType) -; itkGetConstObjectMacro(InputVectorData, InputVectorDataType) + itkSetObjectMacro(InputVectorData, InputVectorDataType); +; itkGetConstObjectMacro(InputVectorData, InputVectorDataType); ; // void SetInput(const InputVectorDataType *object); // InputVectorDataType * GetInput(); diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h index 4ac6a19766e2d13155b74177c66d60c269623c72..fbf13cc064e8e96b308d84307c3453f18ea8fa6d 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h @@ -89,20 +89,20 @@ public: typedef typename InputRSRType::RSRVectorType RSRVectorType; typedef typename std::vector<ValuePrecisionType> ReduceSpectralResponseVectorType; /** Standard macros */ - itkNewMacro(Self) -; itkTypeMacro(ReduceSpectralResponse, DataObject) + itkNewMacro(Self); +; itkTypeMacro(ReduceSpectralResponse, DataObject); ; - itkGetConstObjectMacro(InputSatRSR, InputRSRType) -; itkSetObjectMacro(InputSatRSR, InputRSRType) + itkGetConstObjectMacro(InputSatRSR, InputRSRType); +; itkSetObjectMacro(InputSatRSR, InputRSRType); ; - itkGetConstObjectMacro(InputSpectralResponse, InputSpectralResponseType) -; itkSetObjectMacro(InputSpectralResponse, InputSpectralResponseType) + itkGetConstObjectMacro(InputSpectralResponse, InputSpectralResponseType); +; itkSetObjectMacro(InputSpectralResponse, InputSpectralResponseType); ; /** The GetReduceResponse method gives the output. The first value in the pair is the central wavelength of the band (see SpectralResponse). */ - itkGetObjectMacro(ReduceResponse, InputSpectralResponseType) + itkGetObjectMacro(ReduceResponse, InputSpectralResponseType); ; itkSetMacro(ReflectanceMode, bool); diff --git a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h index 4a1d3880a2c29ae24446e6a5e1c86472eac6c6ad..46b14f6041c24c0454ed1fa727474920d4d35ad2 100644 --- a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h +++ b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h @@ -55,17 +55,17 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Standard macros */ - itkNewMacro(Self) -; itkTypeMacro(SatelliteRSR, DataObject) + itkNewMacro(Self); +; itkTypeMacro(SatelliteRSR, DataObject); ; /** Set the number of band of the satellite from an ASCII file * Need to parse first all the file to determine the number of columns */ - itkGetConstMacro(NbBands, unsigned int) -; itkSetMacro(NbBands, unsigned int) + itkGetConstMacro(NbBands, unsigned int); +; itkSetMacro(NbBands, unsigned int); ; - itkSetMacro(SortBands, bool) + itkSetMacro(SortBands, bool); ; /** Template parameters typedef */ diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h index ca71ba4639f05e4ccc6f09987740745be944fbdc..e1e2737b12212752fed20184beeaadaf1798ab0a 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h @@ -59,8 +59,8 @@ public: /** Standard Macro*/ itkTypeMacro(SimulationStep1Base, ProcessObject); - itkSetMacro(Parameters, ParametersType) - itkGetMacro(Parameters, ParametersType) + itkSetMacro(Parameters, ParametersType); + itkGetMacro(Parameters, ParametersType); //virtual void SetInput(const ParametersType &) = 0; virtual SpectralResponseType * GetReflectance() = 0; diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h index 040d7bb552d0d9f71022acaa64949e8009d4fdd6..5a351fe3b9d68b0614cdd966ee7ff85c1b8a17fa 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h @@ -55,11 +55,11 @@ public: typedef itk::Array<ParametersValueType> ParametersType; /** Standard Macro*/ - itkTypeMacro(SimulationStep2Base, ProcessObject) + itkTypeMacro(SimulationStep2Base, ProcessObject); ; - itkSetMacro(Parameters, ParametersType) - itkGetMacro(Parameters, ParametersType) + itkSetMacro(Parameters, ParametersType); + itkGetMacro(Parameters, ParametersType); //; virtual void SetReflectance(const SpectralResponseType *) = 0; diff --git a/Modules/Registration/DisplacementField/test/CMakeLists.txt b/Modules/Registration/DisplacementField/test/CMakeLists.txt index 284c22e5571c64d3215cf7652395fccfbbfdd637..8e2e73032b17b3e350d30fc3abe70b75fd8cc4b6 100644 --- a/Modules/Registration/DisplacementField/test/CMakeLists.txt +++ b/Modules/Registration/DisplacementField/test/CMakeLists.txt @@ -38,51 +38,51 @@ otb_module_target_label(otbDisplacementFieldTestDriver) otb_add_test(NAME dmTvNNearestTransformsLinearInterpolateDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/dmTvNNearestTransformsLinearInterpolateDeformationField.hdr - ${TEMP}/dmTvNNearestTransformsLinearInterpolateDisplacementField.hdr + ${BASELINE}/dmTvNNearestTransformsLinearInterpolateDeformationField.tif + ${TEMP}/dmTvNNearestTransformsLinearInterpolateDisplacementField.tif otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator - ${TEMP}/dmTvNNearestTransformsLinearInterpolateDisplacementField.hdr + ${TEMP}/dmTvNNearestTransformsLinearInterpolateDisplacementField.tif ) otb_add_test(NAME dmTvNNearestPointsLinearInterpolateDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/dmTvNNearestPointsLinearInterpolateDeformationField.hdr - ${TEMP}/dmTvNNearestPointsLinearInterpolateDisplacementField.hdr + ${BASELINE}/dmTvNNearestPointsLinearInterpolateDeformationField.tif + ${TEMP}/dmTvNNearestPointsLinearInterpolateDisplacementField.tif otbNNearestPointsLinearInterpolateDisplacementFieldGenerator - ${TEMP}/dmTvNNearestPointsLinearInterpolateDisplacementField.hdr + ${TEMP}/dmTvNNearestPointsLinearInterpolateDisplacementField.tif ) otb_add_test(NAME dmTvNearestTransformDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/dmTvNearestTransformDeformationField.hdr - ${TEMP}/dmTvNearestTransformDisplacementField.hdr + ${BASELINE}/dmTvNearestTransformDeformationField.tif + ${TEMP}/dmTvNearestTransformDisplacementField.tif otbNearestTransformDisplacementFieldGenerator - ${TEMP}/dmTvNearestTransformDisplacementField.hdr + ${TEMP}/dmTvNearestTransformDisplacementField.tif ) otb_add_test(NAME dmTvNearestPointDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/dmTvNearestPointDeformationField.hdr - ${TEMP}/dmTvNearestPointDisplacementField.hdr + ${BASELINE}/dmTvNearestPointDeformationField.tif + ${TEMP}/dmTvNearestPointDisplacementField.tif otbNearestPointDisplacementFieldGenerator - ${TEMP}/dmTvNearestPointDisplacementField.hdr + ${TEMP}/dmTvNearestPointDisplacementField.tif ) #otb_add_test(NAME dmTvBSplinesInterpolateTransformDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver #--compare-image ${EPSILON_4} - #${BASELINE}/dmTvBSplinesInterpolateTransformDeformationFieldGenerator.hdr - #${TEMP}/dmTvBSplinesInterpolateTransformDisplacementFieldGenerator.hdr + #${BASELINE}/dmTvBSplinesInterpolateTransformDeformationFieldGenerator.tif + #${TEMP}/dmTvBSplinesInterpolateTransformDisplacementFieldGenerator.tif #otbBSplinesInterpolateTransformDisplacementFieldGenerator - #${TEMP}/dmTvBSplinesInterpolateTransformDisplacementFieldGenerator.hdr + #${TEMP}/dmTvBSplinesInterpolateTransformDisplacementFieldGenerator.tif #) otb_add_test(NAME dmTvBSplinesInterpolateDisplacementFieldGenerator COMMAND otbDisplacementFieldTestDriver --compare-image ${EPSILON_10} - ${BASELINE}/dmTvBSplinesInterpolateDeformationField.hdr - ${TEMP}/dmTvBSplinesInterpolateDisplacementField.hdr + ${BASELINE}/dmTvBSplinesInterpolateDeformationField.tif + ${TEMP}/dmTvBSplinesInterpolateDisplacementField.tif otbBSplinesInterpolateDisplacementFieldGenerator - ${TEMP}/dmTvBSplinesInterpolateDisplacementField.hdr + ${TEMP}/dmTvBSplinesInterpolateDisplacementField.tif ) diff --git a/Modules/Remote/otbGRM.remote.cmake b/Modules/Remote/otbGRM.remote.cmake index 383c97da56fe3de3a8ad53ba7fbbf2d7c4c60698..3d2dda71f0cca6db264ff9b6cc6922719df4475e 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 https://github.com/orfeotoolbox/GRM - GIT_TAG c53a61d12b895a85c3909130021988730c309cb7 + GIT_TAG 209161cc0b3fadad7999e80b83838868f430289e ) diff --git a/Modules/Remote/phenotb.remote.cmake b/Modules/Remote/phenotb.remote.cmake index 74d83a9d96d04bd545ee5b02d4790fcac6ab6e3e..4db964f39069a9b6ddede58b2057736bc5cb5bd0 100644 --- a/Modules/Remote/phenotb.remote.cmake +++ b/Modules/Remote/phenotb.remote.cmake @@ -27,5 +27,5 @@ A more detailed description can be found on the project website: https://gitlab.orfeo-toolbox.org/jinglada/phenotb " GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/jinglada/phenotb.git - GIT_TAG c9349eb89a652a18b28a40dfb3fa352b76388527 -) + GIT_TAG 72ba22feac301ae00869b5604c2eef17d6a3fae5 + ) diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..b5434fecb3a3ed9eb1f6077ed91c1a3147f174c2 --- /dev/null +++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h @@ -0,0 +1,255 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbLabelImageSmallRegionMergingFilter_h +#define otbLabelImageSmallRegionMergingFilter_h + +#include "otbPersistentImageFilter.h" +#include "otbPersistentFilterStreamingDecorator.h" + +#include <unordered_map> + +namespace otb +{ + +/** \class PersistentLabelImageSmallRegionMergingFilter + * + * This class can be used to merge each segments of a given size in a label + * image to the connected segment with the closest radiometry (in the sense of + * the euclidian squared distance). + * This persistent filter should be used as template parameter of a + * PersistentFilterStreamingDecorator. + * It computes from an input label image an equivalence table + * that gives for each pixel, the corresponding label in the merged image. + * The merged image can then be computed using a ChangeLabelImageFilter. + * + * This filter can be updated several times for different values of size, + * the output equivalence table will be the results of all computations. + * + * \ingroup ImageSegmentation + * + * \ingroup OTBConversion + */ +template <class TInputLabelImage> +class ITK_EXPORT PersistentLabelImageSmallRegionMergingFilter + : public PersistentImageFilter<TInputLabelImage, TInputLabelImage> +{ +public: + /** Standard class typedef */ + typedef PersistentLabelImageSmallRegionMergingFilter Self; + typedef PersistentImageFilter<TInputLabelImage, TInputLabelImage> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Type macro */ + itkTypeMacro(PersistentLabelImageSmallRegionMergingFilter, + PersistentImageFilter); + itkNewMacro(Self); + + /** Template parameters typedefs */ + + typedef TInputLabelImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointerType; + typedef typename InputImageType::PixelType InputLabelType; + typedef typename InputImageType::SizeType InputSizeType; + typedef typename InputImageType::PointType PointType; + typedef typename InputImageType::RegionType RegionType; + + typedef itk::VariableLengthVector<double> RealVectorPixelType; + + typedef std::unordered_map<InputLabelType, std::set<InputLabelType> > + NeigboursMapType; + + typedef std::unordered_map<InputLabelType , RealVectorPixelType > + LabelStatisticType; + typedef std::unordered_map<InputLabelType , double> + LabelPopulationType; + typedef std::unordered_map<InputLabelType , InputLabelType> LUTType; + + /** Set/Get size of segments to be merged */ + itkGetMacro(Size , unsigned int); + itkSetMacro(Size , unsigned int); + + /** Set the Label population and initialize the LUT */ + void SetLabelPopulation( LabelPopulationType const & labelPopulation ); + + /** Get the Label population */ + LabelPopulationType const & GetLabelPopulation() const; + + /** Set the label statistic */ + void SetLabelStatistic( LabelStatisticType const & labelStatistic ); + + /** Get the label statistic */ + LabelStatisticType const & GetLabelStatistic() const; + + /** Get the LUT */ + LUTType const & GetLUT() const; + + virtual void Reset(void) override; + virtual void Synthetize(void) override; + +protected: + /** The input requested region should be padded by a radius of 1 to use the + * neigbourhood iterator */ + void GenerateInputRequestedRegion() override; + + /** Threaded Generate Data : find the neighbours of each segments of size + * m_Size for each tile and store them in an accumulator */ + void ThreadedGenerateData(const RegionType& + outputRegionForThread, itk::ThreadIdType threadId) override; + + + /** Use the LUT recursively to find the label corresponding to the input + * label */ + InputLabelType FindCorrespondingLabel( InputLabelType label); + + /** Constructor */ + PersistentLabelImageSmallRegionMergingFilter(); + + /** Destructor */ + ~PersistentLabelImageSmallRegionMergingFilter() override = default; + + /** PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + +private: + PersistentLabelImageSmallRegionMergingFilter(const Self &) = delete; + void operator =(const Self&) = delete; + + /** Size of the segments to be merged */ + unsigned int m_Size; + + /** Map containing at key i the population of the segment labelled i */ + LabelPopulationType m_LabelPopulation; + + /** Map containing at key i the mean of element of the segment labelled i */ + LabelStatisticType m_LabelStatistic; + + /** Neigbours maps for each thread */ + std::vector <NeigboursMapType > m_NeighboursMapsTmp; + + /** LUT giving correspondance between labels in the original segmentation + * and the merged labels */ + LUTType m_LUT; +}; + +/** \class LabelImageSmallRegionMergingFilter + * + * This filter computes from a label image an equivalence table that gives for + * each pixel, the corresponding label in the merged image. It uses a + * PersistentFilterStreamingDecorator templated over a + * PersistentLabelImageSmallRegionMergingFilter + * to merge the segments recursively from segment of size 1 to segment of a + * size specified by the attribute MinSize. + * The equivalence table can be accessed with the method GetLut and used to + * compute the merged image with a ChangeLabelImageFilterType. + * + * \ingroup ImageSegmentation + * + * \ingroup OTBConversion + */ +template <class TInputLabelImage> +class ITK_EXPORT LabelImageSmallRegionMergingFilter + : public itk::ProcessObject +{ +public: + /** Standard Self typedef */ + typedef LabelImageSmallRegionMergingFilter Self; + typedef itk::ProcessObject Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Type macro */ + itkNewMacro(Self); + + /** Creation through object factory macro */ + itkTypeMacro(LabelImageSmallRegionMergingFilter, itk::ProcessObject); + + // Small region merging filter typedefs + typedef PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > + PersistentLabelImageSmallRegionMergingFilterType; + typedef PersistentFilterStreamingDecorator + < PersistentLabelImageSmallRegionMergingFilterType > + LabelImageSmallRegionMergingFilterType; + + typedef typename PersistentLabelImageSmallRegionMergingFilterType + ::LabelPopulationType LabelPopulationType; + + typedef typename PersistentLabelImageSmallRegionMergingFilterType + ::LabelStatisticType LabelStatisticType; + + typedef typename PersistentLabelImageSmallRegionMergingFilterType::LUTType + LUTType; + + + /** Set/Get size of polygon to be merged */ + itkGetMacro(MinSize , unsigned int); + itkSetMacro(MinSize , unsigned int); + + /** Set the Label population map */ + void SetInputLabelImage( const TInputLabelImage * labelImage ); + + /** Set the Label population map */ + void SetLabelPopulation( LabelPopulationType const & labelPopulation ); + + /** Get the Label population map */ + LabelPopulationType const & GetLabelPopulation() const; + + /** Set the Label statistic map */ + void SetLabelStatistic( LabelStatisticType const & labelStatistic ); + + /** Get the Label statistic map */ + LabelStatisticType const & GetLabelStatistic() const; + + /** Get the Label statistic map */ + LUTType const & GetLUT() const; + + /** Call GenerateData() */ + void Update() override; + +protected: + /** Constructor */ + LabelImageSmallRegionMergingFilter(); + /** Destructor */ + ~LabelImageSmallRegionMergingFilter() override = default; + + /** Generate Data method (Update LabelImageSmallRegionMergingFilterType + * recursively) */ + void GenerateData() override; + +private: + LabelImageSmallRegionMergingFilter(const Self &) = delete; + void operator =(const Self&) = delete; + + // Filter used recursively to build the equivalence table + typename + LabelImageSmallRegionMergingFilterType::Pointer m_SmallRegionMergingFilter; + + // All segments with size < m_MinSize will be merged to bigger segments. + unsigned int m_MinSize; +}; + +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbLabelImageSmallRegionMergingFilter.hxx" +#endif + +#endif diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a38536377486589e151ed48db2dd154c0aea2ba6 --- /dev/null +++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx @@ -0,0 +1,380 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef otbLabelImageSmallRegionMergingFilter_hxx +#define otbLabelImageSmallRegionMergingFilter_hxx + +#include "otbLabelImageSmallRegionMergingFilter.h" +#include "itkConstShapedNeighborhoodIterator.h" +#include "itkProgressReporter.h" + +namespace otb +{ +template <class TInputLabelImage > +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::PersistentLabelImageSmallRegionMergingFilter() : m_Size(1) +{ +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::SetLabelPopulation( LabelPopulationType const & labelPopulation ) +{ + m_LabelPopulation = labelPopulation; + + // Initialize m_CorrespondingMap to the identity (i.e. m[label] = label) + for (auto label : m_LabelPopulation) + { + m_LUT[label.first] = label.first; + } +} + +template <class TInputLabelImage > +typename PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::LabelPopulationType const & +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLabelPopulation() const +{ + return m_LabelPopulation; +} + + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::SetLabelStatistic( LabelStatisticType const & labelStatistic ) +{ + m_LabelStatistic = labelStatistic; +} + +template <class TInputLabelImage > +typename PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::LabelStatisticType const & +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLabelStatistic() const +{ + return m_LabelStatistic; +} + +template <class TInputLabelImage > +typename PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::LUTType const & +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLUT() const +{ + return m_LUT; +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::Reset() +{ + m_NeighboursMapsTmp.clear(); + m_NeighboursMapsTmp.resize( this->GetNumberOfThreads() ); +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::Synthetize() +{ + NeigboursMapType neighboursMap; + + // Merge the neighbours maps from all threads + for( unsigned int threadId = 0; threadId < this->GetNumberOfThreads(); + threadId++) + { + for (auto const & neighbours : m_NeighboursMapsTmp[threadId]) + { + neighboursMap[ neighbours.first ].insert + ( neighbours.second.begin(), neighbours.second.end() ); + } + } + + // For each label of the label map, find the "closest" connected label, + // according to the euclidian distance between the corresponding + // m_labelStatistic elements. + for (auto const & neighbours : neighboursMap) + { + double proximity = itk::NumericTraits<double>::max(); + InputLabelType label = neighbours.first; + InputLabelType closestNeighbour = label; + auto const& statsLabel = m_LabelStatistic[ label ]; + + for (auto const & neighbour : neighbours.second) + { + auto const & statsNeighbour = m_LabelStatistic[ neighbour ]; + assert( statsLabel.Size() == statsNeighbour.Size() ); + + double distance = (statsLabel - statsNeighbour).GetSquaredNorm(); + if (distance < proximity) + { + proximity = distance; + closestNeighbour = neighbour; + } + } + + auto curLabelLUT = FindCorrespondingLabel(label); + auto adjLabelLUT = FindCorrespondingLabel(closestNeighbour); + + // Keep the smallest label (this prevents infinite loop in the LUT + // (like LUT[i]=j and LUT[j]=i) + if(curLabelLUT < adjLabelLUT) + { + m_LUT[adjLabelLUT] = curLabelLUT; + } + else + { + m_LUT[curLabelLUT] = adjLabelLUT; + } + } + + // Update the LUT + for (auto & label : m_LUT) + { + label.second = FindCorrespondingLabel( label.first ); + } + + // Update statistics : for each newly merged segments, sum the population, and + // recompute the mean. + for (auto const & label : m_LUT) + { + if ((label.second != label.first) && (m_LabelPopulation[label.first]!=0)) + { + // Cache values to reduce number of lookups + auto const & populationFirst = m_LabelPopulation[label.first]; + auto const & populationSecond = m_LabelPopulation[label.second]; + auto const & statisticFirst = m_LabelStatistic[label.first]; + auto const & statisticSecond = m_LabelStatistic[label.second]; + + m_LabelStatistic[ label.second ] = + ( (statisticFirst * populationFirst) + + (statisticSecond * populationSecond) ) + / (populationFirst + populationSecond); + + m_LabelPopulation[ label.second ] += populationFirst; + + // Do not use this label anymore + m_LabelPopulation[ label.first ] = 0; + } + } +} + +template <class TInputLabelImage > +typename PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::InputLabelType +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::FindCorrespondingLabel( typename PersistentLabelImageSmallRegionMergingFilter + < TInputLabelImage >::InputLabelType label) +{ + auto correspondingLabel = m_LUT[label]; + while (label != correspondingLabel) + { + label = correspondingLabel; + correspondingLabel = m_LUT[correspondingLabel]; + } + return correspondingLabel; +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::GenerateInputRequestedRegion() +{ + // call the superclass' implementation of this method + Superclass::GenerateInputRequestedRegion(); + + // get pointers to the input + auto inputPtr = const_cast<TInputLabelImage *>(this->GetInput()); + + + // get a copy of the input requested region + auto inputRequestedRegion = inputPtr->GetRequestedRegion(); + + // pad the input requested region by the operator radius + inputRequestedRegion.PadByRadius(1); + // crop the input requested region at the input's largest possible region + if (inputRequestedRegion.Crop(inputPtr->GetLargestPossibleRegion())) + { + inputPtr->SetRequestedRegion(inputRequestedRegion); + return; + } + else + { + // Couldn't crop the region (requested region is outside the largest + // possible region). Throw an exception. + + // store what we tried to request (prior to trying to crop) + inputPtr->SetRequestedRegion(inputRequestedRegion); + + // build an exception + itk::InvalidRequestedRegionError e(__FILE__, __LINE__); + e.SetLocation(ITK_LOCATION); + e.SetDescription("Requested region is (at least partially) outside the " + "largest possible region."); + e.SetDataObject(inputPtr); + throw e; + } + +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::ThreadedGenerateData(const RegionType& outputRegionForThread, + itk::ThreadIdType threadId ) +{ + using IteratorType = itk::ImageRegionConstIterator< TInputLabelImage >; + using NeighborhoodIteratorType = + itk::ConstShapedNeighborhoodIterator< TInputLabelImage >; + + typename NeighborhoodIteratorType::RadiusType radius; + radius.Fill(1); + + auto labelImage = this->GetInput(); + + IteratorType it(labelImage, outputRegionForThread); + NeighborhoodIteratorType itN(radius, labelImage, outputRegionForThread); + + // 4 connected Neighborhood (top, bottom, left and right) + typename IteratorType::OffsetType top = {{0,-1}}; + itN.ActivateOffset(top); + typename IteratorType::OffsetType bottom = {{0,1}}; + itN.ActivateOffset(bottom); + typename IteratorType::OffsetType right = {{1,0}}; + itN.ActivateOffset(right); + typename IteratorType::OffsetType left = {{-1,0}}; + itN.ActivateOffset(left); + + for (it.GoToBegin(); ! it.IsAtEnd(); ++it, ++itN) + { + assert( !itN.IsAtEnd() ); + int currentLabel = m_LUT[ it.Get() ]; + + if ( m_LabelPopulation[currentLabel] == m_Size ) + { + for (auto ci = itN.Begin() ; !ci.IsAtEnd(); ci++) + { + int neighbourLabel = m_LUT[ ci.Get() ]; + if (neighbourLabel != currentLabel) + m_NeighboursMapsTmp[threadId][ currentLabel ].insert(neighbourLabel); + } + } + } +} + +template <class TInputLabelImage > +void +PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); +} + +template <class TInputLabelImage > +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::LabelImageSmallRegionMergingFilter() : m_MinSize(1) +{ + m_SmallRegionMergingFilter = LabelImageSmallRegionMergingFilterType::New(); +} + +template <class TInputLabelImage > +void +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::SetInputLabelImage( const TInputLabelImage * labelImage ) +{ + m_SmallRegionMergingFilter->GetFilter()->SetInput( labelImage ); +} + +template <class TInputLabelImage > +void +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::SetLabelPopulation( LabelPopulationType const & labelPopulation ) +{ + m_SmallRegionMergingFilter->GetFilter() + ->SetLabelPopulation(labelPopulation); +} + +template <class TInputLabelImage > +typename LabelImageSmallRegionMergingFilter< TInputLabelImage > +::LabelPopulationType const & +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLabelPopulation() const +{ + return m_SmallRegionMergingFilter->GetFilter()->GetLabelPopulation(); +} + +template <class TInputLabelImage > +void +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::SetLabelStatistic( LabelStatisticType const & labelStatistic ) +{ + m_SmallRegionMergingFilter->GetFilter()->SetLabelStatistic(labelStatistic); +} + +template <class TInputLabelImage > +typename LabelImageSmallRegionMergingFilter< TInputLabelImage > +::LabelStatisticType const & +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLabelStatistic() const +{ + return m_SmallRegionMergingFilter->GetFilter()->GetLabelStatistic(); +} + +template <class TInputLabelImage > +typename LabelImageSmallRegionMergingFilter< TInputLabelImage > +::LUTType const & +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::GetLUT() const +{ + return m_SmallRegionMergingFilter->GetFilter()->GetLUT(); +} + +template <class TInputLabelImage> +void +LabelImageSmallRegionMergingFilter<TInputLabelImage> +::Update() +{ + this->GenerateData(); +} + +template <class TInputLabelImage > +void +LabelImageSmallRegionMergingFilter< TInputLabelImage > +::GenerateData() +{ + this->SetProgress(0.0); + + // Update the filter for all sizes. + for (unsigned int size = 1; size < m_MinSize; size++) + { + m_SmallRegionMergingFilter->GetFilter()->SetSize( size) ; + m_SmallRegionMergingFilter->Update(); + this->UpdateProgress(static_cast<double>(size+1)/m_MinSize); + } +} + + +} // end namespace otb + +#endif diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h index 6f086648d7de5c8621de605d3b39d8e6e0089b9d..63717bf0a540ff2d37388228a24f945d195b1051 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h @@ -137,6 +137,11 @@ public: itkGetConstReferenceMacro(BurnAttributeMode,bool); itkBooleanMacro(BurnAttributeMode); + /** Set/Get the AllTouchedMode flag */ + itkSetMacro(AllTouchedMode,bool); + itkGetConstReferenceMacro(AllTouchedMode,bool); + itkBooleanMacro(AllTouchedMode); + /** Useful to set the output parameters from an existing image*/ void SetOutputParametersFromImage(const ImageBaseType * image); @@ -169,6 +174,7 @@ private: OutputImageInternalPixelType m_BackgroundValue; OutputImageInternalPixelType m_ForegroundValue; bool m_BurnAttributeMode; + bool m_AllTouchedMode; }; // end of class VectorDataToLabelImageFilter } // end of namespace otb diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.hxx b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.hxx index 30c3e9fba8a7625f2863aa806f0865fca919cf69..4e33a951a5ac9287d0e0021098cc3239eecadf69 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.hxx +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.hxx @@ -39,7 +39,8 @@ OGRDataSourceToLabelImageFilter<TOutputImage> ::OGRDataSourceToLabelImageFilter() : m_BurnAttribute("DN"), m_BackgroundValue(0), m_ForegroundValue(255), - m_BurnAttributeMode(true) + m_BurnAttributeMode(true), + m_AllTouchedMode(false) { this->SetNumberOfRequiredInputs(1); @@ -129,7 +130,7 @@ OGRDataSourceToLabelImageFilter<TOutputImage> this->SetOutputOrigin ( image->GetOrigin() ); this->SetOutputSpacing ( internal::GetSignedSpacing( image ) ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); - + ImageMetadataInterfaceBase::Pointer imi = ImageMetadataInterfaceFactory::CreateIMI(image->GetMetaDataDictionary()); this->SetOutputProjectionRef(imi->GetProjectionRef()); @@ -251,6 +252,10 @@ OGRDataSourceToLabelImageFilter<TOutputImage>::GenerateData() { options.push_back("ATTRIBUTE="+m_BurnAttribute); } + if(m_AllTouchedMode) + { + options.push_back("ALL_TOUCHED=TRUE"); + } GDALRasterizeLayers( dataset, nbBands, &m_BandsToBurn[0], diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h index d708f1d99569f54512a469ff38f73a08723c71b0..d719606ae3492d9589f49fa15429bbb00b32d640 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h @@ -99,6 +99,11 @@ public: typedef itk::DataObject DataObjectType; + /** Set/Get the AllTouchedMode flag */ + itkSetMacro(AllTouchedMode,bool); + itkGetConstReferenceMacro(AllTouchedMode,bool); + itkBooleanMacro(AllTouchedMode); + const InputImageType * GetInput(); const DataObjectType* GetInput(unsigned int idx); @@ -163,6 +168,7 @@ private: std::vector<double> m_BurnValues; std::vector<double> m_FullBurnValues; std::vector<int> m_BandsToBurn; + bool m_AllTouchedMode; }; // end of class RasterizeVectorDataFilter diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.hxx b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.hxx index c140348c0483eda9f005435ab976d8c434654458..6b45a3fcdff73d0f9bebb56ba9af5fc474c08678 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.hxx +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.hxx @@ -30,7 +30,8 @@ namespace otb template<class TVectorData, class TInputImage, class TOutputImage> RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage> ::RasterizeVectorDataFilter() - : m_OGRDataSourcePointer(nullptr) + : m_OGRDataSourcePointer(nullptr), + m_AllTouchedMode(false) { this->SetNumberOfRequiredInputs(1); } @@ -188,6 +189,12 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData( geoTransform[4] = 0.; GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer())); + char **options = nullptr; + if (m_AllTouchedMode) + { + options = CSLSetNameValue(options, "ALL_TOUCHED", "TRUE"); + } + // Burn the geometries into the dataset if (dataset != nullptr) { @@ -196,9 +203,11 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData( m_SrcDataSetLayers.size(), &(m_SrcDataSetLayers[0]), nullptr, nullptr, &(m_FullBurnValues[0]), - nullptr, + options, GDALDummyProgress, nullptr ); + CSLDestroy(options); + // release the dataset GDALClose( dataset ); } diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h index 63c7d85cc82eef29621c3d2ba3d6e977f037447b..6cdbabc3974e38da1993b092a130ea042879fffc 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h @@ -129,6 +129,11 @@ public: itkSetMacro(DefaultBurnValue, OutputImageInternalPixelType); itkGetMacro(DefaultBurnValue, OutputImageInternalPixelType); + /** Set/Get the AllTouchedMode flag */ + itkSetMacro(AllTouchedMode,bool); + itkGetConstReferenceMacro(AllTouchedMode,bool); + itkBooleanMacro(AllTouchedMode); + /** Useful to set the output parameters from an existing image*/ void SetOutputParametersFromImage(const ImageBaseType * image); @@ -176,6 +181,9 @@ private: // Background value OutputImageInternalPixelType m_BackgroundValue; + // All touched mode + bool m_AllTouchedMode; + // Output params std::string m_OutputProjectionRef; OutputSpacingType m_OutputSpacing; diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.hxx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.hxx index 49afc91079839422acf465f1799feda1b2690133..ab370f7545ac25fead58061b7db3b24bed524568 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.hxx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.hxx @@ -40,7 +40,8 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> m_BandsToBurn(1, 1), m_BurnAttribute("FID"), m_DefaultBurnValue(1.), - m_BackgroundValue(0.) + m_BackgroundValue(0.), + m_AllTouchedMode(false) { this->SetNumberOfRequiredInputs(1); @@ -262,7 +263,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData() // Fill the buffer with the background value this->GetOutput()->FillBuffer(m_BackgroundValue); - + // nb bands unsigned int nbBands = this->GetOutput()->GetNumberOfComponentsPerPixel(); @@ -303,6 +304,12 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData() geoTransform[4] = 0.; GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer())); + char **options = nullptr; + if (m_AllTouchedMode) + { + options = CSLSetNameValue(options, "ALL_TOUCHED", "TRUE"); + } + // Burn the geometries into the dataset if (dataset != nullptr) { @@ -311,9 +318,11 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData() m_SrcDataSetGeometries.size(), &(m_SrcDataSetGeometries[0]), nullptr, nullptr, &(m_FullBurnValues[0]), - nullptr, + options, GDALDummyProgress, nullptr ); + CSLDestroy(options); + // release the dataset GDALClose( dataset ); } diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h index 72c9f1b455ef4b87b14bc5daea60ec2c53c9c8b6..c8a2a059c165f48df3d07ba32885977bee2d71b3 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h @@ -122,44 +122,44 @@ public: /** * Run-time type information (and related methods) */ - itkTypeMacro(VectorDataToLabelMapWithAttributesFilter, ImageToImageFilter) + itkTypeMacro(VectorDataToLabelMapWithAttributesFilter, ImageToImageFilter); ; /** * Method for creation through the object factory. */ - itkNewMacro(Self) + itkNewMacro(Self); ; /** * Set/Get the value used as "background" in the output image. * Defaults to NumericTraits<PixelType>::NonpositiveMin(). */ - itkSetMacro(BackgroundValue, OutputLabelMapPixelType) -; itkGetConstMacro(BackgroundValue, OutputLabelMapPixelType) + itkSetMacro(BackgroundValue, OutputLabelMapPixelType); +; itkGetConstMacro(BackgroundValue, OutputLabelMapPixelType); ; /** Set the size of the output image. */ - itkSetMacro(Size, SizeType) + itkSetMacro(Size, SizeType); ; /** Get the size of the output image. */ - itkGetConstReferenceMacro(Size, SizeType) + itkGetConstReferenceMacro(Size, SizeType); ; /** Set the origin of the vector data. * \sa GetOrigin() */ - itkSetMacro(Origin, OriginType) + itkSetMacro(Origin, OriginType); ; virtual void SetOrigin(const double origin[2]); virtual void SetOrigin(const float origin[2]); - itkGetConstReferenceMacro(Origin, OriginType) + itkGetConstReferenceMacro(Origin, OriginType); ; /** Get/Set start index*/ - itkGetConstReferenceMacro(StartIndex, IndexType) -; itkSetMacro(StartIndex, IndexType) + itkGetConstReferenceMacro(StartIndex, IndexType); +; itkSetMacro(StartIndex, IndexType); ; /** Set the spacing (size of a pixel) of the vector data. * \sa GetSignedSpacing() */ @@ -167,7 +167,7 @@ public: virtual void SetSpacing(const double spacing[2]); virtual void SetSpacing(const float spacing[2]); - itkGetConstReferenceMacro(Spacing, SpacingType) + itkGetConstReferenceMacro(Spacing, SpacingType); ; /** Set/Get the Vector data input of this process object. */ @@ -178,13 +178,13 @@ public: const InputVectorDataType * GetInput(unsigned int idx); /** Set/Get Automatic size computation mode*/ - itkSetMacro(AutomaticSizeComputation, bool) -; itkGetMacro(AutomaticSizeComputation, bool) + itkSetMacro(AutomaticSizeComputation, bool); +; itkGetMacro(AutomaticSizeComputation, bool); ; /** Set/Get Initial label value */ - itkSetMacro(InitialLabel, LabelType) -; itkGetMacro(InitialLabel, LabelType) + itkSetMacro(InitialLabel, LabelType); +; itkGetMacro(InitialLabel, LabelType); ; void GenerateOutputInformation() override; diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h index d67452592e1e220fbaf3c1f537d48ed6f1382d05..4e231d374a52eb9f159de362fc2ebf6e0934f26f 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h @@ -22,7 +22,7 @@ #define otbMeanShiftSegmentationFilter_h #include "itkMacro.h" - +#include "otbMacro.h" #include "otbMeanShiftSmoothingImageFilter.h" #include "otbLabelImageRegionMergingFilter.h" #include "otbLabelImageRegionPruningFilter.h" diff --git a/Modules/ThirdParty/Mapnik/otb-module.cmake b/Modules/ThirdParty/Mapnik/otb-module.cmake index 34ee5c29ddcf57be645f5d4babcc122ffe75e848..dc2bb04a0f17bb6321363664618bd9af83ed5dd2 100644 --- a/Modules/ThirdParty/Mapnik/otb-module.cmake +++ b/Modules/ThirdParty/Mapnik/otb-module.cmake @@ -24,7 +24,9 @@ otb_module(OTBMapnik DEPENDS TEST_DEPENDS - + + DEPRECATED + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp index d8f5e85b602faa555a62bc73511b50aeed7313e4..73aa0ad9b61a4555185a082ae651b71d446cf4b2 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp @@ -124,7 +124,7 @@ namespace ossimplugins _sensor = new SensorParams(); /* - if(strcmp(time_dir_pix.c_str(), "INCREASE") == 0) + if(time_dir_pix == "INCREASE") { _sensor->set_col_direction(1); } @@ -138,7 +138,7 @@ namespace ossimplugins // TODO: Have to verify whether the time direction indicator should be always positive /* - if(strcmp(time_dir_lin.c_str(), "INCREASE") == 0) + if(time_dir_lin == "INCREASE") { _sensor->set_lin_direction(1); } diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp index 337fdfcc6f24dcd1d58269efda8be8a995d476f1..7fa0bc95cd24ac8ab0bfcbfcecad5db4cfe3eeeb 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp @@ -116,7 +116,7 @@ namespace ossimplugins _sensor = new SensorParams(); - if (strcmp(time_dir_pix.c_str(), "INCREASE") == 0) + if (time_dir_pix == "INCREASE") { _sensor->set_col_direction(1); } @@ -125,7 +125,7 @@ namespace ossimplugins _sensor->set_col_direction(-1); } - if (strcmp(time_dir_lin.c_str(), "INCREASE") == 0) + if (time_dir_lin == "INCREASE") { _sensor->set_lin_direction(1); } diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp index 443e37dd4cfd587ab6a17f478616286078c8e3ae..fd588dfe5c9884c80034745fdac0a19dacc94707 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp @@ -86,7 +86,8 @@ ossimFormosatDimapSupportData::ossimFormosatDimapSupportData () { } ossimFormosatDimapSupportData::ossimFormosatDimapSupportData(const ossimFormosatDimapSupportData& rhs) - :ossimErrorStatusInterface(rhs), + :ossimObject(rhs), + ossimErrorStatusInterface(rhs), theMetadataVersion(rhs.theMetadataVersion), theImageID(rhs.theImageID), theMetadataFile (rhs.theMetadataFile), diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.cpp index caeabc9efd8a67134a370e7808ef3249d1ea67c2..bc3c02047a4824fc0c3275076f1a06485e083c1e 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.cpp @@ -47,7 +47,7 @@ namespace ossimplugins ossimPluginReaderFactory::~ossimPluginReaderFactory() { - theInstance = 0; + theInstance = nullptr; } ossimPluginReaderFactory* ossimPluginReaderFactory::instance() @@ -179,10 +179,4 @@ namespace ossimplugins { extensionList.push_back(ossimString("xml")); } - - ossimPluginReaderFactory::ossimPluginReaderFactory(){} - - ossimPluginReaderFactory::ossimPluginReaderFactory(const ossimPluginReaderFactory&){} - - void ossimPluginReaderFactory::operator=(const ossimPluginReaderFactory&){} } diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.h index b7c7d493a41f718960a1cb86e6c29bde90c7319c..df9454f78893a456fce43395610e8a62e2677038 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginReaderFactory.h @@ -97,21 +97,21 @@ namespace ossimplugins virtual void getSupportedExtensions( ossimImageHandlerFactoryBase::UniqueStringList& extensionList)const; - protected: - /** @brief hidden from use default constructor */ - ossimPluginReaderFactory(); + /** @brief deleted copy constructor */ + ossimPluginReaderFactory(const ossimPluginReaderFactory&) = delete; - /** @brief hidden from use copy constructor */ - ossimPluginReaderFactory(const ossimPluginReaderFactory&); + /** @brief deleted copy assignment operator */ + void operator=(const ossimPluginReaderFactory&) = delete; - /** @brief hidden from use copy constructor */ - void operator=(const ossimPluginReaderFactory&); + protected: + /** @brief hidden from use default constructor */ + ossimPluginReaderFactory() {} /** static instance of this class */ static ossimPluginReaderFactory* theInstance; TYPE_DATA - }; + }; } #endif /* end of #ifndef ossimPluginReaderFactory_HEADER */ diff --git a/Modules/ThirdParty/SiftFast/src/CMakeLists.txt b/Modules/ThirdParty/SiftFast/src/CMakeLists.txt index 2c6dc502edfb4c1e5c4df806b7db366c2d55e4de..2e6079167cde6968e8ad8a4ac196298cf650c1e8 100644 --- a/Modules/ThirdParty/SiftFast/src/CMakeLists.txt +++ b/Modules/ThirdParty/SiftFast/src/CMakeLists.txt @@ -33,7 +33,7 @@ if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) set(IS_SIFTFAST_COMPILE 0) try_compile(IS_SIFTFAST_COMPILE ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/test_try_compile_libsiftfast.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/otbsiftfast/test_try_compile_libsiftfast.cpp OUTPUT_VARIABLE OUTPUT) if(IS_SIFTFAST_COMPILE) message(STATUS "Try to compile libsiftfast.cpp -- yes.") @@ -41,7 +41,7 @@ if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) message(STATUS "Try to compile libsiftfast.cpp -- no. OUTPUT_VARIABLE has ${OUTPUT}") try_compile(IS_SIFTFAST_COMPILE2 ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/test_try_compile_libsiftfast.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/otbsiftfast/test_try_compile_libsiftfast.cpp COMPILE_DEFINITIONS -DOTB_DISABLE_FAST_FUNCTIONS OUTPUT_VARIABLE OUTPUT) if(IS_SIFTFAST_COMPILE2) @@ -75,7 +75,7 @@ endif() #set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") #add_xxdefinitions(" -Wall -fPIC ") -add_library(otbsiftfast libsiftfast.cpp) +add_library(otbsiftfast otbsiftfast/libsiftfast.cpp) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) # target_link_libraries(otbsiftfast m stdc++) target_link_libraries(otbsiftfast m) @@ -97,7 +97,7 @@ endif() #set_target_properties(otbsiftfast PROPERTIES OUTPUT_NAME siftfast CLEAN_DIRECT_OUTPUT 1) # compile without depending on libsiftfast -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/otbsiftfast) #set_target_properties(siftfast PROPERTIES COMPILE_FLAGS "-DDVPROFILE") #target_link_libraries(siftfast libsiftfast) @@ -113,7 +113,7 @@ install(TARGETS otbsiftfast ARCHIVE DESTINATION ${OTB3P_INSTALL_ARCHIVE_DIR} COMPONENT Development ) -install(FILES siftfast.h +install(FILES otbsiftfast/siftfast.h DESTINATION ${OTB3P_INSTALL_INCLUDE_DIR}/otbsiftfast COMPONENT Development ) diff --git a/Modules/ThirdParty/SiftFast/src/otb_siftfast.h b/Modules/ThirdParty/SiftFast/src/otb_siftfast.h index ad733dc85f0b6f871697aa663b6c68fc8cf2a5ca..1e303c1a5b9e1be255e94f61412d720b396bcad7 100644 --- a/Modules/ThirdParty/SiftFast/src/otb_siftfast.h +++ b/Modules/ThirdParty/SiftFast/src/otb_siftfast.h @@ -19,6 +19,7 @@ */ #ifndef otb_siftfast_h +#define otb_siftfast_h #include "otbsiftfast/siftfast.h" diff --git a/Modules/ThirdParty/SiftFast/src/AUTHORS b/Modules/ThirdParty/SiftFast/src/otbsiftfast/AUTHORS similarity index 100% rename from Modules/ThirdParty/SiftFast/src/AUTHORS rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/AUTHORS diff --git a/Modules/ThirdParty/SiftFast/src/FindBoost.cmake b/Modules/ThirdParty/SiftFast/src/otbsiftfast/FindBoost.cmake similarity index 100% rename from Modules/ThirdParty/SiftFast/src/FindBoost.cmake rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/FindBoost.cmake diff --git a/Modules/ThirdParty/SiftFast/src/FindOctave.cmake b/Modules/ThirdParty/SiftFast/src/otbsiftfast/FindOctave.cmake similarity index 100% rename from Modules/ThirdParty/SiftFast/src/FindOctave.cmake rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/FindOctave.cmake diff --git a/Modules/ThirdParty/SiftFast/src/INSTALL b/Modules/ThirdParty/SiftFast/src/otbsiftfast/INSTALL similarity index 100% rename from Modules/ThirdParty/SiftFast/src/INSTALL rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/INSTALL diff --git a/Modules/ThirdParty/SiftFast/src/LICENSE b/Modules/ThirdParty/SiftFast/src/otbsiftfast/LICENSE similarity index 100% rename from Modules/ThirdParty/SiftFast/src/LICENSE rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/LICENSE diff --git a/Modules/ThirdParty/SiftFast/src/Makefile-upstream b/Modules/ThirdParty/SiftFast/src/otbsiftfast/Makefile-upstream similarity index 100% rename from Modules/ThirdParty/SiftFast/src/Makefile-upstream rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/Makefile-upstream diff --git a/Modules/ThirdParty/SiftFast/src/README b/Modules/ThirdParty/SiftFast/src/otbsiftfast/README similarity index 100% rename from Modules/ThirdParty/SiftFast/src/README rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/README diff --git a/Modules/ThirdParty/SiftFast/src/cmake_uninstall.cmake.in b/Modules/ThirdParty/SiftFast/src/otbsiftfast/cmake_uninstall.cmake.in similarity index 100% rename from Modules/ThirdParty/SiftFast/src/cmake_uninstall.cmake.in rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/cmake_uninstall.cmake.in diff --git a/Modules/ThirdParty/SiftFast/src/libsiftfast.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/libsiftfast.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/libsiftfast.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/libsiftfast.cpp diff --git a/Modules/ThirdParty/SiftFast/src/makerelease.sh b/Modules/ThirdParty/SiftFast/src/otbsiftfast/makerelease.sh similarity index 100% rename from Modules/ThirdParty/SiftFast/src/makerelease.sh rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/makerelease.sh diff --git a/Modules/ThirdParty/SiftFast/src/profiler.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/profiler.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/profiler.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/profiler.cpp diff --git a/Modules/ThirdParty/SiftFast/src/profiler.h b/Modules/ThirdParty/SiftFast/src/otbsiftfast/profiler.h similarity index 100% rename from Modules/ThirdParty/SiftFast/src/profiler.h rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/profiler.h diff --git a/Modules/ThirdParty/SiftFast/src/runcmake.bat b/Modules/ThirdParty/SiftFast/src/otbsiftfast/runcmake.bat similarity index 100% rename from Modules/ThirdParty/SiftFast/src/runcmake.bat rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/runcmake.bat diff --git a/Modules/ThirdParty/SiftFast/src/siftfast.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/siftfast.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.cpp diff --git a/Modules/ThirdParty/SiftFast/src/siftfast.h b/Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.h similarity index 100% rename from Modules/ThirdParty/SiftFast/src/siftfast.h rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.h diff --git a/Modules/ThirdParty/SiftFast/src/siftfast.m b/Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.m similarity index 100% rename from Modules/ThirdParty/SiftFast/src/siftfast.m rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfast.m diff --git a/Modules/ThirdParty/SiftFast/src/siftfastpy.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfastpy.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/siftfastpy.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/siftfastpy.cpp diff --git a/Modules/ThirdParty/SiftFast/src/siftmex.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/siftmex.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/siftmex.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/siftmex.cpp diff --git a/Modules/ThirdParty/SiftFast/src/test_try_compile_libsiftfast.cpp b/Modules/ThirdParty/SiftFast/src/otbsiftfast/test_try_compile_libsiftfast.cpp similarity index 100% rename from Modules/ThirdParty/SiftFast/src/test_try_compile_libsiftfast.cpp rename to Modules/ThirdParty/SiftFast/src/otbsiftfast/test_try_compile_libsiftfast.cpp diff --git a/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx index e1516508bb73754160c607fd472ec0c977605dd0..141c8f4111e795f60077c19b231f57f805504803 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx @@ -171,7 +171,7 @@ AbstractImageModel count++) { std::ostringstream oss; - oss <<ToStdString( tr("BAND ") )<< count; + oss <<ToStdString( tr("BAND ") )<< count + 1; outputBandNames.push_back(oss.str()); } diff --git a/Modules/Visualization/MonteverdiCore/src/mvdVectorImageSettings.cxx b/Modules/Visualization/MonteverdiCore/src/mvdVectorImageSettings.cxx index e3bc7b02c824537ee4a18adf596a1a2f9b76b7a4..e5f453b94ccb2a34c7746cc85a191c11eb52d594 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdVectorImageSettings.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdVectorImageSettings.cxx @@ -83,6 +83,7 @@ VectorImageSettings /***************************************************************************/ VectorImageSettings ::VectorImageSettings( const VectorImageSettings & other ) : + ImageSettings(other), m_RgbChannels( other.m_RgbChannels ), m_RgbDynamicsParams( other.m_RgbDynamicsParams ), m_IsGrayscaleActivated( other.m_IsGrayscaleActivated ), diff --git a/Modules/Visualization/MonteverdiGui/src/mvdColorSetupWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdColorSetupWidget.cxx index f269274797d7fdce18601bcdfab0d972672162c3..020d5ad0de638eb5700a20ef5574fdb762f0d390 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdColorSetupWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdColorSetupWidget.cxx @@ -109,21 +109,6 @@ ColorSetupWidget QStringList itemTexts( components ); - // TODO: Move to mvd::core::AbstractImageModel (see ENHANCED_BAND_NAMES[]). - for( int i=0; - i<itemTexts.size(); - ++ i ) - { - if( itemTexts[ i ].isEmpty() ) - { - itemTexts[ i ] = tr( "BAND %1" ).arg( i+1 ); - } - else - { - itemTexts[ i ].prepend( QString( "%1: " ).arg( i+1 ) ); - } - } - m_UI->rComboBox->addItems( itemTexts ); m_UI->gComboBox->addItems( itemTexts ); m_UI->bComboBox->addItems( itemTexts ); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 92c4fed306daa0c796be5bb64dfdfa47168a9860..da8aef6b51bf9319c3761f171a328b19fc9386df 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -115,8 +115,8 @@ public: /** Run the application. * - * For pipeline ready application, this only wire - * and configure the pipeline, and provides + * For pipeline ready application, this only wires + * and configures the pipeline, and provides * the output image or vector data parameters as pointers. * * In other cases, the application must handle @@ -126,7 +126,7 @@ public: */ int Execute(); - /** Run the application, then writes all the output to disk + /** Run the application, then write all of the output to disk * if they have an associated filename. * This is a helper function for wrappers without pipeline support. * @@ -182,7 +182,7 @@ public: * (not automatically computed by the application) */ bool HasUserValue(std::string paramKey) const; - /* If a user value was provided clear it and update the other parameters */ + /* If a user value was provided, clear it and update the other parameters */ void ClearValue(std::string paramKey); /* Returns true if the parameter has an associated value. @@ -271,7 +271,7 @@ public: void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag = true); /** Checks if the application is ready to be executed. It checks that there - * is no parameter missing + * is no missing parameter */ bool IsApplicationReady(); @@ -338,7 +338,7 @@ public: */ void SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type); - /* Set a minimum int value, must used in the + /* Set a minimum int value, must used in the * DoInit when setting a value by default * for the parameter * @@ -347,7 +347,7 @@ public: */ void SetMinimumParameterIntValue(std::string parameter, int value); - /* Set a maximum int value, must used in the + /* Set a maximum int value, must used in the * DoInit when setting a value by default * for the parameter * @@ -356,7 +356,7 @@ public: */ void SetMaximumParameterIntValue(std::string parameter, int value); - /* Set a minimum int value, must used in the + /* Set a minimum int value, must used in the * DoInit when setting a value by default * for the parameter * @@ -365,7 +365,7 @@ public: */ void SetMinimumParameterFloatValue(std::string parameter, float value); - /* Set a maximum int value, must used in the + /* Set a maximum int value, must used in the * DoInit when setting a value by default * for the parameter * @@ -376,7 +376,7 @@ public: /** - * Enable single selection mode for list view if status in true + * Enable single selection mode for list view if status is true * (default is false). * * Can be called for types: @@ -384,6 +384,14 @@ public: */ void SetListViewSingleSelectionMode(std::string parameter, bool status); + /** + * True if the parameter is a list view and is in single selection mode + * + * Can be called for types: + * \li ParameterType_ListView + */ + bool GetListViewSingleSelectionMode(const std::string& parameter); + /* Set an output image value * * Can be called for types : diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.hxx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.hxx index 634193bee1b2b2dacd5a6bec0bbef78b8c7bb4b2..e79d17eaccf0815f940e117a67a5711965ff2962 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.hxx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.hxx @@ -217,8 +217,10 @@ InputImageParameter::GetImage() /** declare a specialization for ImageBaseType */ template <> +OTBApplicationEngine_EXPORT ImageBaseType* -InputImageParameter::GetImage(); +InputImageParameter::GetImage<ImageBaseType>(); + template <class TInputImage, class TOutputImage> TOutputImage* diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 46635f7954c0fe78586d113e16755e2d540f8cbe..9f820a3e8f6382dc267c72f1d1b52e85ab911e9c 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -1422,6 +1422,21 @@ void Application::SetListViewSingleSelectionMode(std::string parameter, bool sta } +bool Application::GetListViewSingleSelectionMode(const std::string& parameter) +{ + Parameter* param = GetParameterByKey(parameter); + + ListViewParameter* paramListView = dynamic_cast<ListViewParameter*>(param); + if (paramListView) + { + return paramListView->GetSingleSelection(); + } + else + { + itkExceptionMacro(<<parameter << " parameter can't be casted to ListView"); + } +} + void Application::SetParameterOutputImage(std::string parameter, FloatVectorImageType* value) { diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx index 59c9448ffd3264ae8cd3f1acbf73b3ca0553e201..520133cde871b79f0db5be1170f40ea4e80ee321 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx @@ -146,9 +146,9 @@ DocExampleStructure::GenerateCLExample( unsigned int exId ) res = oss.str(); // Suppress last added space - res.erase( res.size()-1, 1); + res.pop_back(); - return res.c_str(); + return res; } std::string diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx index 0882bd9596f70ebf3e932c03a0d0b1317b6bde69..31352df0b80f5cbb260fea3d5faa086bd0ffe162 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx @@ -70,7 +70,7 @@ InputImageParameter::GetImage() template <> ImageBaseType* -InputImageParameter::GetImage() +InputImageParameter::GetImage<ImageBaseType>() { if (m_Image.IsNull()) return this->GetImage<FloatVectorImageType>(); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx index a4d4557c6d58dad4cdd47bec748822eac41d2ffd..69cc498e1c7a81d0b45cdb266301b6c410ab0360 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx @@ -142,7 +142,7 @@ const std::string MapProjectionParametersHandler::GetProjectionRefFromChoice(con // Set the hem char hem = 'N'; - if (!app->IsParameterEnabled(hemKey.str())) + if (!app->GetParameterInt(hemKey.str())) hem = 'S'; utmProjection->SetHemisphere(hem); @@ -241,15 +241,7 @@ void MapProjectionParametersHandler::InitializeUTMParameters(Application::Pointe genericRSEstimator->GetOutputOrigin()[1]); // Update the UTM Gui fields app->SetParameterInt(zoneKey.str(), zone); - if (genericRSEstimator->GetOutputOrigin()[1] > 0.) - { - app->EnableParameter(hemKey.str()); - } - else - { - app->DisableParameter(hemKey.str()); - } - + app->SetParameterInt(hemKey.str(),genericRSEstimator->GetOutputOrigin()[1] > 0.); app->AutomaticValueOn(zoneKey.str()); app->AutomaticValueOn(hemKey.str()); } diff --git a/Modules/Wrappers/QGIS/otb-module.cmake b/Modules/Wrappers/QGIS/otb-module.cmake index 4c847249eed848a5be169ee0dc4cfc66ad2944eb..9b118b44b6909469120c863e0bc61162d593d096 100644 --- a/Modules/Wrappers/QGIS/otb-module.cmake +++ b/Modules/Wrappers/QGIS/otb-module.cmake @@ -18,7 +18,7 @@ # limitations under the License. # -set(DOCUMENTATION "This module allows to generate application descriptor files for QGIS processing plugin.") +set(DOCUMENTATION "This module allows for the generation of the application descriptor files for the QGIS processing plugin.") otb_module(OTBQGIS DEPENDS diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx index 954f4ffbc684321d4a8d0108aea7dcb8b062be07..a33f61dc7a5ce1917e5da9532a9614bc11bc74b6 100644 --- a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx +++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) #endif ApplicationRegistry::AddApplicationPath(argv[2]); - Application::Pointer appli = ApplicationRegistry::CreateApplicationFaster(module.c_str()); + Application::Pointer appli = ApplicationRegistry::CreateApplicationFaster(module); assert(!appli.IsNull()); diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index 665b689fd17300b423490b77bace6c518edc5164..50ab3e24aced3994827c4a508abe1065eaf0d1e2 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -261,6 +261,8 @@ public: std::vector<std::string> GetParameterStringList(std::string parameter); std::string GetParameterAsString(std::string paramKey); + bool GetListViewSingleSelectionMode(const std::string& paramKey); + ImageBaseType * GetParameterOutputImage(std::string parameter); void SetParameterInputImage(std::string parameter, ImageBaseType * inputImage); ImageBaseType * GetParameterComplexOutputImage(std::string parameter); @@ -592,7 +594,7 @@ class ApplicationProxy(object): return s def SetParameters(self, dict_params): - for param_key, param_value in dict_params.iteritems(): + for param_key, param_value in dict_params.items(): self.SetParameterValue(param_key, param_value) def SetParameterValue(self, paramKey, value): diff --git a/NOTICE b/NOTICE index f1fb9b732f23fa1d8164f4b569c5ffd68650acda..543e30708cdfb858149731f4546c40869629970e 100644 --- a/NOTICE +++ b/NOTICE @@ -378,3 +378,30 @@ binaries: Copyright (c) 2016, Even Rouault <even.rouault@spatialys.com> MIT license https://opensource.org/licenses/MIT + + +Some parts of the software may be licensed differently in the following +cases described below: + + +* Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx + When ITK is built using FFTW, the binary application DomainTransform + becomes licensed under GNU GPL v3. + + +* Module/Remote/OTBTemporalGapFilling/* + Module/Remote/OTBPhenology/* + Module/Remote/OTBBioVars/* + These remote modules, when enabled, are licensed under GNU Affero GPL v3 + + +* Module/Remote/SertitObject/* + This remote module, when enabled, is licensed under CeCILL-B + + +* Module/Remote/otbGRM/* + This remote module, when enabled, is licensed under GNU GPL v3 + + +* Module/Remote/OTBFFSforGMM/* + This remote module, when enabled, is licensed under Apache v2 license diff --git a/Packaging/LICENSE b/Packaging/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..775e0501fd39d103a22fa5fc3a294fdceb7c3261 --- /dev/null +++ b/Packaging/LICENSE @@ -0,0 +1,8 @@ +This package is composed of binary and source files, with various licenses. +Most of OTB material in the package is licensed under the: + + Apache v2 license (copy available in share/copyright/LICENSE). + +Exceptions and third parties are described in the document: + + share/copyright/NOTICE diff --git a/Packaging/install_share_dirs.cmake b/Packaging/install_share_dirs.cmake index 1a6890d6284323825e2eb897912d328d0c6f0fc9..6726fe67b6dbd44a33e1516bf82f5fd090c40fa3 100644 --- a/Packaging/install_share_dirs.cmake +++ b/Packaging/install_share_dirs.cmake @@ -59,7 +59,7 @@ function(install_share_dirs) ####################### Install copyrights ########################## #install license for packages install_without_message("${PKG_SHARE_SOURCE_DIR}/copyright" "share" ) - install(FILES ${PKG_SHARE_SOURCE_DIR}/copyright/LICENSE + install(FILES ${OTBPackaging_SOURCE_DIR}/LICENSE DESTINATION ${PKG_STAGE_DIR}) ####################### install share/otb ########################### diff --git a/README.md b/README.md index 7ef8de3b855180d3b49bb8fc8d4323062777c58a..494ae8d4c08a8bd41542976e748592bc6ae95511 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,13 @@ not a black box! * [Wiki](http://wiki.orfeo-toolbox.org/index.php/Main_Page) * [Task tracking](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues) +### Installation + +We provide ready-to-use packages for Windows, Mac and Linux. [Download them here](https://www.orfeo-toolbox.org/download/) on our website, and see instructions for your platform [here in the Cookbook](https://www.orfeo-toolbox.org/CookBook/Installation.html). + +If you're interested, you can also [compile from source](https://www.orfeo-toolbox.org/SoftwareGuide/SoftwareGuidech2.html#x16-190002). + + ### Join the community Get help, share your experience and contribute to the Orfeo-Toolbox project by joining our community and mailing lists. diff --git a/SuperBuild/CMake/External_hdf5.cmake b/SuperBuild/CMake/External_hdf5.cmake index ce3d2a07e61d3d394265aed4c3c96860597fca0b..3e0de14ef9d8f2e39534951798526d41f7080eab 100644 --- a/SuperBuild/CMake/External_hdf5.cmake +++ b/SuperBuild/CMake/External_hdf5.cmake @@ -29,7 +29,7 @@ set(HDF5_SB_CONFIG) ExternalProject_Add(HDF5 PREFIX HDF5 - URL "http://support.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.1.tar.gz" + URL "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/hdf5-1.10.1.tar.gz" URL_MD5 43a2f9466702fb1db31df98ae6677f15 SOURCE_DIR ${HDF5_SB_SRC} BINARY_DIR ${HDF5_SB_BUILD_DIR} diff --git a/SuperBuild/CMake/External_itk.cmake b/SuperBuild/CMake/External_itk.cmake index e9eb7d0b2ca528ab272a3c818f7705f5bdfee70a..2b9d6a5add47dd3f5a4d551212ff3aa1eebbe25b 100644 --- a/SuperBuild/CMake/External_itk.cmake +++ b/SuperBuild/CMake/External_itk.cmake @@ -143,14 +143,14 @@ endif() #variables are later used in packaging set(SB_ITK_VERSION_MAJOR "4") -set(SB_ITK_VERSION_MINOR "12") +set(SB_ITK_VERSION_MINOR "13") set(_SB_ITK_DIR ${SB_INSTALL_PREFIX}/lib/cmake/ITK-${SB_ITK_VERSION_MAJOR}.${SB_ITK_VERSION_MINOR}) ExternalProject_Add(ITK PREFIX ITK - URL "https://sourceforge.net/projects/itk/files/itk/4.12/InsightToolkit-4.12.0.tar.gz" - URL_MD5 561a403f93c88c64085b5623e8e61f79 + URL "https://sourceforge.net/projects/itk/files/itk/4.13/InsightToolkit-4.13.1.tar.gz" + URL_MD5 c7e229802c4ee64e1b2a6d48b1df67e9 SOURCE_DIR ${ITK_SB_SRC} BINARY_DIR ${ITK_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake index 1f4acfe91db9f86e191a3a3a870772b00b07aed5..9e0606dd01a81baa199cf4ac267bd7ae499fd434 100644 --- a/SuperBuild/CMake/External_otb.cmake +++ b/SuperBuild/CMake/External_otb.cmake @@ -26,7 +26,12 @@ set(OTB_SB_SRC ${CMAKE_SOURCE_DIR}/..) ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB GDAL OSSIM ITK TINYXML BOOST) -##get_property(OTB_DEPENDENCIES GLOBAL PROPERTY GLOBAL_OTB_DEPENDENCIES) +# Check BUILD_ALWAYS option +if(BUILD_ALWAYS) + set(OTB_BUILD_ALWAYS_OPTION 1) +else() + set(OTB_BUILD_ALWAYS_OPTION 0) +endif() if(OTB_USE_CURL) ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB CURL) @@ -181,6 +186,7 @@ ExternalProject_Add(OTB BINARY_DIR ${OTB_SB_BUILD_DIR} INSTALL_DIR ${CMAKE_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + BUILD_ALWAYS ${OTB_BUILD_ALWAYS_OPTION} CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} ${OTB_MODULES_CONFIG} @@ -210,6 +216,8 @@ ExternalProject_Add(OTB -DOTB_WRAP_PYTHON:BOOL=${OTB_WRAP_PYTHON} -DOTB_WRAP_PYTHON3:BOOL=${OTB_WRAP_PYTHON3} -DOTB_WRAP_JAVA:BOOL=${OTB_WRAP_JAVA} + -DOTB_USE_MPI:BOOL=${OTB_USE_MPI} + -DOTB_USE_SPTW:BOOL=${OTB_USE_SPTW} ${OTB_ADDITIONAL_CACHE} CMAKE_ARGS ${OTB_SB_CONFIG} CMAKE_COMMAND ${SB_CMAKE_COMMAND} @@ -224,7 +232,7 @@ ExternalProject_Add_Step( COMMAND ${CMAKE_COMMAND} -E copy ${OTB_SB_SRC}/NOTICE ${CMAKE_INSTALL_PREFIX}/share/copyright/NOTICE - + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright diff --git a/SuperBuild/CMake/External_qt5.cmake b/SuperBuild/CMake/External_qt5.cmake index 0d0c64976cb0b70fe32c8d2a7342516251af1e40..d8d490906865ffb6c226e7e99d3b56a3d13cb401 100644 --- a/SuperBuild/CMake/External_qt5.cmake +++ b/SuperBuild/CMake/External_qt5.cmake @@ -22,17 +22,6 @@ INCLUDE_ONCE_MACRO(QT5) SETUP_SUPERBUILD(QT5) -#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 - -# if(UNIX AND NOT APPLE) -# message(STATUS " SuperBuild may fail to compile Qt4. If so, you should install it via package manager.") -# endif() - - -#set(QT4_SB_ENABLE_GTK OFF CACHE INTERNAL "Enable GTK+ style with qt using -gtkstlye. Default is OFF") - #NOTE: make sure your superbuild install directory does not contain any #Qt files from previous install of superbuild QT. # declare dependencies @@ -102,30 +91,14 @@ set(QT5_SB_CONFIG -skip qtwinextras \ -skip qtx11extras \ -skip qtxmlpatterns \ - -system-libpng -system-libjpeg -system-zlib -system-freetype") -# "-prefix ${QT4_INSTALL_PREFIX_NATIVE} -L ${QT4_LIB_PREFIX_NATIVE} \ -# -I ${QT4_INCLUDE_PREFIX_NATIVE} -I ${QT4_INCLUDE_FREETYPE_NATIVE} \ -# -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-accessibility -no-qt3support -no-xmlpatterns -no-sql-sqlite -no-openssl \ -# -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib") - -#RK: building faling on mac. png include is in a macframework -# if(USE_SYSTEM_PNG) - # set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -I ${PNG_PNG_INCLUDE_DIR}") -# endif() + -system-libpng -system-libjpeg -system-zlib -system-freetype -qt-harfbuzz") if(UNIX) if(APPLE) set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-framework") - else() #Linux -# if(QT5_SB_ENABLE_GTK) -# message(WARNING "QT5_SB_ENABLE_GTK support is experimental") -# set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -sm -xrender -xrandr -gtkstyle") -# else() + else() + #Linux set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-glib -no-fontconfig") -# endif() endif() #common for all unix set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-dbus -no-icu -v") @@ -151,52 +124,20 @@ endif() configure_file( ${QT5_CONFIGURE_COMMAND_IN} ${QT5_CONFIGURE_COMMAND} @ONLY ) -#Remove left over or previous installation from install prefix. -#Existing files in install prefix was disturbing a second installation. -#even after 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}/include/Qt" -# 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}/lib/pkgconfig/Qt*" -# 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(QT5 - PREFIX QT5 - URL "http://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz" - URL_MD5 7e167b9617e7bd64012daaacb85477af - BINARY_DIR ${QT5_SB_BUILD_DIR} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND ${QT5_CONFIGURE_COMMAND} - DEPENDS ${QT5_DEPENDENCIES} - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_INSTALL 1 - ) +ExternalProject_Add(QT5 + PREFIX QT5 + URL "http://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz" + URL_MD5 7e167b9617e7bd64012daaacb85477af + BINARY_DIR ${QT5_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + CONFIGURE_COMMAND ${QT5_CONFIGURE_COMMAND} + DEPENDS ${QT5_DEPENDENCIES} + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 + ) SUPERBUILD_PATCH_SOURCE(QT5) @@ -204,11 +145,11 @@ set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake) if(UNIX AND NOT APPLE) ExternalProject_Add_Step(QT5 adding_font - COMMAND ${CMAKE_COMMAND} - -D BUILD_DIR=${QT5_SB_BUILD_DIR} - -D INSTALL_DIR=${SB_INSTALL_PREFIX} - -D DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION} - -P ${CMAKE_SOURCE_DIR}/CMake/External_font.cmake + COMMAND ${CMAKE_COMMAND} + -D BUILD_DIR=${QT5_SB_BUILD_DIR} + -D INSTALL_DIR=${SB_INSTALL_PREFIX} + -D DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION} + -P ${CMAKE_SOURCE_DIR}/CMake/External_font.cmake DEPENDEES install WORKING_DIRECTORY ${SB_INSTALL_PREFIX} ) endif() diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 72b4b7c780c53be044db3f48d2f072cab08a476a..514783bbd114f63208d67541ae5e43e8defef18f 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -52,6 +52,7 @@ endif() option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON) option(BUILD_STATIC_LIBS "Build with static libraries." OFF) +option(BUILD_ALWAYS "Always build or install OTB." ON) option(WITH_REMOTE_MODULES "Build with specific list of remote modules." OFF) option(OTB_USE_OPENMP "use openmp" OFF) set(OTB_ADDITIONAL_CACHE "" CACHE STRING "Additional cmake option for OTB -DVAR:TYPE=VALUE ...") @@ -317,7 +318,7 @@ option(OTB_USE_OPENGL "Enable module OpenGL in OTB" ON) option(OTB_USE_GLEW "Enable module GLEW in OTB" ON) #Cannot activate GLUT on OSX. See Mantis issue #1194") -# do not activate GLFW by default on osx. see failing test +# do not activate GLFW by default on osx. see failing test # https://dash.orfeo-toolbox.org/testDetails.php?test=59844554&build=287120 if(APPLE) option(OTB_USE_GLUT "Enable module GLUT in OTB" OFF) @@ -331,6 +332,9 @@ option(OTB_USE_SHARK "Enable module Shark in OTB" ON) option(OTB_USE_QWT "Enable module QWT in OTB" ON) option(OTB_USE_GSL "Enable module GSL in OTB" ON) +option(OTB_USE_MPI "Enable MPI in OTB" OFF) +option(OTB_USE_SPTW "Enable Simple Parallel Tiff Writer in OTB" OFF) + # set OTB_DATA_ROOT to run test find_path(OTB_DATA_ROOT README-OTB-Data PATHS diff --git a/SuperBuild/Copyright/AGPLv3.TXT b/SuperBuild/Copyright/AGPLv3.TXT new file mode 100644 index 0000000000000000000000000000000000000000..be3f7b28e564e7dd05eaf59d64adba1a4065ac0e --- /dev/null +++ b/SuperBuild/Copyright/AGPLv3.TXT @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +<https://www.gnu.org/licenses/>. diff --git a/SuperBuild/README.md b/SuperBuild/README.md index 27bdaf011e15e36fc8dc68e2f6b1cee5a8fb2586..7a8022ad1a4e344547aad43cc7c69118e2283569 100644 --- a/SuperBuild/README.md +++ b/SuperBuild/README.md @@ -1,8 +1,17 @@ -This folder contains all the sources used to compile the SuperBuild. This project is intended for people who want to build OTB from source on platforms where they don't have an easy access to OTB dependencies. The SuperBuild can automatically download and compile the necessary dependencies for OTB. +# OTB SuperBuild -In order to compile the SuperBuild, you shall : +This folder contains all the sources used to compile the SuperBuild. This +project is intended for people who want to build OTB from source on platforms +where they don't have an easy access to OTB dependencies. The SuperBuild can +automatically download and compile the necessary dependencies for OTB. + +## Getting Started + +### Installing + +In order to compile the SuperBuild, you should : - go to your build directory -- run cmake using 'path-to-OTB/SuperBuild' as the source folder +- run CMake using 'path-to-OTB/SuperBuild' as the source folder - it is advised to give a specific install prefix for the superbuild as all dependencies will be deployed there - once the configure step is done, nothing is built yet, but the build directory is setup with sub-folders for each dependency. - run make in order to begin the SuperBuild. For each dependency, CMake will do the following tasks : @@ -10,9 +19,52 @@ In order to compile the SuperBuild, you shall : * uncompress sources and patch them if necessary * configure, build and install the library. -During the configure step, you have access to a range of parameters that control the build of OTB dependencies. For each dependency 'XXX', there is a variable USE_SYSTEM_XXX to choose if a system install of XXX should be used, or if a SuperBuild version should be compiled. -If you want to use a system version of XXX, you have to set the corresponding variable USE_SYSTEM_XXX to ON. When your system XXX is installed in default system location, CMake should find it without help. If the location is different, you can specify it using : -- CMAKE_PREFIX_PATH : this is the easiest way to point other install prefixes so that CMake will look into them. This variable may hold a list of paths for each install prefix. For instance, CMAKE_PREFIX_PATH=/opt/local will tell CMake to look in the folders /opt/local/lib, /opt/local/include, ... -- XXX_INCLUDE_DIR, XXX_LIBRARY, XXX_DIR : you can give more specific locations using those variables +### Setting OTB options + +During the configure step, you have access to a set of parameters that control +the build of OTB dependencies. For each dependency 'XXX', there is a variable +USE_SYSTEM_XXX to choose if the version from the system for 'XXX' should be used, or if a +SuperBuild version should be compiled. + +If you want to use a system version of XXX, you have to set the corresponding +variable USE_SYSTEM_XXX to ON. When your system XXX is installed in default +system location, CMake should find it without help. If the location is +different, you can specify it using : +- CMAKE_PREFIX_PATH : this is the easiest way to point other install prefixes so + that CMake will look into them. This variable may hold a list of paths for + each install prefix. For instance, CMAKE_PREFIX_PATH=/opt/local will tell + CMake to look in the folders /opt/local/lib, /opt/local/include... +- XXX_INCLUDE_DIR, XXX_LIBRARY, XXX_DIR : you can give more specific locations + using those variables + +Some variables are used to configure the OTB itself. They have the same name as +in OTB project. For instance, you can enable optional third-parties using cmake +options (OTB_USE_XXX). + +### Other useful options + +#### Take dependencies sources from a local directory + +``` +Set CMake option DOWNLOAD_LOCATION to the directory where all the source archives are located. +``` + +Sources not available in the directory will automatically downloaded there during the SuperBuild compilation. + +#### Build everything but OTB + +``` +make OTB_DEPENDS +``` + +#### Always trigger OTB build step from the superbuild build tree + +``` +set CMake option BUILD_ALWAYS to ON +``` + +#### Build with specific list of remote modules -Some variables are used to configure the OTB itself. They have the same name as in OTB project. For instance, you have access to the third-party enablement options (OTB_USE_XXX). +``` +set WITH_REMOTE_MODULES to ON +``` diff --git a/SuperBuild/patches/OPENCV/opencv-1-install-prefix-win.diff b/SuperBuild/patches/OPENCV/opencv-1-install-prefix-win.diff index f25264beba7a4534e593a47e9037108dedfca268..c356bd2f4eb53c6ff8b6ecaf5a15dc25b97b55dc 100755 --- a/SuperBuild/patches/OPENCV/opencv-1-install-prefix-win.diff +++ b/SuperBuild/patches/OPENCV/opencv-1-install-prefix-win.diff @@ -1,14 +1,12 @@ -diff -burN opencv-2.4.13.2.orig/CMakeLists.txt opencv-2.4.13.2/CMakeLists.txt ---- opencv-2.4.13.2.orig/CMakeLists.txt 2017-04-25 14:05:11.148414719 +0200 -+++ opencv-2.4.13.2/CMakeLists.txt 2017-04-25 14:06:05.944787632 +0200 -@@ -290,7 +290,9 @@ +diff -burN opencv-3.4.1.orig/CMakeLists.txt opencv-3.4.1/CMakeLists.txt +--- opencv-3.4.1.orig/CMakeLists.txt Wed Sep 26 15:10:50 2018 ++++ opencv-3.4.1/CMakeLists.txt Wed Sep 26 15:12:40 2018 +@@ -373,7 +373,7 @@ - if(WIN32) + if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) -- set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") -+ #OTB PATCH [BEGIN] -+ set(OpenCV_INSTALL_BINARIES_PREFIX "") # "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") -+ #OTB PATCH [END] +- ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") ++ ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "") #${OpenCV_ARCH}/${OpenCV_RUNTIME}/") else() message(STATUS "Can't detect runtime and/or arch") - set(OpenCV_INSTALL_BINARIES_PREFIX "") + ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "") diff --git a/SuperBuild/patches/OSSIM/ossim-6-clang7-all.diff b/SuperBuild/patches/OSSIM/ossim-6-clang7-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..895f1a718e00b9ba9f0ce60e3c41804ca1041238 --- /dev/null +++ b/SuperBuild/patches/OSSIM/ossim-6-clang7-all.diff @@ -0,0 +1,46 @@ +diff -burN OSSIM-orig/ossim/src/ossim/base/ossimArgumentParser.cpp OSSIM/ossim/src/ossim/base/ossimArgumentParser.cpp +--- OSSIM-orig/ossim/src/ossim/base/ossimArgumentParser.cpp 2018-11-07 16:07:35.000000000 +0100 ++++ OSSIM/ossim/src/ossim/base/ossimArgumentParser.cpp 2018-11-07 16:16:01.000000000 +0100 +@@ -191,7 +191,7 @@ + + void ossimArgumentParser::initialize(int* argc, const char **argv) + { +- if(argc > 0) delete (theArgv); ++ if(*argc > 0) delete (theArgv); + theArgc = argc; + theArgv = new char*[*argc]; + for(int i=0;i<*argc;i++) +diff -burN OSSIM-orig/ossim/src/ossim/elevation/ossimElevManager.cpp OSSIM/ossim/src/ossim/elevation/ossimElevManager.cpp +--- OSSIM-orig/ossim/src/ossim/elevation/ossimElevManager.cpp 2018-11-07 16:07:36.000000000 +0100 ++++ OSSIM/ossim/src/ossim/elevation/ossimElevManager.cpp 2018-11-07 16:25:43.000000000 +0100 +@@ -647,9 +647,14 @@ + { + out<<"\nm_dbRoundRobin["<<i<<"].size = "<<m_dbRoundRobin[i].size()<<endl; + for (ossim_uint32 j=0; j<m_dbRoundRobin[i].size(); ++j) +- out<<"m_dbRoundRobin["<<i<<"]["<<j<<"] = "<<m_dbRoundRobin[i][j]->print(out)<<endl; ++ { ++ out<<"m_dbRoundRobin["<<i<<"]["<<j<<"] = "; ++ m_dbRoundRobin[i][j]->print(out); ++ out<<endl; ++ } + } +- cout<<"\n"<<ossimElevSource::print(cout); ++ cout<<"\n"; ++ ossimElevSource::print(cout); + return out; + } + +diff -burN OSSIM-orig/ossim/src/ossim/elevation/ossimElevSource.cpp OSSIM/ossim/src/ossim/elevation/ossimElevSource.cpp +--- OSSIM-orig/ossim/src/ossim/elevation/ossimElevSource.cpp 2018-11-07 16:07:36.000000000 +0100 ++++ OSSIM/ossim/src/ossim/elevation/ossimElevSource.cpp 2018-11-07 16:27:06.000000000 +0100 +@@ -269,8 +269,8 @@ + << "\ntheMaxHeightAboveMSL = "<<theMaxHeightAboveMSL + << "\ntheNullHeightValue = "<<theNullHeightValue + << "\ntheSeaLevelValue = "<<theSeaLevelValue +- << "\ntheGroundRect = "<<theGroundRect +- << ossimSource::print(out); ++ << "\ntheGroundRect = "<<theGroundRect; ++ ossimSource::print(out); + return out; + } + diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index 1b961efd204bb55578eda4aa6bff2cd6f641f0b7..61d868fbb25b5393f0894dbfc81034bcee7a87de 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -168,10 +168,10 @@ if (BUILD_DOCUMENTATION) add_custom_target(Documentation-doxygen COMMAND ${DOXYGEN_EXECUTABLE} ${OTB_BINARY_DIR}/Utilities/Doxygen/doxygen.config - #COMMAND ${CMAKE_COMMAND} -E copy - # ${OTB_SOURCE_DIR}/Utilities/Doxygen/favicon.ico - # ${OTB_BINARY_DIR}/Documentation/Doxygen/html - # DEPENDS ${OTB_BINARY_DIR}/Documentation/Doxygen/Examples.dox + # fix php section delimiters for PHP 7 + COMMAND ${PERL_EXECUTABLE} -i + "${OTB_SOURCE_DIR}/Utilities/Doxygen/fix_php7.pl" + "${OTB_BINARY_DIR}/Documentation/Doxygen/html/*.php" WORKING_DIRECTORY ${OTB_BINARY_DIR}/Utilities/Doxygen ) diff --git a/Modules/Adapters/OpenThreadsAdapters/src/CMakeLists.txt b/Utilities/Doxygen/fix_php7.pl old mode 100644 new mode 100755 similarity index 57% rename from Modules/Adapters/OpenThreadsAdapters/src/CMakeLists.txt rename to Utilities/Doxygen/fix_php7.pl index 82ff4b2cc7f99c1f76f3524efa27b1027cd76984..04ed486aabf26c0c873103be86731eab51648483 --- a/Modules/Adapters/OpenThreadsAdapters/src/CMakeLists.txt +++ b/Utilities/Doxygen/fix_php7.pl @@ -1,5 +1,7 @@ +#!/usr/bin/perl + # -# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) +# Copyright (C) 2005-2018 Centre National d'Etudes Spatiales (CNES) # # This file is part of Orfeo Toolbox # @@ -18,13 +20,23 @@ # limitations under the License. # -set(OTBOpenThreadsAdapters_SRC - otbThreads.cxx - ) - -add_library(OTBOpenThreadsAdapters ${OTBOpenThreadsAdapters_SRC}) -target_link_libraries(OTBOpenThreadsAdapters - ${OTBOpenThreads_LIBRARIES} - ) +# Transform script section declared as '<script language="php">' into '<?php' +$isInPHPSection=0; -otb_module_target(OTBOpenThreadsAdapters) +while(<>) +{ + chomp; + $line = $_; + if($line =~ s/<script language="(php|PHP)">/<\?php/) + { + $isInPHPSection = 1; + } + if($isInPHPSection) + { + if($line =~ s/<\/script>/\?>/) + { + $isInPHPSection = 0; + } + } + print $line . "\n"; +}